#arma3_scripting
1 messages · Page 351 of 1
🤔
== reports true when either side is NaN
>, <, >=, <= work as expected and report false.
This is a huge pitfall...
epic fail
and probably differs from system to system
erg, using the visual c compiler, 10 / 0 is failing
on my raspberry pi with gcc it returns NaN 😄
I blame all PhysX errors and flips on logic like this.
probably something like that in there too
where they simply did forgot to add NaN to >, <, >=, <=
or more: added it to == because some dev always crashed his pc with it back in OFP
@little eagle Sorry for being a pain. It works like a charm, but is it going to give money to every player on the server like it was before?
Every player that is inside one of these cars.
Amazing. Thank you so much
@queen cargo What are you expecting 10/0 to return?
0/0
reports 0 and errors "zero devisor"
But it does not report NaN. It's still 0.
...
Isn't this what NaN is for?
Right, thought you were expecting something other than that 😛
not in the arma world @little eagle
not in the arma world 😛
now for the next goal ... figuring out how filtering in https://community.bistudio.com/wiki/supportInfo works
Seems right, due to precision
i hate that crappy support info command ...
@little eagle yes and no, i want to keep it playable with vanilla but i'll support mods (ace, rhs, etc)
@little eagle a/b where b = 0, returns 0, always
Pi also seems to be accurate to 3.1415926536
tan 90 does the same
a/b where b = 0, returns 0, always
In my country this would be undefined. Not a rational number.
commy2, you feel like telling me your easy way for the server-client vote thingy?
if (isServer) then {
missionNamespace setVariable ["asdfg_voteNamespace", createSimpleObject ["Building", [0,0,0]], true];
};
// client
asdfg_voteNamespace setVariable [str clientOwner, "yes", true];
To count the "yes" or whatever:
{asdfg_voteNamespace getVariable _x isEqualTo "yes"} count allVariables asdfg_voteNamespace
Could've used the CBA function instead of createSimpleObject.
I always have to look up how you do this in vanilla.
This way you can easily overwrite your previous vote as client.
And the counting is quick.
So this made sense to me.
I'm not entirely sure i understand this correctly. so on the server you create a new namespace? on a dummy object?
oh, i see. objects are automatically synced over network, so every client can glue a var to it?
now it makes sense to me. thanks!
I guess it's a bit unusual, but done in very few lines of code.
so, i try to make the AI drive wile i have recorded what to do, but he is moving wile pressing the brakes
setDriveOnPath ?
disableAi of the driver???
#define CFGEND(var1) bin\config.bin/CfgDebriefing/##var1
[CFGEND(endDeath),CFGEND(loser),CFGEND(PlayerLost),CFGEND(PlayerWon)];
Is this how you are supposed to macro?
disableAi did not worked
The SQF would need quote marks.
Also I'm not 100% sure if / is one of the chars that doesn't have to have the glue ##
I can never remember those. They are somewhere in DOUBLES and TRIPLES from CBA and I always just use those.
There is no rhyme or reason to ## as far as I can tell.
it's for when you want to double hashtag something
i always just lint shit with eliteness and fiddle till it works
#define QUOTE(var) #var
#define CFG_END(var) (configFile >> "CfgDebriefing" >> QUOTE(var))
[CFG_END(endDeath),CFG_END(loser),CFG_END(PlayerLost),CFG_END(PlayerWon)];
Something like that ^
Oh
#define CFG_END(var) (configFile >> "CfgDebriefing" >> 'var')
[CFG_END(endDeath),CFG_END(loser),CFG_END(PlayerLost),CFG_END(PlayerWon)];
Simpler
= better
^^
huh didnt know "var" doesnt expand but 'var' does
Yup. That is how it works.
Is there a reason for choosing missionNamespace setVariable?
as opposed to?
Are there benifits to using
missionNamespace setVariable ["asdfg_voteNamespace", createSimpleObject ["Building", [0,0,0]]
Instead of
asdfg_voteNamespace = createSimpleObject ["Building", [0,0,0]]
?
That was not what was posted.
missionNamespace setVariable ["asdfg_voteNamespace", createSimpleObject ["Building", [0,0,0], true]
missionNamespace setVariable [_myVarNameThatIsUnknownOrDynamic,true,true];
and this has publicVariable built directly into the command
also it let's you specify that you want to set a variable in missionNamespace
you can never be 100% sure that you are in missionNamespace in scheduled scripts
The syntax without the public flag is pretty pointless. Would just use a normal assignment. And switching to uiNamespace should very rarely happen.
am i correct assuming that calling a script with compileFinal preprocessFileLineNumbers and calling a function is just about the same thing?
Calling a (precompiled) function is superior, because the machine has to do less stuff during the mission.
well in the BIKI article for vars it says if you use global vars in MP, use compileFinal preprocessFileLineNumbers to prevent people from messing with them. And i kind of? get why, but why not just turn it into a function right away?
Reading a file is pretty expensive and a bit less so, but still not needed is compiling a string to executable code.
In my opinion.
compileFinal is pointless outside of caching functions in ui namespace.
anything i define as a function is compiled at mission start anyways, isn't it?
If someone can execute arbitrary code to change functions, you already lost.
caching functions in ui namespace? why would one need that?
So that starting a mission with ACE doesn't take my machine 30 seconds to recompile all the functions.
It's what the CfgFunctions framework does.
For missions: compile and preprocess all functions at preInit
For addons: do it as game start in ui namespace and copy them over to mission namespace at preInit
Or just use CfgFunctions which does this all for you.
But it's handy to know what CfgFunctions actually does.
I guess.
CfgFunctions is part of ? arma? ace?
Vanilla.
i'll add this topic to my reading list.
stupid () and links
of course i want my \ to turn into /
tbh it breaks on more sites with a markup ish language
He's smart enough to follow the link.
i am indeed.
^^
🍪 😛
well obviously one doesn't want to recompile every time. its not like i'm a gentoo user.
If i have a bunch of functions i want to execute on mission start and i need them to be ran in a particular order, whats the best way to do that? i used to just chain my scripts together, so when script1 was done it would call script2, etc but that gets a little bit messy after a while.
doing it in a central place would be neat, but i'm somehow stuck with the thought that will actually cost performance
call asdfg_fnc_function1;
call asdfg_fnc_function2;
function2 will only run after function1 is completed.
oh. right. it being call and all. thanks commy2. I've slightly confused myself today with too much work.
A central place would be a postInit function. The vanilla one is scheduled and the loading screen only finishes after postInit is done, but that's nothing that isNil can't fix.
i don't follow
The link I posted about the function library. You can set functions to be automatically executed "preInit" (before any objects are created) or "postInit" (after all* objects are created).
to ensure editor placed objects already exist?
So make one function as your "postInit" hub and set up your mission there.
They will already exist when a postInit function is called.
it seems to me most people just call their mission scripts at the bottom of the init event scripts? is that about equal, exactly equal, or is there something big i'm missing why it isn't?
With the postInit one you can use player, the loading screen only ends when it's done running and the timing is the same in SP.
I'm sorry if i'm annoying, i'm a bit of a slowpoke today. Why wouldn't one be able to use player otherwise? And by timing you are saying that the postinit state is set for all connected players and the server at the same time?
Some initialization scripts run before the player command returns an object. Thats why you sometimes see waituntil {!isNull player} in scripts
Now with what you guys told me i'm confused a bit. What is the purpose of the init scripts? If i leave them blank, does nothing happen in the init phase? or does arma internal stuff happen that leads to player returning an object post init but (eventually) not during init?
is there things one needs to do in the init phase because it is impossible post-init?
that's a strange question man
it all depends on what you're trying to accomplish really doesn't it
i cant say i understand the question fully, but to clear a part of it up.
You don't NEED any of the init scripts (init, initServer, initPlayerLocal, initPlayerServer), the mission will still start as expected, however if you need scripts to run when the mission starts and you don't want to add a pre or post init fnc to the cfgfunctions, those files are where you'd do it.
well it is not like i have any problems. i put my mission scripts at the end of the init scripts, and everything worked fine so far. but from what commy2 wrote i figured it is bad practice to rely on the timing being right when doing that.
thanks you two!
>a/b where b = 0, returns 0, always
In my country this would be undefined. Not a rational number.
I meant in ARMA (hardcoded to). Undefined globally 😛 @little eagle
I would assume variables saved in the profileNamespace are loaded on start from the profile and stay in memory the entire runtime?
i think profilenamespace stays around forever
all the vars are written in to a file called yourarmaprofilename.vars or something - should be next to your profile file i think
it's what people use to make a ghetto "database" system without using addons @waxen tide
UInamespace is the one which stays around until your game is shut down
@rancid ruin i do quite extensive checks on the map to get data i use later to spawn stuff. i cache the data in the servers profile so i don't have to re-do it everytime (i included a check for the arma version and re-do checks on version change)
But i was wondering if that profile is loaded into RAM on start?
well the reason i cache the data is to not rape the performance all the time by going thru the whole map to fetch data to spawn stuff. if profile reads from the file all the time, that would be expensive. so i would rather create a global var from profile to have it in memory.
but i guess it is keept in memory anyways
yeah don't worry about read/write, it's certain to just be kept in memory and written to disk at shutdown
at least....that's how it should work if arma 3 was made in a half-way competent fashion
if your going to be saving stuff to it, you need to do saveProfileNamespace to make your changes permenant
otherwise you will have data loss once the mission is over/restarted
so in the most simple way, you could just do saveProfileNamespace after any setVariable you do that has to do with it
in the end the read writes are so tiny its meaningless to add one more onto the list
i was able to store thousands of variables inside it and writing/saving a couple hundred every few minutes and there was no measurable performance drop
yeah i've already implemented it like you wrote. I guess compared what you're doing i'm using that feature very lightly.
Does anyone know how to remove the open/close door icons from the default doors? I am able to include a mod so config tweaks are usable.
good question. not sure of the best way to do this, but what i'd probably do is de-pbo all the vanilla arma 3 UI pbos, find the .paa with the door open/close icon, and then work backwards from there. search main cfg file for the .paa's filename, then write a cfgPatch which hides it in some way, or just replaces the texture with a blank one @blazing zodiac
Makes perfect sense, I'll take a look when I get home @rancid ruin
@blazing zodiac \Arma 3\Addons\ui_f_data\IGUI\Cfg\Actions\open_door_ca.paa there ya go bruh 👍🏿
close_ca.paain the same dir
Awesome man, thanks for looking for me @rancid ruin
no problem, glhf
saveProfileNamespace does nothing. If you change a variable in the profile, it stays through the whole session so also mission restarts etc.
And the profile is saved when the game is closed. saveProfileNamespace does nothing. Try it.
hi guys can anyone help me out here with deactivating sounds from a trigger once out of the triggered area? currently it just keeps playing till the end
sfx works with trigger, but error keeps popping up saying no sound file but still plays
Could someone tell me why this isn't working?
_CurrentWeapon = primaryWeapon player;
if !(isNil "_CurrentWeapon") then {
_CurrentWeapon = primaryWeapon player;
_magazines = getArray (configFile / "CfgWeapons" / _CurrentWeapon / "magazines");
player addMagazine (_magazines select 0);
};
};
Supposed to add a mag for your current weapon
Well, your primary.
You don't have space in your uniform / vest / backpack.
_CurrentWeapon = primaryWeapon player;
if !(isNil "_CurrentWeapon") then {
_CurrentWeapon = primaryWeapon player;
???
This isn't my script so I'm just as ??? as you are.
_CurrentWeapon will never be nil
"" maybe, but not nil
So yeah, addMagazine adds it to your uniform/vest/backpack and if you have no space, it just fails silently.
So then I need to remove the isNil bit?
I had plenty of space in my containers
There's no way that's what was wrong
You can, because it's a tautology. It wouldn't change a thing, but simplify.
Then it must not be working for another reason
So your uniform etc. isn't full?
Then this script isn't executed or there is an error before this code block which prevents this from being executed.
does ur player have a primary weapon?
well i think i know the problem then 👍
the script itself works fine. if the unit has a primary weapon in the primary weapon slot then surely its just a space issue
Yeah, this part is "fine". Search the error somewhere else.
^ 👍
It's definitely not a space issue
Also, if your avatar is naked, no uniform/vest/backpack etc. then you never have enough space.
It never goes into the weapon directly.
What's the weapon?
ACR Remington
Try with MX
Then this code block is not being executed.
Btw. it's just a function assignment by itself. You'd need to call that function in the local variable.
That makes a bit more sense
I put this into the debug console and it gave me a mag. Note the last line I added.
_FNC_1Mag = {
_CurrentWeapon = primaryWeapon player;
if !(isNil "_CurrentWeapon") then {
_CurrentWeapon = primaryWeapon player;
_magazines = getArray (configFile / "CfgWeapons" / _CurrentWeapon / "magazines");
player addMagazine (_magazines select 0);
};
};
call _FNC_1Mag
I see that, yes.
Thank you. Every bit of this is something else learned.
I am growing stronger
yw
Lads, with ACE3, its fairly clear how to set new damage with a function they've created. I'm struggling however to get that damage in a similar fashion to the bohemia getDamage function. Is there a way to find out what ACE injuries they have?
getHitPointDamage
But that's only vanilla damage like broken legs.
ACE Injuries are stored in ACE internal variables.
see the fullHeal function for names of all of them
_hitPoint = ["HitHead","HitBody","HitRightArm","HitLeftArm","HitRightLeg","HitLeftLeg"];
_aceHead = (_object getHitPointDamage (_hitPoint select 0));
_aceBody = (_object getHitPointDamage (_hitPoint select 1));
I have that currently.
do you mean this one https://github.com/acemod/ACE3/blob/master/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf
I don't think the medical system has "damage". It has wounds and bloodloss etc.
is _target the bodyPart hitPoint?
The Player/Unit
I'm seriously blind wow
It was such a pita to put these function headers everywhere D:
_var = player getVariable "ace_medical_openWounds";
systemchat format ["%1",_var];
[[1,21,1,1,0.01],[2,3,3,2,0.01],[1,8,1,1,0]]
So it returns that on the unit who volunteered to take frag grenade. Where am I able to find what each part of that array is equal to? It appears to be the different injury types and how many of them there are
In fact doesn't matter for what I want as to what they are, just need to be able to store them to set them again
Beauty
Tinkering with the internals. Sounds like a recipe for disaster. Good luck though.
I'm persisting their medical status in a session so disconnecting and reconnecting doesn't allow being cheeky to reset medical stats or if a game crash happens and they get back in they keep their stats.
I know its not ideal to do it with internals, especially when medical rewrite goes public but shouldn't be much strain to update it.
People have been requesting a function to serialize the medic system stuff for ages. If it were as simple as copying over some variables, it would've been done a long time ago.
Oh nah not saying anything is slack at all, just making do with what I can
Would it be possible to have a make a script that would show the location of every player on the map for set amount of time?
yes.
proof:
{
systemChat str [name _x, getPosASL _x];
} forEach allPlayers;
is there a way to identify what cargo to join? for exemple, a huming bird side seats, he has 4 seasts, can i especify one of the seats?
https://community.bistudio.com/wiki/moveInCargo
unit moveInCargo [vehicle, CargoIndex]```
that CargoIndex, there is a way to i know what is ir index?
@little eagle is QGVAR(internalWounds) used yet? I know Airways aren't at the moment
I've just never seen an internal wound in ingame experience
what do you mean roque? how do you know which index to move them into?
get on the sides and use this
vehicle player getCargoIndex player```
and then in ur script lock the one side with the indexs for it
thanks
another thing, do triggers can detect only the player inside the vehicle with out the vehicle it self? or will detect the vehicle and not the player inside it?
exemple: i do i tiny trigger are especificly made to detect the player seat inside of a vehicle and i wanna to just detect hin and not the vehicle it self.
Which cargo index corresponds to what position in the vehicle depends on how they are numbered in the model.
i tried this but the driver still not go on full mode
oh, yea my bad. i assume you tried this one?
driver1 setSpeedMode "FULL";```
the snippet you pasted is two commands in one so thats why it errored.
The generic error is not a generic error. You just need to look more closely at the error message.
is there any command that makes AI drivers not care about obstacles? like walls or even units? i dont wanna they to try to dodge anyting, just follow the waypoint
No.
i tried to use this but its broken af
not only it give a error when paste the Path but when edit it to actually work it drives in a completely diferent direction.
it give a error
???
pretty sure it works
You are probably causing it to error, hence it does not work for you
garbage in garbage out
copy the Path with F1
vehicleName setDriveOnPath
paste the points
some error
edit the path to fit
goes to some palce else
"some error" Thank you. Very helpful.
>copy the Path with F1
wrong game / sport
😄
pate your code here using
` == key under escape
```sqf
//mycode
private _nil = nil;
```
looks like
//mycode
private _nil = nil;
I wish I would start work on loadout systems
Conclusion: fix the error and it will work.
or params
Or just post code 😉
how? i cant put images or files here
Copy paste code
example :
#include "script_component.cpp"
// Code begins
// Player init
if (hasInterface) then {
call tpb_fnc_blocker;
};
oh, you mean i paste it?
Yeah, because that command would be max ~5 lines ?
i can put that on the trigger?
trigger, ree
No you can't put pasting something in discord on a trigger
😂
and yes. When nigel says "paste" then he does mean "paste" like you correctly assumed.
You were asked to post your problem code here so we can take a look at it.
wait what it is that for?
For helping you.
here is a exemple
myVehicle setDriveOnPath [[1000,10,1000],[1100,10,1000]]
the this is
there is allot of numbers so i cant paste here
what is the error message
Please don't confuse obviously already confused people @peak plover :x
I understand that. Post the error....
That's what she said 😂
That is definetly incorrect. As you already said
myVehicle setDriveOnPath [[1000,10,1000],[1100,10,1000]]
That is how it should look. You have
myVehicle setDriveOnPath [[0,[1000,10,1000],...]
So after the first 4 characters you can already see that it's wrong
exacly
when i remove those 4 characters it work but goes in a diferent direction
Then the order of the waypoints is incorrect
Yes... You have a thing it front of you that is called keyboard. It has buttons on it. These buttons can edit text. You also have a Mouse. A Mouse can be used to select text.
A script is a big piece of text. It can be edited like any other piece of text.
Where do you get your path data from? (To repeat myself)
you probably just have one bracket to much arround your data
[[[],[]]] instead of [[],[]]
recording it
Roque, you got it wrong
Put your TOO BIG code on pastebin or something...
like here
@tough abyss No.
[[0,[
would still be wrong with less brackets
yup, to big for it too
yea he also messed up everything
unitCapture is designed to be used with unitPlay. not setDriveOnPath.
setDriveOnPath won't work for unitCapture data
And both are designed for helicopters... Not ground vehicles
but after initially pasting the path he just shouldnt paste it into [] but reather directly behind the command
wait his data comes from unitCapture?
nods
@still forum are you sure? https://www.youtube.com/watch?v=leHpxq8QaWk
have you tried unitPlay? Also that video doesn't say anything. He probably used the unitCapture data and edited it manually
I don't think you're supposed to enter hundreds of positions to setDriveOnPath like you would with the unitPlay/Capture functions.
make a simple path by hand for it, then make a script to grab it for you once you figured the format out:
https://community.bistudio.com/wiki/setDriveOnPath
there is another way to get that data?
thats why i said it was broken
It's working fine if you give it the correct input.
garbage in garbage out
afther i was using
path1 =;
[unit1, path1] spawn BIS_fnc_Unitplay;
make a file for it and evreytinhg
it did worked but the driver keeps braking
its goes normal if i turn off the enginne
but course no enginne sound its looks like a ghost car
and if i order the AI to go fast it fix it
Have you copy pasted your code to pastebin already?
driver1 setDriveOnPath [[0,[4466.54,12216.8,4.2871],[-0.975498,-0.21581,0.0427808], ...
This is wrong on multiple levels.
myVehicle setDriveOnPath [[1000,10,1000],[1100,10,1000]]
That's one too many nested arrays and you're supposed to give it to the car, not the driver.
yes, the name of the car is driver1
Well that's confusing.
dont ask
Even then, the array has the wrong format and will error and not work.
There are 8 lines in the lower half
Just enter
getPos cameraOn
In one of the odd numbered ones.
And it will write where you are.
x,y,z
Then you get a bunch of those
And used them with the command.
i got it
myVehicle setDriveOnPath [[x1,y1,z1],[x2,y2,z2], ...]
so for multiple one is myVehicle setDriveOnPath [[1000,10,1000],[1100,10,1000],[1100,10,1000]] and soo on?
CopyToClipboard?
You can get the pos with the editor by right clicking
that will take some time, but at least works
there is a bind to that? or maybe i can bind it my self?
You just need to record the positions where the car would turn I think.
You can make a key down eventhandler that will add your current pos to an array, this way you could make it a lot faster... then when you done copy the array to clipboard
findDisplay 46 displayAddEventHandler ["keyDown", {
params ["", "_key"];
If (_key == 0x3B) then {
systemChat str time;
diag_log getPos cameraOn;
};
}];
There. F1
i need to change the "_key"?
findDisplay 46 displayAddEventHandler ["keyDown", {
params ["", "DIK_APPS"];
If (_key == 0x3B) then {
systemChat str time;
diag_log getPos cameraOn;
};
}];
is that right?
*facepalms *
The == compares the key you just pressed with a id.
findDisplay 46 displayAddEventHandler ["keyDown", {
params ["", "_key"];
If (_key == 0xDD ) then {
systemChat str time;
diag_log getPos cameraOn;
};
}];
right?
lgtm
Debug console, upper half this time.
Then LOCAL EXEC
Result is in %LOCALAPPDATA%\Arma 3. On Windows at least.
#include "\a3\editor_f\Data\Scripts\dikCodes.h" for using DIK_<KEY> instead of hex values
No you don't @little eagle
You remember what happens when the preprocessor fails?
You really want that to be doable with via script?
Fix the crashing too
open latest rpt file
is there a scripting command/function that would allow me to set a camera view (curator camera) to show multiple objects? Same question for 2D map. Like a fit view to selection type function.
sounds[] = {};
class sound1
{
name = "snipe.ogg";
sound[] = {"sound\snipe.ogg", 1, 1};
titles[] = {};
};
"Member already defined"
what do
what member is already defined? iit should say.
Use unique classnames. No repeat "sound1"
should I change sound1 to the sound name then?
yes
You only have one sound? Because this is missing a closing curly bracket if so.
Then you need another }
class CfgSounds {
sounds[] = {};
class sound1 {
name = "snipe.ogg";
sound[] = {"sound\snipe.ogg", 1, 1};
titles[] = {};
};
}; <--- there
Also, not sure about the name "snipe.ogg". Those sounds may have to not have a dot in their names
if (_no > 1 && _no < 2) then {true}
-> If there a more efficient way of finding out if no. is between 1 and 2?
Or am I overthinking 🤔
Integers?
Decimal. Maybe I shoyldve put 1.0 and 2.0 instead
You can totally do what you have, but I'm thinking of something strange.
Yeah... I have a strange feeling it can be done with min and max
Nope, I'm just seeing if there's a more efficient way of fidning out if a number is inside a range
Still getting that "member already defined" crap
Post the description.ext
/*
Header
*/
author = "Skull";
onLoadName = "Hardline: Malden";
loadScreen="Pictures\Cops.jpg";
onLoadMission = "Police forces battle Cartel Gunmen on Malden. Complete objectives and kill your enemy to bleed their respawn tickets.";
#include "voiceControl.cpp"
/*
Classes
*/
#include "HG\UI\HG_DialogsMaster.h"
class RscTitles
{
#include "HG\UI\Dialogs\HG_HUD.h"
#include "HG\UI\Dialogs\HG_Tags.h"
};
class CfgClient
{
#include "HG\Config\HG_Config.h"
};
class CfgSounds
{
#include "HG\Sounds\HG_Sounds.h"
};
class CfgFunctions
{
#include "HG\Functions\HG_Functions.h"
};
class CfgSounds {
sounds[] = {};
class snipe {
name = "snipe";
sound[] = {"sound\snipe.ogg", 1, 1};
titles[] = {};
};
};```
Only use one.
he'll still need to merge one of them at least partially into the other
class CfgFunctions {
class debug
{
class fnc
{
file = "engine\debug";
class log {};
};
};
class mission
{
class fnc
{
file = "engine";
class loadSettings {};
class initPlugin {preinit = 1;};
class initPlayable {preinit = 1;};
};
};
#define MISSION_PLUGIN_FUNCTIONS
#include "plugins\plugins.cpp"
#undef MISSION_PLUGIN_FUNCTIONS
};
works fine
Why would sounds not work?
if you have two cfgAnything it will still cause the same problem
I got it
_no = 5;
if (_no > 0 && _no < 10 ) then {true}
is the same as
_no = 5;
if ((_no min 10) == (_no max 0) ) then {true};
you just move it to a different location lol
_no = 5;
if ((_no min 10) == (_no max 0) ) then {true};
// same as
_no = 5;
((_no min 10) == (_no max 0) )
Can these numbers be negative?
then {true} is kind of, erm useless?
Sure
I want to do something with log.
Well, true is just as placeholder for "code"
Or sine
aah
Every time I try to fix this I just do it wrong lol
nigel - Today at 9:10 AM
put #include "HG\Sounds\HG_Sounds.h" into the other one
So put it in the bottom one?
_no = 5;
if (_no > 0 && _no < 10 ) then {true}
```0.0026 ms
```sqf
_no = 5;
if ((_no min 10) == (_no max 0) ) then {true};
```0.0026 ms
There's no difference, but its a nice quirk
private _array = [5, _no, 10];
_array sort true;
if (_attay select 1 isEqualTo _no) then {
Watch this be faster than > and < #SQF
I wish sort would return the array.
Cool tricks @atomic epoch @little eagle
Then this would almost guaranteed to be faster...
Mine is (hopefully) worse^^
if ((5 - _no) * (10 - _no) < 0) then {
Polynomial!
I tested
private _array = [5, _no, 10];
_array sort true;
if (_attay select 1 isEqualTo _no) then {true}
0.0030
Is this meant to check if a number is inside a range or something else?
Inside the range.
It's slower by 0.0004ms in my test 😦
good
_no = 5;
if ((0 - _no) * (10 - _no) < 0) then {true};
genuinely curious about this one ^
_no = 5;
if ((0 - _no) * (10 - _no) < 0) then {true};
0.0029ms
and < is still faster
Well. The errors went away, but it's not playing the sound.
Fix'd. Thanks ❤
How fast is _no in [0,1,2,3,4,5]; ? 😃
1.5
harsh
Helicopter does not disappear, but remains a ghost Do you know what the problem is? I think it's only a problem on my server. My guess is it's a "script" issue.
wait what the hell is wrong with that game
broken videocard? there's artifacts all over screen
@Adanteh#0761 where? I don't see any
@still forum https://i.imgur.com/yiFfEhf.png ? 😃
ugh. wow.
😄
Chinese
Are you sure it's Chinese? Maybe its Japanese
Circles / ovals = Korean
Does it include simple lines? Probably japanese
WE ASIAN NOW
I thought the game only supports Japanese and Chinese.
can the special argument of createVehicle ("CAN_COLLIDE" etc) be applied to createVehicleLocal?
No.
:C
Isn't it already in that mode though?
CAN_COLLIDE is the simplest one. NONE is just the default for the other command.
You could just follow up with a setPosASL
Sure.
i am mildly confused but i see.
How come?
well i wonder what fly is good for
"don't ignore z, don't glue me to the ground"
i.e. helicopters and planes ^^
Yeah. I think it also starts the engine for helicopters and planes in the air. Or maybe I am thinking of the editor...
This is really poorly documented.
can I ask TFAR specific questions in this channel?
No one can stop you.
it does start the engines, they basically get spawned in a "flying" state
Mods can 😛
@simple solstice Go ahead. I'm listening
So, how can I move the listening object (the player) to the Zeus camera when I open it?
0.9.x or 1.0 ?
0.9.x
Ewwwww
yes. 1.0 beta
Extended_DisplayLoad_EventHandlers > RscDisplayCurator > detect open/close.
If open override
player setVariable ["TF_fnc_position", {ATLToASL (positionCameraToWorld [0,0,0])}];
if closed
player setVariable ["TF_fnc_position", nil];
Dunno if TF_fnc_position changed in 1.0 .. might have
in 1.0 it is "Tick the checkbox in Eden"
so if I nil the variable it returns to the player object, right?
yes. Then it returns to default behaviour
people won't be able to hear you. But you can listen from the camera
No
That "should" work in 0.9.x
But I think the height in the position changed. I think 0.9.x uses ATL. So you should remove the "ATLToASL"
Is there a way to do it by scripting and not mods?
I... Just showed you the scripting way
Extended_DisplayLoad_EventHandlers can be put into the description.ext
Oh sorry the googling result misguided me
I'm a bit lost of where to add it and how 😅
// Ivan_fnc_deploy_vote
hint "molos";
// works
["deploy_vote_molos", "onMapSingleClick", {hint "molos"},"molos"] call BIS_fnc_addStackedEventHandler;
// doesn't work
["deploy_vote_molos", "onMapSingleClick", {call Ivan_fnc_deploy_vote},"molos"] call BIS_fnc_addStackedEventHandler;
class Extended_DisplayLoad_EventHandlers {
class RscDisplayCurator {
myTag_fixTFAR_Zeus = " player setVariable ['TF_fnc_position', {ATLToASL (positionCameraToWorld [0,0,0])}];";
};
};
class Extended_DisplayUnload_EventHandlers {
class RscDisplayCurator {
myTag_fixTFAR_Zeus = " player setVariable ['TF_fnc_position', nil];";
};
};
???
Thank you, I really had no idea on how to do it
Just a piece of code that should run when the curator display is opened / closed.
XEH!
cba to install CBA 🍆
It's running TFAR already.
I see
Sorry, I am stuck in SQF and never think of anything other than it when it comes to arma 😦
And scripting
#Intercept
#ShamelessAdvertising
Release 1.0
If I only knew C++
@tame portal you learn too fast
C or assembly
poor n<xor eax,eax><xor ecx,ecx>b's
C++ is too many functions to ever remember.
I personally will probably never go lower than C++
I want to move zeros and ones.
Next step is write them on paper manually
The result is not scalar NaN.
So there is something wrong between calc and hint. Or input and calc
need to show more script
it says here that "y and z are swapped around, different from your usual model space coordinates format"
Isn't this going to cause problem for TFAR?
@simple solstice Uhm... I didn't switch them around.. so.. supposidly it's fine
Deleted my stupid ass comment as i was blind
Ohhh I thought that when returning it's swapped
And its for the parameter
sorry, im going to hide in the shadow now
true.
I meant the in-game one ;/
ACE spectator is a in-game one ^^
Not using ACE 😦
Good one..
Can I check it for you in any way? Have Arma open
RscDisplayEGSpectator
😄
*facerub * I just found and fixed a TFAR bug 😄
I mean the spectator that you can open from the debug console
I am using RscDisplayEGSpectator
class Extended_DisplayLoad_EventHandlers {
class RscDisplayEGSpectator {
commy_plsWork = "systemChat str _this";
};
};
class Extended_DisplayUnload_EventHandlers {
class RscDisplayEGSpectator {
commy_plsWork = "systemChat str _this";
};
};
and it was causing a bug that people couldn't get out of TFAR spectator anymore. So I guess that works
Isn't the debug console just using a camera script?
Dunno if there even is a display to tap into.
@little eagle remember the script you helped me with yesterday? The one that had to do with giving money per 5 seconds while you're in a car, then terminating when you get out? What would I do if I wanted that for playing a sound instead? I tried it out and ended up CTD
this was my attempt
while {true} do {
if (player in cop1) then {
playsound "chatter";
};
};
};```
with an eventhandler to run the script when you get in the car
@simple solstice no need to
soon™ you can create real desktop applications using sqf 😈
@still forum the variable doesnt work :/
waituntil {({side group _x == INDEPENDENT} count (allUnits inAreaArray _mkr) > 1) && ({side group _x == BLUFOR} count (allUnits inAreaArray _mkr) < 1)};
The above has been functioning with no issue when in SQF, but in a function it gives a generic error before the && line.
Can you not use a waitUntil in a function/call?
Its also inside a While loop not while true
¯_(ツ)_/¯
@daring pawn There is no generic error. Check the real error message
you can't suspend in unscheduled
2:38:18 Suspending not allowed in this context
2:38:18 Error in expression < count (allUnits inAreaArray _mkr) > 1) && ({side group _x == BLUFOR} count (all>
2:38:18 Error position: <&& ({side group _x == BLUFOR} count (all>
2:38:18 Error Generic error in expression
suspending not allowed yeah..
from where does your code get called
At the end of another script with [_mkr] remoteExecCall ["gridState",2];
why are you using remoteExecCall instead of remoteExec?
because i'm making the assumption its something i'd normally just use call on. But i need it run on server
am I about to find out RemoteExec is scheduled ~_~
nmvm
it pushes the code onto the scheduled script array. If it is a script function
Alright now in terms of a load question, waitUntil, is that each frame?
no
scheduled characteristics apply
it might execute every frame. It might execute every 10 minutes
can I disable the zeus ping
Ah right so, lets say I have a lot of those functions I have and they're all individually waiting on their WaitUntil's, could significant delay occur?
im going insane
THANK YOU
@simple solstice I think there is an eventhandler for that. Use it and just kill the guy pressing the button
remoteExecCall is a horrible name. It implies stuff about it that isn't true and it implies stuff about regular call that isn't true either.
@daring pawn The functions themselves could be delayed a lot.. Just like anything else in scheduled
Well yea i've been using it (not reading the vague wiki difference in them) for anything I'm putting server end.
@still forum Yea alrighty, i'll have to look into how much of an effect its going to cause for what i'm doing
you'll probably be fine if it's your mission
cheers though. I'da spent ages wondering why I couldn't have my suspension in the call... never thought of the difference
You could've just read the error message and plugged it into google
I did, got lots of things not related to remoteExecCall though
I wouldn't have made the connection between remoteExecCall being the unscheduled
And initially thought it was the fact it was a function
How would you do it without a function? ^^
setSkill is global / global ?
I was about to do it as an execVM instead -_-
which would have been yuck considering i'm proud so far of using that only once so far
execvm makes a function out of the script and executes it
😬 please I feel silly enough already 😛
My guess is local args, global effects. And if locality of the object changes the local values of the new owner take effect.
What are benefits of execVm?
there are none
It's passing an empty array.
muh us
actually. µs singular. If you ceil
good one
actually. µs singular. If you ceil
u drunk?
huge performance increase
replaced all my ; with ,
Gained 1 second average per script
µ drµnk?
tired as always. But don't see anything wrong with that
hey i had to leave, thanks for the codes and stuff to help me.
Has anyone ever done loadouts? I want to get a good way of defining different setups
Plenty people have I suspect.
A lot of variables, and ways to do it,
_weapon = "rifle";
_weaponAmmo = "clipazine";
_weapon = ["rifle","clipazine"];
🤔
I just use loadout scripts exported from arsenal
That seems pointless no? You replace a string with a string.
@still forum how do you extract mags/nades for vehicles/ammoboxes from that?
ahahahaha
Cargo scripts? I write them manually.. Or copy-paste from the backpack part from arsenal
Ewww....arsenal exports.
comment
I want to define weapons and crap in one file. Then use functions to move those things to everything
setUnitLoadout hella weird..
How so?
So much data
I guess I can make functions that will edit arrays and use a couple to set the loadout for players....
But I feel like it would be easier to just do addItem etc.
It's not like it is an insane amount of data. It is the same amount of data except faster if you were to do it manually
loadout also means that if a vest does not in reality fit items, they will still be added. But if I use a function I can check per item, if it fits or not
I feel like getting the ammo/weapons for cargo etc. it would be faster for me to do everythign from scratch....
That's what i'm trying to figure out
if one of these has a big advantage or not
Which one is the ~best~
Really depends on the usage then
Could you elaborate usage
Depends on what you are using it for
I want to result with 1 file (per side) that I edit to change unit loadouts, vehicle cargo, etc.
Wether or not you want more or less control over what goes in and what does not
Then you will likely want to add/remove anything manually based on side
From what I've done before, Sometimes certain roles will have certain quirks, random weapons sometimes, random uniforms sometimes
I've goit that one figured out
But general system is under question
🤔
Afaik each unit has a specified loadout initially per role. Defined via config
I'd use unit classnames or variable that you can set for unit to decide which loadout he gets
is this for missionmakers? 3den attributes yo
then 3den attributes
What does that mean?
make your mod add a 3den attribute where you can select a loadout?
I'm trying to center the map and zoom it so that the entire map is visible on opening. Anyone having a good idea how to do that?
as opposed to having to link either a classname somewhere or set a variable
It's basically this : Set player as Squad leader (B_soldier_SL_F), he will get SL loadout unless he has a _unit setVariable ["unit_loadout_override","Grenadier"];
player setUnitLoadout "B_soldier_SL_F";
Yes, but loadout for SL is defined in a single file
So If I want to edit the uniform and rifle I change
_uniform = "new_unfirom";
_rifle = ["rifle","clip"];
Also do
_rifle = {
selectRandom [["rifle","clip"],["rifle2","assaultClip"]
};
why add {}
and
_SLBeforeLoadout = {};
_SLAfterLoadout = {};
It's code
It's exectuded every time yo uget a loadout, eevery time new weapon
its a local var anyway, itll get recreated every time
🤔
There's a chance there will be more complex code there, maybe?
why would you want that in there
if you want to execute code add a _code = {} variable or something
just, in, case?
Yeah, but only code for _rifle... ?
I could have a different helmet per random weapon you recieve, so it needs to run that
i mean if you see a usecase sure
I am very good at making up stupid issues, and features
you run into the case of there being better alternative ways i think
_helmets select (_weaponsOptions find _weapon max 0)
etc
You should see my ai concept/notes 😄
its still all a scriptfile you execute that you have control over
why add extra code in a context where you can already execute code and now suffer a call overhead?
I want there to be 1 file, that I have to change per mission
So all the functions do magic
call overhead is this real?
Searching 249 files for "call"
call { commands } will be slower than commands
youre already in a file where youre executing code 😛
729 matches across 149 files
😦
ohh boy
I've used call very freely and usually replace code with functions if they get too confusing or big 😦
I mean thats fine
im just confused why youd want the option to execute code ... in a context where youre already executing code
if it works for you its all fine in the end
nah, I'll just load the file and then call a function that will add the weapon for ex.
Then the function will see if it's a string or code, code will be called and then give weapon
Reason I want to use both is becaues sometimes I might want a simple quick only add class name for gun / uniform, next time I might want something more complex
And I want it to work in both cases with only editing 1 file
but you can just add more code under line under or above that in the same file 😛
keep it clean ? ughh that's a good point
I think I was thinking of not doing local variables
I can do variables which can be set globally to override default values
this way I can change shit during the mission as well
That's probably too much :S
i am giving a drive orders to move on the car and he just dont obey, what can be?
you gave the driver a Move waypoint?
you might wanna ask in #arma3_questions , thats not really a scripting issue
does anyone know how to convert arma rgb format to html rgb format?
HTML rgb is just a differently formatted HEX right?
yup
arma colour format is basically a normalized RGB + alpha channel
so just use an RGB to hex algorithm
"algorithm"
there is your algorithm
afterwards, just put those hex characters after the 0x together
yea i found some really good info already. i thought maybe someone found a bis_fnc for that. i just want to be able to control text color insdie structured text the same as control colors
ah cool. thx man
HTML (or more CSS) uses RGBA format
while arma uses ARGB i think
no alpha channel is 4th
and yea figured he might wanna SQF it
not really something arma is suited for i guess
👍🏻
fn_armaToRGB = { _this resize 3; _this vectorMultiply 255 }; // _color call fn_armaToRGB
😮
the set unit speed command is have to be put in the vehicle or the driver?
you mean the speedMode?
setSpeedMode needs to be set to a Group
@polar folio if you wanna make it in sqf, i found this really old post with a script to convert a decimal number to any base (so including hex): https://forums.bistudio.com/forums/topic/176111-code-snippet-decimal-to-base-any-encoder-and-decoder-vehicle-diagnostic-tool/
it isent that optiom we can select were he go full, half etc?
i am seting up a tigger that teleport me to a gunner possition
this moveInGunner car1;
is not working, what i do to fix it?
this in a trigger is just true or false. Read the description in the editor.
this is on the "on activation"
The tooltip should say what you need to use.
thisList and thisTrigger does nothing
yup, nothing
It's an array with all the units inside the area.
You have to use it as array and not as object.
wondering right now ... anyone ever checked if when using objects the "this" variable is cleaned in missionNamespace?
thisList moveInGunner car1;
((same with other special vars like thisTrigger etc.))
They are.
how it should be?
No.
is this singleplayer? just use player
its a coop
do you understand what the thisList variable contains?
no
there's your problem 😄
i think you will get more answers and better answers if you show that you want to understand the code and not jsut copy paste it
so, how it works?
so once you read this you will realise that it's a list of objects as the name says. afaik a vehicle can only have one gunner position that can be accessed by moveinGunner. so there's already a logical problem with your approach
its atually have only one gunner
so who exactly needs to be in the gunner position? first guy to enter the trigger?
yes
is your trigger set to one time or repeat?
just one time
ok changing idea
how about if to detect a player inside of a vehicle and use the moveInGunner car1;
Good evening all.
I've forgotten how to set up global scripts. Can anyone help me out? Global scripts are scripts that you can call from outside the mission folder
You mean.. A Mod.. Or CfgFunctions?
https://community.bistudio.com/wiki/Script_Path
Look under "File only reference". You could store scripts in another folder
I remember it was possible in Arma 2
Sqf in vanilla only
You need a mod for this when you say "outside the mission folder".
I remember doing it without mods. You sure?
What else is there besides mod or mission?
I don't want that it's been removed
https://www.reddit.com/r/armadev/comments/4syugi/global_script_folder/?st=j79j3jtm&sh=3a78fc7b
But if you guys have no idea, then...
You are probably talking about filePatching. Yes that has been disabled
you cannot load stuff that is not inside a pbo or missionfolder
Thanks @still forum
Apprently disabled in 1.50: https://forums.bistudio.com/forums/topic/183049-file-patching/
It's sad 😦
Check if its a player?
how?
isPlayer (whatever your checking)
how about to check if is a AI?
so if this is a AI this command will execute?
Uhhh yes if it works
if (!isPlayer a) then {
isPlayer moveInGunner car1;
};
no
Oh shoot
isPlayer moveInGunner car1; this line is not right
Yes true
a moveInGunner car1;
There you go
Id recommend a better variable name, though. a is pretty bad
isPlayer is a command lol
no its a command
@north vortex why are you writing there you go when you clearly don't know what you are talking about?
...
i havent seen you say a single correct thing 😛
^
I think I know the difference between a script and a command 😛
Well there you go
He meant Komanda I think @cold pebble
lol
😂
Can you hear me?
Can you hear me?
Yes
🤣
it worked, thanks guys
😂 😂 😂 😂 😂 😂
I can hear you
😂 😂 😂 😂
Oh so you can hear me
😂 😂 😂 😂
How could we not?
can we cut the spam a lil but
if (!isPlayer a) then {
a moveInGunner car1;
};
Oh oh lol sorry can you se3 my text🙂 😂
Sorry for my childishness
nice work Roque
a is the name of the unit
WHAT'S SO BAD ABOUT "A" AS VARIABLE NAME?
But yeah, as @indigo snow said, you probably want to rename that variable to something more conspicious @astral tendon
yea its pretty bad tho since its so short and undescriptive
if you name your variables like that youll make a mistake and override it some way pretty soon if you dont watch out
i just did that to test anyway
aight just making sure since youre new to this
i remember a guy on the forums
lets not talk about that
Also, a would be a global variable, so you most likely want to do add a underscore for a local variable.
@little eagle I CANT HEAR YOU
not in a trigger
So you are not clogging up missionNamespace @astral tendon
HELLO?!
But I am the police.
youre not the whiskey brown!
@rotund cypress what do you mean?
So a variable without a underscore would be a global variable, which means that it can be accessed globally in any scope