#arma3_scripting
1 messages Β· Page 704 of 1
unique vehicles
@little raptor will waitUntil require me to spawn the code?
or does only sleep n; require spawned code?
yes it will
anything that requires suspension will
god fin damn it
what's the problem?
i wish waitUntil had some sort of limit in unscheduled, like while does π
Testing from the debug console right now while on dedicated
And it does what I need without the spawn
but I can not put it in the init of the player object because it will run the code before alive player
It needs to be inside the playerobjects init field
and wait until the player actually can see shit
That is the code
this spawn {
waitUntil { alive _this };
sleep 1;
hint "did A";
if (local _this && !isServer && hasInterface) then {
hint "did B";
[true,true,true] call ACE_spectator_fnc_setSpectator;
};
};```
^that shit^
goes into playerobject init field
does not work on dedicated
I simply spawn without anything happening
because I want it to be there
as it is only for specific slots and needs to be JIP compatible
the faster you learn to do external scripts, the more likely you are to not lose all your crap when arma inevitably fails you.
In an easy way for people to understand as in, take this and paste it in the slots init
My missions are full of external scripts
_x addEventHandler ["Killed", {castle sideChat (format ["Lost %1 to %2!", _unit, _killer])}]
so, how do I access the output of an EH? I'd like to announce in chat when a friendly is lost, and say who killed your ally. _unit, _killer just returns me "Lost any to any!"
I sort of have the feeling that spawned code within the init field kinda doesn't work, because it loads a weird screen in between slotting screen and map screen
pretty sure its the spec
so hard to see tho
try using default spectator first to confirm your code works
did you define the other parameters for ace spectator?
wat?
did you add sides for the spectator to view?
[[west], [east,civilian]] call ace_spectator_fnc_updateSides
0: Sides to add
1: Sides to remove
You forget to define _unitand _killer
_x addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
castle sideChat (format ["Lost %1 to %2!", _unit, _killer]);
}]
alright well let me do some testing to see if its something you're doing. standby
if (local this && isPlayer this && hasInterface && (!isServer)) then {
this spawn {
waitUntil {alive _this};
[true, true, true] call ACE_spectator_fnc_setSpectator;
};
};
this works fine for me
On dedicated?
Nope, just put it in debugconsoles local exec
because this doesn't exist in the debug console...
i just pasted it in with this as _unit and _unit = player and it works fine on my dedi
local debug
//if you want to use debug
_unit = player;
if (local _unit && isPlayer _unit && hasInterface && (!isServer)) then {
_unit spawn {
waitUntil {alive _this};
[true, true, true] call ACE_spectator_fnc_setSpectator;
};
};
working! Now to find a way to return the actual vehicle names. something like "Lost M2A1 Slammer to T-140 Angara!"
okay, I will try it again @fair drum Thanks so much for your help sofar man!
getText (configFile >> "cfgVehicles" >> typeOf _vehicle >> "displayName")
should be a good start
i think this is an issue about when ace spectator can be run. it won't run exactly at mission start. you might need to give it a few frames
this spawn {
waitUntil {alive _this};
sleep 3;
if (local _this && isPlayer _this && hasInterface && (!isServer)) then {
[true, true, true] call ACE_spectator_fnc_setSpectator;
};
};
this gives you your intended results
just have to give ace more time to initialize
you can bump that sleep down over and over till it fails
The issue is, that I still do not know if the if condition was my mistake or that ace did init too early
i think its ace inits because i ran into your issue when testing and all i did was add more time
only thing possibly was that the not could have messed up. i keep my not isolated. but I think it just needs more time than 1 second
yeah its just the time. the condition is going to go through all the commands since they are nular and unary operators, then will do the logical operators.
you also don't need to check for hasInterface because that function already checks it
the delay for alive check is built in
// Delay if local player (must not be ACE_Player) does not exist
if (isNull player) exitWith {
[
{ !isNull player },
FUNC(setSpectator),
_this
] call CBA_fnc_waitUntilAndExecute;
};
cheers. working as intended!
everything you ever need to know is on the github
stop the swearing
wat? f = o7
what era are you from π ?
Oh the one above that
I see
and above that one too. no swearing in these channels
good christian scripting channel
server #rules
Yes... what else but server rules would it be in? You ain't knowing that meme? Christian xyz?
testing this on dedi now
@fair drum IT WOOOOOOOOOORKKSSSSS π₯²
Anyone know if it is possible to create and delete a zeus module from script?
(Any tips are welcome)
Give the module a name an use <objname> call BIS_fnc_isCurator ?
Not sure what this would return tho
I would have to create it first tho, how would I do that? without placing it in editor
uh...
assignCurator @somber radish
nope
Actually... yes. That should be it. player assignCurator and player unassignCurator
Do not even have to place a module manually
@somber radish
Yeah
That assigns a pre-placed Zeus module to a player
But I need to create the module ingame
on the fly
Kinda like what is done using ```sqf
CreateVehicle
are you using ace?
@somber radish
Curator modules to initialise properly, especially when setting allowed addons, need to be created before time > 0. It would be best to create as many curators as needed (playableSlotsNumber ?) in a preInit function.
- By Larrow in BI Forums
ace you can create curators during the game. its complicated. here's the code...
Trying to keep everything vanilla
then no you can't
π
just create the slots before hand and assign them as needed
Oh well, thank u guys for the effort in helping out anyway
Well can't he simply take the code from ACE team, adjust it and preprocessfilelinenumbers it for own use?
no, he can't. ace uses CBA macros and their own macros
right, cba, forgot that
I want to avoid that because each Module is a looping script which affects performance
yes
each Module is a looping script which affects performance
wat? no
I do get them up when using ```sqf
diag_activeSQFScripts
How?
it's complicated 
Any pages I could read up on?
Β―_(γ)_/Β―
Niiice, I was googling like a madman and couldnt find it
I'm not sure if there are any BIS functions for these, but:
_curator addCuratorAddons activatedAddons;
_curator addEventHandler ["CuratorObjectRegistered", {...}]; //set costs
[_curator, "object", ["UnitPos", "Rank", "Lock", "Damage", "Fuel", "RespawnVehicle", "RespawnPosition", "Exec"]] call BIS_fnc_setCuratorAttributes; //set attributes
....
//set owner
_curator setVariable ["Owner", getPlayerUID player, true];
player synchronizeObjectsAdd [_curator];
player assignCurator _curator;
something like that
zeus module? I don't think so...
P.S: I'm not sure if what I said works in MP properly. I've only tried in SP
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["HC\data\scripts\HC_local.sqf","A3\modules_f\HC\data\scripts\HC_local.sqf",true,158],
Getting one for each module placed
If is faster
yup
π
call {
if (_something) exitWith { /* some code */ };
if (_somethingElse) exitWith { /* some other code */ };
};
```this β is faster π
I want to make a function that uses sleep. do I have to call it from a script?
if you make a function, use CfgFunctions
if you want to call it from a trigger/init field, use spawn
Does anyone know if it's possible to force a client's FSAA to Disabled?
not possible
I figured π¦ Was worth a shot to ask though.
Any suggestions for how to mitigate the new AMD driver/foilage issue for people then?
It's most likely just a waiting game until AMD fixes their shit in a future patch, but hoping there's something server owners can do to combat it
that's a user-side error, not a game server one
I know, but if people are using/abusing it, it allows them to see people that they shouldn't no?
still
or are people still hidden even though the foilage is not displayed?
nope, I don't think they are
π€·ββοΈ Worth a shot anyway, thanks for the info again.
show them a warning message or something
automatically ban AMD users :^)
How do I set up a vehicle so that it can take damage but never explode/be destroyed?
I assume this is something on the handle damage event handler
correct! make sure that the "" damage section doesn't go over 0.95 ir 0.97 iirc
gotcha
Can anyone help me attach a camera to a missile? Currently trying to use camCreate and attachTo.
@winter rose did this, didn't seem to work: sqf this addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"]; if (_damage > 0.9) exitWith { 0.9; }; _damage; }];
then-else ; exitWith does not work (well?) in EHs
ah
I didn't know about that... I just thought EHs did not work well with anything really... so how about using that call {
if (_something) exitWith { /* some code / };
if (_somethingElse) exitWith { / some other code */ };
}; inside the EH?
Is there a way to add an action to an object only for specific players, I wanna make a tp available to only marksman in the team so that the rifleman don't get a bunch of dmr's from the marksman cache
but like on an object and not present all the time for that specific group
if anyone has an answer pls ping me I'm off to bed
IDK - see KK's note on an EH page
what else "doesn't work"?
Are you sure? Why should it be any different? AFAIK it works just fine
there is a KK note somewhere, also some people asked about that this month iirc
Yes
Only add the action on that unit's machine
Gonna look it up. Thanks
Looks old tho 
Does it still apply?
one way to find out! π
people asking about that had the issue IIRC, but it is still a good thing to try an if exitWith in e.g a HandleDamage
so we can "still in 2.06" mark the note
it doesn't make sense tho. exitWith is almost literally call {} breakOut "scope"
or maybe it works like apply? π€
To that units machine?
Well like obviously I could do that. Doesn't mean the players would actually follow that lol
β¦sqf?
I would say if it doesn't work it is the apply thing
See remoteExec
Or are you talking about vanilla object actions?
Like rearm, inventory, etc.?
Doing a simple teleporter script on a tent with no doors so that people with the machine Gunner role for example can have the action to scroll wheel on it and hit "enter tent" and then teleported inside tent where there's a cache of weapons. This would use the addAction function
I don't know how I'd specify in the addAction function that only certain players can see it
Ok then use remoteExec
How does remote exec help with that?
And you can also modify the addAction's condition
Actions are local
They're only visible on the PC where the action was added
The action is just added in the init of the tent
It's worked on servers before
For me
And other players
Object Init executes for everyone
That's why
So how would I go about doing a local execution. I'm not like a master coder lol
Depends. Can the player's role change during mission? (Like that marksman thing you said)
what is "the apply thing" though?
Nah they can't change
I can literally just give a variable to each person of each class
There are only a few of each type
the lazy way of doing what you want is changing the addAction's condition
Okay what I have right now is the basic way where it's like addAction name, runsqf;
How do I add the condition to that
_this in [unit1, unit2, unit3]
See the wiki
Like I see that theres a condition in there that's possible but don't I then have to include a ton of other stuff in front of it
To actually just get a condition
I mean like that thing where if you break apply/count codes with exitWith unexpected results will be returned
Yes
ah yeah, mayhaps
I don't know if it is an unscheduled/return value code synchro thingy
So just to get a condition I need the bloody argument priority hide show and shortcut
Just look at wiki and fill in the defaults
I've been playing around with the radio commands and have one that calls a script to replace the players' gear as a test. After testing I noticed when it's used it'll run the script for all players rather than the person who called it. Is there a way to make it run locally for the player that calls it?
Triggers make me angry π
Triggers are already entirely local. The way you describe it it appears Arma synchronises the radio activation across all clients.
That would make sense, it only became an issue after running the script through the radio
I don't see a way to solve this problem right now. Each client has its own trigger that then fires at the same time as the other client's triggers, there's no remote execution involved, every client resolves the On Activation code locally. I don't see a way to get the original source that made the radio input.
I appreciate you looking into it. Been spending a lot of quality google time without success myself. Thinking I'm just gonna have to bite the bullet and learn how to make a gui menu
Thanks for the help though
Is addAction not an option for your use case?
I was doing everything with addaction for a while but I've got a few "abilities" id like to give players and they were cluttering up the scroll menu/making selecting the desired option difficult
That's why I was gonna move them to radio commands, but evidently that wasn't a good idea
Might just make a single addaction entry that opens up a submenu for the others
Why not use the roleDescription in the condition? condition: sqf "'marksman' in toLower (roleDescription player)"
because translations π
hm
yea
could use classnames?
My unit uses the correct classes for all our units, makes life simple.
the thing is: what makes a marksman or a sniper? the rifle, the outfit, the starting slot?
Actually I don't think role description is localised, as it's a property of a unit in Eden and not the config or anything
and objNull == objNull always returns false, and will return true once player is !null
Why would anyone do that tho :u
player==player established itself as "the standard" back in Arma 2. Even though its somewhat stupid and there are better solutions
even I used it, and isNull exists for a long time so I don't get where the hype came from!
yes and no. If the unit is local to you, local will be true.
For units placed in editor, local is usually only true for the script that runs on serverside.
It could be a AI posessing the unit too, which would make it !null
at that part I meant objNull isEqualTo objNull but objNull != objNull 
I realized that objNull == objNull is false after testing (didn't expect it tho)
correc'
If the side is west then no. Because you do 4x if, 4x then, 4x playerSide, 4x isEqualTo.
Wheras the switch will just jump out at case east
Also if you want know performance of scripts, you can always just check in debug console.
if then -> 0.0028ms
switch -> 0.0016ms
its not
not even this?
that is probably the best, according to wiki
0.0013ms
@still forum do you know why?
I just tested and it is true
If I knew I'd have already answered
but makes no sense
thought you didn't see it π¦
why not ask KK?
but Dedmen is a giant orange fox!!
Because exitWith has to follow the rules set by KK in his note on https://community.bistudio.com/wiki/exitWith
and I'm a giant orange Leopard! π
fight talk then π
ah so that's why I thought it worked
I always write my EH codes like this:
bla addEH ["EH", {call fnc}];
because of the compile issue that EHs had at some point (still not sure if fully fixed)
Because KK said so, and exitWith is scared of him 
is fixed afaik
If I put name setPos[getPos x]; in a onPlayerRespawn.sqf
When that specific player respawns will he teleport to x position?
Name being variable name
no
Ah trying to make specific respawn points for specific units
{ case "zulu": { player setPosATL getmarkerpos "respawn2"; };```
Would that be it? Sorry for format on mobile
player setPosATL getMarkerPos "respawn2";
Edited message
does anyone know if https://community.bistudio.com/wiki/Arma_2:_Modules:_UAV works on a dedicated server? I tried it but it only works locally but never on a server
if (!isNull playerUAV) exitWith {
player groupChat "You already have a UAV";
//--- Disable targetting.
{(gunner playerUAV) disableAI _x} forEach ["TARGET","AUTOTARGET"];
};
if (!isNull playerUAV) then {if (!alive playerUAV) then {playerUAV = objNull}};
_uav = createVehicle ["MQ9PredatorB",getPos player, [], 0, "FLY"];
_uav removeWeapon "HellfireLauncher";
playerUAV = _uav;
processInitCommands;
_group = createGroup west;
_driver = _group createUnit ["USMC_Soldier",getPos _uav, [], 0, "FORM"];
_driver moveInDriver _uav;
_gunner = _group createUnit ["USMC_Soldier",getPos _uav, [], 0, "FORM"];
_gunner MoveInGunner _uav;
uavmodule synchronizeObjectsAdd [uavterminal, playerUAV, player];
this is what i am using
uavmodule is added by the mission editor
just as uavterminal
on a dedicated server, UAV action is missing from the terminal, however it is spawned and all variables are assigned
So basically it still does what I need it to do.
When its editor placed and is AI and I call a server script asking if the unit is local and its not a HC it will return true, but it won't return true but false if the same script is called severside and the same unit has been slotted with a player. Because now the object is local to the connected client with hasInterface? Therefore the serverside script asking if local returns false.
If called locally by the onPlayerRespawn it will return true because obviously its local.
Locality make brain go poof
https://community.bistudio.com/wiki/Multiplayer_Scripting#Locality may help you? π
Probably read that side 20 times by now and It still turns me into a mushroom
Hi all. How can i get a satchel or explosive charge to activate a trigger when they blow up?
hi, was the satchel placed by a unit or by script?
Well, want to be able to place it from a player.
For some reason I cannot post SQF code... the server rejects it with "Your message could not be delivered" message even thou I have 200 characters left to spare and I am not quoting anyone... why is that?
your free support trial has expired π
So I was banned?
β¦that's a joke
```sqf
this is a test
// test
hint "test";
```
try this?
//Test
This is a test
// test
Perhaps it was too long? Even thou it said I had characters to spare
so you can
and since the Discord limit is 2k chars, yeahβ¦ post a link instead thank you π
Were can I put longer code for you guys to see?
sqfbin
Ok so according to what Lou said, and KK wrote years ago on the wiki and Dedmen failed to comment on and therefore almost confirmed it... this code wouldn't work right on an EH: https://sqfbin.com/izobamumocuziyotuxav
I am asking because I've seen ExitWith being used in LOTS of mods and by very experienced modders/coders too... so all those mods and scripts are broken and they don't even know about it...
I could warn a few of them so they can change their EHs
see exitWith's page on th wiki yeah
and no need to post all this to ask a question about exitWith, plz simplify π
also, they might have wrapped it in a call {}, which would then make it work (as per KK's note)
Well I wanted to show the code because it is the code that @digital jacinth uses in his "Armor Plates System - Standalone Alternative Medical System" mod https://steamcommunity.com/sharedfiles/filedetails/?id=2523439183
And the poor guy doesn't know that exitWith is broken inside EHs
well now he knows, because you pinged him
thank you, really! we can't have fun anymoreβ¦
KK's note on the ExitWith wiki or the EHs Wiki? Can you post the link please π
exitWith
Yes we can fun, sorry for being such an old worm but I really got scared from the revelation because I've been using this code for a long time in my missions and now everything makes sense! π
I was joking about "oh no now diwako knows and we can't make fun of his code not working"
(which was obviously not the case ofc)
but yep, it's an important one to know with EHs (e.g "HandleDamage")
The benefits of randomly reading this Channel proved invaluable time and time again
// do this in some init field
TAG_sideSwitchMap = [west, east, resistance, civilian] createHashMapFromArray [{"west"}, {"east"}, {"resistance"}, {"civilian"}];
call (TAG_sideSwitchMap getOrDefault [playerSide, {"default"}])
constant time π and fastest
createHashMapFromArray [{"west"}, {"east"}, {"resistance"}, {"civilian"}];
what
oh. secondary syntax.
don't mind me
ever heard of WFSideText? :p
Hello guys, i got a problem with passing an argument to antoher script. I want to pass an Object identified by its "VehicleVarname" to a script. I tryed it with "call" but i get the error "Error Call: Type string, expected code". Im using this code to identify the object and pass it to another file.
[_vendor] call "myScript.sqf";```
use execVM instead of call (https://community.bistudio.com/wiki/execVM)
note that call and execVM behave differently: when calling "call" the script will wait until the script you are calling is complete, that's not the case with execVM, which will execute the script and proceeds to the next line while the script you execVM'ed could still be running
@patent lava im having a problem im using a function for that because im doing somthing for an altis life server. execVM dose only work for calling files by thier names. What can i do else to make it work?
open up an issue on the github page. I am currently a few thousand km away from my PC looking at bombed houses. that said I am fairly certain I am using a call to my own function which should work just fine.
if you want to do it the "proper" way, follow this guide: https://community.bistudio.com/wiki/Arma_3:_Functions_Library#Function_Declaration
with this method you can define .sqf files as functions, and then you can either use the call or spawn function
lets say you have a file named "fn_myScript.sqf" and you define it following the linked page
you can call it this way:
[player] call MYTAG_fnc_myScript;
// or
[player] spawn MYTAG_fnc_myScript;
@patent lava can i use it also like this?
_vendor call life_fnc_myfunction
because i need the vendor with is an object to be transferd into the other script
yes, thats what the argument array is for
Anyone need a setVelocity with more than 5km/s speed?
We need at least 299.792.458 km/s π
Why?
see #dev_rc_branch
I'm applying the same limit this as setPos has
good
And i also fixed the memory leak/game crash when you go out of bounds so far (which is the reason for what the setPos limit was introduced)
so technically we don't need that anymore buuuuuuut
Shouldn't it be 50 km/s then?
Same kind of limit
ok
Well even 5 km/s is absurdly large for a game engine like Arma
So I'd say it's good
Okay I must be stupid or something but why isn't this working.
this addaction ["Rifleman and medic tent","Riflemantele.sqf",this in [team1, team2, team3, medic1, medic2, medic3]];
Its supposed to only add that action to a tent for the players that have those variables on their player character so that other players can't use it. The code is just placed in the init of the tent. When I tested it it still added the action to everyone that wanted to interact with it
I tried using _this but it was complaining that its a local variable in global space
this addaction [
"Rifleman and medic tent", // name: OK
"Riflemantele.sqf", // script: OK
this in [team1, team2, team3, medic1, medic2, medic3] // boolean: WRONG
];
see https://community.bistudio.com/wiki/addAction @fossil peak
I've looked at it, I'm pretty bad at coding and it hurts my brain to read lol everything I've made so far is so bodged
the simplest way would be to use```sqf
if (player in [team1, team2, team3, medic1, medic2, medic3]) then
{
this addaction [
"Rifleman and medic tent",
"Riflemantele.sqf"
];
};
thanks for the help though
Is there a reason why would anybody do:
call {[params] call SomeFunction};
instead of just:
[params] call SomeFunction;
in vehicle's INIT field in mission?
CBA to prevent some init field issue (that has been fixed now so they don't do it anymore)
Aha, so it is a forgotten leftover, thank you.
btw. just out of curiosity, what was that issue?
the top level scope of an init had some extra linting stuff
the init field could not have any value, e.g [] spawn {}; returns the spawn handle
so you had to do an awful 0 = [] spawn {};
its just nonsense, thats the easiest way to describe it π
because call {[] spawn {}} worked fine, though it still returned a script handle
π this rings a bell now
is there an EH that fires when a vehicle weapon/magazine runs out of ammo?
How can I make a trigger to determine if a specific vehicle enters an area? (Not a type of vehicle, by the variable name is fine)
Would that have to be game logic?
(player needs to deliver truck to specific location)
use just a trigger. I think if you synchronise it to the truck and make the activation "present", it should work
Ah! Right, not player...Gotcha!
None that I know of (https://community.bistudio.com/wiki/Arma_3:_Event_Handlers). There is a command to check though: https://community.bistudio.com/wiki/someAmmo
yep
use the "fire" EH and check if the mag still has something
that's the closest I could find. how does that EH work, exactly? if I fire one bullet, it'll fire once? if I fire a burst of three, it'll fire three times?
Hello its me again. I managed to get my script working but when i use it on my dedicated server the "#particlesource" is not emmiting particels. Dose someone know what im doing wrong?
The Code:
["_nObject",objNull,[objNull]]
];
_pos = getPos _nObject;
_smoke = "#particlesource" createVehiclelocal _pos;
_smoke setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [2, 6, 12],
[[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]],
[0.25], 1, 0, "", "", _smoke];
_smoke setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_smoke setDropInterval 0.1;
_smoke attachTo [_nObject, [0,0,0]];
diag_log "Smokeisda";
sleep 19;
deleteVehicle _smoke;```
latter yes
I hope it isn't a performance hog If I attach it to a vehicle with a minigun 
nah
because you break execution after only checking if the magazine is 0
I don't think you can fire more than once per frame π
particles are local, as createVehicleLocal implies
As long as your gun fire rate isn't greater than your fps*60. 180 per minute at least. Don't know why you would ever willingly play ARMA with only 30fps.
even if it were, an ammo check is not much
Just a single var check per frame. < The thousands of lines of codes that are regularly executed every frame.
I don't know, it might be too intensive.
lol
how do I refer to the event handler object? I use _this?
no
look at BIKI
there is a doc, read it indeed π
I did this... like, yesterday π§ 
then, if you forgot, redo it π
pain is more or less part of the learning process, mostly because it is unavoidable, not because it is great π¬
I'm trying to make a basic fortification system kinda like ACEX fortify and Plank but I'm not sure how I should update the preview object to be in front of the player. I have functions to update the dir, pos, etc but I'm not sure how I should keep calling those without killing frames.
attachTo
but you won't be killing frames if you do the manual way properly
I don't know why you want "functions to update the dir, pos,"
just use modelToWorldVisualWorld and vectorModelToWorldVisual
Alright. But how would I go about constantly updating it? Cause I'm trying to have object snap to the surface below it as well
surfaceNormal
- AGLtoASL
if on terrain
otherwise use getPos
And to keep updating it use a while loop with a small sleep?
Yeah. Then delete the local object and create a public when they confirm the position
yes
Now I just got to wrap my head around how I'm going to order this
You guys know a good planner website that has those automated shapes and arrows so you can see the flow of things?
HAH! joke's on you
http://penandpaper.com/docs/solutions.htm

lucid charts is what I used in school for flowcharts and UML and swimlanes
Yeah that's what I was looking for. I remember using it a while back but forgot the name
I use this one all the time. gets the job done, is free and has no shape limit afaik
ok, so, since the vehicle has multiple magazines, I need to keep track of them efficiently. the event handler is set and working. I've tried using someAmmo, but it also takes into consideration vehicle countermeasures. it would only fire the condition after I've spent all the ammunition including the countermeasure magazine, which is something I don't want happening. the script must check if any of the magazines is empty (magazinesAmmo?) and the magazine that is empty, disregarding the others.
someAmmo is not to be used in that case
and all you need to do is check if the currently fired magazine is empty
because a magazine cannot evaporate and empty by itself π
π π€ π
will think of a way to do this without being more inefficient than bogo sort
the "Fired" EH provides weapon and muzzle
you can do something with that and ammo I guess
it's working! now I just need to currently apply setAmmo with the magazine's appropriate amount. cfg value perhaps
most likely.
what are you trying to do?
if a magazine has 30 bullets in it, the code must set 30 bullets in it.
_unit setAmmo [_muzzle, 2];
https://community.bistudio.com/wiki/setAmmo
If you try to set more ammo than the magazine can hold, it will be clipped at default magazine capacity
if you want to do an unlimited ammo, just do a setAmmo on every shot
I am asking about your final intent
makes it simpler. I'll just slap a "3000" in it.
after completely spending a magazine, the unit / player must wait a certain time until it is automatically refilled
it's infinite ammo, but you must reload
"cooldown", not really reload right?
yeah! that would be a better term
also, inserting a fresh new ammo is doable
grab the mag class, insert in weapon, ready
the "fired" EH does returns _magazine
yep
and instead of toying with setAmmo, you can simply slap a new mag
see addPrimaryWeaponItem
will do. thanks again Lou
I'm trying to return _fortID from WAG_fnc_createFortification to use in WAG_fnc_startFortPlacement for [_player, _fortID] spawn WAG_fnc_updateFortPlacement; but I'm getting an undefined variable error. Anyone know what's up?
WAG_fnc_startFortPlacement = {
_player = (_this select 0);
_fortArray = (_this select 1);
if ((_player getVariable ["WAG_object_placementState", STATE_PLACEMENT_INIT]) != STATE_PLACEMENT_IN_PROGRESS) then {
removeAllActions _player;
_player setVariable ["WAG_object_placementState", STATE_PLACEMENT_IN_PROGRESS, false];
[_player, _fortArray] call WAG_fnc_setFortVariables;
[_player] call WAG_fnc_createFortification;
//[_unit] call plank_deploy_fnc_addPlacementActions;
[_player, _fortID] spawn WAG_fnc_updateFortPlacement;
};
};
WAG_fnc_createFortification = {
_player = (_this select 0);
private _fortClassname = _player getVariable ["WAG_fortClassname", objNull];
private _fortID = createVehicle [_fortClassname, [0,0,0], [], 0, "NONE"];
[_player, _fortID] call WAG_fnc_setFortDirection;
[_player, _fortID] call WAG_fnc_setFortPosition;
_fortID;
};
You're not saving the returned value? 3rd line from the bottom in the first function
also I'm not sure if this is the final fortification, but anyway, just letting you know that your object is not local
also you can't return anything from a spawned code
it simply gives you the handle to the spawn
oh nvm
you're calling it
call WAG_fnc_createFortification; That's spawned?
yeah
createVehicleLocal right?
createVehicleLocal [_fortClassname, [0,0,0], [], 0, "NONE"];
createVehicleLocal doesn't have such syntax
dang
will this work for vehicles? on the BIKI, it explicitly says "this is used for infantry weapons"
won't
but you can addMagazine / addMagazineTurret etc
if you want to cover both, maybe your previous version is better (or you could check if one is human, etc)
How to open/close the cabin door on Caesar BTT using a script?
try animateDoor
i tried animate, animateDoor, animateSource, all with various sources like door_l, door_r, door_l_open, door_r_open, and even cabin just in case, but nothing works.
Have you the correct animation name using https://community.bistudio.com/wiki/animationNames ?
animationNames does list several of those sources i mentioned, apart from other things that are obviously unrelated.
But none of what i tried worked.
Hey Guys its me again. I still got the Problem that the "#particlesource" dose not emit particles on my dedicated server. My script works on singelplayer (editor).
Here is what i did:
Im calling the script via remoteExec like this:
[_nObject] remoteExec ["life_fnc_myParticleFunction", 0];
The code of the Partikelscript looks like this:
["_nObject",objNull,[objNull]]
];
diag_log "Script called";
_pos = getPos _nObject;
private _smoke = "#particlesource" createVehiclelocal _pos;
_smoke setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [2, 6, 12],
[[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]],
[0.25], 1, 0, "", "", _smoke];
_smoke setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_smoke setDropInterval 0.1;
_smoke attachTo [_nObject, [0,0,0]];
diag_log "smoke spawned";
sleep 19;
deleteVehicle _smoke;```
The script gets executed and i can tell that by the diag_log in the scripts that is beein outputed.
Oh and when i do swap the _smoke part with a smoke grenade like this:
```_smoke = "SmokeShellRed" createVehicleLocal _pos;```
The grenade spawns even wtih the throwing sound but dose not emit smoke, just the object is getting spawned and attached there.
I think particle source is local - after all you are even using createVehicleLocal - so that won't do much when used on a dedicated server.
So, you need that script to run on a client machine (each client machine, if all players are to see the particles).
privateο»Ώ _dummy = selectRandom thisList spawn
{ ο»Ώ
private _grp = group pc1;
privatο»Ώe _wp = _grp addWaypoint [position _this, 0];
_grp setCurrentWaypoint _wp;
waitUntil
{
sleep 2;
_wp seο»ΏtWaypointPosition [position _this, 0];
not alive pc1 or not alive _this
};
};
I have been pinged?
One more thing... i recall i had to attach the particle emitter to player, or to player's vehicle if the player was in one, otherwise there was some problem and i think the problem was that the particles weren't showing.
I even had to use GetInMan/GetOutMan eventhandler for every player, where i would keep reattaching the emitter to (vehicle player).
EDIT: that probably had to do something with the particle emitter getting left behind at the spot where player entered vehicle, so i had to reattach the emitter to the vehicle, and then obviously back to player if player exited the vehicle.
https://community.bistudio.com/wiki/fadeSound I'm kind of an idiot, anyone know if a fadesound value of 1 is more quiet or less quiet then a value of 0
it doesn't say
And since i don't see you changing the particle parameters at runtime, you may want to consider making an addon where you define the particle parameters in CfgCloudlets config - it should have less impact on performance than a fully scripted particle effect you are using (see https://community.bistudio.com/wiki/Arma_3:_Particle_Effects).
@supple matrix thank you 4 your reply β€οΈ but there must be another way or something im missing because it works when i use it on the editor and i got it to work on the server but i lost the progress and i dont know how i did it π¦
and that should be given given with the RemoteExec 0 so the code is beein executet on all clients
What is the _nObject?
ok.. the problem with the current script is that it only resupplies a single weapon/hardpoint. if a helicopter has two rocket launchers, it will only resupply one of them fully. I need to find a way to rearm all magazines at once
Shouldn't you call it _nObject remoteExec ["life_fnc_myParticleFunction", 0];
You mean the param? that is for convenience, you can keep that.
Anyway, sorry, i was mistaken, i think you are passing the object to remex just fine, i just got confused π
Does the nObject exist on the client? isn't it something local to somebody else existing on some other machine only? (like something created with a create...Local command?)
its an object played on the map that is called by its VehicleVarName
@tired delta did you try writing _pos to the diag log?
...just to see where that particle emitter really gets created
yes and i get a pos out of it π
and the position is not somewhere far away from your player? or under the terrain?
no because when i cahnge the code to spawn a smokegernade and attach it to it , it spawns and gets atteched
@supple matrix its just strange that the particle dont emit
when you say called you mean spawned yh? Or something scheduled?
oh sorry π by called i mean that the script gets executed
yhyh, just making sure we are not missing something obvious π
thank you π
Have you check your server rpt to see if throwing any errors, i dont rlly see why it would be but just in case?
i did but no errors on server or client
i think im missing somthing but i dont know what. I wrote earlier that i made it work in an early stage but lost the Progress and now im struggling to find out how to fix it
I'm trying to set the _fort object to be in front of the player (as done in modelToWorld) but I'm also trying to make the object snap to the surface below it so that way I can move the object to be on the surface of buildings. I've tried a lot of stuff but I can't seem to get it to work.
_player = (_this select 0);
_fort = (_this select 1);
private _newPostion = _player modelToWorld [0, (_player getVariable "WAG_fortDist"), 0];
_fort setPos _newPostion;
yeah I can't get this EH working. Either the vehicle still explodes or no individual part actually takes significant enough damage to be disabled
/*
Infinite ammo for vehicles.
A cooldown at the end keeps vehicles from spamming weapons endlessly (needs to be implemented)
*/
{
_x addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine"];
if ((_unit ammo _muzzle) == 0) then {
// _unit setAmmo [_muzzle, 3000]; // works but has issues.
_unit addMagazine (currentMagazine (vehicle _unit)); // limited (something wrong with the condition?)
reload _unit;
}; //end if
}]; //end EH
} forEach vehicles;
/*
Issue: only resupplies the last weapon of a kind fired. If a vehicle has two or more identical weapons (share ammo and weapon slot) only the last weapon that fires will be resupplied. take two rocket pods as an example. both are fired at once. The counter reaches 0, the script resupplies but only one of the pods (last fired) is resupplied.
Issue: only works on the last magazine spent. A tank cannon has three magazines: HE, HEAT and AP. If one of those magazines are spent, nothing happens. this happens because the condition (ammo muzzle == 0) is only considered 0 (empty) when there are no more magazines, as observed: when there's magazines left and one magazine has been just spent, the ammo counter does not reach '0', but instead counts the ammo on the new loaded magazine.
*/
If someone knows an approach to the issues above, please contact meee
What are people's tricks to shorten the iteration cycle when you're developing an UI or scripting something (including a multiplayer mission)? Any ways to do hot reloads of the edited files or something like that?
I think if you use execvm which calls the sqf directly you can hot edit the file...but I've never tried it...
I've been thinking the same thing lately...
I use a KeyUp eventhandler (Numpad 1) to execute a sqf file. In that file I have all the functions I am working on atm and at the bottom I put a [] Spawn Function thing. That way I can just make a change in the text-editor then press [1 NMPD] and see the effect
(No idea if I explained that correctly)
Hi all. Unsure if this is the correct # to put it in, but happy to be redirected if not.
I'm making a couple of derivative Ammo Boxes from Base Game, changing the displayName and tweaking maximumLoad slightly. I'd like to have the new displayName from the config (e.g. "My special ammo box 1" & "Not so special ammo box 2") display on screen when you're looking at it, similar to when player names display. I'm at a loss as to how to do this though - whether it be a tag inside the config.cpp of the mod, or it needs to be an EH of some kind, though I've scoured that list as well and can't find something that's appropriate.
Does anyone have a suggestion on how to do this?
you can do that in the functions menu in the pause menu
Is there any way to script it so that tasks don't show up everywhere? like only show tasks within a few km
recompile, for multiplayer mission, if you mean reloading a function on a client, not really possible, apart from recompiling on server, and broadcasting the function to the client(s)
not sure what you mean by that
umm, dynamically enable/disable destination? or maybe this? https://community.bistudio.com/wiki/BIS_fnc_taskSetAlwaysVisible but it's a global function so you'd have to dig abit maybe and find a way to do it locally
So simple, yet so elegant. Thanks @copper raven!
The magazine is already passed to you
Why do you use currentMagazine?
for UI, no way except creating them with a script
for functions, recompiling them (afaik only possible in editor? and you must have allowFunctionsRecompile or something in description.ext)
only possible in editor
correct, and if you want it to be possible in a normal mission
you must have allowFunctionsRecompile
oh 
but anyway as sharp said, it's a bit of a hassle to do in MP
not sure if BIS_fnc_recompile does that automatically π€
the function is changed locally tho 
nothing happens if you remote exec it, the source files on the client are still the old ones
I mean, remoteExec the recompile function to recompile everywhere
I'd like to simulate a laggy, desynced, low fps server for bug testing. Any ideas how to do that?
run it on Windows 95
β¦or run a VM with limited resources, network-limited with a low setting
I tried to get Win95 running in a VM but it doesn't work π
VM server isn't a bad idea
you can attribute CPU, RAM & network in a VM
Yea that'll work I think
I've not used virtual box in about 10 years, this'll be fun
Anyone?
you mean snap to terrain?
No. I have the object in front of the player at a certain height and from there Iβm trying to make the object go down until it hits a surface (terrain or building)
snap to surface then
yeah
lineIntersects then setPosASL?
Alright
I'm getting positionAGL from modelToWorld right?
IDK, the wiki does
I guess Iβll just have to guess then but it seems like it
Considering it says right below it
"See also: modelToWorld, worldToModel, modelToWorldVisual..."
yes. don't use it
don't guess, read
setPos
Sets object position to format PositionATL (over terrain) or PositionASL (over sea).
this is completely wrong
Fix it then π
Well it seemed to work so I kinda didnβt bother looking at what it took in 
yeah, it works in that case
I would but I don't even know what to write about it
as I said before it's neither AGL nor AGLS
actually it's both...
Β―_(γ)_/Β―
yeah, but I don't have anything with what to replace it, so I am not just deleting the description, I need a replacement
Sets object position to a format that is sometimes AGL and sometimes AGLS! π€£
if you want to make a small paragraph in the notes I can link to it in the description
You guys know where I messed up here?
private _begPosASL = AGLToASL (_player modelToWorld [0, (_player getVariable "WAG_fortDist"), 0]); //Object pos without checking for surface
private _endPosASL = _begPosASL;
_endPosASL set [2, 0]; //Getting same pos as object but setting Z axis to 0 to get the furthest position below object
_intersections = lineIntersectsSurfaces [_begPosASL, _endPosASL, _fort, objNull, true, 1]; //Ignores the object
_newPos = (_intersections select 0); //Getting the position of the first surface below the object
_fort setPos _newPos; //Sets object to the surface below it hopefully
why not using modelToWorldVisualWorld directly
private _endPosASL = _begPosASL;
```you are copying a _reference_ to the same array. use +
That worked but now setPos is getting 4 elements provided for some reason. Isn't _newPos = (_intersections select 0); getting the intersectPosASL?
Well it finally works. Ty Lou
why thank meβ¦
π
set on a reference
_newPos = (_intersections select 0);
wrong
_intersections is an array of arrays, in format [intersectPos,....]
It may be empty.
the correct way is:
_newPos = _intersections param [0, [_begPosASL]] select 0;
_fort setPos _newPos;
wrong
_newPos is ASL
stop using setPos for the love of god 
and I don't mean just here
forever
Don't worry I fixed all that up already
oh yeah I forgot to remove that. it was an workaround to an issue I had. I had params set up like ["_unit", "_weapon", "_muzzle", "_magazine"], and when I added _magazine it would say magazine not found... I printed _magazine with a hint and its returns was "burst", "manual", etc. same as _mode. I thought: the _magazine param occupies index 3, same as _mode if I didn't erase what I didn't want to use. so, _magazine is actually a renamed _mode in this case. I didn't know the params worked such way.
params simply maps array elements to new variables
[1,2,3] params ["_var1", "_var2", "_var3"];
when the left argument is omitted, it's simply _this
params [...];
//is the same as
_this params [...];
fixed that. now to fix the real enigmatic issues
if anyone could give me some hints to the issues described I'd be very thankful
for the second problem use magazinesAmmoFull
not sure about the first one
I can see how that would work. but still, the condition is still a problem. It wouldn't resupply the vehicles without spending all their magazines in a given muzzle. that's the only way for the counter to reach 0
Anyone got a reliable hack for getting selectPlayer to actually be reliable in MP? Seems to mess up and fail to transfer locality sometimes, or something like that, I'm not 100% sure what the issue is but it ends up with the player in an uncontrollable unit
I'm thinking pfh that is something like (pseudo code as I'm on mobile)
if !(local _unit) then {
[_unit, clientOwner] remoteExec [setOwner, 2]
} else {
selectPlayer _unit
_pfh call removeperframehandler
}
But I'm not sure I'm barking up the wrong tree with what the actual issue is
Must not contain group switching :/
I'm not sure what the issue is in the first place, but what you're doing doesn't make any sense either
The issue being selectPlayer often seems to put the camera where it needs to be, but not pass over control when used in multiplayer
often seems
when do you execute it?
Except it's not really reproducible and although I think it's a locality issue, I'm not 100%
What do you mean when?
init, etc.
Unscheduled function call mid mission
Super frustrating bug as it works most of the time, except sometimes it completely borks character controls
So I'm looking for a dumb hack that makes sure that selectPlayer actually does what it says on the tin.
And brute forcing the locality transfer is one idea, wondering if people have anything better from having this issue before.
brute forcing the locality transfer is one idea
I don't think the command needs a local arg anyway
isn't this your problem?
Creating and immediately selecting player into newly created unit could cause all sort of problems due to possible delay in unit initialization. Give unit some time to propagate properly on network before selecting player into it.
"all sorts of problems" and "some time" are such useless terms that it's hard to tell.
The problem occurs when switching to an already existing unit, however earlier in the script I temporarily switch player to a new agent inside of 1 frame, but the player doesn't need to control it so it's fine if that isn't perfect.
And besides, I actually encounter this issue in Zeus sometimes too. When remote controlling units the control is never transferred, but then also switching back to Zeus the player character is now uncontrollable. Zeus uses remoteControl but the issue is identical, so I don't think it's the mentioned wiki issue.
Which circles me back to thinking that the locality fails to transfer properly, or there is some deeper issue.
Super frustrating all around as it works fine in a testing environment, such as an unstressed server with one or two players.
I have the same issue. My work-around when the unit freezes is using a function that creates a new unit, then copies all variables and gear to the new unit and finally "SelectPlayer" to the new unit
I activate the function using a keyDown eventhandler
Have you found no way to fix the unit itself?
dig more digging, it's not a locality problem
it's some other issue not easily fixed via script π
how do I select a value from a bi-dimensional array?
(_array select 0) select 0 ?
or _array#0#0
Nope, I tried selectPlayer
tried using remoteControl
It seems that there is some data lost when playing on mp
some variable or somethign
If I knew what then the fix would be easy
thanks, so it's a double select
is there a way to force an unit to use/reload a certain magazine?
loadMagazine, I suppose?
loadMagazine is for vehicles, I'm not sure if you can do it for units
I can't even fix it with selectPlayer, must be some deeper issue.
except I can't reproduce it on my own server in vanilla!
Ok spent today struggling with some scripting (im not anygood at it) and what seemed like It should be really easy has led me around in circles, Basically I have done most of an intro script and need to add an image to it at the top then its done but looking at stuff has sent me around in circles. I have it so it blacks the screen at start puts my text up then fades back in etc, but need an image displayed on the top centre of the screen whilst this is happening? if anyone is around to help it would be appreciated.
loadMagazine works, atleast for vehicles.
do it manually
you can also play the reload animation if you care
but there is no actual magazine animations
just the hands moving
my infinite ammo script works very well if there's a reloadtime in the weapon's cfg. I gave a infantrymen one magazine to work with, and fired 300 bullets like he was full of ammo, with reloads every 30 rounds. the problem (I think beyond my reach) is when there's no reloadtime defined or it is 0. happens most of the time with weapons that aren't supposed to have any spare magazines. they reload instantly and consequently fire the next shot very fast in the case of missile launchers or an infinite hail of bullets in the case of cannons and machineguns
Me either, which is why I resorted to create a new unit and then transfer to that one...
anyone knows a way to return an array of only ground vehicles? non-dynamic loadout vehicles would be an even better return
vehicles select {getPylonMagazines _x isEqualTo []} the dynamic loadout part is a guess
actually wait, are there even any ground vehicles with dynamic loadouts?
that might be enough, edited
heh, it's not AND. I'd like to apply to both ground vehicles and vehicles with static loadouts, including air vehicles
to return an array of only ground vehicles
was talking about the "non dynamic loadout" vehicles part :P
vehicles select {_x isKindOf "Land"};
this looks like it will do the trick
yeah, incase it doesn't, the next option is looking up config, that will 100% be right
that is what isKindOf does
yeah but there isn't a class that all dynamic loadout vehicles inherit
i guess you can do !("dynamicLoadout" in typeOf _x)
but then that's classname-based, and mods may not follow that format π
!isClass (configOf _x >> "Components" >> "TransportPylonsComponent")
} forEach vehicles |!|select {getPylonMagazines _x isEqualTo []};
``` I'm getting type number, expected array in this syntax bleh
or count (configOf _x >> "Components" >> "TransportPylonsComponent" >> "Pylons") > 0
yea because you have a precedence issue
(({...} forEach vehicles) select {getPylonMagazines _x isEqualTo []}) is the precedence
Does it make sense or provides any advantage (speed/execution time) if you define the player once _playerObject = player; and then use _playerObject ~Command~ instead of repeatedly doingplayer ~Command~
(inside a script/function)
I don't think so, but⦠an engine dev might help here to make it certain
anyway, the gain would be negligible at best
yes
the gain would be negligible at best
and yes
you think a local var faster than a command? (or maybe you know though)
it is
based on my test just now:
player
```->0.00077 ms
```sqf
_this
```->0.00048 ms
like ~0.0002-3 ms faster 
if you use it like a few thousand times in a script it is worth it
otherwise no
if the assignation itself does not counter that π€£
also if the local variable is not private I'm expecting it to be slower maybe
private _value = player; // 500ms :D
thanks guys π
however there is another reason (not) to do that. if the code is running in scheduled environment, the player object might change, so storing the unit might be either better or worse, depending on what you're trying to do
Sometimes im aware of that. Had to/have to learn that the hard way π
how'd you all put a sleep instruction in an EH?
spawn
aight. I'd need to spawn a function and execute the code I want there, correct? I'd like to use the params the EH gives in the function
yes
just use:
_this spawn fnc
that will cast all of the EH's output into the function?
what is "EH's output"?!
the param stuff
yes
I'll see how it works
You found a reliable repro? I can't do it in Vanilla, I'm wondering if ACE breaks it.
trying to get a image from my mission folder into this command, however it doesn't seem to work. The img folder is in my mission folder:
vultureIcon = addMissionEventHandler ["draw3d",
{
_pos = player getPos [10, 0] vectorAdd [0,0,2];
_k = 8 / (player distance _pos);
drawIcon3D
[
"img\vultureaidlogo.paa",
[-1,-1,-1,-1],
vulture,
1 * _k,
1 * _k,
0,
"",
0,
0.04 * _k,
"RobotoCondensed",
"center",
false,
0.005 * _k,
-0.05 * _k
];
}];
wat? there is no [-1,-1,-1,-1] color
also path to the icon must be absolute in the case of missions
Although you are not SOL, you can still do what you want using getMissionPath https://community.bistudio.com/wiki/getMissionPath
Also is the EH type string case sensitive? Idk but it could be "Draw3D"
isn't that for the default colour of the icon?
Also is the EH type string case sensitive?
no
it's [1,1,1,1]
Problem solved my friend who codes managed to help me through the final bits!
oh right, thought that was white, my mistake
anyone free i need some assistance on adding a range to my add action im struggling to understand it. Don't send me the wiki i been using it and still don't understand it.
code
also plz use syntax highlighting
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Trying to convert this
this addAction["<t color='#FF0000'>Cadet</t>", {player execVM "Cadetloadout.sqf"}];
To
this addAction
[
"Cadet", // title
{
params ["_target", "player", "_actionId", "Cadetloadout.sqf"]; // script
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
50, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
I don't understand. Didn't you just do it?!
no... Im trying to add a range to this script
this addAction["<t color='#FF0000'>Cadet</t>", {player execVM "Cadetloadout.sqf"}];
just fill in the other arguments till you get to the range
this addAction["<t color='#FF0000'>Cadet</t>", {player execVM "Cadetloadout.sqf"}, nil, 1.5, true, true, "", "true", 10];
10m range
ok so wiki just got me confused when I saw this
this addAction
[
"title", // title
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
50, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
you could've just copy pasted it and replaced the parts you want:
this addAction
[
"<t color='#FF0000'>Cadet</t>", // title
{player execVM "Cadetloadout.sqf"},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
10, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
Yeah I can see that im still very new to scripting. But thank you for your help
np
Thanks for the tips regarding shortening the iteration cycle @somber radish @brazen lagoon @copper raven @little raptor ! π
np, best of luck!
I've done great progress on my infinite ammo script. It works for infantry and land vehicles. for vehicles with dynamic loadouts it uses a separate script. Now I just need to add a cooldown and we're all set
anyone have any ideas on making it possible to walk around a moving vehicle?
I wanna make a bus that you can walk around
worst case I can just make it possible to shoot from but the ideal is having it be walkable
I'm afraid of that it'd be really hard to make without proper engine support for it. But who knows? Maybe there's a way for it
that's what I was thinking but someone's made an add-on that lets you walk around choppers
gonna take a look at it and see what it does
that's a negative ghost rider
anyone has a clue how to detect if a weapon in a vehicle is dynamic loadout?
_camera = "camera" camcreate [0,0,0];
_camera cameraeffect ["internal", "back"];
showCinemaBorder true;
;comment "19:56:37";
_camera camPreparePos [3001.66,2937.74,46.1979];
_camera camSetDir ([3001.66,2937.74,46.1979] vectorFromTo (getpos nik));
_camera camPrepareFOV 0.25;
_camera camCommitPrepared 0;
_camera camPrepareFOV 0.1;
_camera camCommitPrepared 10;
yo bros im trying to get camera to zoom
but i want the transition to be 10 seconds, however with this script it zooms in immediately?
There's no sleep between two camPrepareFOV's
_camera camPrepareFOV 0.25;
_camera camCommitPrepared 0;
sleep 1;
_camera camPrepareFOV 0.1;
_camera camCommitPrepared 10;
still same result, instant zoom
How did you run the code?
immediately after camera created
0.25 to 0.1?
yes
Tried to use camSetXXX than camPrepareXXX?
_camera camPreparePos [3001.66,2937.74,46.1979];
_camera camSetDir ([3001.66,2937.74,46.1979] vectorFromTo (getpos nik));
_camera camPrepareFOV 0.25;
_camera camCommitPrepared 0;
_camera camPreparePos [3002.66,2937.74,46.1979];
_camera camPrepareFOV 0.1;
_camera camCommitPrepared 10;
this moves the camera smoothly for 10 seconds, but fov zoom is still instant
yea i tried camset but same result, let me try again
_camera camSetFOV 0.1;
_camera camCommit 5;
instant zoom still
If you do like, 1 to 0.1 FOV, what it looks?
still instant
Hmm π€

Does anybody know why I can't modify the already existing entries in cfgRecoils? Arma2:OA.
radio addAction [ "turn on radio", {
radio say3D [ "Chatter4"]
} ];
The action exists when i look at the radio but is giving me an error saying that Chatter4 does not exsit
The sound name in the player in eden is Chatter 4 so i have tried that and Chatter4 and both give the same error and will not play the sounds
Name != className. Most of scripts needs className which is internal name declared in-game. What is the Chatter4? Did you defined it in Description.ext?
class name isnt needed the script works fine but it is telling me chatter4 does not exist
when in sounds i can see it clearly
ok
im trying to play the sound from a radio object so idk what i would use classname for anyways
what about you give us details so maybe we can find out and explain to you what's wrong?
about four times, then its worth, but ofc depends on the nular command π
Result:
0.0009 ms
Cycles:
10000/10000
Code:
player;player;player;player
Result:
0.0008 ms
Cycles:
10000/10000
Code:
private _player = player; _player; _player; _player; _player
{N > Chatter 1
C > Chatter1 <--
F > \addons\music\Chatter1.ogg } This is the sound name
Variable name for the radio is radio
radio addAction [ "turn radio on", {
radio say3D ["Chatter1"]
] };
Error states "Sound Chatter1 is not found"
it is from a mod I can get the sound to play with triggers using playSound "Chatter1" and it works fine,
does iskindof "Boat" ever exists ?
Check if Chatter1 exists in CfgMusic or CfgSounds
isKindOf "Boat_F"
music
do i need to do playMusic?
am I stupid?
no, but the config might be "too short range" and only work with playSound
unless you are talking about a MP thing where others don't hear it
if playSound "Chatter1" works, something say3D "Chatter1" should work
ok so this works
radio addAction [ "turn on radio", {
playMusic "Chatter1"
} ];
but its not 3D so its not playing from the radio
is there a playMusic3D?
Can I take the file and make it a sound?
Yes. But I have no idea what is your goal so can't say how
I just want the radio to play Chatter 1 as a 3d sound
so, yeah, playMusic is not playSound indeed.
grab the file path from the config, declare it in your own CfgSounds as a sound, and enjoy your music
How can I avoid this while testing my changes?
12:03:26 Flushing file C:\Users\Net_2\AppData\Local\Arma 3\MPMissionsCache\__cur_mp.pbo not possible - still open
do you save as MP then test or do you play MP from Eden?
(also not really scripting ^^)
I have directory symlink from my git repo folder to the MPMissions folder of Arma 3 Server folder, as I thought I could edit the files while playing the mission (but save the changes only after closing the local server)
maybe use filepatching?
Now, when I save the changes after closing the local dedi server, I get that error after relaunching the server and trying to join ingame
Hmm, will test
@winter rose Still the same error
then dunno
Does everyone else really shut down their game and relaunch it every time they add a missing character to a script?
they usually check the script works in Eden ^^
using a dedi is only the last step to check locality issues
So I need to debug the same script in multiple phases because of the game not being able to hot reload a mission file? (Not even an actual hot reload since I close and relaunch the server in between)
-.-
Maybe I'm a spoiled kid but... ugh
I need that Dedmen version of the "Morickyyy....!" meme again π
closing the server should release the pbo at least, if it doesn't, something is wrong or you are running yet another instance
It does release it. Or at least I assume so, because I can save the changes I made to the mission files after closing the server
So Windows releases the file lock at least
But the game keeps insisting that it can't change the __cur_mp.pbo for some reason
I assume it flushes/refreshes the file only if the mission pbo or folder name changes, which makes me think why
I don't know your setup, anyway you can make a .bat deleting that file if everything else fails
I can't, because __cur_mp.pbo is reserved by the actual game instance
(Tried that already π )
β¦so you restart that game instance
I got it to work i took the music from the mod and added a sounds folder to my missions in my profile
That's the issue! It increases the iteration cycle for fixing even the smallest mistake (that misplaced comma as example) dramatically
Unless the code controlling that is written in some really hacky way, it should be relatively simple process to force it to flush it every time unless the compiled PBO checksum is the same
Hello, is it possible to stop a sound after having started it with an "addAction"? I have tried several options but none of them actually work.
{
playSound "alarm_on";
}
];
alarm addAction ["<t color='#8B0000'>[DESACTIVATE ALARM]</t>",
{
???
}
];```
that's what I mean, don't try to use a dedi to test your code
use it at the last stage to make sure locality has been dealt with appropriately

It could be fixed though given that the issue is so simple to fix as I mentioned above, no?
(Filing a bug report just in case)
let's build a car to see if the battery works fine
the proper way is:
save as (MP) mission
take the pbo
put it on the server
restart the server
test
anything else is cheap workaround
That all adds (unnecessary if you ask me) steps and time to the iteration cycle
Therefore, debug your scripts and make your system work in Eden Editor
the dedi server thing is overkill to test scripting, like, really
I understand it if it's hard to fix (which makes me wonder how is it implemented), but if it's such a trivial-ish thing to fix, I just don't get it why couldn't it be fixed.
When it comes to the dedi server, why wouldn't I want to test directly in production-like environment if I had the option? Could see right away if there's something wrong.
Anyways, my blood pressure is starting to rise to a level that I'd need to take another pill soon, so I'll just head to the FT to grumble there about the issue 
why wouldn't I want to test directly in production environment if I had the option?
β¦you're not a dev, are you? π
basically: debug script = singleplayer editor, even a VR world
debug mission & systems = singleplayer editor
debug locality = dedi + 2 players
here you are taking the hard road and say "why is it hard?"
so no, I am not helping you hurting yourself :D stop what you are doing and take even less steps by using the editor directly, period
Soon not an Arma dev at least π€―
Maybe I'm a simple guy but I'd just like to see all errors at once π
then you don't know what to fix
"how to eat an elephant?" "one bite at a time"
Start from the first error and go through them one by one?
check your module that is wrong
fix it
retry
fix the other thing from the other part that is wrong
trying to fix everything at once = big fail
Yes, no no for fixing everything at once
What I mean that β and I don't know about others in this case β that it adds to my mental workload at least to have to debug in phases like that. I already have my tiny brain working at full capacity trying to create something new
The more I have to think about debugging process itself, the less I'm able to focus to actual development. So kind of process optimization
so you overload yourself with ALL the problems at once�
protip, don't π go layer after layer
being able to say "I trust my script, I know it is not what is failing here" is good to have - then you can blame locality or Bohemia
why wouldn't I want to test directly in production environment
yikes
I wouldn't fix all problems at once, but I'd like to just go through them one by one, testing in between each change, regardless whether the bug would be caused by locality, misspelling etc
Oops, meant to say "production-like environment" lol
I have tried the examples but they don't work.
and what have you tried?
@winter rose _source = playSound "AlarmCar"; _source spawn { sleep 1.2; deleteVehicle _this; };
probably won't even that hard, use filewatcher to detect changes to mpmissions, on change, push them to your dedi server with some postfix like mission_001.map.pbo, then swap to your arma instance that is connected to the dedi, #missions and load the latest iteration
you can add new missions to a dedi server without restart, just can't modify running missions
if you are a dev, and you know a tiny bit of js, could use something like fsevents to do it all
Yeah, I get it. I'd just like to focus 100 % on the actual creative/technical process and think as little as possible about the testing process itself. We know what multitasking does to the brain in the long run, not to mention that making constant context switches causes performance losses in brain too
Indeed, could write a script to do that. Just need to learn creating them at first π
yeee, my entire arma server infrastructure runs on javascript
automation helps. But tbh, it's like Lou said, just build everything without worrying about locality, then at least you got a working SP mission
Then make it MP compatible
Then worry about HCs 
CfgFunctions, filepatching (I don't know if you even need filePatching for local mission folders, probably not even)
I'm trying to use sqf TruckName lockCargo [ something , true]; to lock the rear of a zamtac truck but I'm not understanding what index means or how to find out which indexes are which...
I want the driver/front passenger to be usable but the rear of the truck to not...
use https://community.bistudio.com/wiki/fullCrew to find out indices
So I need to combine filePatching with CfgFunctions for it to work?
Because filepatching alone didn't work
alternatively you can get in the wanted seat yourself, and run https://community.bistudio.com/wiki/getCargoIndex @past gazelle
filePatching alone should work, but CfgFunctions with integrated function recompile is probably easier
Ahh I got it!
you can't pass an array to lockCargo, you have to do the command separately for positions 1-14 or whatever is in config viewer...
good thing the wiki explains it all π
use the first syntax then?
or if you have like one position that you want to keep open, run the first syntax, then unlock the x one via alternative
about this...
I was using the diag exe, so it was slower than it should be.
The difference is ~0.0001-2
did you test using an ingame config viewer to make sure?
use camSet... instead of camPrepare...
Does anyone know a way to remove the pause between different arguments of the RadioProtocol?
I am asking because I would like to make a unit say "Fox Two" when firing e.g. a BIM-9X but when I use the kbTell together with the RadioProtocol the unit says "Fox ||<one second pause>|| Two" which sounds like the unit had a microsleep half way through the radio message...
@little raptor tried mate still same result for me, did it work for you in game?
didn't test. but I never use the prepare version of cam commands (due to issues I had with them in the past)
Hmmm, im gonna need someone else to verify in game whether the command is broken or its just my wrong scripting
https://community.bistudio.com/wiki/Camera_Tutorial may help, unsure though
I'm pretty sure that's part of Fox itself
Because iirc Fox is a unit name
So you would experience the same thing if you tried "Miller Two"
If i use hundreds of spawns from time to time, but they last for just a fraction of second, more or less, this can hurt performance in general when no spawn is running? I heard they cause problems after they finish because they are not fully cleared after all. This is true?
no, they are cleared
but using hundreds of spawns seems like a bad design (from the little I hear)
Sadlly the code have problems when running in unscheduled mode.
With only ONE spawn it takes too much time.
May be with more spawns it goes faster.
But if they get cleared, a feel happy. Thanks!
they don't slow down the game
but they slow down the scheduler
in other words, other scripts take longer to complete
having more threads slows things down
don't abuse spawn π
while true 
while true do spawn while true
for "_i1" from 1 to 10000 do {
for "_i2" from 1 to 10000 do {
0 spawn {uiSleep 1000;};
};
};
Run in unscheduled π
I will se what happens with fps.
your game will stop working
you can probably only move if you do that, the rest will be kinda stuck

Scheduled scripts have 3ms of time every frame.
But sorting all running scripts by last runtime also counts into that. Worst case you spend 3ms sorting scripts, no scripts ever run, and all scripts stop running and you waste 3ms every frame
wat?
But for that you really need couple 10k spawned scripts
so that would be a lock case where nothing would ever run again?
aka sorting β 3ms reached β failed β sorting β β¦
yea
Ah no, actually its clamped to 0.5ms at minimum.
So you'll get 0.5ms of scripts at least.
But thats still essentially dead
Yep, now it makes more sense.
Anyone know if there is a command which grabs the steam id of a player?
getPlayerUID
thanks
has any one made a way where you load a kit on addaction, and anytime you die you respawn with the kit you loaded from when activating that script so you dont have to go back and fourth?
I'm sure many have, but you can make it yourself
for an idea of it ofc - adapt it to your needs
When using BIS_fnc_objectsGrabber/BIS_fnc_objectsMapper can you disable the objects simulation so they don't go flying everywhere when you create them?
does the function return created objects?
BIS_fnc_objectsMapper seems to return an array of objects so should I run a foreach on the object array and do
_x enableSimulationGlobal false;
well⦠yes?
alrighty
When using "call", does it loop?
wat
what classes can I use with isKindOf? I'm looking for something like "Aerial vehicle"
isKindOf starts at the classname of the object
if it doesn't match, it goes up the hierarchy tree until it finds a match
I think so yes
when in doubt, look at config viewer
I really wish there was a search function. or i'm missing something
that's a mod, right?
yes
pls share immediately

dang, that worked
any way how to disable markers while operating arma 2 uav? The uav seems to mark everyone on the map
even if disabled in difficulty settings?
How can i get a trigger to play 2 one after the other sounds right now they are just playing over each other, im using say3D
ok thanks i tested around a bit and found the problem, FOV changes instantly when camera dont have target defined by camPrepareTarget, is this intended behavior?
sometimes you want camera to zoom without it tracking a target
I don't think so, and this code is very old
i see, worth creating a ticket or no?
worth a ticket, unlikely to happen but why not
yea exactly what i was thinking xD
is it possible to check the status on a stacked event handler? ie, see that it has been deleted?
but maybe fixed in arma4? 
or, is it possible to get a local variable from inside an event handler and view it?
no
wdym?
so, if i wanted to wait until an event handler/stacked event handler is finished running (i.e. it deletes itself after finishing execution), how would you suggest doing that? you have the ID of the event handler, but I can't seem to find any functions to check if the event handler still exists
i was looking at scriptDone, but that takes a script handle, while stackedEventHandler's handles are just strings
but I can't seem to find any functions to check if the event handler still exists
why would you want that anyway?
just use _thisEventHandler magic variable from inside the EH to delete itself
wait until an event handler/stacked event handler is finished running
you never waitUntil an event handler executes
that would nullify the whole point of event handlers
instead, you do whatever you want to do when the EH executes
(from within the EH code itself)
i was looking at scriptDone, but that takes a script handle, while stackedEventHandler's handles are just strings
event handlers are not loops. they're "idle", and execute when an event takes place
they don't need a handle
horrible hack, but as arrays are references you can pass an array as a parameter then use set on an element, it'll update any other references to the same array
maybe it would help if i explained what im trying to do. I'm trying to use onEachFrame, but from what I can tell you can't pass local variables to that, which leaves me with a bunch of global variables that I don't want to be public, so I'm using the onEachFrame stacked event handler since you can pass local variables to that and keep everything private and secure. I was waiting until the execution inside the onEachFrame finishes, then continuing to the next element in my forEach loop. So, I want to wait until the event handler finishes its forEachFrame loop and deletes itself before I continue.
ummm, why?
I mean why do you use an eachFrame loop like that?
use an eachFrame mission event handler https://community.bistudio.com/wiki/addMissionEventHandler
you can pass params to an event handler that way.
im using setVelocityTransformation, which requires onEachFrame to linear interpolate between one position to another. I'm trying to move away from onEachFrame to using an event handler, so that I can pass private variables.
But as I said, I need to wait until the linear interpolation from one position to the next is finished until I can move on to the next position
yeah, use an eachFrame addMissionEventHandler. You can self-remove an event handler using _thisEventHandler
yea, i've gotten that far, but now how do I check if the event handler still exists?
do everything inside the eachFrame loop
it's not as bad as it sounds
if you do it right
you could use setVariable on the object itself. When initialising the eachFrame:
_object setVariable ["TAG_hasMyEH",true];
when you conditionally self-remove the EH inside the EH:
_object setVariable ["TAG_hasMyEH",false];
if you constantly just delete EHs and add new ones, you eventually run out of event handler IDs
they're always incremented
and never decremented when you delete them
also mind you you can only go up to ~16 M
because of floating point accuracy.
after that EH deletions are hit-or-miss (you could even end up deleting other people's EHs)
i would only be making ~3-4 event handlers
when you pass a variable to an event handler, does it make a copy of that variable or is it a direct reference?
arrays are references, primitives like strings and numbers are effectively copies.
every variable in sqf is a reference
but only arrays and hashmaps have commands that allow the reference to be modified
there, clarified π
so if I passed an object to an event handler, then used setVariable inside the EH, would I be able to getVariable outside the EH?
that worked, thanks. there's probably a better way but for now it's better than what was used before
the setVariable method is the second best way of making sure you don't have 2 loops doing the same thing at once.
the first being make it impossible to create 2 in the first place, but that isn't always an option
Looking for some help, to create a Zeus Module via Function.
The blackbox of doom is telling me I have an error in line 8 of the function, where it does not seem able to pick up the position data, could anyone have a gander and point me in the right direction.
Happy for someone to sit down and show me the error of my ways if easier as I'm a complete novice to this side of the ArmA world π
This is the Function
_logic = _this param [0,objNull,[objNull]];
_units = _this param [1,[],[[]]];
_activated = _this param [2,true,[true]];
if (_activated) then {
[] spawn {
_pos = getPos _logic;
if !(isnull (attachedto _logic)) then {_pos = getposatl (attachedto _logic);};
_dir = _logic getvariable ["dir",random 360];
_h = _pos param [2,0];
_h = _h + 75;
_pos set [2, _h];
_box = "B_CargoNet_01_ammo_F" createVehicle [0,0,0];
_box setPosATL _pos;
parachute_1 = "B_parachute_02_f" createVehicle [0,0,0];
parachute_1 setPosASL (getPosASL _box);
_box attachTo [parachute_1, [0,0,0]];
clearItemCargoGlobal _box;
clearWeaponCargoGlobal _box;
clearMagazineCargoGlobal _box;
{
_box addMagazineCargoGlobal [primaryWeaponMagazine _x select 0, 5];
} forEach allPlayers;
_smoke = "SmokeShellOrange" createVehicle [0,0,0];
_smoke attachTo [_box, [0,0,0]];
};
};
true
you're spawning a new code, which doesn't see your local variables outside of it
Many thanks, how would one get this to read the variables outside of it, is this a simple fix?
yes
just pass them in
and apologies for config, thought it might help for troubleshooting
if (_activated) then {
[_logic, _units, _activated] spawn {
params [_logic, _units, _activated]
anyone knows how to force the reload of a vehicle turret?
my params?
@digital vine ```sqf
_activated = _this param [2,true,[true]];
if (_activated) then {
_this spawn {
params ["_logic", "_units"];
};
};
no
yea need string right
exocet's
i've tried:
_unit = current vehicle
reload (_unit turretUnit (_unit unitTurret _gunner));
reload _unit;
reload _gunner;
Going to have a try now, this has been super helpful π
Thanks!
reload only works if the unit can reload
it doesn't work like pressing R
also not sure if it works on vehicles? π€
if they can't reload, it adds a magazine and performs the reload command
I've only tested units
it does, partially