#arma3_scripting
1 messages Β· Page 689 of 1
cant coz i want to keep its rotors spinning
kill the pilot
tried but it made rotors spin wierdly

still take off
β¦code plz?
land makes it land but not after taking off first :/
attachTo with a Logic. Should do
"all", not all
i even tried disabling simulation to pilot but the chopper still flies away o.0
ight wait
still
yes mate for land vehicles you can easily just disableAI path or move the driver and they not move
but aircraft seems to have different AI system
attachTo with a Logic. Should do
dis
That's what I've done for screenshot purpose :)
ooh sweet
ok it works but it kinda does the split second rotation thing lol
the moment it attaches
like it rotates 180 degrees when the code kicks in and then goes back to normal
any way to fix?
weird, as disableAI works for me.
Hi confused, I'm ded
ok it seems like the reason it took off even though AI features were disabled was because i put a transport unload waypoint to disembark the troops inside, when i removed this waypoint, the chopper stayed where the unitplay ended
looks like i'll just have to manually script the disembark
I still think something else is wrong :\
ok nvm the chopper actually took off again even though without the waypoint :/
do you want me to send you the test mission?
ah well, why not
ok let me zip it

Hey, I have been trying to add the M2 Flamethrower (from the Burn Em mod ) to the RHS M1A2 Abrams TUSK II under control of the gunner using scripts, specifically the addWeaponTurret script. But no matter what I try, i cant seem to get it to work. To be fair I am brand new to scripting, as in this is my first attempt.Can anyone help me?
I've done it, saying its not easy. that functionality is not built into Arsenal, so you have to create scripts to plug/hack into Arsenal
because you also have to monitor the players gear to ensure that they are only carrying whitelisted equipment
here's an example script
so if you do your own script for it, you first have to read thru and understand the vanilla arsenal function
@still forum can we get initFunctions.sqf optimized pls?
its still executing this, every time a player connects
[[[player,didJIP],"initPlayerServer.sqf"],"bis_fnc_execvm",false,false] call bis_fnc_mp;
i want a description.ext option to ignore that line
initplayerserver = 0;
[] execvm "initServer.sqf";
"initServer.sqf" call bis_fnc_logFormat;
};
//--- Run mission scripts
if !(isDedicated) then {
[player,didJIP] execvm "initPlayerLocal.sqf";
[[[player,didJIP],"initPlayerServer.sqf"],"bis_fnc_execvm",false,false] call bis_fnc_mp;
"initPlayerLocal.sqf" call bis_fnc_logFormat;
"initPlayerServer.sqf" call bis_fnc_logFormat;
};```
and why is that bad?
Kinda funny that someone added didJIP but did not replace BIS_fnc_MP with remoteExec π
What are you talking about π
Anyone able to help me out with this one.
_this, if allPlayers > 12 setVehicleLock "UNLOCKED" then [this, ["GreenHornets"]] call vn_mf_fnc_lock_vehicle_to_teams;
So what I'm trying to do is - keep the vehicle locked - until the player count reaches 12, and if it is 12 or above run the regular mf_fnc_lock_vehicle_to_teams check.
Where to start to point it out, actually? π€
@still forum i want a description.ext config option to not have that network call each time a client connects
Read the syntax
I don't know which article/guide you read to write that script, forget about it
if i dont use initPlayerServer then i dont want bis_fnc_mp or remoteExec, also ugly to see bis_fnc_mp in official bis functions/scripts π
@cosmic lichen IIRC didJIP pre-dated remoteExec
so:
- lock the vehicle
- wait until there are 12 players
- unlock the vehicle
Cheers - appreciate the link.
Yes, correct.
Looking into the link Henry provided now - what I posted was me just shooting from the hip - and seeing what sticks. Now I got some semblance of guidance at least.
Then make a FT ticket
Anyone used the Art of War diorama display to rotate objects before?
what about it?
wondering how other people did it
afaik its just drag&drop in 3den?
how you connect the two tho
attachTo?
@winter rose looking through the spotrep for the june, 9 2021 update, it says that HashMap apply, values commands were added. Is that a single command HashMap apply? because when you click the links on the spot reps, it takes you to the hash map and apply individual pages which we've already had for quite a while.
Reference: https://dev.arma3.com/post/spotrep-00099
β¦no? you can click links?
"Hashmap's apply and values" would be more correcterest
oh... the hashmap aspect of apply is new, not that apply is new in itself
correct π
Is that a single command HashMap apply?
a single command cannot have whitespace in it
yeah it was just my monkey brain going, wait, we already have apply, why was this listed? was there a typo and there shouldn't be whitespace? but just me being a potato
Its apply for hashmap that was added
I was told by a dev that posts here very often that BIS_fnc_MP was indeed updated with remoteExec inside of the fnc....
yes but still overhead so baaaaaad π
"overhead is any combination of excess or indirect computation time, memory, bandwidth, or other resources that are required to perform a specific task"
Please devs just replace bis_fnc_MP with remoteExec
no, for backward compatibility - the 20yo curse of RV
well I thought you asked to remove it
I wasn't talking about removing bis_fnc_MP but just change it inside A3 vanilla scripts
yep
but most likely not going to happen still π
keep it for user made scripts that don't want to update
It won't be hard to do, just kinda time consuming. Basically extract all sqf files, open them all with an editor, search for Bis_fnc_MP in all opened files and replace each one...
"Ctrl+H, easy!" π
π
for only a little gain
it's better to profile & identify big perf hogs, as Ded' did with lights π
I don't want to advertise tickets I made but I keep thinking that the default addactions could be perf hogs too... I wonder how many FPSs we would gain by removing those
d'you have perf samples in those tickets? π
as in "zOMG look, 10 actions = -10 FPS!"
actually, and speaking seriously here, as a community we (well, am I still part of the community now) must provide repro cases to devs so they don't have to hunt and try to get the problematic situation
the community, if it want and can, now should:
- dig the perf leak scenarios
- once found confirm that someone might work on it
- if so provide straight example repro missions
so devs only have to use that plug & play situation in order to:
- repro the issue
- test their fix
that's the fastest way to better A3 perfs aside from dev-side profiling π
How to disable dropping inventory items?
Like how exactly?
Like it deletes the item when its dropped on the ground?
Also, btw, is there a object variable that can be used when its been spawned by a script (like _x, this, or player, stuff like that)?
Well I want them to keep the item
would it be easier to just disable the inventory option completely?
im new so
hi new, I'm dad!
omg π
hi new, I'm dad!
Lou Montana; Monday, 31 May 2021
lol
give me like a second...
kk
do you want them to still pickup stuff?
nope
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
_container removeItem _item;
_unit addItem _item;
}];
I think it SHOULD work.
Not 100% sure.
free magazine refill
for initServer.sqf?
init.sqf
thanks
@fierce solar try reloading, does it allow you to reload
Still?
one second
Or, well, at least, does it remove and then add the Item back into your inventory?
it says its missing a ;
oh
hold one
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
_container removeItem _item;
_unit addItem _item;
}];
There.
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
_container removeItem _item;
_unit addItem _item;
}];
Oh, cool.
IKR??
I can still drop stuff
does it delete it and put it back into your bag.
hmm, i guess the ground doesn't count as a "container"
Hmm, I'll give it a try.
Ah, I see the issue.
removeItem is looking for an object, and the ground probably doesn't constitute as an object
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
clearItemCargoGlobal _container;
clearWeaponCargoGlobal _container;
_unit addItem _item;
}];
@fierce solar found a fix
ah, wait
I mean, so long as they don't drop their main rifle, it should be fine.
Alright let me try
you may addUniform then
yeah
next issue is how to check if the item is a uniform
i mean
i guess
if they have the same uniform, he could just put the same classname
but that seems lazy
config check
it works great, but is there a way to add the same uniform back to wearing it?
if isClass (configFile >> "CfgSomething" >> _itemClass)
or vest/glasses/helmet etc
Answer
:P
may I ask "what for"?
Man, you're quick to the draw
Basically working on a way for players to be able to switch through our mission on our server without having to be an admin
(Or use vote admin)
that's whβ
at she said
I also want to see if I can save variables specific to a certain mission
missionNameSource
Ah sweet, thanks!
How do I get the animation completion of an animation triggered in playMove/playMoveNow/switchMove?
E.g. waitUntil {_animationcompleted}
Where _animationCompleted is a boolean that is true when the current playMove is finished
is EH ok for you?
is there an eventhandler for doing something on mine clearing?
Hey scripting question
I wanna use a sideChat script in a mp environment
Can I use it in a trigger that's set to server and in the on act box
unit1 sideChat "bla...";
Ah no gotta use remoteExec
if I am adding an action to an object from initServer.sqf, and I want all players to be able to use it, would I use remoteExec?
and would that be:
//Default
SpecSign addAction ["Spectate Match", "spectate.sqf", nil, 6, true, true, "", "true", 5, false, "", ""];
//remoteExec
[SpecSign, ["Spectate Match", "spectate.sqf", nil, 6, true, true, "", "true", 5, false, "", ""]] remoteExec ["addAction"];
but I suppose there's no reason to put it in initServer.sqf instead of init.sqf, so im just gonna do that instead
initPlayerLocal would be the most correct
ok
what would be the difference between adding actions in initPlayerLocal.sqf and init.sqf?
ohhhh
would the actions only be available to those who were present when the mission starts?
hello, anyone know of a script for Firing from Vehicle (FFV) for a PO Orca? If such a script dont exist, what command would be making it possible?
does exitwith stop execution of the script?
Q: do you have to doStop all units you create? or just the grp leaders?
it breaks the scope it's executed in
{
if (_x == 3) exitWith {}; //4 and 5 won't run
} forEach [1,2,3,4,5];
//code continues```
It is possible to terminate the script too, though
it will exit the current scope that the script is in, so if it is inside an if statement, it leaves the if statement. if it is inside a while loop, it leaves the loop. if it isnt inside any {}, then it stops the script. It will then execute whatever code you put....
exitWith {HERE};
so i have an if statement that I want to exit the current script that I have the if statement in, how would I do that, im guessing if (condition) exitWith {hint "string"}; wont do that?
thank you
how do I get rid of the UI of the camera module?
cameraEffectEnableHUD false;
showHUD false;
don't seem to have effect on it
Cant see pic
Array method of showHUD. Worth a try
I will try it
showHUD [true,false, true, true, true, true, true,false, true, true] fixed it, thanks
I am trying to script the BPz 2A0 from Global Mobilization to function like the Bobcat where it will rearm, refuel, and repair, everything from tanks, to towed artillery, to helicopters, and jets. I tried a few scripts I found online but none of them are working.
hey so i have a dialog that opens another dialog, what i want to do is close them both from a script that is run when a button on the second dialog is pressed, how would i go about doing that?
if I replace a unit's uniform, backpack, or vest, will it clear everything currently in the inventory of that clothing item, or will the game do its best to fit everything previously in the inventory into the new one?
Replace how?
Well that's easy to test
true
also the wording on all of these commands is kind of unclear... will it actually replace the current respective item equipped?
https://community.bistudio.com/wiki/addUniform
https://community.bistudio.com/wiki/addWeapon
https://community.bistudio.com/wiki/addWeaponItem
Yes
ok
so its never going to try to fit that item into the unit's uniform or backpack?
just wanna make sure, since its pretty important for what im doing
wdym by fit item into uniform or backpack?
if my unit is carrying a Mk-I and then I use addWeapon to give him a PDW, will it try to put that PDW into the unit's backpack if there is enough space?
Well, correction a bit: addWeapon actually adds, not replaces
But to the weapon space (rifle, pistol, launcher) not the item space
yeah
i am removing the unit's current weapon THEN adding the new weapon
shoulda mentioned that
but yeah i think it'll work
I think addItem is to add a weapon to the inventory
_caller = _this select 1;
if ( roleDescription _caller == "Player 1" ) then { _loadoutBot = blueLoadoutBot1 };
if ( roleDescription _caller == "Player 2" ) then { _loadoutBot = blueLoadoutBot2 };
if ( roleDescription _caller == "Player 3" ) then { _loadoutBot = blueLoadoutBot3 };
if ( roleDescription _caller == "Player 4" ) then { _loadoutBot = blueLoadoutBot4 };
if ( roleDescription _caller == "Player 5" ) then { _loadoutBot = redLoadoutBot1 };
if ( roleDescription _caller == "Player 6" ) then { _loadoutBot = redLoadoutBot2 };
if ( roleDescription _caller == "Player 7" ) then { _loadoutBot = redLoadoutBot3 };
if ( roleDescription _caller == "Player 8" ) then { _loadoutBot = redLoadoutBot4 };
_opticsArray = primaryWeaponItems _loadoutBot;
does anyone know why I am getting Undefined Variable: _loadoutBot on line 11 (bottom line)? will those variables not be initialized if they are inside an if statement?
I am playing with unit whose role description is definitely Player 1
it's because _loadoutBot is undefined in that particular scope
also use a hashmap instead of that if stuff
ok thats what i thought
ive never used a hashmap before. what exactly is a hashmap? i will look for it on the wiki
HashMap is a βhey what is the data of the key: joe?β βIt's biden, sirβ type of operator
ok
hashmap is a map.
it maps keys to values efficiently.
"What value is associated with key X"
its very fast at looking up keys
is it super complicated compared to what I was doing?
In this case it would be like: sqf _map = createHashMapFromArray [ ["joe","biden"], ["suga","yoshihide"], ["angela","merkel"] ]; _map get "joe"; //returns "biden" _map get "angela"; //returns "merkel"
_map get "emmanuel"; // returns "slapon"
_caller = _this select 1;
_map = createHashMapFromArray [
["Player 1", blueLoadoutBot1],
["Player 2", blueLoadoutBot2],
["Player 3", blueLoadoutBot3],
["Player 4", blueLoadoutBot4],
["Player 5", redLoadoutBot1],
["Player 6", redLoadoutBot2],
["Player 7", redLoadoutBot3],
["Player 8", redLoadoutBot4],
];
// lookup which value is associated with the key being the roleDescription, return objNull if none found
_loadoutBot = _map getOrDefault [roleDescription _caller, objNull];
_opticsArray = primaryWeaponItems _loadoutBot;
But in your case the hashmap is constant, recreating it everytime your script is called is inefficient. But you could store it in a global variable
ok thanks guys
i will read up on the wiki about it as well
gotta head out for the night now
Is there any way to list what memory points a vehicle has, for use with attachTo? In searching I've found a couple of lists of commonly-used mempoint names, but the ones I thought were the ones I wanted don't seem to be located where you would expect on the vehicle in question.
*I just found the one I was looking for in this case, but it would still be cool to know if there's a way to generate a list for a given vehicle
Hey, I have a weird issue with animations and scripting. My script somehow manages to break the player's stance animation, causing them to bend over and being stuck like that until death. Anyone have a clue on what could be causing it, or how to prevent it.?
for "_i" from 1 to _sets do
{
player playMove "AmovPercMstpSnonWnonDnon_exercisePushup";
sleep 15;
};
It doesn't break it always so I don't know how to replicate the issue every time
@quaint ivy you have to clear the move after its done. so switchmove ""; should reset them back to normal.
@exotic tinsel they return to normal. My problem is that sometimes the normal animation gets broken
and switchMove doesnt help in that scenario
I need to get a screenshot of the actual issue
when it happened in the past did you try switchmove ""; ? That always resets the players animations for me for all animation bugs. A picture would help.
Yup, i tried to fix it like that. Its the regular animation that's broken. I just got the bug replicated so im taking screenshots right now
Okay, here's a link to an imgur post with the pictures of the bug https://imgur.com/a/FhyaW25
In the pictures, I am not using free look. In the 2nd picture you can even see that I'm walking forward while the character's torso is pointing down and to the side.
I think I know what causes it. I think giving movement inputs while the animation is playing is causing the normal stance to break
closeDialog/closeDisplay
do anyone has a script that I can play a video (w/ sound) in a in-game monitor?
Im using a hashmap now, but im still getting undefined variable on the bottom line for _loadoutBot. Did I do it wrong? Do I need to use getOrDefault?
_caller = _this select 1;
_personalLoadoutBots = createHashmapFromArray [
["Player 1", BlueLoadoutBot1],
["Player 2", BlueLoadoutBot2],
["Player 3", BlueLoadoutBot3],
["Player 4", BlueLoadoutBot4],
["Player 5", RedLoadoutBot1],
["Player 6", RedLoadoutBot2],
["Player 7", RedLoadoutBot3],
["Player 8", RedLoadoutBot4]
];
_loadoutBot = _personalLoadoutBots get roleDescription _caller;
_opticsArray = primaryWeaponItems _loadoutBot;
uh oh
Thats not the script I sent you as example
Leopard20 did the
emoji
my example used getOrDefault for a reason ^^
it's looking for [roleDescription _caller]
ok
it's looking for [roleDescription _caller]
which is wrong, you don't have any arrays in your hashmap
just do what dedmen said
No you don't...
oh
You want to lookup by roleDescription, what do you need arrays for?
if you want to look up the roleDescription you just need them
so I store roleDescription _caller to a variable first?
@past wagon in other words:
_loadoutBot = _personalLoadoutBots get roleDescription _caller;
but the problem is, if it's not in the hashmap the var won't be defined
so use getOrDefault like Dedmen said:
_loadoutBot = _personalLoadoutBots getOrDefault [roleDescription _caller, _defaultLoadout];
not by an array containing one roleDescription
oh
so just get rid of the []
yeah but the way the game and scripts are set up it would be pointless to have a default
there are only 8 players in the game, each has a personal loadout bot
its complicated but i have no need for a default
make loadout arrays 
you don't need "bots" for loadouts
because if it was ever the case that there was someone in my mission without one of those role descriptions, I would want to know
yeah i know
but for what im doing im pretty sure this is the easiest way
or grab the loadout from config
you don't need any useless units in the mission. that just slows down the game.
if you want an "easy way", at least delete the unit:
BlueLoadout1 = getUnitLoadout BlueLoadoutBot1;
deleteVehicle BlueLoadoutBot1
if you use the default loadouts, do what Lou said
yeah but I need to be able to change different elements of the loadout, and having a bot that the player get's their loadout set to is the most effective
yeah but this isnt a normal mission
because when a match starts, the players get TP'ed to the AO and their loadouts get set to whatever they chose in the lobby (which gets stored to the loadout bots)
// GET SCOPE NAME
_scopeNamesMap = createHashmapFromArray [
[["optic_Arco_blk_F"], "ARCO Scope"],
[["optic_Hamr"], "RCO Scope"],
[["optic_ERCO_blk_F"], "ERCO Scope"],
[["optic_MRCO"], "MRCO Scope"]
];
_scopeName = _scopeNamesMap get primaryWeaponItems _loadoutBot;
// MESSAGE
["Your Current Loadout: " + _weaponName + _scopeName] remoteExec ["hint", _caller, false];
How is _scopeName undefined on the bottom line?
Key not found in your map
and _loadoutBot only has a scope on his gun
wrong way to do it anyway
did you try to just add logging to see whats going on?
arrays as keysβ¦
no
if I use primaryWeaponItems and there is only one item, wouldnt it return an array?
it does
then what did I do wrong in the hashmap? can hashmaps not take arrays?
arrays as key = not referencing the same array
so it works with isEqualTo, not by ref?
They can.
Add logging and check what you're actually doing
yes ofc
Array keys are copied on insertion anyway so that you cannot have any references to them

