#arma3_scripting
1 messages ยท Page 734 of 1
Exactly
Do you have any other code in your dedi's init to act as a sanity check?
I have 2 view distance lines and an addAction. Before the event handler is an sleep of 3 seconds (heard that the init sometimes loads to quick)
How about this
Rather than doing your 3 second sleep, do this
waitUntil {!(isNull findDisplay 46)};
Nope
this is how my init looks like
setObjectViewDistance [2500, 800]; //Objekte, Schatten
setViewDistance 8000; //allgemeine Sichtweite des Servers
private _currentLeaderRespawn = leader player;
leaderRespawn = _currentLeaderRespawn addAction ["<t color='#662112'>Respawn Erstellen</t>", "_resupply\scripts\createRespawn.sqf", [], 6, false, false, "", "true", 0.2];
waitUntil {!(isNull findDisplay 46)};
doTeleport = (findDisplay 46) displayAddEventHandler ["KeyDown", {if ((_this select 1) == 54) then {_nul = [] execVM '_resupply\scripts\teleport.sqf'}}];
Alrighty how about this
since all of that code is intended for actual clients, slap a ```sqf
if (isDedicated) exitWith {};
at the top
what should go in there? All the init?
just use initPlayerLocal.sqf if you intend to run it on clients only
tried that too
uhm, what exactly doesn't work here? ๐ค
so I just have to use smth like onButtonPress?
do systemChat loadFile "_resupply\scripts\teleport.sqf" or something and see if it prints anything (on dedi as any client)
in the keyDown handler?
how do I open that on dedicated server?
just put it in initPlayerLocal if you don't want to deal with getting debug console open
@tough abyss @copper raven Doesn't drop any output.. only on dedi tho
And the file's still present clientside?
wdym?
Do you as a client still have _resupply\scripts\teleport.sqf
when you're testing on dedi
Idk if I have, but as I said, on the client side it did not drop any output
So you get output in SP and local MP but not on dedi
and you're not changing any files between those tests
correct?
Yes
I can access the files via FileZilla
Ok
so you've been able to edit the init via that but don't currently have access to the config
alright
I didn't edit any serverside files
aaaaaand bingo that's your problem
my ears be growing big, tell me
I don't know how to put this
your local init isn't going to run if the dedi's hosting the mission
you need to edit the serverside
if the server's in control
hence why your stuff's only working in SP and local MP
initServer.sqf?
any of them
init, initPlayerLocal, initServer, etc.
those are all done by the mission host
but my thingy is in init.sqf
correct
which is defined by the mission host
which in dedi's case is the dedi server
Okay
and mission change == server restart, iirc
so if I put the script locally (initPlayerLoca.sqf) it should work
No
If you're playing on a dedicated server
the dedi provides all of the init files
you can't force it to exec your local copy unless you do some strange voodoo with remoteExec which I'd not recommend
the solution to your problem is to get access to your dedi's init files and change those
then it should work fine
thanks for the help, I'll wait til I get the init and tell you if it worked
๐ hope it goes well
Basically I wonder whether it is possible to tell AI via a scripting command to e.g. heal someone.
How can I use a variable defined file A, in file B. file A is only executed by one person, but all users should use that variable in file B
@vague geode I'm not super experienced with that in specific but I don't think there's much for that
@fervent kettle There's lots of ways. The cleanest would probably be to broadcast the value of the variable in file A to all of the people using file B
Which you could do via publicVariable
worked, thanks again ๐
No problem
Intel creation script, works but only on the player who picks it up.
Anyone able to see whats up?
call{data = [this,"RscAttributeDiaryRecord",["Map of Tria Swampland","This Map of Trias' Swampland shows the Cartels' <marker name='Int1'>Barracks</marker>",""]] call bis_fnc_setServerVariable; }
Why is this not working? It is a sqf in the mission folder and when I call it it just quickly flashes' back for a frame or two and later uses the blur effect.
[] spawn
{
cutText ["", "BLACK FADED", 999];
0.1 fadeSound 0;
sleep 3;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [6];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 3;
cutText ["", "BLACK IN", 7];
14 fadeSound 1;
playMusic "AmbientTrack01a_F_EXP";
sleep 1;
[str ("Delta") , str (date select 2) + "." + str (date select 1) + "." + str (date select 0)] spawn BIS_fnc_infoText;
sleep 11;
[str ("Time"), str (date select 3) + "." + str (date select 4)] spawn BIS_fnc_infoText;
sleep 10;
0=[[["MISSIONAREA, ","align = 'center' size = '0.7' font='PuristaBold'"],["","<br/>"],["MISSIONISLAND","align = 'center' size = '0.7'","#aaaaaa"]]] spawn BIS_fnc_typeText2;
};
what's its usage?
It is suppose to be a black screen with text appear and then fade to the game with a short amount of blur
on mission start?
this should be _this for a call
idk what "black faded" nor "fadesound" are
but this might help https://community.bistudio.com/wiki/BIS_fnc_fadeEffect
No same problem just a quick flash of black
[1, "Black", 2, 0] spawn BIS_fnc_fadeEffect;
sleep 5;
[0, "Black", 2, 0] spawn BIS_fnc_fadeEffect;
The simplest set up I can think of. It should fade to black and the back.
I'm outta depth here. I only use this when starting a mission in the init.sqf
Tried increasing the fade times? 3 - 5?
and the sleep time?
999 didn't make a difference
no clue anymore
anyone else?
fadeColor: String - (Optional, default "BLACK") case-sensitive can be "BLACK" or "WHITE"
Did not fix it
So im trying to destroy the Bridge in Harcourt on Tanoa but it cant be destroyed via explosives and essentially has to be deleted/removed from the mission when they go off and the only way I can see of doing this is the Edit Terrain Objects under the Environment but I dont know if I can change the presence of it from false to true.
This is the script I'm using for the explosives and was wondering if I could add a way to remove the bridge onto the end of it or something
this addAction ["Destroy Charges",{{ _x setDamage 1; } forEach [charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,charge21,charge22,charge23,charge24,charge25,charge26,charge27,charge28,charge29,charge30,charge31,charge32]}];
(don't you mean "Blow up charges"?)
yeah im going to change that in a moment
You can combine hideObjectGlobal (remoteExec'd to the server) and nearestTerrainObjects
right now its still in testing phase
Approximately:
{
[_x,true] remoteExec ["hideObjectGlobal",2];
} forEach nearestTerrainObjects [_position_or_object,["TRACK"],300];
Note: "TRACK" could alternatively be "MAIN ROAD" or "ROAD" or any other type listed here https://community.bistudio.com/wiki/nearestTerrainObjects - try them until you get the right one
(and choose the position and radius carefully so you don't accident any of the nearby roads)
okay thank you
If you can figure out the model name (e.g. by using nearestTerrainObjects in the debug console) you might be able to create a "destroyed" bridge using simple objects of the bridge sections. Bit high-effort though
You can figure out the model name using getModelInfo cursorObject and simply aiming at the object
this addAction ["Destroy Charges",{{ _x setDamage 1; } forEach [charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,charge21,charge22,charge23,charge24,charge25,charge26,charge27,charge28,charge29,charge30,charge31,charge32]}];
Is there any reason why this works on testing in the editor but not in the mission on the server
what doesn't work?
you mean the action is not shown?
what are those charges?
satchels named 1-32
I know. I mean how did you create them and where?
placed and named in the editor on/around the bridge I want to use them on
well setDamage takes global args, so the reason it doesn't work with those seems to suggest it needs local args for ammo 
you can try this:
for "_i" from 1 to 32 do {
_charge = missionNamespace getVariable ["charge" + str _i, objNull];
if (!alive _charge) then {continue};
[_charge, 1] remoteExec ["setDamage", _charge];
}
I got rid of your forEach (you had some nerve to write all that
)
What would cause a script to not execute at all with no shown errors or .trp reports?
I feel like I'm missing something stupid simple or I'm executing it wrong
missing } (not closing a scope)
or wrapping it in {} and not executing the scope
this is what im using.
its a crew check script for whitelisting slots to use vehicles on a Dedi Server
https://www.sqfbin.com/adaximadosokawulular
ive tried using execVM in both init and Serverinit, ive also tried just putting it in both inits ive also treid using EH to fire it and it just doesnt fire.
im still new to all this scripting as i used to only do design so im probably missing something stupid simple
if you simply pay attention to the syntax highlighting you'll see
Well it won't do anything on the server since {player == player} will never be true on a DS
_aircraft = ["B_Heli_Attack_01_dynamicLoadout_F", "B_Heli_Light_01_dynamicLoadout_F", "B_Heli_Transport_01_F", "B_Heli_Light_01_F", "B_Plane_CAS_01_dynamicLoadout_F"];
_armor = ["B_AFV_Wheeled_01_up_cannon_F", "B_MBT_01_TUSK_F", B_MBT_01_arty_F"];
//Wait until player is fully loaded
waitUntil {player == player};
the colors aren't just for show
im an idiot.
not gonna ask for ya to do it for me but where would i need to look in order to fix that? im trying to learn as i do this
It doesn't really need to run on the server so there's no need to fix it, just put it in initPlayerLocal or wrap it in if !(isServer) then { ... }; and it won't matter
you can also use a getInMan event handler instead of that horrifying while {true} do { waitUntil ... }
Aight. I will play with that and see what I can come up with
Thanks for that
Any suggestions for debugging network spam? I tried running my mission yesterday and we ran into an issue where #monitor showed something like 3000 guaranteed messages being sent every second. This seems extremely high, how would you suggest going about figuring out what can get trimmed down?
I think it's something related to this function I run to have cash rewards. Any ideas on what might be a performance problem here?
how do i use params to assert that first argument is an array
params [ ["_array", [], [[]] ] ]; ?
yes
thanks
does waitUntil not inherit its scope?
my private variables defined in the parent scope seem to be undefined in the waitUntil block
your spawn doesn't
ah i was using waitUntil in a context i mistook as spawned
is it possible to make a weapon show up on the UI after adding it to a vehicle with addWeapon(Turret)?
what UI?
sorry lemme get a screenshot
add this to a vehicle that doesn't normally have weapons
I know it is possible by changing unitInfoType to "RscUnitInfoTank" in the vehiclecfg but I was wondering if there is any way that doesn't require an addon
hint str _boxSpawned;```
anyone know why createVehicle isnt returning the object?
maybe _objectToSpawnPos doesn't exist
the object spawns, but when i hint the name nothing shows
is that all of the code?
I mean between the two statements
yeha
what if you put an other hint directly after it?
hint str _boxSpawned;
hint "bla"
@little raptor do you know?
no
yeah it isnt hinting anything
What isn't? Your current code?
well no hint is showing up
How did you do? What you've put into the code?
hint "test"
And how?
?
init or whatever
initServer.sqf
but its a functionn call
initserver.sqf > function
is it hinting on the server?
you need to add some delay
hints are not shown at init
because there's no display
also if you're not the server you won't see the hint either
hints are shown locally
system chat is though
But hint isn't
i've addd a delay, ill also try in console
delay doesn't work and its on a dedi so i cant access the consol
ok, It still isn't returning the object because trying to add an action to the spawned object doesn't work
wat? how do you expect to see anything on dedicated server?
yeah my bad i realise now how stupid that was
you should've sent the hint to the client(s)
or use diag_log
Or don't try to make and debug mission on dedi
I guess nothing along these lines is possible in SQF (?)
arr = [[1,2],[1,2]];
{_x = _x#0 + _x#1} forEach arr;
arr // --> [[1,2],[1,2]], not [3,3];
...and if I wanted to do something like it, I'd have to instead create a new array, for example, and use pushBack to add the result to that one instead
// Tested this and it seems to work as intended
arr = [[1,2],[1,2]];
arr2 = [];
{arr2 pushBack (_x#0 + _x#1)} forEach arr;
arr2 // --> [3,3];
@grave thistle you could, just use arr set [_forEachIndex, _x#0 + _x#1];
Thanks! I'll look into this
In a forEach of course
@grave thistle though really the simplest would be
arr = arr apply {_x#0 + _x#1};
If you're OK with losing the forEach
This would work too. I'm just trying to figure out the simplest & tidiest ways to do this kind of array manipulation, and apply and set seem to be the keys to most of it.
when you pass array via remoteExecCall to client or server is the array passed as reference even in multiplayer/dedi game? I think this is probably a stupid question but had to ask anyway ๐
when testing this in editor the array passed to remoteExecCall is passed by reference
ofc not
it's not
how did you test it exactly?
so its just different behaviour while testing in editor
like this: ```
_posTest = [123,777,0];
testFn =
{
params ["_tp"];
_tp set [2,888];
systemchat format ["--> %1 ", _tp];
};
[_posTest] remoteExecCall ["testFn", 2];
systemchat format ["> %1 ", _posTest];
in this case no network transfer occurs. it just executes locally
yea hence the array is passed by reference
ok
its good to know otherwise would get weird results while testing
modifying the original array...
you will once you test it on other clients
which is not what I want
so why do you put remoteExec then?
for MP
wat?
which is not what I want
if it's not what you want you don't want remoteExec either
I need remoteExec to call client function (and pass the array) but I dont want it to modify the original array
the original array server has
I can use the + copy to make sure the behavior is same in editor/dedi
[+_posTest] remoteExecCall ["testFn", 0];
so that the original array wont be modified
Good day. What can break 'LOITER' waypoint behaviour? ๐ค And how can I fix it?
It works good if there are no enemies nearby, but if there are, it never works and helicopters are just hanging in the air in one place instead of loitering.
maybe AI behavior
set them on careless
Could try that on pilot only, but since they are also a group leader at the same time, won't it break combat behaviour?
what combat behavior?! he's just loitering 
And gunners should go pew-pew-pew (=
you can try. they'll still open fire
shouldn't matter much in your case
Ok. Thank you
which heli are you using
i am no expert on arma ai but i am pretty sure you are witnessing them breaking out of loiter to engage the enemies and they do one strafe and the ai thinks it is finished since it has no more waypoints
i have managed to convince myself that you cannot make them loiter and shoot enemies at the same time since the ai is just programmed to forget their loiter waypoint when they start to engage enemies
except for some reason
the cups independent heli CH-146 Griffon (armed) will happily do a loiter while also mowing down enemy infantry
dont know why but if i change that to some other heli they will either just loiter and not engage at all, or they will break loiter and do strafes
i do have this in the heli init
this spawn {
while { alive _this } do {
{
if (_this distance2d _x < 300) then {
_this reveal [_x, 4];
};
} forEach (units independent);
sleep 3;
};
};
in this case the heli happens to actually be under opfor control
and it is loitering independent units
and going brrrt
the minigun has 2000 rounds loaded and it burns them very quickly
Good evening, I seem to have an array error (by the looks of it). I've made a function which accesses the values of a 2D array (objects and a number), I have a simple if statement cover the rest of the code inside the function, if the object exists then do this. what happens is, I make friendly units kill the array units (4 enemy units in total). when the functions fires a 5th time it throws "Error Zero divisor". My question is, why? it can't follow through with the rest of the function , why throw an error? . What I am not seeing?
https://sqfbin.com/umonuvefulajibigatux
Function: lines 16-48.
called: 70,93
That try-catch can't catch out of range errors
Didn't know that, Do you happen to have any reccomendations?
Yeah, use if
If I use an If statement, it still throws the error as technically it tries to access an element that does not exist
if(!isNil {Threats select _arrayIndex})then
//do stuff
yeah so check if _arrayIndex is out of bounds
hey guys, i hope i ended up in the right place for my problem. So in Arma3 i am using MGI Modules Spawn attack waves and there you can put in a condition to trigger the module. I use either triggerActivated trg1; or EAST countSide allGroups < 3. Each on their own works as intended. i can't get it to work having both of them. Any syntax tipps are greatly appreciated.
(triggerActivated trg1) or (east countSide allGroups < 3)
thx for the quick answer. It works, however i kinda want them both to be mandatory to trigger the attack spawn. Now it's either the trigger or the countSide. Would be nice if both of them would be necessary
try changing or to and
Seen the trailer for the Enfusion Engine for Bohemia?
Thoughts on how that's gonna work out for scripting in Arma 4, ya'll think it'll be better?
Yay, let's play a guessing game in #arma3_scripting now
Enfusion uses Enforce Script; see the wiki and DayZ for more info
it has if-else xd
Overriding the index operator can be achieved through the Set and Get methods
who designed this crap
doesn't look great, but better than sqf i guess. not that that's a very high bar
hey fellas. is there a way to stop a playsound3d after it starts?
i don't think so, you can use https://community.bistudio.com/wiki/say3D instead though
did you configure cfgSounds properly?
note that it doesn't take path unlike playsound3d
I most likely have not
Do you have an example of what it should like?
i found one all good
@copper raven sorry to bother you. Is there a way to then stop a say3d when it starts?
check the wiki
sadly not
??
_trgBomber setVariable ["_AssassineLeader", _AssassineLeader , true];
_trgBomber setTriggerStatements ["!alive AssassineLeader","
I have a problem with this Piece of code.... When I want to use a lokal Variable in the Trigger Condition it wont work (even if variable is set to this spesific trigger. It works as intended with global Variable but i need it to work with a lokal one. Can somebody tell me whats wrong?
you can use thisTrigger and https://community.bistudio.com/wiki/getVariable
_trgBomber setTriggerStatements ["!alive (thisTrigger getVariable '_AssassineLeader')","
You mean this? because i tried that and it did not work either
it might be because you're trying to use a variable within a string
_trgBomber setTriggerStatements [format ["!alive %1", _AssassineLeader],
I'm no expert but that's the avenue I would take
is _AssassineLeader defined and everything? do a systemChat str [_AssassineLeader] before you do setVariable
no, it's fine
why would it matter?
yeah it is in the trigger it can be used and the code in the trigger works, With activation true the code works perfecly
Which Position format does createUnit interpret its Position argument as? ASL/AGL/AGLS/ATL/ASLW? I'm guessing AGLS but not sure.
It's not documented there
It just says it receives a Position argument but doesn't specify what format.
Ok, thanks, I'll try to confirm. Working on a garrison script...
if you get a good info (test with water, water + waves, terrain, building surfaces) I'll update the wiki thanks to that & you ๐
can you use setpos on ModuleSpawnAIPoint_F?
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
so what should i use, please enlighten me
you have plenty of variants, setPosATL, setPosASL, setPosWorld ๐
fair enough, ill give them a try
it might not work (but it also may ๐ฌ let's see)
hello, i got stuck with a simple script, can somebody help me out please? i'm trying to add action to a static object (e.g. noticeboard) that is going to spawn a vehicle at a given location on the map (can be determined by coordinates, or invisible helipad or generally anything, the location is not going to move around)
this addAction [hatchback, {createVehicle [C_Hatchback_01_F, [9160,8288]]}]
``` thank you
check the syntax. hatchback has to be a string, eg "hatchback", as well as the classname "C_Hatchback_01_F"
oh god you're right, now it works, thank you, i knew i'm missing some detail
by the way since we're in it, is there a way to give the spawned vehicle a script into its init?
you can use the first syntax and then use that variable to do whatever you want with it
createVehicle returns the created vehicle
here's an example, i would like to spawn a vehicle using this: sqf this addAction ["hatchback", {createVehicle ["C_Hatchback_01_F", [9160,8288]]}] and that vehicle should have this: ```sqf
this addaction["Last 112 call",{ [caller_position] spawn gps_fnc_main; }];
this addaction["Last 911 call",{ [caller_position2] spawn gps_fnc_main; }];
this addAction ["hatchback", {
private _vehicle = createVehicle ["C_Hatchback_01_F", [9160,8288]];
_vehicle addaction["Last 112 call",{ [caller_position] spawn gps_fnc_main; }];
_vehicle addaction["Last 911 call",{ [caller_position2] spawn gps_fnc_main; }];
}];
wow that was quick
why is there the "private" word? what does it do?
it will only make that variable visible to the current scope. it's not really necessary in this case but it's good practice
https://community.bistudio.com/wiki/private explains it better than I can
allright so basically no other scripts on the server will use it
anyways, thank you very much @distant oyster you helped me and taught me something new ๐
that's what she said
get used to it with Terra
nevermind me, carry on
so the variable doesn't get overwritten by another script or overwrites a variable with the same variable name, eg:
_var = 123;
[] call {_var = 456};
if (_var == 123) then {/* Do very important stuff*/};
now imagine {_var = 456} is a function that you don't know the code of but the author forgot the private statement. your code will not work and you don't know why.
allright i think i might have the point, thank you
oh by the way merry christmas @distant oyster ๐
and you too @winter rose ๐
is it possible to spawn pre-placed units when a trigger is activated?
and not directly from the get go
i think you can place the units, make them invisible and then make them visible again using the trigger
this script does the trick
https://community.bistudio.com/wiki/hideObjectGlobal
if you right click the unit go to atributes and find "show model" or something like that, i've got the game in different language
The "Show / Hide" module works in MP as well for this type of thing, no script needed. While hidden, units are not simulated and performance is saved.
uncheck it to make the unit disappear and then use the trigger and the script to make it visible again
@last coral in trigger on activation: ```sqf
soldier hideObjectGlobal false
hideObjectGlobal needs server exec
they'll still move and detect enemies
keep that in mind
so they are cpu heavy as if they would be there?
they are just invisible but they are still there and can even shoot, move around etc...
not as much, no
if you also disable their simulation hopefully that'll solve the problem
right, the computer doesn't have to display textures
yes i forgot about that, that is also necessary
by the way hello @little raptor ๐ merry christmas also to you
not just GPU usage, but CPU usage too (e.g. other units won't bother to check if they see them)
thanks! merry Christmas to you too
thank you
it's a bit early tho ๐
are my clock ahead? ๐ค you're not the first one to tell this to me but i feel like it's just 6 days to christmas
I was just kidding 
ah ok ๐ you got me
when i get back to the previous script for a while ```sqf
this addAction ["hatchback", {
private _vehicle = createVehicle ["C_Hatchback_01_F", [9160,8288]]}];
_vehicle addaction["Last 112 call",{ [caller_position] spawn gps_fnc_main; }];
_vehicle addaction["Last 911 call",{ [caller_position2] spawn gps_fnc_main; }];
you've closed the bracket too early
indentationnn
allright, i had a feeling that there is going to be a problem like this, let me try to fix that
this addAction ["Create hatchback", {
private _vehicle = createVehicle ["C_Hatchback_01_F", [9160,8288]];
_vehicle addAction ["Last 112 call", {
[caller_position] spawn gps_fnc_main;
}];
_vehicle addAction ["Last 911 call", {
[caller_position2] spawn gps_fnc_main;
}];
}];
now i've got it! thanks, took me a while to get orientated in those brackets ๐
that's on me. I edited the code seconds after I posted it
it's fine, no problem, i just created necessary script (359lines) and placed it into our server ... and it doesn't work so right now i'm wondering, whether the script is incorrect, or if i perhaps inserted wrong coordinates so the car actually got spawned, but really far away where i can't see it so i'm thinking how to figure it out right now ๐
yeah i got it, wrong coordinates ... got to rewrite the entire script ๐คฆโโ๏ธ whatever
argh, findIf doesn't work with hashmaps
https://drive.google.com/file/d/1Ns5sM1M_HihaM1mcI0Bg8HZmNeN8PoK8/view?usp=sharing
I installed this script.
How can I stop a script from snowing with the debug console?
Tried to terminate, but it didn't work.
ahem, that's not a script, that's an entire mission file pbo
please
https://sqfbin.com
sorry. There are too many files... is it impossible with a link?
_script = [] execVM "script.sqf";
sleep 5;
terminate _script;```
I tried like this, but to no avail.
given how it is designed, it seems like an old code
read the documentation or contact the author, that's your best chance
I just wanted to know how to exit the script. Is there no way to terminate unless it is modified?
nobody knows without reading the whole thing
the script spawn/execVMs it's own codes
you're just terminating your own script
it appears this is the variable that controls the snow: al_snowstorm_om
so simply try:
sleep 5;
al_snowstorm_om = false;
thank you for the reply.
But I just tested it and it didn't work.
lol wtf?!
al_snowstorm_om=true; publicvariable "al_snowstorm_om"; sleep _duration_storm; al_snowstorm_om=false; publicvariable "al_snowstorm_om"
why?! 
server-side script?
newbie?
both?
just go through the scripts and find global boolean variables (those that don't start with _ and set equal to true or false)
if it can be disabled, it most likely has a global boolean var that controls the snow
but in any case, that's a terribly written script
better just forget about it
I tried running it in the debug console and it doesn't work, do I need to add a global variable?
it can never work in debug console because you had sleep
sleep 5;
this?
yes
Can you set mod settings using a file? Whether it was through description.ext or some on start eh
if the mod supports cba then yes
what mod settings?
like setting ace damage and etc
yes. they're just normal variables
oh
I think if you hover your mouse over them you can see the variable name as well
cba lets you import and export all your cba settings
so at least you can copy and paste in and out different versions of ypur settings
I'm dumb. Never realized those were variables for some reason
there is also a cba_settings.sqf but i remember that you need to place some extra pbo from the cba mod dir somewhere
that would exactly then be a file you can move around and edit outside arma
After some light testing inside and on top of a building, inside and on top of a dirt pile object, and inside and above a shallow pond, it seems that createUnit accepts an AGL position. For the pond, the observed Z placement was relative to water surface not terrain, hence AGL not ATL. For building and dirt pile, observed Z placement was relative to terrain not object, hence AGL not AGLS.
Hey thanks!
Question, have you tried Ocean, and not just Pond (which is an object)?
no need. it's AGL
AGL is the default position format
so dumb. world should have been default
I don't know why every non- specialized command doesn't just take and return world pos
Would make things much more straightforward and avoid all the stupid conversion bugs
how to install Arma
click install in steam
Also why the hell is there no nice universally applicable bug-free command for smoothly rotating vectors, literally had to make an sqf quaternion library for this shit
apparently quaternions are too complicated ๐
Right but imo it should be pretty much standard for object manipulation
As it is in most engines
does typeof command works with currentweapon or vehicle only ?
see the wiki
Cc @peak pond
Hey, what';s the command to grab the offset between two posAGLs?
I need to offset positionAGL -> positionAGL, rather than object -> positionAGL, so getRelPos and other commands won't work for me
vectorDiff?
that's just the definition of the AGL pos 
so let's change that ๐
that is how it was already
although, wait
it says "positionATL" but for boats, not for e.g humans
so what happens if you create a car over water
etc
Hello!
On the steam workshop, there is this mod for traffic lights
https://steamcommunity.com/sharedfiles/filedetails/?id=2444073983
that has one little problem. The red light does not emit light. So it pretty much all works but red light is nearly invisible and can not be seen at night at all. My attempts to contact the mod creator were unsuccessful so i came here. In theory i can attach a source of red light right over the red light on the pole. By using hide object global i can try to make it appear and disappear, but my question is - is there a way to relate any script to the phase of the traffic lights?
Unless the light actually moves, do not attach it. attaching is slow
Also there's no need to hide the light (I'm not sure if it works at all). You can just set the light intensity to zero
As for the phase, it's preferable to embed your code in the script directly
But if you don't want to, just take a look at how the script "animates" the light
My guess is that it uses animateSource
If you don't want to "embed" your code just run an external loop
judging by observation, i think, that the traffic light is just an object that does nothing, the effect of individual colours being lit is done using independent coloured circles and light sources that are attached to it and appear in in front of the desired light
Ok. Then it's a lot t simpler
well it's just my guess based on what i see in game
There's no need to guess. Just look at the script 
unfortunately there are no settings whatsoever, basically i place the object in the editor and it does the job, nothing to set up so there's also nothing to catch up with
hold on, i'll have a look
...i feel like there's a bunch of useless things in the mod folder that are not used in any way
@edgy larkno crossposting thank you
the .rar is not supposed to be there at all right?
No 
not my fault by the way, i didn't do this ๐
anyways thank you @little raptor i think i can handle it from this point, thanks for the help
Good question. I didnโt have time for a proper test. Tested on GOS Gunkizli. No ocean on that map, but it has marshes at sea level, similar to Limni on Altis. So, not sure if thatโs a lot of pond objects or if it counts as (shallow) ocean ๐ค , but creatUnitโing infantry at 0 height placed them at the water surface, not the terrain underneath. ยฏ_(ใ)_/ยฏ
Hello everyone, I'm looking for a simple (I'm not a programmer) and quick way to transform an object, vehicle, tent, house, etc. into a medical facility capable of automatically treating who enters or who is transported inside as injured. Using the ACE system.
Thank you all for your cooperation and happy holidays.
Hey, I haven't heard of anything that exists like that, but if you have or know someone with a small amount of experience programming it should be possible. ACE has a couple of functions to do with medical, ace_medical_treatment_fnc_fullHeal and ACE_medical_ai_fnc_healingLogic that may be of use to you, to heal people using ace medical. They are not documented as public so use at your own risk though!
@tribal sphinx so you just want to make it so that whatever object you choose heals nearby players or you actually want to have it turn into an actual medical facility building?
Hello,
exactly, basically I would like to create some sort of hospital or medical center in a facility or even on a vehicle
@tribal sphinx so how do you want it implemented?
Just heal nearby players automatically? An action?
Heal only those who enter and are carried in
Well then it's going to need to work differently depending on whether it's a vehicle or not
That okay?
it would be fine, thanks.
The cure should be done automatically without selecting any options and / or commands
Is there a way after using setweaponzeroing to script the system back to auto ranging
just a quick question:```sqf
_waitTime = time + 10;
waitUntil {time > _waitTime};
Is it possible to get this to work in an trigger within the on activation code? need a Delay but donยดt want to use spawn because i would have to pass many variables
In 3denEnhanced, you can set the ambient animations of a unit... I'm not able to get all of them to work with BIS_fnc_ambientAnim. Am I missing something?
no
any other way then spawn?
no
๐ฆ
thanks anyway for the help
@tough abyss how should the ini on the server be called an located?
So I've got this hint displaying a unit's traits but is there a way to make the values in the hint be a different color? Like instead of it being the gray as the rest of the message if it is true it's color is green and red for false.
_isMedic = _unit getUnitTrait "medic";
_isEngineer = _unit getUnitTrait "engineer";
_isExplosive = _unit getUnitTrait "explosiveSpecialist";
_isHacker = _unit getUnitTrait "UAVHacker";
private _text = parseText format ["
<t color='#FFA32B' size='3' font='PuristaBold'>Unit Traits</t><br/>
<t color='#807E78' size='1.5' font='PuristaBold'>Medic : %1</t><br/>
<t color='#807E78' size='1.5' font='PuristaBold'>Engineer : %2</t><br/>
<t color='#807E78' size='1.5' font='PuristaBold'>Explosive : %3</t><br/>
<t color='#807E78' size='1.5' font='PuristaBold'>Hacker : %4</t>
",_isMedic,_isEngineer,_isExplosive,_isHacker];
[_text] remoteExec ["hintSilent", _unit];
Would it be possible for units to be spawned upon certain units entering a trigger? And if so could you make them delayed?
format ["<t color='%1'>Red if false, green if true</t>", ["#ff0000", "#00ff00"] select true];
also important: you can't send structured text over network with remoteExec
Good to know
ty
Is there a way to change how strong a tanks armor is? My players want to use this Mammoth tank on my exile server, but its too strong, pretty much can take 100 AT rockets and its still functional. Is there anyway to make it have less armor so that it isn't indestructible?
https://steamcommunity.com/sharedfiles/filedetails/?id=1341958961&searchtext=%40X66-Mammoth+Tank
You pretty much have to shoot it in the face with a arty 5 times to kill it lol
@tough abyss you can change the armor values in its config
Thanks for the reply, @tough abyss
Do you have an example or walkthrough on this?
When I try to look at things the pbo, it all looks like gibberish
It's probably binarized then
You'll need to unbinarize the config.bin and change the armor values
Now this is a mod, does that need to be defined somehow in the mission.pbo, so it pushes out to players connecting?
You would just need to distribute your edited version of the mod to your clients
Like create my own mod and key
Alternatively if you don't want to basically repack someone else's mod
You could make your own mod that creates a vehicle that inherits from that tank and just overwrite the armor values
Then distribute that mod to your clients and use the new tank
ok, so as a first step, whats the best way to fix the .bin file
I know I had to do it once in the editor with my mission file
just untick the binary when saving, but not sure how to do that with a tank config
You won't need to if you go with option 2
Which I recommend
I think thats a good idea, making my own mod
But I still can't edit anything if its all gibberish
It's fine because you're not editing directly
Just inheriting from the existing tank class and overriding values
So you can experiment with new armor values and see what you like
Just look at the cfgVehicles documentation
So pretty new to this kind of stuff, is there anything you could suggest that I read or look at for more information?
The cfgVehicles documentation will get you started
Can ask for more specific info in #arma3_config
As this is more of a config area
ok, thank you
Anyone know why this might not work? For the object I have this in its init
_this execVM "filepath";
and this is the file I'm trying to run on a dedicated server
https://pastebin.com/9MbE8c5F
For the most part the file is just a lot of functions that run off each other and at the end it calls the function to start the code
try it with out putting _this.
just use execVM "filepath";
Does anyone know where I can find an overview of all the "advanced hints" https://community.bistudio.com/wiki/Arma_3:_Advanced_Hints_(Field_Manual)
? So that I can call it with BIS_fnc_advHint;
It would save a lot of coffee if I didn't have to manually work my way through the campaign missions to find the one where the game explains how CAS works ๐
hey is there a away to use https://community.bistudio.com/wiki/publicVariableClient from HC to Player?
(because of the clientID)
That wiki page you linked explains everything
Just use setVariable
publicVariable is extinct now
Aye, it explains that they are defined in config files. So, do I really have to comb through every "configFile, campaignConfigFile and missionConfigFile" of the A3 pbos ?
There's no other way to search for them?
And no
Oh, just to clarify: I want to re-use an existing advanced hint of the game.
You just open the config viewer
Namely, the one that explains how to call Close Air Support.
Find it in config viewer then
problem is that the var i wanted to change is not set with setvar, its an not private var like weaponLevel
i used a script and remotexec but soon will get rid of vars like this
I am not extremely experienced with the ConfigViewer. I've used it to find attributes of certain things (eg: does the classname* have hiddenselections?). As I understand it (?), there's no search function. So, I would indeed have to search every config of the campaigns and missions to find my cfgHint, or not?
It's defined in the root of the config. You don't have to search for anything
Just find the name that is closest to what you want
And there are alternatives to vanilla config viewer with search option
Oh, great, there are mods for that? Because, I wouldn't know how the game references a specific cfgHint directly.
Do you have a name of a mod for me, please?
Advanced Developer Tools
Thank you!
@acoustic abyss there's one here. not sure if this is what you want:
configFile >> "CfgHints" >> "Tactics" >> "Supports"
Thank you so much for this. Let me check it out.
That's almost the one. Could be wrong, but thought there was another hint about how to laser designate targets. But I now understand the structure. Appreciate the handholding ๐ถ
you can search for the word "lase"
@acoustic abyss here's an example:
configFile >> "CfgHints" >> "Weapons" >> "Designator"
description = "Laser designator is used for aiming guided missiles, bombs and artillery.%1<t></t>1. Select %3Laser Designator%4 by pressing %16.%1<t></t>2. Use its optics by pressing %17.%1<t></t>3. Zoom using %12<t></t>, %13.%1<t></t>4. Switch view modes with %14.%1<t></t>5. And finally, press %15 to mark the target."
Ok. So I have two BI advanced hints config references and a short one of my own, that explain a new player how to CAS with a laser designator:
i) config reference >> "Supports"
ii) a short line hint "Press "B" to equip your laser designator"
iii) config reference >> "Designator:
I'm stuck on finding an appropriate condition for the second hint. It should activate/trigger once players have completed calling CAS via the radio menu. I couldn't find an appropriate action to reference.. do I need to check what the player has done via User Interface Event Handlers ?
Alright, so I have a plane, and I want it to fly in a (almost) perfectly straight line from point A to point B at a constant velocity. I have already tried waypoints, and the plane always zig zags back and forth a bit and does not travel nearly as perfectly as I need it to. I have tried setting the plane's direction and velocity, and that really doesn't seem to make the plane fly naturally any way I set it. Does anyone know any methods I should try?
pretty sure I and others have answered that many times
yeah a few days I started to try setVectorTransformation but it seems really complicated and not the best way to do what I need
I want to write the script myself and fully understand all of it, and I'd rather work with something I'm familiar with now unless setVectorTransformation is easy enough to figure out, but it doesn't seem so.
if you want a "perfectly straight line" with proper networks sync that's the best way
what do you mean "sync"?
I mean object moving properly and not jittering
ohh
yeah no I see what youre saying
okay
I had trouble figuring out the params last time tho
and I already showed you a premade script
I will look at that again
The problem is I dont know the starting velocity of the object
I put it in a random position and want it to travel in a straight line from there
and that script can do that
I want it to travel at a constant speed the entire time but I dont direction of the vector
you don't need to know it
okay, how do I get it then?
_velo = _dir vectorMultiply _speed;
oh
if you just use that script you don't need anything at all
oh that makes sense
I just didnt know how the vector system worked
yeah that makes sense thanks I'll use that
but wait is _dir in this case vectorDir?
read the script
well
oh vectorFromTo ok
and since it is a uniform flight path, I should just initialize all these variables outside of the EH, right?
interval is just percent of progress
This is what you put, but I'm not exactly sure how it works.
_interval = _speed * diag_deltaTime / _dist;
yeah
I don't know how to get that tho
you get it using math 
yeah
you say "I want the plane to be here at this point in time"
but why is it speed * duration of last frame / distance?
_speed * _duration = how much it should move (displacement)
the reason I've written it like that is because I move the p1
p1 is not constant
oh
it's the current position of the plane
that's not the point
I'm not
not really lol
the way I've written it allows you to change destination
yeah
it's harder
not easier
you think it's easier
oh really
well otherwise you'd have to subtract the previous frames
or something like that
this is the easier way (p1 and p2 constant):
_interval = (time - startTime) / duration;
yeah
so i guess I might as well do that
but if this is multiplayer, wouldnt time be weird? gotta check that
it runs locally 
but that's another reason why I don't use time
time is a float
as it grows bigger, accuracy drops
yeah
you can instead create your own timer
so if I initialize the object's position inside the EH then I won't need to use time tho, right?
but again it accumulates errors as you increment it
yeah I don't wanna have to worry about that
you can't "initialize" position inside the EH
you set it outside the EH
This is what I mean```sqf
addMissionEventHandler["EachFrame", {
{
_obj = _x;
_p1 = getPosWorld _obj;
so it gets re-initialized on each frame
if you want to use this yes
if this or your own timer no
it's no longer affected by the loop
so the event handler will stop being fired?
no. only the object is removed from the loop
ohh
at least in my code
if you only have 1 plane and only want to do it once just use a global variable and ditch the forEach
and remove the EH once done
use this as the termination condition (that one's incorrect because it doesn't take into account the FPS and speed):
_dir = _p1 vectorFromTo _p2;
_velo = _dir vectorMultiply _speed;
if ((_p2 vectorDiff (_p1 vectorAdd (_velo vectorMultiply diag_deltaTime * accTime))) vectorCos _dir <= 0) then {
movingObjs = movingObjs - [_x];
continue;
};
yeah thats what im doing
is that checking whether or not the plane is still between the two positions?
although come to think of it it's better to use a constant dir vector
what if you just took the plane dir and the plane pos and checked if the coords of the ending position were behind the plane or not
_p2 = _obj getVariable ["destination", _p1];
if (_p2 isNotEqualTo (_obj getVariable ["lastDestination", _p1]) then {
_obj setVariable ["lastDestination", _p2];
_obj setVariable ["targetDir", _p1 vectorFromTo _p2];
};
if (_dir vectorCos (_obj getVariable ["targetDir", _dir]) <= 0) then { //terminate
}
that's what it does
but the point is that the p1 is moving
ok
there's no "front" or "behind" here
well, p2 is set and p1 is where the plane is which is either past or not past p2
how do you define "past"?
the plane is facing away or towards
it's always facing towards
what if it goes past the point and begins moving away from it?
just use this and stop asking questions
ok lmao
it does what you're asking
yeah
you said you want it to go from point a to point b
not from point a past point b
and even if you do want that why not just put a point past point b and use that as point b
okay so if it wont ever go past point B, what will happen when it gets there?
I haven't read through leopard's script so I'm not sure
though I'd assume the code keeping the plane straight probably stops
just with setVelocityTransformation in general
so pretty much what I just said then
ok
setVelocityTransformation simply sets where the object would be based on your interval
if interval is between 0 and 1 it interpolates
yeah
outside that range it extrapolates
ohhhh
interpolate is the opposite of extrapolate
now it all makes sense to me
but im getting Type any, expected array here:
plane setVelocityTransformation [
getPosWorld plane,
is plane defined?
its the object variable name
what about the rest?
//START FLIGHT
addMissionEventHandler ["EachFrame", {
_thisArgs params ["_planeStartPos", "_planeDir", "_planeEndPos"];
_vectorDir = _planeStartPos vectorFromTo _planeEndPos;
_velocity = _vectorDir vectorMultiply 150;
_distance = getPosWorld plane vectorDistance _planeEndPos;
plane setVelocityTransformation [
getPosWorld plane,
_planeEndPos,
_velocity,
_velocity,
_vectorDir,
_vectorDir,
[0,0,0],
[0,0,0],
150 * diag_deltaTime / _distance
];
}, _this];
those vars are not defined inside the EH
also this code never ends
I could just set a timer to destroy the object then
just use vectorCos
your destination and start are fixed in your code
it's a lot easier
yea
_pos = getPosWorld plane;
if (_vectorDir vectorCos (_pos vectorFromTo _planeEndPos) <= 0) exitWith {
removeMissionEventHandler ["EachFrame", _thisEventhandler];
}
what about this tho
if (plane inPolygon [_planeStartPos, _planeEndPos]) exitWith {
removeMissionEventHandler ["EachFrame", _thisEH];
};
yours is probably better, just curious
first of all [_planeStartPos, _planeEndPos] is not a polygon
a polygon needs at least three points
second of all, that would still be subject to the same error as checking the distance
because it would be technically in the polygon?
ok
if you really want to know why I can explain
no it's actually very simple
let's say your plane was going at 500 m/s and you're running the game at 100FPS, and let's say you set the termination condition to _dist < 1
diag_deltaTime is 1/100 = 0.01s
now let's say the plane is within 3 m of the end pos
if you move the plane again, it will move by 500 * 0.01 = 5 m
so it'll move past the end pos
in the next frame it's now 2m away from the end pos, so it moves in the opposite direction and again ends up at 3m from the end pos
this movement will never end. it just keeps going forward and backward
if you simply check the distance or polygon or area or something it'll be wrong, because its accuracy will depend on FPS and velocity
the correct way is checking direction
ok
yeah that does make sense i guess
okay its basically working perfectly now which is awesome
the only thing is that I did the vectorUp wrong and I'm not sure how I should do it
I did [0,0,0]
If I want the plane to fly completely level, what do I do?
[0,0,1]
up should point up 
oh
yeah makes sense lol
okay I changed that and it's still going up
I think it might be something to do with the vectors
what do you mean going up?
the direction in which it moves?
if so the problems are your start and end position
its going forward as well. but its also gaining altitude very quickly
here's whole script:
//GET RANDOM PATHZONE POSITION AND DIRECTION
_pathZonePos = [["centerZone"], ["water"]] call BIS_fnc_randomPos;
_pathZoneDir = random 360;
//SET PATHZONE POSITION AND DIRECTION
"pathZone" setMarkerPos _pathZonePos;
"pathZone" setMarkerDir _pathZoneDir;
//SPLIT PATHZONE POSITION ARRAY AND INITIALIZE PLANE DIRECTION
_pathZonePos params ["_posX", "_posY"];
_positive = selectRandom [true, false];
//CALCULATE PLANE STARTING POSITION
_sideA = 15000 * cos _pathZoneDir;
_sideB = 15000 * sin _pathZoneDir;
_planeStartPos = if (_positive) then {
[_posX + _sideB, _posY + _sideA, 1500]
} else {
[_posX - _sideB, _posY - _sideA, 1500]
};
//GET PLANE STARTING DIRECTION
_planeDir = if (_positive) then {
_pathZoneDir + 180
} else {
_pathZoneDir
};
//CALCULATE PLANE END POSITION
_sideA = 15000 * cos _pathZoneDir;
_sideB = 15000 * sin _pathZoneDir;
_planeEndPos = if (_positive) then {
[_posX - _sideB, _posY - _sideA, 1500]
} else {
[_posX + _sideB, _posY + _sideA, 1500]
};
//RETURN PLANE STARTING POSITION, DIRECTION, AND WAYPOINT POSITIONS
[_planeStartPos, _planeDir, _planeEndPos]
but basically the _endPos should have an altitude of 1500
nvm
you must place the plane at the start position
I do
//DEFINE VARIABLES
params ["_planeStartPos", "_planeDir", "_planeEndPos"];
//PUT PLANE INTO POSITION
plane setPos _planeStartPos;
plane setDir _planeDir;
//START FLIGHT
addMissionEventHandler ["EachFrame", {
_thisArgs params ["_planeStartPos", "_planeDir", "_planeEndPos"];
if (_vectorDir vectorCos (getPosWorld plane vectorFromTo _planeEndPos) <= 0) exitWith {
removeMissionEventHandler ["EachFrame", _thisEventHandler];
};
_vectorDir = _planeStartPos vectorFromTo _planeEndPos;
_velocity = _vectorDir vectorMultiply 150;
_distance = getPosWorld plane vectorDistance _planeEndPos;
plane setVelocityTransformation [
getPosWorld plane,
_planeEndPos,
_velocity,
_velocity,
_vectorDir,
_vectorDir,
[0,0,1],
[0,0,1],
150 * diag_deltaTime / _distance
];
}, _this];
you're joking right?
uhh
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
world
ok
okay well that wasnt the problem because it's still going up
I think its gotta be the vectors
this code doesn't even work
what are you talking about?
it must be the AI
_vectorDir vectorCos (getPosWorld plane vectorFromTo _planeEndPos) <= 0
_vectorDir is not defined
well that code doesnt work but I was gonna worry about that later
oh
need to re-arrange it
but yeah thats not the problem either i dont think
it seems to be flying up at the same rate it is flying forward
if your positions are correct there's no reason for it to fly up
my positions have gotta be corrrect tho
also where are you running that code?
init.sqf:
//INITIALIZE PATH ZONE
_flightArray = call TRI_fnc_pathZone;
//START FLIGHT
_flightArray call TRI_fnc_startFlight;
did you just restart the mission?
oh
well
I'm pretty sure I did a couple times
but I've mostly just been restarting
yeah, still not working
put a systemChat in your code
in the EH?
systemChat format ["%1 | %2 | %3", _planeStartPos#2, getPosWorld plane#2, _planeEndPos#2];
yes
why's your plane at 7000 m? 
is that at the start?
try this instead:
//DEFINE VARIABLES
params ["_planeStartPos", "_planeDir", "_planeEndPos"];
//PUT PLANE INTO POSITION
plane setPosASL _planeStartPos;
//START FLIGHT
addMissionEventHandler ["EachFrame", {
_thisArgs params ["_planeStartPos", "_planeDir", "_planeEndPos"];
_vectorDir = _planeStartPos vectorFromTo _planeEndPos;
if (_vectorDir vectorCos (getPosASL plane vectorFromTo _planeEndPos) <= 0) exitWith {
removeMissionEventHandler ["EachFrame", _thisEventHandler];
};
_velocity = _vectorDir vectorMultiply 150;
_distance = getPosASL plane vectorDistance _planeEndPos;
plane setVelocityTransformation [
getPosASL plane,
_planeEndPos,
_velocity,
_velocity,
_vectorDir,
_vectorDir,
[0,0,1],
[0,0,1],
150 * diag_deltaTime / _distance
];
}, _this];
changed the world to ASL
although it's stupid that the game uses ASL and not world 
ASL pos changes depending on object orientation
@tidal ferry btw that must've been why you had that problem 
yeah
makes sense
thanks for helping me tonight
finally got this damn plane to fly straight smh
np
Vectors make me want to die
I've got a question. I'm working on various scripts for public zeus custom compositions, and I'm having a hard time understanding locality of init. Other sources on google suggest that any scripts in the init of an object are run on every client, including JIP clients. This means that if you use a remoteExec on, say, an addAction, then every new client that joins will run that init and create another copy of that added action on the attached object. However, I've used a remoteExec to make add an action and did not experience any action duplication when new player join. Am I misunderstanding something? Is the init of objects placed by zeus somehow different?
Other sources on google suggest that any scripts in the init of an object are run on every client
yes
I've used a remoteExec to make add an action and did not experience any action duplication when new player join
makes no sense
sometimes when i set variables and inspect them later, the value of the variable shows up as any or string instead of any actual value like 1 or "foo"
i cant pinpoint when this happens
does someone know the reason?
hard to guess without looking at the code
you probably assign it to something where you shouldn't
or maybe you don't use tags and another script modifies your variable
actually I think the init of a Zeus placed object only runs once
On the client of the zeus?
yep
you can test it tho
but it'd make no sense to run it anywhere else
the object that Zeus creates is local to that Zeus client, so it makes sense that it also runs the init script locally
Alright, I suspect that's the case as it would explain why the code I have is working (and why the tutorials I was basing my code on used this code). Thanks for the quick answer!
i was doing ```sqf
call { if (...) then { _foo = 1 } else { _foo = 2 }; _value = 1 + _foo; _value }
i had to declare _foo somewhere before the if
are you asking why you had to?
no i am just reporting why
just if someone else was wondering why
i dont know if that was very useful since it will quickly be drowned under new messages
but i did it anyway
how do i collect each config in CfgVehicles where VehicleClass == given?
Hi. I don't know since which update, but from some time now, when I have cba_a3 + zen loaded, open unit init and put this code inside:
this setVariable ["yethe_variable1", true, true];```
Nothing happens. It used to be working just fine couple of months ago. Right now, only solution I have is to assing a variable name to the unit via Zeus module and then launching this code via console:
```sqf
unitVarName setVariable ["yethe_variable1", true, true];```
Which is not ideal. I don't know why the old way is not working currently. How should I change the code so I can execute it properly inside the unit init field?
Zeus. Sorry I didn't clarify it at the beginning.
i believe in zen you have to use _this instead of this when referring to the unit in the init field
When I do this in editor, it is working just fine. But when I spawn something in Zeus and I would want to use the same thing, it does not work for some reason.
Okay, will try it
configClasses
It works. Thank you very much.
@upper siren the part about that starts roughly there.
ok, I can see how that is confusing if you don't know what they mean
so in really simplified way:
if you're hosting locally or in SP the only place where scripts get executed is on the server (which is you because its localhost/SP):
Once you move to dedicated that doesn't hold true anymore, the server and you are to separate instances, so e.g. something you put in initServer.sqf will run on the dedicated server and not on you.
BUT if you localhost initServer.sqf will run on you, the player, because you're ALSO the server.
in short, try calling your script from initplayerlocal.sqf and see if that works
meaning, instead of doing whatever you're doing in init.sqf just rename the file to initplayerlocal.sqf (the file should be in your mission)
If anyone reading this sees something wrong with this do tell ๐
initServer.sqf* ๐
so THATS why my scripts never work!
can someone help, im trying to start a mission off with a breifing but i cant do that, i have a breif but the player has to open breifing in the map. is there a way to start the situation with a breifing
if you could join general voice to help that would be nice
I think that actually worked, many thanks. Now it's time to put it to test in action ๐
๐ I can recommend generous usage of diag_log to check if stuff is actually running and where (and debug console)
Will definetely look into that next time I write some stuff
Is there a way to get the weapon that a given magazine uses?
I'm putting together a script that will allow players to set pylon weapons in public zeus. So far it has worked, but the issue I've run into is that when all pylons of a weapon type has been removed (by being replaced with setPylonLoadout), that weapon is still on the weapon list, just with no ammo. Supposedly this can be fixed by running removeWeaponGlobal, but that function requires a weapon name. The only function I know to check what is on a pylon is getAllPylonsInfo, which only gives you the magazines on each pylon, hence my original question.
Edit: Found the solution, I can read what weapon uses a given magazine from that magazine's config file using the >> operator.
Hey I noticed that I cant spawn the Land_Carrier_01_base_F or Land_Destroyer_01_base_F with createVehicleLocal or createSimpleObject only with createVehicle
Is there any explanation for that?
Ok Iโm stumped. Iโm trying to stop the characters from having asthma attacks from walking 2 feet.
{
player enableFatigue false;
};```
`player enableFatigue false;`
Neither works. Any solution?
maybe try player enableStamina false; and player enableFatigue false;
also if you do respawn this has to be set again, execute this one time and you should be good player addEventHandler ["Respawn", { player enableFatigue false; player enableStamina false; }];
https://forums.bohemia.net/forums/topic/186336-how-to-remove-154-fatigue-stamina-weight/
Any particular place to put it or just make a new sqf
https://community.bistudio.com/wiki/Initialization_Order
i would use the initPlayerLocal.sqf
Please not without sleep
Does anyone know why
missionNamespace setVariable ["BIS_fnc_garage_data", _temp];
is not actually changing the contents of BIS_fnc_garage_data? Both BIS_fnc_garage_data and _temp are arrays of the same dimension/structure, _temp is defined earlier in my code and I confirmed it is taking the correct value.
Is BIS_fnc_garage_data an existing BIS function or custom?
Existing
That'd be why
It's not defined in missionNameSpace then
Hence why your code isn't overwriting it
why is it an array if it's called BIS_fnc_something
According to the wiki, BIS_fnc_garage_data should be defined in the missionNamespace:
https://community.bistudio.com/wiki/BIS_fnc_garage
Am I misunderstanding something?
that's BI's way of declaring global variables. BIS_fnc_garage_data is defined and used in BIS_fnc_garage
oh okay, so the naming convention is just dumb
no it makes sense. if the variable is only used in that function
Yeah that's a dumb name
why have fnc if not for the hungarian notation
it's to make absolutely sure that there is no other variable with that name, given that arma has several hundred functions
You don't name a variable with function naming convention just because a function uses it
It's bad and unnecessary
Why not BIS_var_garage_data
imagine if bohemia had invented static typing
well sqf kinda has readonly variables, only i thought the user couldn't create any except for code via compileFinal
That was my understanding
iirc there are some cases where the engine creates readonly variables with values of other types
@pallid ravine since it's a global var it might be worth trying direct assignment with =
setVariable might be encountering issues for some reason
I figured it out. It seems like calling BIS_fnc_garage overwrites BIS_fnc_garage_data for some reason. I'll investigate some more and see if there's a way around that.
If all else fails you could make a wrapper function that calls both of them to restore its initial state
Though I imagine there's a better way
as always, I assume I'm missing something... but _speaker say3D _sound; is returning "Sound RadioAmbient4 not found" _speaker is an object, _sound is "RadioAmbient4" which is the class name so I'm not sure what the issue is.
using playSound "RadioAmbient4"; from the debug console results in "NOID <no shape>"
Seems like it doesn't like _speaker then
As the return value of both commands is supposed to be the object used
As for why it can't find the sound
playSound has nothing to do with the object though when fired from the debug menu
You have it properly set up in CfgSound?
I mean, that's the entirety of the command playSound "RadioAmbient4";
it's a vanilla sound
Ah
but does it play the sound
No... that's the problem
so it might not be defined in CfgSounds but in another subclass
if you know the file path you can define it yourself with @ prefix in your own description.ext
ugh disregard
I knew I was screwing up something stupid... it's Music
alright... forget I was here!
*spanks*
Usually something simple like that
nice havin' you here! ๐ anytime ^^
lol
Debugging is 99% self dread anyways
hmm, whyโฆ whyโฆ WHY?!!
oh! that's why.
hm, who is the idjit thatโฆ nevermind that was me
how can it not work in such edge case? oh, fixedโฆ wait, how could it work before??
Oh god that's the worst
I don't know how it works, and I don't like that because now I have no clue what will break it
Lol always
there a function for averaging an array of numbers?
BIS_fnc_arithmeticMean yes
be sure to check that the array is not empty, otherwise it will throw a division by zero error
Is there a movetime equivalent for gestures?
nope afaik
can't do shit with gestures
there's no way to make use of the gesture animation graph from sqf, even in A3 is there?
If I do this:sqf for _i from 0 to 10 do { "Land_PlasticCase_01_large_black_F" createVehicle call BIS_fnc_randomPos; "WeaponHolderSimulated" createVehicle call BIS_fnc_randomPos; }; And then later....```sqf
{
deleteVehicle _x;
} forEach allMissionObjects "Land_PlasticCase_01_large_black_F";
{
deleteVehicle _x;
} forEach allMissionObjects "WeaponHolderSimulated";
I'm just a bit confused about whether or not they would be in `allMissionObjects` and if their classnames will work the `type`.
Its generally really bad to use AllMissionObjects like that. As you create the vehicles, store them in a variable, then forEach through that variable
ok
thanks
Eh using it isn't so bad so long as you're not using it regularly and the script doesn't need to be fast
Ideally you'd be doing some sort of caching though
My gosh if it's not one thing it's another... I've seen a million different solutions for this but why the heck are my helicopters ignoring the land waypoints? They're set to carless and the waypoints are placed directly on invisible helipads. They move close to them then just hover
why am I getting Undefined variable in expression: _i here?
for _i from 1 to 3 do {
pilot action ["VectoringDown", plane];
};
"_i"... put it in quotes
Lol pretty sure I just said that same thing earlier
lol
I'm trying to write a script that will spawn weapons and supplies inside buildings on the floor and in crates. I'm checking buildings and not getting anything. Does anyone see what might be the problem with my code?
//INITIALIZE VARIABLES
_buildingArray = nearestObjects [[15000,15000,0], ["house"], 20000, true] inAreaArray "pathZone";
_containerArray = [
"Land_PlasticCase_01_large_black_F", 1,
"WeaponHolderSimulated", 7
];
_groundWeaponArray = [
[["arifle_Katiba_F", "30Rnd_65x39_caseless_green"],1,["arifle_Katiba_ACO_F", "30Rnd_65x39_caseless_green"],1,["arifle_Katiba_ARCO_F", "30Rnd_65x39_caseless_green"],1],1
];
_groundItemArray = [
"FirstAidKit",1
];
_crateWeaponArray = [
[["arifle_Katiba_F", "30Rnd_65x39_caseless_green"],1,["arifle_Katiba_ACO_F", "30Rnd_65x39_caseless_green"],1,["arifle_Katiba_ARCO_F", "30Rnd_65x39_caseless_green"],1],1
];
_crateItemArray = [
"FirstAidKit",1
];
_crateArray = [];
_groundArray = [];
//CREATE LOOT CONTAINERS
{
if (_x buildingPos -1 isEqualTo []) then {
continue;
};
if (random 10 > 5) then {
continue;
};
_lootPos = selectRandom (_x buildingPos -1);
_lootContainer = selectRandomWeighted _containerArray;
_lootContainer createVehicle _lootPos;
if (_lootContainer == "Land_PlasticCase_01_large_black_F") then {
_crateArray pushBack _lootContainer;
} else {
_groundArray pushBack _lootContainer;
};
if random 10 > 5 then {
_lootPos = selectRandom ((_x buildingPos -1) - [_lootPos]);
_lootContainer = selectRandomWeighted _containerArray;
_lootContainer createVehicle _lootPos;
if (_lootContainer == "Land_PlasticCase_01_large_black_F") then {
_crateArray pushBack _lootContainer;
} else {
_groundArray pushBack _lootContainer;
};
};
} forEach _buildingArray;
//SPAWN CRATE LOOT
{
_gunAndMag = selectRandomWeighted (selectRandomWeighted (_crateWeaponArray));
_gunAndMag params ["_gun", "_mag"];
_x addWeaponCargoGlobal [_gun, 1];
_x addMagazineCargoGlobal [_mag, 4 + (round random 3)];
for "_i" from 1 to 2 do {
_item = selectRandomWeighted _crateItemArray;
_x addItemCargoGlobal [_item, 1];
} forEach _crateArray;
//SPAWN GROUND LOOT
{
if random 10 > 5 then {
_gunAndMag = selectRandomWeighted (selectRandomWeighted (_groundWeaponArray));
_gunAndMag params ["_gun", "_mag"];
_x addWeaponCargoGlobal [_gun, 1];
_x addMagazineCargoGlobal [_mag, 2 + (round random 3)];
} else {
_item = selectRandomWeighted _groundItemArray;
_x addItemCargoGlobal [_item, 1];
};
} forEach _groundArray;
this is how I do mine. maybe it can help you with yours
hello! I'm trying to understand to some scripts and i just need a little push. ```sqf
[lod1, true] remoteExec ["hideObjectGlobal", 2];
[i did read the pinned message in this channel]
It's explained on the wiki iirc
2 means server
i did also read the wiki but i guess i missed that, thank you ๐ so with 2 the script gets executed on the server
Yes
ok great, thanks
Anyone have a suggestion on how to find a route between 2 points?
like, that follows roads I mean
there is calculatePath, see the wiki ๐
cool, didn't know what to search for
thanks!
this makes this idea I have much easier
is there a way to make a dead unit ragdoll straight out of an animation? right now he's flipping around and lying flat for a split second before ragdolling
interesting
when i do
injuredSoldier setDamage 1
it flips him around and ruins it but when I do
[]spawn {
while {true} do {
if (!alive injuredSoldier) then {terminate _thisScript} else {
injuredSoldier setDamage ((damage injuredSoldier) +.05); sleep 1;}
};
}```
then he just ragdolls??
nevermind
it's seemingly random which italian cuisine arma serves up
you have so many errors
unbalanced {}, incorrect ifs, etc.
well that's embarrassing
indent ๐
update fixed this by forcing another animation on a death event handler
ohhh
I forgot the ()'s in the if.
that's wrong
for future reference, if is a unary command