you want me to log what I get from the hashmap or from primaryWeaponItems _loadoutBot?
kk
oooooooo
that makes sense
["", "", "" ,""]
so this is what I want
// GET SCOPE NAME
_scopeNamesMap = createHashmapFromArray [
[["","","optic_Arco_blk_F",""], "ARCO Scope"],
[["","","optic_Hamr",""], "RCO Scope"],
[["","","optic_ERCO_blk_F",""], "ERCO Scope"],
[["","","optic_MRCO",""], "MRCO Scope"]
];
_scopeName = _scopeNamesMap get primaryWeaponItems _loadoutBot;
// MESSAGE
["Your Current Loadout: " + _weaponName + _scopeName] remoteExec ["hint", _caller, false];
If someone wouldnt mind helping me, Im trying to make a hint popup when you enter an area and that seems to work however
i've noticed it triggers the deactivation if you get into a vehicle while still in the area
this is the current trigger
condition
player in thislist```
On activation
```sqf
hint "You are now entering a restricted zone.";```
On Deactivation
```sqf
hint "You are now leaving a restricted zone.";```
condition
player in thislist
vehicle player in thislist
thanks
Look at this man shamelessly wasting our vertical space 
how can I use setVectorDir to change an object's pitch and roll?
you need setVectorDirAndUp
setVectorDirAndUp
[0,0,1]
ok
its top faces the sky π
does someone know a good alternative for isTouchingGround, to check an objects height?
getPosATL
position with height above terrain
or getPosASL for height above sealevel
so for example
if ((getPosASL _objectOne) select 1<2) then{
code;
}
I guess.
I don't know where your _objectOne comes from, but if your object is in there thats correct
if you mean it's closer than 2 meters to the ground:
ASLtoAGL getPosASL _objectOne select 2 < 2
like that?
if ((ASLtoAGL getPosASL getPosASL _createChest) select 2<2) then {
you have 2
just what I said:
if (ASLtoAGL getPosASL _createChest select 2 < 2) then {
}
if you want the version with parentheses:
if ((ASLtoAGL (getPosASL _createChest)) select 2 < 2)
what's the difference between those 2 versions?
nothing. the parentheses are for better readability
Oh, okay
So it's not dropping an error, but also probably not detecting the correct height. Landed on a flat airport tho
are you using a loop?
is there a good way to clear the chat for a player?
// declare variable
_parachute = "B_Parachute_02_F";
//creates the chest
_createChest = "B_supplyCrate_F" createVehicle [0,0,0];
_createChest setPosATL (getPos player vectorAdd [10,0,120]);
//creates and attaches the parachute
_resupplyPos = getpos _createChest;
_parachuteCreate = createVehicle [_parachute, _resupplyPos, [], 0, "NONE"];
_createChest attachTo [_parachuteCreate, [0, 0, 1]];
//removes the parachute when the crate touches the ground and adds a marker to the chests position
// currently not working due to dedicated server problems
if (ASLtoAGL getPosASL _createChest select 50<50) then {
hint "if worked";
detach _parachute;
_markerChest = createMarker ["Nachschubskiste", position _createChest, 1];
}:```
that's the whole code, no loop
you need a loop
it just runs once
so it never sees the object reaching the ground
ah okay
@fervent kettle in other words:
// declare variable
_parachute = "B_Parachute_02_F";
//creates the chest
_createChest = "B_supplyCrate_F" createVehicle [0,0,0];
_createChest setPosATL (getPos player vectorAdd [10,0,120]);
//creates and attaches the parachute
_resupplyPos = getpos _createChest;
_parachuteCreate = createVehicle [_parachute, _resupplyPos, [], 0, "NONE"];
_createChest attachTo [_parachuteCreate, [0, 0, 1]];
//removes the parachute when the crate touches the ground and adds a marker to the chests position
// currently not working due to dedicated server problems
waitUntil {ASLtoAGL getPosASL _createChest select 50<50};
hint "if worked";
detach _parachute;
_markerChest = createMarker ["Nachschubskiste", position _createChest, 1];
also you had a : at the end
the code never worked anyway
not possible afaik π€
is there any way to enable/disable observer mode and change respawn time during game?
ie: normally, respawn is set to 30secs and observer disabled. when admin runs script, respawn timeout is set to 5 min, and observer mode enabled
I am trying to script the BPz 2A0 from Global Mobilization to function like the Bobcat where it will rearm, refuel, and repair, everything from tanks, to towed artillery, to helicopters, and jets. I tried a few scripts I found online but none of them are working.
is there a way to increase the rate which chat messages expire?
you can't have it behave exactly like the bobcat
Β―_(γ)_/Β―
kk
clear as in how?
get rid of everything
no @winter rose i think s/he means cls/clear in linux-style
to clear systemchat history (currently shown on screen)
do you think I should remoteExec it?
remoteExec ["clearRadio"];
it doesnt have any parameters
yep
I am trying to script
why are you using other people's scripts then?
ok
local effect
never seen the clearRadio command in my life
used thousand commands, never knew that 1 existed
@sonic hill it might not have fuel/ammo/repair cargo capacity
that is config not scripting
yea, i mean hooking into the vanilla system
not sure its even possible with script, needs config
yeah it's not
What you mean by that? Will it be able to refuel, repair, and rearm vehicles?
yeah
but you won't have that action that appears on the vehicle
(you can script it tho)
didn't know I could do a config. How would I do that?
is that for a mission or mod?
if it's a mission it's better to stick to the scripting solution
yeah it's for a training Zeus Op for West Germany Cold War period.
So how do I script it?
do you want it to be automatic or activated using an action?
automatic tbh
is there any way to enable/disable observer mode and change respawn time during game?
ie: normally, respawn is set to 30secs and observer disabled. when admin runs script, respawn timeout is set to 5 min, and observer mode enabled(editado)
This is outputting <t color='#0000ff'>Blue</t> team wins!
["<t color='#0000ff'>Blue</t>" + " team wins!"] remoteExec ["hint", 0, false];
So I tried this:
_blueWinText = parseText "<t color='#0000ff'>Blue</t>" + "team wins!";
[_blueWinText] remoteExec ["hint", 0, false];
and I got an error
https://community.bistudio.com/wiki/Arma_3:_Respawn
You might find this inspiring
Of course you did, check the output data type of parseText vs what hint takes
this outputs structured text, and hint says that it takes a string OR structured text
oh whoops
you can use a server-side loop I guess:
I think this is the best way to do it? 
if (!isServer) exitWith {};
while {alive this} do {
_nearVehs = this nearEntities ["allVehicles", 15];
{
_x setFuel (fuel _x + 0.1);
_x setDamage (getDammage _x - 0.2);
} forEach (_nearVehs - [this]);
sleep 2;
}
the rearming part is a bit more complicated

Q: how do I find the bounding box of a class (vehicle)? without creating the vehicle. can I do it given the class name only? and/or discovering its config?
no
setFuel is a snowflake and wants Remote Execution
It could be due + is not supported for structured text + string then
ok
I think you can't. You should make a function which has a cache of bounding box sizes. If the value is not in the cache, you create the vehicle, get its bbox and delete it instantly, and add value to the cache. That's what I did when I had to solve this.
_blueWinText = parseText "<t color='#0000ff'>Blue</t>" + "team wins!";
[_blueWinText] remoteExec ["hint", 0, false];
does this work?
nope that is still structured text + string
oh yeah
did you initialize by creating the vehicles initially then? maybe creating them 'local' to the server? and grabbing their boxes?
parseText "<t color='#0000ff'>Blue</t> team wins!";
yeah creating them locally is a good idea
Why you always feed solutions to people :o
sowwy :3 I just didn't want something like 2Γ parseText
or 'local' to server anyway. so then the trick is discovering all the objects that can be created... scanning missionConfig?
I wanted though :(
or known set of available vehicle classes
no, you should do it lazily, no need to do it for all vehicles in advance
Hello, I am completely new to ArmA 3 scripting and I have this simple vehicle spawning script but would like to spawn drones the same type of way but drones need their AI and this script doesn't spawn vehicles with their crew. Can anyone give me some pointers?
this addAction
[
"Spawn (vehicle)",
{
_pad1 = getPosATL Spawn_Pad1;
_dir = getDir Spawn_Pad1;
_veh = createVehicle
[
"(vehicle)",
_pad1,
[],
0,
"NONE"
];
_veh setDir _dir;
}
];
UAVs are snowflakes too
Not sure if it works with UAVs tho
https://community.bistudio.com/wiki/BIS_fnc_spawnVehicle
Rumor has it this works with UAVs.
radioChannelCreate [color, label, callSign, units, sentenceType]
What is callSign?
params ["_className"];
if (isNil "bbcache") then {
bbcache = createHashmap;
};
_bbfromcache = bbcache get _classname; // Get cached value
if (isNil "_bbfromcache") then { // If cached value is not present for this class,
_veh = createVehicleLocal ... ; // obtain the value and put value into cache
_bb = boundingboxreal _veh;
deleteVehicleLocal _veh;
bbcache set [_classname, _bb];
_bb; // return
} else {
_bbfromcache; // Return
};
In the end your cache size will grow to the size of all vehicles this function has been called for.
have you heard of our Lord and Saviour The WikiΒ©?
π¬
where do I find the config files?
under the debug console > CONFIG
ooooooh
magic, I know π
am I not able to preview any of the sounds in CfgSounds?
am I not able to do this:
waitUntil { !isNil "myVariable" };
why not?
exceptionally, I shall allow it.
here is my permission: you can do what you like, bud β€οΈ
nevermind i got it
thanks
also how do the x and y coords work for BIS_fnc_dynamicText?
I want it to appear at the top middle of the screen but when I change the values its confusing
from top-left of the screen I believe?
well when X is zero, it is centered
so what do I need to put for y to make it at the top of the screen?
i cant figure it out
0
it doesnt have any boolean arguments
what are the arguments you set?
[gameTimeString, 0, 1.5, 1, 0, 0] spawn BIS_fnc_dynamicText;
(gameTimeString is the time left in the game)
im testing out the second value
right now it is at 1.5, and the text doesnt appear anywhere
if I set it to 1, it is near the bottom of the screen, if I set it to 0 it is in the middle of the screen
then set it to -1? π
I tried that
I must be blind, I am not seeing the error. Does boundingBoxReal require clippingType then?
params [
["_className", "", [""]]
, ["_pos", getPos KPLIB_eden_createVehicle, [[]]]
];
if (isNil {KPLIB_common_bbrCache}) then {
KPLIB_common_bbrCache = createHashMap;
};
private _bbrCurrent = KPLIB_common_bbrCache get _className;
if (!isNil {_bbrCurrent}) exitWith {_bbrCurrent;};
private _object = _className createVehicleLocal _pos;
private _bbr = boundingBoxReal _object;
deleteVehicleLocal _object;
KPLIB_common_bbrCache set [_className, _bbr];
_bbr;
With errors:
16:06:31 Error in expression <ingBoxReal _object;
deleteVehicleLocal _object;
KPLIB_common_bbrCache set [_cl>
16:06:31 Error position: <_object;
KPLIB_common_bbrCache set [_cl>
16:06:31 Error Missing ;
ok correction: when I set it to 0, the text is towards the top of the screen, but not as high as I want it
1 is at the bottom
deleteVehicleLocal _object;
wat. Thats not a thing. And thats where your error message points to
16:06:31 Error position: <_object;
KPLIB_common_bbrCache set [_cl>
deleteVehicleLocal |#|_object;
KPLIB_common_bbrCache set [_cl
I wrote deletevehiclelocal in my pseudocode but it was pseudocode just to demonstrate how it works
Is there a way to get more info on an error besides just the black and white pop up box
RPT sometimes says more about it than the popup box
you can start Arma with -debug parameter which will give you the full callstack of the error to RPT
no I get that; the syntax highlighting isn't perfect either so wasn't completely certain
but the error doesn't tell you, command invalid either, so... anywho. thanks...
does anyone know how the coordinates system works for BIS_fnc_dynamicText? what do I need to put for it to appear at the top middle of the screen?
[gameTimeString, 0, 0, 1, 0, 0] spawn BIS_fnc_dynamicText;
yeah error messages are very weird sometimes π
anyone know of a scritpt or command to make firing from vehicle (FFV) from the passenger of a PO Orca?
@digital torrent I think you'd need a mod for that to reconfigure the seats
Does anyone know of an eventhandler for custom controls being used? Im trying to make a mod that uses Ctrl+Mouse Wheel Up but I can't figure it out.
that's just a mouseZChanged + keyDown event handler
This is center?
is there a way to detect if a class name in a var is a weapon? This is not working, it always spawns as an object without mag.
if (
(_item_classname isKindOf "Weapon") ||
(_item_classname isKindOf "Rifle") ||
(_item_classname isKindOf "Pistol") ||
(_item_classname isKindOf "Launcher")
) then
{
diag_log "weapon";
_item = "groundweaponholder" createVehicle _spawn_pos;
_item addWeaponCargo [_item_classname, 1];
_item setPos _spawn_pos;
}
else
{
diag_log "just an object";
_item = _item_classname createVehicle _spawn_pos;
_item setPos _spawn_pos;
};
@cosmic lichen sweet thanks mate
pretty sure the center is x=0, y=1
actually maybe its y=-1
You said, top center
the only values that work for y are 0, 1, and -1 from my testing
yes
y = 0 above the center
y = 1 below the center
y = -1 center
but I want it to be at the very top of the screen in the middle
Yeah it's weird. Looking at the function now
["gameTimeString", 0, safezoneY, 4, 2, 5] spawn BIS_fnc_dynamicText;
is that a different syntax?
no
@restive leaf should I just type (setEnemy)?
If i Want to get them to be enemyβs?
setEnemy? What is that?
To make blufor units kill other blufor (blue units)
There is no command setEnemy
To change side relation see https://community.bistudio.com/wiki/Side_relations
Why on earth do you even think you need to do that. As I explained in #general_chat_arma it doesn't matter that the German forces in IFA are BLUFOR so long as the side you are on are not... It's really not that complicated unless you are trying to do some sci-fi scenario of them fighting modern Western European forces...???
Also note I linked the setFriend command, not setEnemy... setFriend sets side relations, friendly or enemy
I wanna do it with the Danish Army .And they are in BLUFOR that is why? So are there any opportunities to that?
In IFA3?
Yes sir
Don't see a Denmark faction or unit in IFA3
Is a DLC from the 80 that i have modifed to look like 1940 soldier thats why
That won't work unless you mod the configs in the 80s mod to make them GUER/INDEP...
is that easy?
Sort of, a lot of work... now you need to move to #arma3_config where others can help
It should be possible to do it in Editor or scripting, simply group them to opposite side's group or whatever
oh okay thanks for the help both of u!
Really?
Yup. I think scripting method is more reliable, simply spawn them as a member of a opposite side's group
Oh, cool. Had never tried that... in all my time in ARMA... had never tried that π€¦
Going to now though. Thanks π€£
@warm hedge What is works lol thanks for it!
So ACE 3 has some way to tell if a unit has explosives in their inventory, given they show an "Explosives" menu if you do, and no menu if you don't
does anyone know if I can tap into that code somehow to determine if a unit has explosives or not
im trying to spawn weapons and gear on the floors of buildings. im using the building positions but the items seem to hove above the ground. I have tried using the following but has no effect. Any suggestions or links?
_item setVectorUp surfaceNormal position _item;
setVectorUp does nothing to do with positions. Most likely you're using wrong position format (z-format)
ive tried setpos, setposATL, and setposASL. some still hover like rocket launchers
Post the entire code
_item = _item_classname createVehicle _spawn_pos;
_item setPos _spawn_pos;
_item setVectorUp surfaceNormal position _item;
_item setDir (getDir _random_location_obj);
that same code does this with backpacks
https://imgur.com/a/o6RLTMI
other stuff works ok
https://imgur.com/a/9jxeCYh
What's _spawn_pos?
either the top of an object or a building position. by building positions i mean I used BIS_fnc_buildingPositions.
Confused. Post the entire, not the part of it
Also get rid of that setVectorUp part, that doesn't do anything more like could problematic. surfaceNormal does return the terrain normal not a object's surface's normal
One of my scripts for an insignia mod is saying input after endoffile
And everything is fine with the bracketing from what it looks like to me
Nothing can be said unless you post an actual code or script or config or whatever
Uh it's a little long
Then sqfbin or pastebin
version={"1.0"};
this part
one solution is using simulated weapon holders, but not really ideal. a better solution would be (id imagine), creating simulated objects in every position, waiting abit so they fall down, saving their positions relative to the building in some hashmap and reusing those positions later for actual spawning
Or just hardcode the height
well that's basically the same thing
there arent many building models. set up a good dev environment and you can hardcode all the locations in an evening
with a simple lookup table
fall back on hardcoded building positions for ones you havent done yet
So im trying to create a loot spawner and im having issues filling crates with items the server admin listed. We are using the class names for a gun from the eden editor. I need a way to detect if the classname is a weapon, mag, item, or back pack. Someone suggested using BIS_fnc_itemType but it returns and empty array.
Any thoughts?
here is an example of one of the items in the loot spawn array
[
["className", "Box_NATO_Ammo_F"],
["locations", []],
["max_count", 100],
["min_count", 2],
["inventory",
[
["Weapon_arifle_MX_F", 10],
["Weapon_launch_RPG7_F", 10],
["Weapon_LMG_Zafir_F", 10]
]
], //item list from inventory copied from eden editor and quantities
["can_spawn_on_ground", true],
["spawn_on_ground_only", true],
["iswepon", false],
["active", true]
],
So you can stack event handlers like that?
Yes, UI EHs are stackable.
@cosmic lichen Could you write me a single line for adding stacked event handlers? Is it like: _myDisplay displayAddEventHandler ["KeyDown" + "MouseButtonClick",{}]; or did I misunderstand you guys?
_myDisplay displayAddEventHandler ["KeyDown", {}];
_myDisplay displayAddEventHandler ["KeyDown", {}];
_myDisplay displayAddEventHandler ["KeyDown", {}];
_myDisplay displayAddEventHandler ["MouseButtonClick", {}];
_myDisplay displayAddEventHandler ["MouseButtonClick", {}];
_myDisplay displayAddEventHandler ["MouseButtonClick", {}];
This is valid. Each EH of given type will get it's own index as reference.
@exotic tinsel Weapon_arifle_MX_F
This is an incorrect class name
The classname which points to the weapon is arifle_MX_F
"arifle_MX_F" call BIS_fnc_itemType; //["Weapon","AssaultRifle"]
In 2.* version the street lamp halo stays even if the lamp is hidden or destroyed. Are there any ways to fix it?
Ah, I've got it, an old trick. Need to setDamage 0.9, then to hideObjectGlobal.
Hmm... No, it can't be done with the script. What is the trick?
The halo is disabled on damage 0.9, but when I try to hide the lamp, it enables again...
So how is it handled?
P.S. Got it finally. Need to setDamage 0.95.
don't mix weapons in cfgvehicles and cfgweapons
// initPlayerLocal.sqf
[player, [missionNamespace, "gear"]] call BIS_fnc_saveInventory;
[missionNamespace, "arsenalClosed", { [player, [missionNamespace, "gear"]] call BIS_fnc_saveInventory; }] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn", { [player, [missionNamespace, "gear"]] call BIS_fnc_loadInventory; }];
for some reason I don't get loadout saved from arsenal after respawn. (testing on editor > multiplayer )
what about onPlayerRespawn.sqf?
that works. strange as event handler should do the same
yes, that was my original code, was trying with BIS functions, seems like going back to commands
_this sideChat "Last one out lock the door!";
null = [] spawn {
{
if(((assignedVehicleRole _x)select 0) =="Cargo") then {
removeBackpack _x;
_x addBackpack "B_Parachute";
[_x] ordergetin false;
[_x] allowGetIn false;
unassignvehicle _x;
moveout _x;
sleep 0.3;
};
} forEach(crew _this);
};
This isn't right is it?
It's an airdrop script
_this isn't defined inside spawn {}
have to pass it
What do you mean by pass it
_this spawn {params ["_vehicle"];....}
Then replace _this with _vehicle inside spawn
Hmm
_this sideChat "Last one out lock the door!";
_this spawn
{
params ["_vehicle"];
{
if ((assignedVehicleRole _x select 0) =="Cargo") then
{
removeBackpack _x;
_x addBackpack "B_Parachute";
[_x] ordergetin false;
[_x] allowGetIn false;
unassignvehicle _x;
moveout _x;
sleep 0.3;
};
} forEach (crew _vehicle);
};
respawnTemplates[] = {"MenuInventory"}; was messing with respawn loadout
Is there a way to disable and enable VON during the mission individually for each player?
Thanks π
But as I understand, it sets the overall volume to 0. So, it blocks every incoming messages. Maybe there could be another way, to block voice transmitting individually? Because if player A can't hear player B, but can hear player C, then it should hear only C.
I don't think that's possible
Can someone point me in the direction on how to spawn a grenade on the ground so that players can pick it up and use. I know i can put on one the ground and pick it up but cant figure out how to script it.
create a groundweaponholder (see createVehicle) and add magazine cargo to it
is this the right code?
_item = "groundweaponHolder" createVehicle _spawn_pos;
_item addMagazineCargoGlobal["HandGrenade", 1];
_item setPos _spawn_pos;
_item setDir (getDir _random_location_obj);
why createVehicle and setPos?
@cosmic lichen It was more precise from my experience, but it is critical only for vehicles.
I have a problem with triggers.
I created a trigger that activates on load:
private _factory = nearestObject [[6215.61,16282.9,0], "Land_Ind_Pec_03"];
private _trigger = createTrigger ["EmptyDetector", getPosATL _factory, true];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerInterval 5;
_trigger setVariable ["Factory", _factory, true];
_trigger setTriggerArea [100, 100, 0, false];
_trigger setTriggerStatements
[
"some conditions, true at the moment of creation",
"some script",
""
];
The problem is that it could be activated only when I change some of statement conditions, but not from the very beginning.
Is this a known behaviour?
Dunno, never used triggers in sqf really
I made a battle royale game a while ago and in order to have random weapon loot with guns and their respective magazines, I used an array of arrays:
private _weaponArray = [
["hgun_ACPC2_F", "9Rnd_45ACP_Mag"],
["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"],
["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"],
["arifle_AKM_F", "30Rnd_762x39_Mag_F"],
["arifle_Katiba_F", "30Rnd_65x39_caseless_green"],
["sgun_HunterShotgun_01_F", "2Rnd_12Gauge_Slug"],
["srifle_DMR_03_F", "20Rnd_762x51_Mag"],
["srifle_EBR_F", "20Rnd_762x51_Mag"],
["arifle_Mk20_F", "30Rnd_556x45_Stanag"],
["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"],
["arifle_MXM_Black_F", "30Rnd_65x39_caseless_black_mag"],
["hgun_P07_blk_F", "16Rnd_9x21_Mag"],
["hgun_PDW2000_F", "30Rnd_9x21_Mag"],
["hgun_Pistol_01_F", "10Rnd_9x21_Mag"],
["SMG_05_F", "30Rnd_9x21_Mag_SMG_02"],
["hgun_Rook40_F", "16Rnd_9x21_Mag"],
["arifle_SDAR_F", "20Rnd_556x45_UW_mag"],
["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"],
["arifle_SPAR_03_blk_F", "20Rnd_762x51_Mag"],
["SMG_02_F", "30Rnd_9x21_Mag_SMG_02"],
["arifle_TRG21_F", "30Rnd_556x45_Stanag"],
["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"],
["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"]];
_weaponAndMag = selectRandom _weaponArray;
_weapon = _weaponAndMag select 0;
_mag = _weaponAndMag select 1;
_crates = allMissionObjects "Land_PlasticCase_01_medium_black_F";
{
_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 5];
} forEach _crates;
@winter rose They code i posted puts something on teh ground but nothing happens when i hit and also i get this message when the mission starts. https://imgur.com/a/LvolkWv
@cosmic lichen I do setpos because createVehicle places in a safe spot.
@past wagon I need a solution for spawing the hand grenade on the ground to be picked up
Yeah�
try addItem*
nope
no, my bet on you doing something wrong
@unique sundial Maybe.
The problem is in the script condition.
I supposed that if it triggers, then there are some players nearby (trigger radius > 100 m), so in the script there is following condition:
(allplayers findif {_x distance2D OT_factoryPos < 100}) != -1
And it is false at the time the trigger fires.
Uh, my issue is spawning grenades on ground, you're talking about the other guys issue. Thanks though.
i have many questions about that code as it is useless without full context, if you think there is a bug, make ticket with repro @unreal scroll
does it work? yes- yes the right code, no- no not the right code
ok thx
Could some one slip me a config that works for thrown weapons please.
@exotic tinsel if you still need help, post your entire code and explain what you are trying to do. I will help you
@past wagon thanks mate for following up, I figured it out.
dumb question, is there a method to have a seperate sqf but refer to a private variable of another script?
Yes. Pass them as arguments
ok
Main script:
[_variable1, _variable2, _variable3] execVM "myOtherScript.sqf";
Other script:
_variable1 = _this select 0;
_variable2 = _this select 1;
_variable3 = _this select 2;
Alternative other script (easier) :
params ["_variable1","_variable2","_variable3"];
whoops meant to respond to @digital torrent
params ["_variable1","_variable2","_variable3"];``` is highly recommended instead
but would the params in the other script be refered to the original?
lol yea. so that my question
they wouldnt get passed back
basically it is something like
im not 100% sure about that
but im pretty sure the best way to do it would be to just use a global variable
private ["_variable1"];
_variable1 = create unit "soldier"
some method to pass to other script
deletevehicle _variable1
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
use this instead:
private _variable1 = createUnit "soldier";
private ["_entitate"];
_entitate= _grp createUnit ["B_Soldier_VR_F",getmarkerpos _poz_orig_sc, [], 0,"NONE"];
_entitate addEventHandler ["HitPart", {[[_this select 0 select 5, _this select 0 select 6 select 0], "AL_Screamer\screamer_hp.sqf"] call BIS_fnc_execVM;}];
some method so in other script, when i do deletevehicle _entitate works
you can start by creating the variable in script 1, then you can pass it to script 2 and delete the vehicle
so u mean
Params ["_entitate"];
_entitate= _grp createUnit ["B_Soldier_VR_F",getmarkerpos _poz_orig_sc, [], 0,"NONE"];
_entitate addEventHandler ["HitPart", {[[_this select 0 select 5, _this select 0 select 6 select 0, _entitate], "AL_Screamer\screamer_hp.sqf"] call BIS_fnc_execVM;}];
_entitate = _this select 2;
etc....
deletevehicle _entitate;
the second part is the other script
not quite
why are you using BIS_fnc_execVM instead of just execVM?
it doesnt change much does it?
is there a reason for using the function instead of the command tho?
no
BIS_fnc_execVM
wat?
i just used what was propose to make a HP system @little raptor lol
never use execVM/spawn in event handler code anyway (unless you want to)
I have no idea what you mean
_entitate = _grp createUnit ["B_Soldier_VR_F", getmarkerpos _poz_orig_sc, [], 0, "NONE"];
_entitate addEventHandler ["HitPart", {
[_entitate] execVM "AL_Screamer\screamer_hp.sqf";
}];
params ["_entitate"];
ok seems good. i just wanted to try to see if it work on dedicated server
undefined
yeah lemme check the syntax on that

whats the problem?
[_entitate] execVM "AL_Screamer\screamer_hp.sqf";
no array?
_entitate is not defined
as I told you
i cant seems to wrap my head around it lmao
no your script, but combining with what ihave haha
@past wagon i tried doing what u suggest, but i ran problem with my existing script
private ["_entitate"];
_entitate = _grp createUnit ["B_Soldier_VR_F", getmarkerpos _poz_orig_sc, [], 0, "NONE"];
_entitate addEventHandler ["HitPart", {[[_this select 0 select 5, _this select 0 select 6 select 0], "AL_Screamer\screamer_hp.sqf"] call BIS_fnc_execVM;}];
}];
Other script
part = _this select 0 select 0;
_dmg = _this select 1;
if(_part == "head")then
{
screamerhp_dmg = screamerhp_dmg + _dmg + 20 ;
}
else
{
screamerhp_dmg = screamerhp_dmg + _dmg;
};
if(screamerhp_dmg > random [1000, 1500, 2000])then
{
_entitate allowDamage true;
_entitate setDamage 1;
_screamer_anomally setdamage 1;
deletevehicle _screamer_anomally;
deletevehicle _entitate;
playsound "earthquakes";
_emit say3D ["scream", 200];
hint "Screamer dead"; systemchat "Screamer dead"
};
*screamerhp_dmg already a public variable
the above is the original
what i tried with your suggestion:
private ["_entitate"];
_entitate = _grp createUnit ["B_Soldier_VR_F", getmarkerpos _poz_orig_sc, [], 0, "NONE"];
[_entitate] execVM "AL_Screamer\screamer_hp.sqf";
params ["_entitate"];
_entitate addEventHandler ["HitPart", {
_part = _this select 0 select 5; //_this select 0 select 0;
_dmg = _this select 0 select 6 select 0; //_this select 1;
if(_part == "head")then
{
screamerhp_dmg = screamerhp_dmg + _dmg + 20 ;
}
else
{
screamerhp_dmg = screamerhp_dmg + _dmg;
};
if(screamerhp_dmg > random [1000, 1500, 2000])then
{
_entitate allowDamage true;
_entitate setDamage 1;
_screamer_anomally setdamage 1;
deletevehicle _screamer_anomally;
deletevehicle _entitate;
playsound "earthquakes";
_emit say3D ["scream", 200];
hint "Screamer dead"; systemchat "Screamer dead"
};
}];
what is the deal with those global vars?

lol i shoudnt have?
well you're damaging multiple entities, and yet you use one var for all of them
i mean i am trying to do dedicated so i thought global would be better
and you're using a global var
well i can spawn multiple of them with that script
that's the problem
and how is that supposed to address the problem? 
use that instead of those global variables
is there an equivialent of player for npc's ?
hiya, i'm trying some super basic code, i have this right now
_magazinetype = currentMagazine player;
while {true} do {
hint str(_magazinetype);
};
i'm trying to get it so that currentMagazine is constantly shown as a hint but it only shows the first loaded mag, not anything i switch to. any support would be appreciated
you assign the variable only once,
not in the while loop
so it just shows the hint of the same magazine over and over again
ahh so move the magazinetype variable into the while loop?
allUnits - allPlayers returns all npc's
that would end up in an array again or not?
while "player" is an object.
I guess there is no same thing for the npc's
well i guess i need to rewrite code π
thanks
yes, it "should" work π
gotcha! thatβs really useful, thanks for your help :)
yes this is an array of all alive npc's
Worked! ty:D
sorry another question, how do i ;print both a variable and string within a hint?
https://community.bistudio.com/wiki/hint
hint format ["Hello, %1!,%2", name player, name player];
im not entirely sure this is the right place to ask this so sorry if its not
Im setting up a zeus mission that vehicles will be spawned on the fly, Is there any way i can make it that anytime i spawn a vehicle it automatically gets its inventory wiped?
i'd like to avoid the players potentially using what comes with the vehicle
spawn via script or via zeus?
via zeus
no, not with vanilla zeus. what you need is to use CBA's class event handler
if you are using ZEN, then you can click the vehicle and click inventory and clear it but its not automatic
ZEN requires CBA
if (isServer) then {
this addEventHandler ["CuratorObjectPlaced", {
_veh = _this select 1;
if (_veh isKindOf "LandVehicle") then { //I dont remember the vehicle hierarchy, u may wanna change this.
clearWeaponCargoGlobal _veh; clearMagazineCargoGlobal _veh; clearItemCargoGlobal _veh;
};
}];
};
Untested ^
Im not well experienced with editor but I guess a isServer check on init of your Game Master module (the thing that you connect to player entity) would be enough.
@unique sundial
"i have many questions about that code as it is useless without full context"
The code doesn't matter.
How does it work for dedicated:
- Make a trigger for player presence
- Player enters the trigger area
- Trigger fires
- If we try to find a player from allplayers inside the trigger statements within the trigger radius, it fails. For local it works well.
private _factory = nearestObject [[6215.61,16282.9,0], "Land_Ind_Pec_03"];
private _trigger = createTrigger ["EmptyDetector", getPosATL _factory, true];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerInterval 5;
_trigger setVariable ["Factory", _factory, true];
_trigger setTriggerArea [100, 100, 0, false];
_trigger setTriggerStatements
[
"true",
"(allplayers findif {_x distance2D [6215.61,16282.9,0] < 100}) != -1", // returns false
""
];
And it doesn't matter how far the player is, I moved from 100 to ~10 m.
If it is not intended, then I'll write a report. But it is better to check twice π
@unreal scroll Apologies for my rustiness with trigger codes but whats the point of setTriggerActivation when you got setTriggerStatement 1st param being true? Shouldnt it be this instead for it to consider that activation? This could also be the issue depending on your test environment.
@crude vigil it is only for testing. Actually there are some conditions, as I mentioned above.
But true means that it should be activated in any case. Could there be triggers that activates in any case? Of course π
You can check conditions inside the executed code.
And the problem is that the trigger doesn't fire for the very first time (if there are any conditions set). If something in statement changes, it activates well. But maybe it is because the player stays inside the trigger radius - seems like the trigger fires before allplayers variable change.
Maybe I need to use thisList as the list of players, but it is strange that server doesn't see the player in allplayers.
@unreal scroll You should have started with "it doesnt work on dedicated". The reason is simple, setTriggerStatements is local command you need to execute it on dedicated if you want it to work on dedicated. The trigger you add will have default condition on dedicated and modified condition on client. Default condition is "this", which means it will only activate when you have triggerActivation happen
Ah, so Talya_taya was right, thanks.
"You should have started with "it doesnt work on dedicated"
I didn't know before today tests π
you can create global triggerfrom any client, but then you have to remoteExec everything else to all clients if you want it to be identical on all clients. I dont know what you are trying to do but there is definitely less painful way
"I dont know what you are trying to do"
Just say3D (ambient sound) and createvehiclelocal (smoke)
You can spawn a smoke grenade globally and arma does the rest for the smoke
Or (way harder, probably not worth it) you create local particles
It is the smokestack smoke, for a long time. I use the Naval Legends implementation.
How do you intend to spawn it? Via module?
Hey, question. Is it possible to define/retrieve variables via server.cfg?
Looking to get a serverside script set up that only activates when a certain variable is enabled
huh, how is this even possible? floating point rounding error perhaps?
_a = 0;
_b = -1;
_a*_b; // -0
versus:
_a = 0;
_b = -1;
round (_a*_b); // 0
as far as i know this is not possible, but you can set values in description.ext and get this values with getNumber/getText
-0 doesn't exist in math, so 0 after round is correct
get config yes, set config no
as if to say, I expect it is a floating point rounding error, correct?
Ah sweet, thanks
I'm not sure part you expect is a rounding error, but IEEE 754 floats have negative zero
https://community.bistudio.com/wiki/Number at least hints towards the fact that the custom (iirc) floats used in RV (partially) comply with the IEEE 754 standard.
Among the many things defined in that standard is obviously the representation of zero. From https://en.wikipedia.org/wiki/IEEE_754#Formats:
Moreover, there are two zero values, called signed zeros: the sign bit specifies whether a zero is +0 (positive zero) or β0 (negative zero).
Having two zero representations is a disadvantage that comes with the binary encoding of numbers; the only way to encode whether a number is positive or negative is using a bit dedicated to storing that information.
Simple example with 4-bit numbers, the first bit stores the sign:
0000 //Zero
1000 //Also zero :-(
0011 //Three
1011 //Negative three
```For integers this can be solved easily using https://en.wikipedia.org/wiki/Two%27s_complement, but for floats it's not that simple.
hmm good to know @willow hound. the thing is, I am working from a (-1 * count _array), and somehow that is -0. does count not return an int?
SQF doesn't have ints, just floats (https://community.bistudio.com/wiki/Number)
ah I see, okay then
May the Enfusion engine save us
isn't that just a terrible rumor at this point? abandon all hope all ye who enter... LOL
@spark turret If you're interested, I can give you the full code later.
Multiple hideobjectglobal through addaction?
in rapid succesion
It doesn't work on MP servers right?
use forEach @zenith ferry
for each?
{ do stuff } forEach [obj1, obj2]
@dreamy kestrel intercept is also an option
Intercept? i never heard of that
Sorry I was replying to michaelwplde (seems like I forgot to press reply)
ah no worries then

You mean one after the other with minor delay (but not instant)?
yeah
Issue is i know the server is executing them
since iget the hints that it has run through but it goes um dumb and client doesn't see it
So i'm using Sleep which is bad in itself but don't know how to use the fnc to do that
My other idea was to make them change locally but can't figure out how to
Can you share the code in question?
B_1 hideObjectGlobal false;
sleep 1;
B_1 hideObjectGlobal true;
sleep 1;
B_1 hideObjectGlobal false;
sleep 1;
B_1 hideObjectGlobal true;
sleep 1;
V_3 hideObjectGlobal true;```
This is just piece of it but it all works on the same basis
The issue is server doesn't update it, and my idea of working on Local is um questionable
What machine does this code run on?
as in Locality or Headless/Dedicated?
I'm confused about the question @willow hound
Does this code run on the server or on a (headless) client?
Server
or um Local? It's through Addaction
that's why it's HideObjectGlobalso it updates it globally
Ah, yes, I forgot you mentioned addAction.
https://community.bistudio.com/wiki/hideObjectGlobal
Well, hideObjectGlobal has to be executed on the server, so there's the problem π
oh HideObjectGlobal is to be executed on server? Huh i wish i knew that beforehand
any idea how to fix it then? or to apply HideObject to all Players?
I presume that would be through execVM
or one of those options i have no clue how to use
Use remote execution (https://community.bistudio.com/wiki/Arma_3:_Remote_Execution).
Pretty simple in this case:
[B_1, false] remoteExec ["hideObjectGlobal", 2];
So i have to do that for each and every one of them right?
I mean as in remoteExec each one of those lines individually
Yes, either that or you could be smart and put the whole code block into a function (or at least its own script file) and then remote execute that function once.
i just realized i'm already using remoteExec in later parts of the script
and that part is the one that works
I'm dumb, thanks so much for help!
nothing bad will happen if i remoteExec a remoteExec ["zen_modules_fnc_moduleNukeLocal",0]
right?
No, but it might be unnecessary (depends on your code design).
I belive it's needed purely to supply params to Nuke so it doesn't kill server
this addaction ["Start",{ remoteExec ["Bonk.sqf", 2]}];
@willow hound Would that work?
no
not gonna lie never used remoteExec with .sqf
litteraly never
oh right i forgot the 2, right?
https://community.bistudio.com/wiki/remoteExec
See if you can figure it out yourself first; remoteExec requires a more complex set of parameters than execVM.
Is Bonk.sqf the script that needs to run on the server?
Yup
one more question how to delete addaction from every user after it has been used? through remoteExec again?
remoteExec doesn't take script file names as a parameter, it only takes commands and functions. Thus, we have to remote execute execVM (which does accept script file names):
"Bonk.sqf" remoteExec ["execVM", 2];
so i was "Close" but not close enough
How do you execute addAction in the first place?
my first idea was this addaction [ "text", {code}]; but if im using remoteExec ig i would use remoteExec to create addaction
there is removeallactions table in the "Bonk.sqf" but it doesn't work
this addaction [ "Turn On", { "Bonk.sqf" remoteExec ["execVM", 2];}]; That's one of ideas how to make it but no clue how would that turn out
ik it would work in SP but no clue about MP
Well the issue with addAction (and removeAllActions) is the fact that it has local effect, the action is only added on the client that runs the command. To solve that we have to use remote execution once again π
Indeed.
Thanks!
if you want to remove it use
unit remoteExec ["removeAllActions ",2];
Thats because you added it to the server only
Thank you guys so much
why adding it to the server only?
Are you sure you run addAction on every client though? π
he is running it on the server only here
You are saving my life tbf since i've found the issue around 4h before the operation....
I have it on 0
that was my mistake while typing
Worked, Thanks man
Server + Clients, but i could probably have it on -2
never script for dedicated only, think of the player-hosted
yeah
if a player
hosts it
No, this code runs addAction only on one machine; execVM "Bonk.sqf"; is what is run on the server once the action is activated by the user.
It's on dedicated, so ig it should be on 0 or -2 or am i missing smth?
never script for dedicated only, think of the player-hosted
so you have two types of servers here:
player hosted (player is the host)
and dedicated (a pc is hosting the game, but the pc is not a player)
when you do -2, if the server was player hosted, you will exclude him as a "server" and he won't see the action
That is go for 0 then
as for dedicated its not a player who is the server so np
yes
Again Thanks so much!
if dedicated it should be -2
It's dedicated
if player is host it should be 0
but doesn't hurt to do 0 either way
yep
I don't think you are going for a front line mission so it doesn't hurt
64
is it a massive change or is it something minor?
Minor, nothing that massive
Most of it is just feeding parameters to Local functions i scavenged from a friend
such as replacing hundreds of entities or spawning a lot of items etc
oh ok
you are good to go I guess
nope, litteraly feeds Positions, and changed if invisible
You can just use:
[0, -2] select isDedicated
Works on both dedi and non dedicated
Ah that's convinient
so in short this addaction [ "Turn On", { "Bonk.sqf" remoteExec ["execVM",[0, -2] select isDedicated]}];
or am i going again into a hole
@little raptor
Yeah that's correct
Absolutely not 
Oh no
I see it ok on my phone 
When does this part of the code get executed?
"Bonk.sqf" remoteExec ["execVM",[0, -2] select isDedicated]
Did you want to exec it on the server?
Never?
Syntax is correct but it doesn't do what is wanted π
Oh
I'm a bit out of loop π
It doesn't run the select isDedicated ig? but either way i'm using 0
since it's um safer?
even though i know it's dedicated
What can go wrong, it's not like i'm gonna crash the whole server by complete accident
triggers, dear triggers
yes
magazines MYTARGET;
MYTARGET is a tank, in my first map when I run this it doesn't return an array, but in the second map it does, any possible reason?
Bonk.sqf contains code that has to run on the server (in fact, please make sure it only contains code that has to run on the server), and the server is always 2, so [0, -2] select isDedicated actually has to be omitted in this code block, you have to use 2 instead.
[0, -2] select isDedicated could be used if you were remote executing addAction, but you are not doing that right now (it could be necessary though), you are remote executing execVM.
I've found out
that all of it can run on Server without Player input
so i will be changing it to 2
since um i don't want 90+ ships spawning accidentaly as local assets...
how do I get units from a group?
for instance:
_groupOne = _this select 0;
_soldier = _groupOne select 0;
units
could you elaborate what that does please?
or how I would use it in this case?
_groupOne = _this select 0;
_unitsGroupOne = units _groupOne;
?
You can check the wiki.
It returns an array of units in the group:
_units = units _groupOne;
Yes
gotcha, thanks a bunch!
Hello, i have one question π
Wanted to make something like
control main vehicle from attached
Though is possible - how to make one vehicle controlled from second one π
Or switch camera from main vehicle to another one?
by switch camera you mean control the driver by switching form a unit to the driver seat of the second vehicle?
yep, or just swith camera to another one
You can only control one vehicle at a time
You might be able to drive the main vehicle if it's a land vehicle and you use an AI to drive it for you
i wanted something like that - but have problem with camera
attached vehicle is too big
You can create your own camera
It won't be as good as vanilla tho
i know - i ask stupid questions, sorry for that 
It's ok 
if (daytime > 18.0000) then {_timech = (daytime) -18.0000;
skipTime ((daytime) - _timech);};
if (daytime < 18.0000) then {_timech = 18.000 - (daytime);
skipTime (daytime + _timech);};
if (daytime == 18.000) then {sleep 0.01;};
I'm trying to set the time (of the mission) to 6pm (18:00)
but when I run this code
it randomly skips to a time
any reason behind that?
Just use setDate 
why don't use switch?
oh ok lol
what is that
you mean case 0, case 1 and this type of stuff ?
should I remoteExec it?
I think so
Check the wiki
I'm on my phone
Time is synced , u dont need as long as it is server executing it.
[date select 0, date select 1,date select 2,18,0] remoteExec ["setDate", 2]; ?
btw that doesn't work
yep, u can go with 0 as well, sometimes (if there is a diff of 15 mins, it sometimes doesnt sync according to my test 2 years ago)
I'm trying it
but its not working for some reason
console
[[2021, 05, 05, 12, 00]] remoteExec ["setDate"]
