#arma3_scripting
1 messages ยท Page 24 of 1
Gotcha, thank you!
you also want to setVehicleAmmo where the object is local (i'm not sure where that event is fired)
https://github.com/acemod/ACE3/blob/286537cd541b0d63933d36ff2c8dd03b925598a3/addons/fortify/XEH_postInit.sqf#L86 it fires on every machine, so yeah
There's a few different events listed on the wiki here (https://ace3.acemod.org/wiki/framework/fortify-framework.html, can't send a ss)
I've tried a few of the events but none actually seem to be getting called
objectPlaced should work
Do I have to do anything with the parameters?
_whenPlaced = ["acex_fortify_objectPlaced", {
deleteVehicle test;
}] call CBA_fnc_addEventHandler;
I tried doing this just to see if it would delete a rock when placed, but nothing happens

well for parameters, no
if test is not getting deleted then either you probably didn't add the event or idk
Anyone know if there's a way to return when CONTINUE has been pressed on a hintC hint? Wiki says game pauses in SP but script keeps running ๐
did you try sleep after it?
not yet but scheduling the script every time its run probably isnt a good idea 
wait it already schedules
i shall try that
works, thanks lol -- dont think ive ever seen hintc used so wasnt sure wtf to do
it probably suspends the entire scheduler, that's why it works
(my guess)
according to the note
ah, makes sense
or actually no, hintC stops the simulation, sleep is simulation, uiSleep isn't, so yeah
oh right, gotchu - im pretty oblivious when it comes to scheduling, i just know it make the sleep
same thing when you pause the game in sp, if you sleep, it just suspends until you unpause the game, then the delay happens
ahh right -- thanks ๐
hello whats the trigger script i need to use so when a VIP is in a trigger area the mission is done
i want the mission to be finshed when this AI VIP is on the trigger
i don't know what to do i use normal trigger connected to task state and put trigger activation on indeprent the VIP but it still don't say completed
Not good with triggers but I found this for you: https://www.youtube.com/watch?v=iX_W9Q9_u5g -- a bit old but HTH
Use a condition like MyVip in thisList and call BIS_fnc_endMission on activation.
Am I just setting it up wrong?
I have two files, the initServer.sqf which sets up the ace fortify stuff, and then this file called test.sqf, which only has this code here
are you executing test.sqf?
Y'know, you think I would've realized that...
Could I just add nul = execVM "test.sqf" in the initServer?
just move the code into initServer.sqf
Yep, worked fine
Perhaps I should not always be scripting at like 5 am lmao
Thank you for putting up with my idiot self twice now lol
Setting the ammo doesn't seam to be working though
// Set up ACE Fortify
[west, 5000, [
["3AS_HeavyRepeater_Armoured", 0]
]] call ace_fortify_fnc_registerObjects;
// Delete ammo from objects when placed
_whenPlaced = ["acex_fortify_objectPlaced", {
objectPlaced setVehicleAmmo 0;
}] call CBA_fnc_addEventHandler;
yes because of locality like i said previously
remoteExec it
[objectPlaced, 0] remoteExec ["setVehicleAmmo"]; like this?
It didn't seem to work, but this is my first time using remoteExec, so I was looking at the wiki for it
Oh wait they do have a case where they set the ammo
{objectPlaced setVehicleAmmo 0;} remoteExec ["call"];
Wait no
[objectPlaced, 0] remoteExec ["setVehicleAmmo", objectPlaced];
sorry i was away ill test it now now
Can anyone give me a water jet example using particle effects ?
Using that over the line I had previously causes the Fortify ace interaction to not appear, any idea why?
I commented out the previous line, added that, and it now no longer appears. Changing back to the old line causes it load fine
no, I don't deal with ACE.
Oh it might've just been a weird hiccup (might not have fully reloaded the mission or something like that), but it gives the same error, that it was expecting a Group, Side, Object, etc.
then objectPlaced is undefined or something like that
or rather, it's something entirely different that is causing the issue
It's in an event handler, is there maybe something else I need to set up?
// Configure ACE Fortify
// Set Budget for Bluefor to 5000
[west, 5000, [
["3AS_HeavyRepeater_Armoured", 0] // E-Web Turret
]] call ace_fortify_fnc_registerObjects;
// Delete ammo when placed
_whenPlaced = ["acex_fortify_objectPlaced", {
// {_this setVehicleAmmo 0;} remoteExec ["call", objectPlaced];
[objectPlaced, 0] remoteExec ["setVehicleAmmo", objectPlaced];
}] call CBA_fnc_addEventHandler;
where is "objectPlaced" defined?
are you sure it is not _objectPlaced? see ACE doc
or you are missing a params somewhere
Oooh wait, there's two different CBA event handlers, CBA_fnc_addEventHandler and CBA_fnc_addEventHandlerArgs
Maybe that's it?
again, no idea
Anyway to set an Object hostile? Without it being manned by AI?
It looks like it's more-so used to pass pre-defined arguments to an event handler
what do you want to do, have a shovel become aggressive?
you were using the params previously, just add them back
(and use local variables)
@winter rose Essentially yes.
Adding the params causes some issue
Did I just put the params in the wrong place?
_whenPlaced = ["acex_fortify_objectPlaced", {
params ["_player", "_side", "_objectPlaced"];
[_objectPlaced, 0] remoteExec ["setVehicleAmmo", _objectPlaced];
}] call CBA_fnc_addEventHandler;
I might actually take a break from this for a little bit, do something else for a bit and come back
that looks fine
what does the error message say?
i think i got it.
It's not one that's displaying in-game, just the fortify menu doesn't appear
So it's probably in a log file
i am 90% sure this is a stupid question but ive been trying to do this for half an hour now
how do i detect if an object is in the area of a trigger to use as a condition? i.e i want a specific classname of object to be in the area of a trigger and that fires the condition
https://community.bistudio.com/wiki/inAreaArray
vehicles select { _x isKindOf "StaticWeapon" } inAreaArray "myMarker"
ah, i was looking at inArea, didn't see inAreaArray :p thanks :)
this AND (count (vehicles select {_x isKindOf "ace_envelope_small"} inAreaArray thisTrigger) > 0);```
using this but it's not returning true when digging a trench ;-;
i think my brain could be frazzled or im not doing it right
this is blufor present in the trigger area
Are you sure those trenches are in vehicles?
Beats me. I never figured what exactly counts as an entity or vehicle in Arma.
It feels like a critical missing part of the wiki.
i assume its not as simple as just being in cfgvehicles or not?
I presume that should work then if ace_envelope_small is a member of vehicles then?
Can't see anything wrong with it. From an optimisation perspective you'd normally want the select after the inAreaArray.
roger, i'll ask in grad trenches then -- thanks ๐
entites ?
(nope)
i mean i could just change the activation to anybody so thisList becomes all objects, right..?
and then modify script accordingly
Yes, and that would probably be better because iterating through vehicles is not necessarily fast
nearObjects works.
I tried something with that before and it didn't work either ;-;
count (thisList select {typeOf _x == "ace_envelope_small"}) > 0```
getPosATL player nearObjects ["ace_envelope_small", 10] is picking up this stupid trench :P
is that editor placed or dug with etool?
thats working for me in debug console too so i presume i could just make that equal a bool or some shit..?
You'd count the result and if it's more than 0...
Don't forget you can use lazy evaluation to save performance:
if (condition1 && {condition2}) then { ...
// condition2 will only be evaluated at all if condition1 returns true```
oh i thought they (&&, AND) meant the same thing
or is that what the {} is for
let me test without GRAD trenches but it should work the same
a && {b} means "don't bother to run b if a is false already"
ah gotchu
&& and and are the same. {} in an and construct controls lazy evaluation.
i should probably go back and change a fair bit of my code then ๐
going to try without grad trenches but i dont see why it wouldnt work with them ๐คท
wait what
@granite sky you werent using grad trenches were you? the small envelope one doesnt show up with regular etool 
plain ACE + small trench
ignore me, grad changes it so its not as high :p
ok so its not working without grad trenches either 
thats the trigger stuff
c (size) is set to -1 so not an issue with that
I would be quite surprised if triggers activated on stuff you can only find with nearObjects.
count (getPosATL player nearObjects ["ace_envelope_small", 10]) > 0``` should accomplish the same thing for the sake of testing, right?
well no, because one's checking the trigger area and one's checking 10m from the local player.
basically accomplishes the same thing for my use case so not a huge deal
At least check a radius from thisTrigger :P
why not use thisList?
because thisList is only condition objects and i cannot for the life of me make the trench show up in it no matter what i do
aha
this works
i'll try it with thisTrigger instead shortly
you can probably go with a much cleaner way by using trench ehs
im sure they have some for when you place them or whatever
almost certainly but everything is contained within object inits atm
ok so that works with thisTrigger so ๐คท
will try reintroduce grad trenches and see if that breaks anything but unlikely
uh, check the inheritance of the trench objects.
i dont think it was an issue with grad trenches per se but just extra complexity on top of standard ace
I have a note here that all the GRAD trenches individually inherit from "Base_Bag_F", so you have to search for each type separately.
ah, its fine as player gets to told to dig one specific type of trench
Just assume that every Arma modder hates missions and it works out.
failure shall result in pulverisation
so far i only have like 2/5 sections for this mission done and each one has taken literal hours
cool, still works with GRAD trenches -- thanks for help all ๐
not quite the thing i was looking for :p
but working all good now anyways ๐
...now doors arent disabling simulation properly
why can this never go right
well, then sqf ["ace_fortify_deployFinished", { (_this#0) params ["_player", "_side", "_configName", "_posASL", "_vectorDir", "_vectorUp"]; if (_configName == "Land_BagFence_01_long_green_F" && {asltoagl _posASL inArea tttt}) exitWith {hint "WOOO3"}; }] call CBA_fnc_addEventHandler;
"i want to rune some code as soon as X happens" is a good indicator that EH may help ๐คทโโ๏ธ
the ACE seems to provide the listed arguments inside a _this#0 array, the example above works on my machine
And does the fortification menu appear without the code? If not - make sure you have the module on the map and the tool inside your inventory ๐คทโโ๏ธ
Activation is set to None so obviously it's not picking anything up
setting it to CIV (which matches the side cursorObject when i look at the stuff) doesn't help as well. I guess triggers don't check for the object with simulation = "house"; or something
Try it with Anybody
still nope
Yeah, I did end up getting it working
Quick question though, is there any way to move objects up and down with ACE Fortify?
It'd be nice to be able to place ladders and not have them halfway in the ground
look up?
It just stays snapped to the ground
Maybe it's just because I'm in VR, but it just stays halfway in the ground no matter where I look
are you "looking" or "aiming" up then?
Like if I'm using freelook with alt?
ah, i guess i'm mixing things. VR map doesn't seem to break stuff for me. When i aim up - i get things floating above the ground ๐ค
I think it might just be with how tall the ladders are, it works with other objects
That seems to be working thank you so much, I can't believe I never tried this earlier, finally get to play an old mission that's been broken for so long.
I have another scripting question, not necessarily for the same person, but the mission also has a crate full of specific weapons with the variable name "a1", that unfortunately for whatever reason glitches out and doesn't spawn properly, and I'm wondering if it's possible to spawn it in game with the debug console. I've tried a few variations of script commands but I don't think they were designed for this.
Is this possible?
createVehicle to create the box and addweaponcargo to add weapons to it
Yeah I figured that would be one way, but I mean to spawn that specific crate that's already defined by the mission. This way would be a bit more tedious, but could still work if the way I want is not possible.
i can think of one or two ways of getting the data of that crate to replicate it with script. But it would be kinda involved. As in: either "dig through the debinarized version of mission.sqm" or "copy-paste the crate into a separate mission, save, export to SQF, dig through the exported code and only leave the relevant parts" involved
me again ๐
this addEventHandler ["Hit", {
Six12th_Targets = Six12th_Targets + 1;
systemChat str Six12th_Targets;
this removeEventHandler [_thisEvent, _thisEventHandler];
}];``` seems to never remove and eventhandler stays, meaning target gets hit and `Six12th_Targets` increases every time its hit
(it should only increase once per target ever)
"this" isn't defined inside the EH
ah
_this#0 should be used instead
within the EH or overall?
within the EH
gotchu -- what does the #0 bit mean?
it's an abbreviated form of select 0, selecting the 0th element in the array
Hmm, well the crate issue isn't too big of a deal I can just circumvent it and it's a rare issue. The more important issue I've found is that the mission seems to restart for all players if someone joins in progress. I know typically when a mission isn't designed for JIP that person spawns at the beginning, but it seems to restart the whole mission.
What would be the cause of this? I can send the mission in the DM if anyone wants to look.
That would have to be something that's scripted that way. Could be a playerConnected EH, something in init.sqf...there are a few ways it could be done so without knowing the mission (don't send it to me, I don't have time to dissect it) it's not really possible to go "oh yeah, that's definitely caused by x"
Ok I see, there script that moves the players at spawn was in initlocalplayer.sqf which I didn't know until now executes locally for all players during start and join in progress. That would make sense.
Moving it to init.sq seems to have fixed it, but still need to figure out a way to move the player, but I think I can do that.
are there any requirements mission-side for playMission? I'm getting an A3 loading screen then returning to main menu a few moments later with the right terrain loaded but judging by the rpt no attempt to load it
changing to config pathing has fixed it for some reason
So what I'm trying to do now is execute a script only when a player joins in progress. The script's function is to spawn the player near other players already in game and I know it works
However, I can't seem to find a way to execute it only on join in progress. It works if I put it in initplayerlocal.sqf but that breaks another script in init.sqf that only when the mission starts, spawns the players at a specific marker.
I tried putting the script in init.sqf and using the onplayerconnected command but that didn't seem to work.
How do I run this script only on players that are trying to JIP?
22:20:37 Error GIF pre stack size violation
the fuck is this
did you try write a different language in sqf
There is a way to make AI land vehicles don't go into an map area? The only way i know is put many PhysicX small objects on this area. Any better way? ๐
what kinda code did you run?
I recently have that thing, I forgot what it was... something related to an array I recall
I think this happens if you have a very large , nested array with a missing bracket
Note: Arma 2 OA!
What on earth is happening here? ๐
"WFBE_Server_PV_SupplyMissionCompletedMessage" addPublicVariableEventHandler {
private ["_message", "_side"];
_message = _this select 0;
_side = _this select 1;
// This throws an error
if ((side player) == _side) then {
_message call CommandChatMessage;
};
};
String STR_EVAL_TYPENAN not found
Error in expression <de = _this select 1;
if ((side player) == _side) then {
_message call CommandCh>
Error position: <== _side) then {
_message call CommandCh>
Error ==: Type Array, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location
== doesn't work with arrays
Ah, I realized my mistake immediately when you sent your message. I need to add ```sqf
_message = (_this select 1) select 0;
_side = (_this select 1) select 1;
it was a missing string in setVariable
is there a way to get cordinates and add a certain amount to a certain axis?
like getpos then add something to the position
getDir, sin and cos
but you might prefer getRelPos
check their velocity?
or modelToWorld commands
modelToWorld
modelToWorldWorld
modelToWorldVisual
modelToWorldVisualWorld
๐
thanks
what do you use to get a vehicle weapon? other than cfgvehicles?
and a magazine?
depends on the use case
air vehicle but i think i can find it in config
When I change the owner of a object via setOwner (server-side) the object vanishes... is there something I need to know?
what object type's ownership are you trying to change?
it's a crate
are you the one creating the crate?
no, the crate is created server-side
with createVehicle?
yes
well, at least all vanilla crates I tried - as example: Box_NATO_Support_F
cannot reproduce
alias to select with higher precedence
https://community.bistudio.com/wiki/HashMap have you read this?
its all you need
Guys, I have some markers named "INFO_01", "INFO_02", "INFO_03" etc etc... and then I have other markers which are "CIVCAR_01", "CIVCAR_02", "CIVCAR_03". Then a script creates Agent NPCs at the locations of the INFO markers. Finally I need to create a vehicle at the CIVCAR marker location but to do so correctly in need to get the last two numbers on the INFO marker name so I can create the right vehicle for each agent at the right CIVCAR marker. How do I do that?
In short, which command do I use to get the last two numebers in a string (the marker name)
https://community.bistudio.com/wiki/select syntax 4 is what you need
and possibly https://community.bistudio.com/wiki/parseNumber
how would i go about adding items to a backpack
that is in the inventory of a weaponholder?
that only works on a soldiers backpack
thanks
of a weapon holder, then what artemoz sent + https://community.bistudio.com/wiki/addItemCargoGlobal i think
not sure though
https://community.bistudio.com/wiki/everyBackpack if it's more than one
Is there any way to play a video on the player's screen?
i.e if i have a gif/mp4/whatever format, is it possible to shove it onto the players screen in the top left
and here i was about to make it frame by frame, thanks ๐
inb4 drone and r2t :3
nein is just for "narrator" most likely
i hope you didn't mean frame by frame with RscPicture or something 
erm.
no, of course not! that'd be silly!
yes
actual id?
O_o
private _data = _playerDataArray select _index;
_data pushBack format ["Data A-%1", parseNumber (_data select -1 select [7, 1e6]) + 1]
that?
it adds string "Data A-(+1 from last)" to the array everytime you run it
This feels like it should be a hashmap so you can get by player ID properly.
or parallel arrays + find
that was the goto way before hashmaps ๐
...wait i have to create this video frame by frame anyway 
unless theres a fade imagine in command ๐
what
image
not imagine
im just trying to fade an image into the top left of the players screen while narrator talks
wait i dont want BIS_fnc_playVideo either way that covers the entire screen
to play the video on an object, e.g an in-game screen, see Example 3
doesn't sound fullscreen
private _uid = getPlayerUID player;
private _hashmap = [_uid] createHashMapFromArray [[0, "blabla"]];
_hashmap get _uid set [0, 1000];
systemChat str (_hashmap get _uid); // [1000,"blabla"]
don't use an array
use a hashmap like in my example
where key is the player uid
no, it's some dummy data (as an example)
Hello, trying to get a handle on appropriate remoteExec (or remoteExecCall) vis-a-vis JIP.
Writing a multiplayer mission, have the units down as 'slots', but have found that the slot unit may not be the same object as the unit on "redeploy". So any actions, etc, I expected were not there.
Question is, does any of that snafu matter when the object in question is not a player (slot or deployed) object? JIP executes on joining, actions may be applied appropriately, and so on.
Thanks...
I, huh, sorry?
if you wonder "will an addAction added in initPlayerLocal.sqf work on a non-player object", the answer is yes
More generally, slot -> object mappings in MP are temporary, but objects are persistent.
You can JIP an addaction on an object, and as long as that object still exists then the addaction will work for newly connected players.
okay so if I follow correctly, player is not necessarily the "same" player OBJECT depending on 'when' you find him re: the slot...
but any other target object should be fine for JIP purposes...
yep, they are hopefully synchronised
just the "player" character object can be deleted/created on leaving/join
cool, seems consistent experientially as well. thank you.
Players are a different object after respawning too, although some stuff is moved over.
(some?) Event Handlers
is there a way to delay a module activating?
a way that doesnt use triggers
because im trying to use the ace ambient sounds module and a trigger doesnt seem to delay the activation
dug into ace github and found this
LOGIC, [bob, kevin], true] call ace_missionmodules_fnc_moduleAmbianceSound
but that misses the option of the sounds following the players
So random 1000 occasionally returns 1000.
this is not good
Like 1 in a few million calls.
no?
or at least, it shouldn't?
https://community.bistudio.com/wiki/random
Return Value:
Number from 0 (included) to x (excluded)
Had an "impossible" error in some code so I did a check.
hmmmmmm
Hey there, does createSimpleObjcet also respect Named Properties of the p3d? I created a flat object with a texture and used class=land_decal but it still floated above the surface and the lighting was strange.
can confirm, got a collision on random 1000 == 1000 after roughly 40M cycles on the current dev version @winter rose 
uuuuuuffโฆ @still forum ๐
Couldn't get selectRandom to break, but that probably doesn't have the int->float conversion.
whats the problem
Number from 0 (included) to x (excluded)
Guess wiki is wrong then
are you sure that its 1000, and not 1000-epsilon?
make ticket then and don't ping
bye
โค๏ธ ๐
random 1000 == 1000 returned true ๐คทโโ๏ธ
it can? not according to the Syntax 1 docs, random x...
Number from 0 (included) to x (excluded)
https://community.bistudio.com/wiki/random#Syntax_1
sigh
feel free to try for yourself. https://sqfbin.com/benucogiroqusemaxufo got me a collision after 16M + 25M iterations
are you sure it was not evaluated random (1000 == 1000). which is stronger from precedence?
read above please ๐
precedence going wrong 40M times and then correct once would be an even better bug ๐คฃ
unary always has higher precedence than binary
I'm trying to get a brighter mortar flare script to function in multiplayer, what commands would have to be executed with remoteExec?
this addEventHandler ["Fired",
{
if ((_this select 4) isEqualTo "Flare_82mm_AMOS_White") then {
_firedObj = (_this select 6);
_light = "#lightpoint" createVehicle ( getPosATL _firedObj ) ;
_light setLightBrightness 5.0;
_light setLightAmbient [1, 1, 1];
_light setLightUseFlare true;
_light setLightFlareSize 5;
_light setLightFlareMaxDistance 500;
_light setLightColor [1, 1, 1];
_light lightAttachObject [_firedObj, [ 0, 0, 0 ]];
_thread = [_firedObj, _light] spawn {
_obj = _this select 0;
_light = _this select 1;
waitUntil {isNull _obj};
deleteVehicle _light;
};
};
}];```
I've been told createVehicle is global
lightpoints are local no matter what you use
you should be using createVehicleLocal for them
waitUntil {isNull _obj}; use ammo event handlers btw
not that it's unscheduled, you can use remoteExec aswell, but there is no reason to not go unschd here
try adding EH on every machine first, it might work fine
i know though that sometimes it doesn't fire on remote machines (don't remember the reason)
I think the wiki said it's better practice to use remoteExecCall and make it a function instead of putting spawn in a normal remoteExec
it's best to stay unscheduled when you can
but then again you said something about ammo remote handlers
so if I can just do it with remote handlers that'd be fine
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Deleted_2 i think might work
yeah i guess i could try that?
so if I just remoteExec the event handlers it might work
I'll try that
don't remoteExec, try with remote ehs first
this addEventHandler ["Fired",
thisyou're running this from an init field i suppose?
it already runs on every pc, so you don't need to do anything additionally
oh I mean remote exec not event handler
no need yes
ok
Special multiplayer behaviour: When added to a remote unit or vehicle, this EH will only fire if said entity is within range of the camera. That range is determined by the fired ammo's highest visibleFire and audibleFire config value. In case of units, muzzle attachment coefficients are applied too.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired this is what i was talking about earlier
IIRC on the server, Fired always triggers.
but clients and HCs have the camera restriction for remote units.
HC object location counts as the camera :P
so wait, if the player isn't looking at the mortar that fires the flare it won't run on their client so they won't see the light?
that's annoying
Your best bet for this stuff is probably to install the Fired handler only on the server, and then remoteExec the contents.
mortar should be fine i imagine
alright I'll probably put it all in a function and remoteExec the function when the Fired handler fires
multiplayer scripting makes my brain hurt
Hey, I need some help
I'm trying to set up a PvP Battlefield Breakthrough-style gamemode and I'm having trouble making it so that once the first sector is captured Opfor, the next sector opens up for capture by Opfor. I have this right now (variable name secn is a sector)
Trigger condition: Sec1 getVariable "owner" == EAST
Trigger OnActivation: Sec2 setVariable ["taskOwner",Everyone];
I'm sure that "everyone" isn't the correct thing to put where it is, but how would I change the task owner to make it capturable by everyone? Sec2's "trigger owners" variable is set to Nobody at mission start btw
I also know that the trigger is activating properly because a hint pops up that I made to test it
Nevermind, it being a task in the first place doesn't change weather or not it's capturable. In that case, how would I make any of that happen? Lol
Also, if anyone does come up with an answer please @ me
Everyone should be 1
So everything's correct, and I should just change "Everyone" to "1"?
yes
Didn't seem to work, something else is wrong too
animstate event handlers probably
if you want to check if they currently are underwater, eyePos player select 2 < 0
i'm not familiar with the sectors thing itself, i just glanced at the 3den attributes in the config
might want to look into the function itself
is surface water, or is swimming, or is underwater?
I mean, trigger ownership isn't a worry anymore. However, enabling and disabling the sector is what I'm really trying to do. I'm also gonna wanna make it so that respawns moved based on which sector is currently held by Blufor in order, but that I'll deal with later
to disable the sector i think you just disable it's simulation iirc
I don't see anywhere in the attributes anything about simulation
surface
_logic enableSimulation false
or swimming
I'll try to make the trigger change that.
_logic enableSimulation false goes in the init of the sector initially and then I set it to "true" OnActivation for the trigger?
surfaceIsWater
if the guy is swimming without water, you have bigger fires to extinguish
ive done it before with no scripting arma moment
This didn't work
execute it where the logic is local
I'm gonna try this enableSimulation false
no
Idk what any of that means
give the logic a name
U want me to place a "game logic" object and name it?
no i mean the sector logic
Oh, the "sector control" gamemode logic or the sector itself? Cuz the sector I already have named
the latter
Could u maybe pop into a vc? It'd probably make this a lot easier
not really, i'll explain this again, you give the sector logic a name (you already did you said), then, you disable it's simulation, via enableSimulation
you should make your trigger server only aswell
Ok
Anyone have an idea on how to get a random name?
I tried
_unit setName (configFile >> "CfgWorlds" >> "GenericNames" >> "SahraniNames");
But that was not correct.
https://community.bistudio.com/wiki/setName does not take config
Any way to convert values of a config to an array?
private _cfg = configFile >> "CfgWorlds" >> "GenericNames" >> "SahraniNames";
_unit setName configName (_cfg select floor random count _cfg);
should work
or perhaps
private _cfg = configFile >> "CfgWorlds" >> "GenericNames" >> "SahraniNames";
_unit setName getText (_cfg select floor random count _cfg >> "FillThisIn");
I'll try either
classname sounds incorrect, so the second, i think there should be a "pretty name" in the class, check the config
I tried the following:
private _cfg = configFile >> "CfgWorlds" >> "GenericNames" >> "SahraniNames" >> "FirstNames"
_unit setName configName (_cfg select floor random count _cfg);
Which works, however it assigns names of variables to the units rather than the values. (For example, instead of David, a unit is named DAVID1, DAVID2, etc.)
replace configName with getText
private _cfg = configFile >> "CfgWorlds" >> "GenericNames" >> "SahraniNames" >> "FirstNames"
_unit setName getText (_cfg select floor random count _cfg);
Yep, this works. Thanks!
Turns out that this will give around 1 in 50 million of your units a blank name :P
huh
_cfg select floor random count _cfg is busted because random doesn't 100% guarantee that it will roll below the input value.
In this case you can just replace with selectRandom _cfg which probably doesn't have the same issue.
selectRandom does not take config
well then subtract a small amount i guess ๐
or min _cnt - 1
oh, this is working directly with config. Fun.
Yeah I was until it threw an impossible error at me yesterday :P
so wiki is wrong?
Arma is wrong :P
Like random is clearly supposed to work as the wiki says.
Probably an int->float conversion glitch.
[] spawn {
private _attempt = 0;
while {true} do {
if (_attempt % 50000 == 0) then {
systemChat str (_attempt toFixed 0);
};
if (random 10 == 10) exitWith {
systemChat str ["hit", _attempt toFixed 0];
};
_attempt = _attempt + 1;
};
};
kek
ticket worthy perhaps
What file formats are accepted by playsound3d? .wss doesn't seem to be working 
should work, you probably converted it wrong
or perhaps you aren't passing the full mission path
playSound3D [getMissionPath "myaudio.wss", player, true]; is what im doing 
wiki uses getmissionpath in its example
and myaudio.wss is in an audio folder in the scenario folder
oh wait you need that
brug
yeah? ๐
getMissionPath implied otherwise to me but i think i am just smooth brain
wait, ignore me
there is an issue it just wasnt a pathing one
playSound3D [getMissionPath "audio\myaudio.wss", player, true, [0,0,0], 2, 1, 0]; isn't playing anything now that ive added the bits onto the end 
do fileExists "audio\myaudio.wss"
if it's true, then the format must be wrong/encoding or whatever
actually, no
The object emitting the sound. If "sound position" is specified this parameter is ignored
https://community.bistudio.com/wiki/playSound3D
and you're passing [0,0,0] as position
pass nil
aaaah right i thought it meant offset ๐คฆ
(as the default was 0,0,0)
thank you ๐
Sorry noob question ahead: why does this event handler ignore my sleep command? ๐ฆ
this addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
sleep (1 + random 1);
[ATLoader, player] say3D [
selectRandom [
"aaa_reloading1","aaa_reloading1","aaa_reloading1",
"aaa_reloading1","aaa_reloading1","aaa_reloading1",
"aaa_reloading1","aaa_reloading1","aaa_reloading1"], 100]; }];
you cannot suspend in unscheduled
Is there any "easy" work around?
selectRandom [
"aaa_reloading1","aaa_reloading1","aaa_reloading1",
"aaa_reloading1","aaa_reloading1","aaa_reloading1",
"aaa_reloading1","aaa_reloading1","aaa_reloading1"]
``` uhhh
Havent found anything on google why sleep does not work with EH
Thats for debugging, as i have a second sound following the first one - and the langauge is russian... which i dont speak ๐ So i get things mixed up^^
will take a look, thanks!
Do i understand that correctly, there is no way to use sleep on event handler? Atleast for us mortals who dont know much about scripting?
I just want a simple "Reloading" shout after i shot the AT Gun, followed by a "reloaded"
this addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
[] spawn {
sleep (1 + random 1);
[ATLoader, player] say3D [
selectRandom [
"aaa_reloading1","aaa_reloading1","aaa_reloading1",
"aaa_reloading1","aaa_reloading1","aaa_reloading1",
"aaa_reloading1","aaa_reloading1","aaa_reloading1"], 100];
};
}];
I have a similar problem : when and how can i sleep in an eventHandler ?
A spawn in an EH is sleep-able. More like spawn makes it sleep-able
oh ok, and is this warning from the wiki spawn page still true : "When multiple Code is spawned in an order, there is no guarantee that the spawned Code will execute in the same order (see Example 2). If the order is important, use BIS_fnc_spawnOrdered." ?
I'll go read this ! Thank you ๐
So it seems that the AT guns from IronFront somehow have just HE loaded - which is a problem as i am not able to destroy tanks with it.
Iยดve tried to by pass that with a EventHandler HandleDamage + setdamage on the tanks, which works. The Problem is, that even a indirect hit (for example 3m in front of the tank) will destroy the tank.
Would anyone happen to know how to script that a direct hit is necessary? Or "apply" a required damage threshold?
If I define a global variable inside init.sqf, is it the same as doing: publicVariable ?
I mean does the global variable update on all pcs or do I need to remoteExec the variable for everyone if the the variable changes?
partially correct, it's not really a public variable, it just defines that variable locally on all pcs at init once
if the variable changes, then it only changes on that machine, nowhere else, so you have to pvar again/remoteExec
Thank you
If they are actually AT guns and not field artillery, then they probably have AP magazines available. You can use addMagazine to give yourself some if you can find them in CfgMagazines.
lol... to remove the current magazine i found out, the gun uses "FakeWeapon" ammo...
Thanks, much appreciated - will give feedback if i get it to work with the right ammo
Waypoints: What is the difference from types "UNLOAD" and "TR UNLOAD"?
TR UNLOAD is TRANSPORT UNLOAD aka unload transported vehicles, iirc
it might be "unload everyone but vehicle crew"
yeah, TR UNLOAD is a waypoint you give to the vehicle crew group to offload the vehicle cargo group. It's surprisingly reliable as waypoints go.
I think UNLOAD is the vehicle-in-vehicle one, which is poorly supported.
GET OUT is for getting the crew group out of a vehicle.
Thanks!
Is there any way to open inventory other than
player action ["Gear", _someCrate]
?
I want to allow player to open certain crate even if it is far away from them
I want to allow player to open certain crate even if it is far away from them
no can do I believe
create an invisible crate and move it near the player?
Yeah, that was my thought too, just wanted to double check if I'm missing something. Thanks, Lou ๐
Is there an option to get the materialfile a certain ground position uses? We have access to the surfactexture via https://community.bistudio.com/wiki/surfaceTexture . Is there something similar for the .rvmat used?
You can probably use https://community.bistudio.com/wiki/surfaceType and then look up what material that type is configured to use
Arma 2 OA! How to get a remote unit to which an object is local (the script is executed on server)? objectFromNetId seems to return the original owner of the object which is exactly what I'm not looking for ๐
as in client machine network id? https://community.bistudio.com/wiki/owner maybe?
Or as in player from that machine? I don't know any direct ways of doing it, short of iterating over allPlayers
player from that machine, yeah. allPlayers was added only in Arma 3 unfortunately ๐
extra oof
https://community.bistudio.com/wiki/BIS_fnc_listPlayers is apparently available in 2 ๐ค
and it is (at least in 3) just an iteration over allUnits 
Could you have a local script that runs on mission start/respawn that makes each client report its player unit as a variable the server can access?
Nice, thanks! ๐ @hallow mortar Might have to do something like that indeed
Hey, just begining with most of eden scripting, and I'm coming across a couple issues with my script.
This is the init:
Protaganist diableAI "MOVE";
Protaganist switchMove "ActsPercMrunSlowWrflDf_FlipFlopPara";
Protaganist switchMove "";
Protaganist switchMove "AmovPercMrunSlowWrflDf";
Protaganist switchMove "";
Protaganist switchMove "HaloFreeFall_non";
animationState Protaganist;
Just for note, two main issues. The first, none of the animations will play. The unit will just begin to run off.
Secondly, whenever attempting to add the disableAI line, it'll prompt me with an error specifically ";" was missing.
Well, step 1, disableAI is spelled wrong.
Secondly, switchMove has instant effect and you're running all those commands immediately after each other, so the unit has no time to play any of them before being put into the next (last one being a freefall state which it presumably immediately recovers from).
You may also need to disableAI "ANIM" to prevent it doing whatever it wants.
Haha, it is! That's why is worked the first time, but not after a retype.
How should I space out animations, I've tried the sleep command but it doesn't have any change at the moment?
sleep doesn't work in init fields because they're unscheduled and sleep requires a scheduled environment (https://community.bistudio.com/wiki/Scheduler). You'll need to create a scheduled environment, for example by using spawn.
How do I use spawn?
https://community.bistudio.com/wiki/spawn
Since you have no arguments to pass into it, and you don't need a reference to the spawned script, all you need is this:
[] spawn {
// your code here
};```
Okay, and this method doesn't require writing anything outside of the eden editor?
It does not
Awesome, the animations are back!
Sorry to berate you with questions, but do you have any ideas on how I can keep the freefall animation playing? Do I just need to throw them into the air?
You could write a loop that repeatedly runs the animation, or you could adjust the height at which the freefall animation automatically triggers (https://community.bistudio.com/wiki/setUnitFreefallHeight) to something super low. Kind of depends on where you need the unit to be and what you need it to do.
how can I place that Laws of War campaign particle-orb-thing? I wanted to create a scenario with similar system of memory points/places, just can't find any info or a solution on whether it is an object or a particle spawned or what
I dont know which orb you mean, but if thats kind of an anomaly thingy you could try out one of aliascartoons scripts as an alternative maybe?
I assumed it's an orb, but it actually is just round, probably flat, the outcome I'd like to achieve is as can be seen here https://youtu.be/NR9Nsbwm01o?t=466
oh ok, thats quite subltle
https://aliascartoons.com/anomalies-scripts-arma-download/ -> the smuggler maybe could be useful for you. The scripts from alias are generally easy to use and very configurable
grab the link, give me a sign and then lets delete the last messages so your question does not get lost
nah no need to delete, if I don't manage to get that effect in few days I'll just ask again, thx for the link
Noob question, but not sure what to google for an answer..
Can i go with: if then <do code> else <no code> to have code only fired when the unit is still alive?
sure, if alive player then { hint "player is alive" }
Oh cool, so i would just skip the else. Thanks for your answer!
What kind of a script should I use to automatically disable AI moving after they have respawned, and only allowing them to move after I have activated a trigger or so?
I hate to see the AI going on a 10km run to regroup with me after they have respawned
ai cannot respawn though?
When they respawn on "respawn_x", they go on a long hike to regroup with me
I would like to prevent that from happening
are you using some mod that does that?
Also, how can I make that the AI can respawn from player placed respawn points such as sleeping bags?
Lambs danger but it is disabled for the player group
no i mean the respawning
Ah
No I do not use any mods which affect AI respawning afaik
Multiplayer tab has custom respawning enabled
And I have a "respawn_independent" there too
I also noticed that the AI takes and does move orders after respawning or parting ways with me, but returning to formation doesn't do a thing
So I can't really proceed forward with them unless I issue them a move command separately
i've never heard of vanilla AI being able to respawn, as in true respawn (like the player unit)
Isn't AI respawning on "respawn_side" vanilla behaviour?
If thats not the case then I have some mod interfering
Definitely
is the AI playable?
Yeah
Whats that
you can probably run https://community.bistudio.com/wiki/doStop on them when they respawn, and then when you activate the trigger, you can run https://community.bistudio.com/wiki/doFollow
Oh I have no idea how to create that or where to put the script into
init box should work
the init box of the unit
Ah
i think this should be fairly easy but i just cannot figure it out
i want to generate a number with BIS_fnc_randomInt, but make sure i dont get the same number twice in a row. ive managed to work out i want to generate a new number if i get the same one twice, but dont know how to check if that number is the same number again without just if statementing for all eternity
_idleLineOld = 0;
_idleLine = [1,3] call BIS_fnc_randomInt;
if (_idleLine == _idleLineOld) then {
//generate random number again
};```
but i do not know what to do if the random number generated again is the same again
you can use recursion
GerTank3 addEventHandler ["Hit", {
params ["_unit", "_source", "_damage", "_instigator"];
Where would i define _instigator = player?
Can i do this in the init.sqf and it will be registered in any EventHandler which contains "_instigator"? Or would i define that in every unit init where the EH gets fired?
you're already defining _instigator with the params line
_instigator will be whatever fired the round that hit the tank
The params available in the EH are special variables that read the properties of that specific event. Each instance only exists in, and only contains the information for, that specific hit event.
They can't be globally changed.
What you can do, if you need the instigator to always be the player, is use https://community.bistudio.com/wiki/setShotParents to set the properties of the projectile involved in the hit event. You would do this at the time it's fired using a Fired EH.
That being said, if the instigator is always going to be the local player, you may as well just use player and not try to screw around with the _instigator param at all.
Thanks so much for that detailed explanation! So i would just replace _instigator with player and will be fine?
how does one define a variable as code? is it like a function? im more so looking for documentation on syntax
cant find any examples
if player is guaranteed to be the only one hitting, it's fine yes
_code = { hint "hi" };, like any other value, it's no different than typing _num = 5;
thanks just checking it is how i imagine it would be
couldnt run it as i am on bad pc
{} represents a code constant in sqf, cfgfunctions doesn't do anything special other than assigning a code value to a variable
well, it also blocks overwriting the variable, like compileFinal.
it does use compileFinal to do that, you can do that manually aswell
Hello there, is it possible to add a key event handler, that will execute a function every time that key is pressed - in mission, no mods
I am looking at CBA function cba_fnc_addKeybind, which even adds they keybind into the Configure addons in settings.
The line I am using right now
["IMF", "ViewDistanceLong", ["Set view distance to long", "Set view distance to long"], {
call IMF_fnc_setViewDistance;
}, {
call IMF_fnc_setViewDistance;
}, [DIK_F1, [false, false, false]]] call CBA_fnc_addKeybind;
But the function IMF_fnc_setViewDistance is never called, any ideas why that would be?
Is it a problem, that this is in mission files, or can it be there?
If so, is there any other way to achieve something similar?
add a ui event handler for "KeyDown", I believe findDisplay 46 will return the mission display
(findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) == 59) then { call IMF_setViewDistance };"]
tried it too and nothing sadly
systemChat str _this to determine if the event handler is firing
it is, give me a second
Ok, managed to get it working with the "vanilla" way, but weirdly it doesn't work with CBA way.
If anyone has any idea, let me know!
And thank you, I was missing a ; in the "vanilla" way call
setAnimSpeedCoef has local effect
does it mean you need to apply it on all machines?
or does the position sync handle that itself
according the comments on the wiki:
nomisum
Must be executed on all clients to work properly in MP (otherwise only movement speed is adjusted, not animation itself)
Waffle SS.
For animation speed to control unit speed, this must be executed on the local client. Non-local clients can set a speed less than the local client's. Non-local clients using an animation speed greater than the local client's may result in the animation freezing.
does anyone know why is this error happening: https://pastebin.com/0hqfbiBP ? i think the respawn works but i get that error sometimes
yeah
_pic is sometimes undefined
but why?
I'm using BIS_fnc_addRespawnPosition
ok
but it doesn't take picture, maybe marker though
Arma 2: OA!
if (_friendlyCommandCenterInProximity) exitWith {
{
_iteratedPlayerUID = _x select 1;
diag_log format ["_associatedSupplyTruck: %1, leader group: %2, getPlayerUID leader group _associatedSupplyTruck: %3, _iteratedPlayerUID: %4, _playerObject: %5", _associatedSupplyTruck, leader group _associatedSupplyTruck, getPlayerUID leader group _associatedSupplyTruck, _iteratedPlayerUID, _playerObject];
if ((getPlayerUID (leader group _associatedSupplyTruck)) == _iteratedPlayerUID) then {
_playerObject = _x select 0;
_match = true;
};
} forEach (WFBE_SE_PLAYERLIST);
_currentSupplyTruckDriverLeader = _playerObject;
diag_log format ["_playerObject/_currentSupplyTruckDriverLeader: %1, _match: %2", _playerObject, _match];
playerObject doesn't get updated if there is more than one player on the server. What might cause it?
RPT print (hid some details): ```
2022/10/11, 4:51:12 "_associatedSupplyTruck: O 1-1-C:1 (somePlayer) REMOTE, leader group: O 1-1-C:1 (somePlayer) REMOTE, getPlayerUID leader group _associatedSupplyTruck: 76561198108738xxx, _iteratedPlayerUID: 0, _playerObject: <NULL-object>"
2022/10/11, 4:51:12 "_associatedSupplyTruck: O 1-1-C:1 (somePlayer) REMOTE, leader group: O 1-1-C:1 (somePlayer) REMOTE, getPlayerUID leader group _associatedSupplyTruck: 76561198108738xxx, _iteratedPlayerUID: 76561198053533xxx, _playerObject: <NULL-object>"
2022/10/11, 4:51:12 "_associatedSupplyTruck: O 1-1-C:1 (somePlayer) REMOTE, leader group: O 1-1-C:1 (somePlayer) REMOTE, getPlayerUID leader group _associatedSupplyTruck: 76561198108738xx, _iteratedPlayerUID: 76561198108738xxx, _playerObject: <NULL-object>"
2022/10/11, 4:51:12 "_playerObject/_currentSupplyTruckDriverLeader: <NULL-object>, _match: true"
The _match does change to true but _playerObject stays <NULL-object>
2022/10/11, 4:44:04 "WFBE_SE_PLAYERLIST after iterating: [[<NULL-object>,"0"],[O 1-1-H:1 (somePlayer) REMOTE,"76561198053533xxx"],[O 1-1-C:1 (anotherPlayer) REMOTE,"76561198108738xxx"]]"
(The first null object is intentionally added there)
Forgot to add that this is executed on server
you declare it somewhere before?
Declare what exactly? Just to make sure ๐
_x select 0 is null obj from what it looks like
thank you (i am blind)
np ๐
It was caused by uninitialized variable on server, the error messages were just a bit confusing. Got it fixed, but thanks in any case! And same to @copper raven ๐
Quick question since my buddy who I'm testing with is apparently in bit of a hurry, is there a quick way to limit marker visibility (to given side only) apart from PV'ing it and making it local?
setMarkerAlphaLocal?
The code spawning the marker is client side, and thanks to the famous rubber duck I realized that I need to make it server side (I guess?) ๐
either
create it locally if the player is of the correct side
or
create it global server-side and setMarkerAlphaLocal on the client
your call
How do I check which Respawn Module a player is spawning at? I wish to have a respawn event handler preform different actions depending on the selected respawn location.
I'm trying to make player do some animations during cutscene, one of which is "Acts_trailer_campCommander" however everytime this one ends, player immediately goes into that lying down dead/unconscious state. I do it as follows:
player playMoveNow "acts_trailer_campCommander";
player playMove "AmovPercMstpSnonWnonDnon";```
so last move should cause the campCommander animation to change into the standing anim, but unit still goes on the ground
is it just because it shouldn't be used on playable units? How am I supposed to know which one I can use and which ones I can't? Or how to set these animations so the campCommander one doesn't end with my unit on the ground?
you could use this addEventHandler ["Respawn", { params ["_unit", "_corpse"]; }];
and then check where the _unit is closest to, and run your actions
you could do some weird jank like having a fake copycat actor instead if certain anis are bugging out on real people.
I already have that all setup, I just dont know to check the id of which module a player spawned at.
Oh wait closest to check? does near entitles work on modules?
dunno, i suppose modules have x,y coords though
Good idea, will look into it
i was thinking of something like: if(_unit distance2D (markerpos "respawn1") < 50) then { do stuff };
Gotcha
hey guys, I'm looking for a scripting command to get the player camera position (visual), currently the only command to get true eye position (including head tracking offsets) is with positionCameraToWorld which is simulation and so doesn't work in vehicles.
There also doesn't appear to be any way to pull current 6dof headtracking offsets independently
you can do something with https://community.bistudio.com/wiki/getCameraViewDirection
Thanks, but unfortunately I'm looks for camera position not dir, and pos in visual time scope
see See Also: positionCameraToWorld
positionCameraToWorld which is simulation and so doesn't work in vehicles.
It seems they tried that and it didn't do what they needed
then nothing else is available
_obj modelToWorldVisual (_obj selectionPosition "pilot") what about this? it's pretty accurate, but would work in first person only ofc, and you could combine that with https://community.bistudio.com/wiki/getCameraViewDirection if you want an offset
Keep getting Error reserved variable in expression when I run this, dunno why. I've tried switching variable names around and it doesn't seem to work.
fnc_mortarFlare = {
params = ["_obj"];
_light = "#lightpoint" createVehicleLocal (getPosATL _obj);
_light setLightBrightness 5.0;
_light setLightAmbient [1, 1, 1];
_light setLightUseFlare true;
_light setLightFlareSize 5;
_light setLightFlareMaxDistance 500;
_light setLightColor [1, 1, 1];
_light lightAttachObject [_obj, [ 0, 0, 0 ]];
waitUntil{isNull _obj};
deleteVehicle _light;
};
this addEventHandler ["Fired",
{
if ((_this select 4) isEqualTo "Flare_82mm_AMOS_White") then {
_firedObj = (_this select 6);
[_firedObj] remoteExecCall ["fnc_mortarFlare", 0];
};
}];
this: params = ["_obj"];
yeah, just fixed it by switching that to _obj = _this select 0;
or just remove the =
now i'm getting Error cannot suspend in this context which is weird because I thought remoteExecCall ran the function in a scheduled environment
oh wait it's the other way around?
Call variant executes the function in unscheduled
yep ๐
aaa
so if i run [[_firedObj], fnc_mortarFlare] remoteExec ["call", 0]; would that work?
this hurts my brain
that would work but that's terrible
:)
you're broadcasting the code value over
define the code value on every machine, and pass a string
_firedObj remoteExec ["fnc_mortarFlare"]
this addEventHandler ["Fired", are you running this code from an initbox?
yes
that's also bad
imagine there are 3 players on the server, player x fires, the 3 players tell every player + self to create a flare
would adding a condition so the code in the fuction so it only runs on the client be better
so pass a -2 argument on a remote exec
Btw, thanks! I ended up using exitWith if the side of origin and player side don't match
(With the first option, the server just PV's the needed data to the clients)
so to get the value from the eventhandler which is being triggered on the server to every client I use another remoteExec?
your code is fine as is, all you're missing is this
createVehicleLocal (getPosATL _obj) except maybe for this part, createVehicleLocal ASLToAGL getPosASL _obj for the proper position format
ah infact you're attaching the light, so you can simply just pass [0, 0, 0]
yeah
will this only work on a dedicated server? trying to test it on a local mp server, no errors but i'm not getting the behavior I want
well what's wrong?
are projectiles synced over the net, though?
the bigger ones are i think
I don't see any light attached to the mortar flare
you're in sp or mp?
tried in SP and on a local MP server, non-dedicated
just in editor
dunno if that makes a difference
Here's what i'm using now
fnc_mortarFlare = {
_obj = _this select 0;
_light = "#lightpoint" createVehicleLocal (getPosATL _obj);
_light setLightBrightness 5.0;
_light setLightAmbient [1, 1, 1];
_light setLightUseFlare true;
_light setLightFlareSize 5;
_light setLightFlareMaxDistance 500;
_light setLightColor [1, 1, 1];
_light lightAttachObject [_obj, [ 0, 0, 0 ]];
waitUntil{isNull _obj};
deleteVehicle _light;
};
if !isServer exitWith {}
this addEventHandler ["Fired",
{
if ((_this select 4) isEqualTo "Flare_82mm_AMOS_White") then {
_firedObj = (_this select 6);
_firedObj remoteExec ["mortarFlare"];
};
}];
wait
i'm dumb
forgot to add fnc_ in front of mortarFlare
hmm still not doing anything
shouldn't _this select 0; do the same thing
partially is same thing
if you pass a non array value params will still work
[_firedObj] remoteExec or switch back to params ["_obj"]
yeah switched back to params
no error but still not doing anything
it was doing an error earlier but switching to params fixed it
might have to add some hints to see if the function
How do artillery flares actually work? i.e. is the burning flare actually the same object as the projectile that's fired, or is it a new object that's created when the projectile fuze triggers?
it's the same object
so it's attached from the moment it's created
so it looks a little goofy when the light is coming out of the barrel, i could add a delay but i'm lazy
works fine in SP without all the remote exec stuff, but now i'm having issues
if it works without the remoteExec but doesn't otherwise, you're doing something wrong
here's the original code
this addEventHandler ["Fired",
{
if ((_this select 4) isEqualTo "Flare_82mm_AMOS_White") then {
_firedObj = (_this select 6);
_light = "#lightpoint" createVehicle ( getPosATL _firedObj ) ;
_light setLightBrightness 5.0;
_light setLightAmbient [1, 1, 1];
_light setLightUseFlare true;
_light setLightFlareSize 5;
_light setLightFlareMaxDistance 500;
_light setLightColor [1, 1, 1];
_light lightAttachObject [_firedObj, [ 0, 0, 0 ]];
_thread = [_firedObj, _light] spawn {
_obj = _this select 0;
_light = _this select 1;
waitUntil {isNull _obj};
deleteVehicle _light;
};
};
}];
for SP
here's what i'm using now
fnc_mortarFlare = {
params ["_obj"];
hint "ran on client";
_light = "#lightpoint" createVehicleLocal (getPosATL _obj);
_light setLightBrightness 5.0;
_light setLightAmbient [1, 1, 1];
_light setLightUseFlare true;
_light setLightFlareSize 5;
_light setLightFlareMaxDistance 500;
_light setLightColor [1, 1, 1];
_light lightAttachObject [_obj, [ 0, 0, 0 ]];
waitUntil{isNull _obj};
deleteVehicle _light;
};
if !isServer exitWith {};
this addEventHandler ["Fired",
{
if ((_this select 4) isEqualTo "Flare_82mm_AMOS_White") then {
_firedObj = (_this select 6);
_firedObj remoteExec ["fnc_mortarFlare"];
};
}];
function is running when mortar is fired, the hint text shows up
next i'll see if the _firedObj var is being passed to the function
it's not
when using hint str _obj I'm getting <NULL-object>
still singleplayer?
this is in a local multiplayer server
the kind you get when you run an eden mission in MP
dunno if that makes any difference
what kind of vehicle is firing?
mortar
firing flare
the var somehow isn't being passed from the eventhandler to the function
maybe because it's only on the server?
and not the client?
i'm running this from the init of a mortar vehicle
nah it's most likely what artemoz said
remove if !isServer exitWith {}; and replace _firedObj remoteExec ["fnc_mortarFlare"]; with _firedObj spawn fnc_mortarFlare;
now says error spawn: type array, expected code
this addEventHandler ["Fired",
{
if ((_this select 4) isEqualTo "Flare_82mm_AMOS_White") then {
_firedObj = (_this select 6);
_firedObj spawn ["fnc_mortarFlare"];
};
}];
with
_firedObj spawn fnc_mortarFlare;
remoteExec will not work
just hope that it works the way it is right now, with remote eh
but then this code isn't really different to what i was using before, and I'm pretty sure that didn't work on MP
i guess I wasn't using createVehicleLocal last time i tested
I made a trigger (repeatable, when player is present in area of that trigger) which On Activation creates a holdAction for opening the strategic map.
In On Deactivation I placed [opzone_1_ui,0] call bis_fnc_holdActionRemove; (because creating that holdAction through debug console gave me ID#0) so it removes that holdAction whenever I leave the trigger area, but it does not work. It creates new holdActions whenever I walk into it (but they have no names), but nothing is removed.
I assume the ID could be wrong and removal process does not start, but I don't get it why
opzone_1_ui is the screen I attached the action to, no typos or anything like that
ids aren't normalized once you remove
they keep incrementing
add > 0
remove > 0 // ok
add > 1 // even though 0 is removed
remove > 0 // fail
so my first holdAction should be removed, but it isn't and instead I have two there once I activate the trigger
that means something else added an action beforehand, and the id wasn't 0
just store an id
//activation
player setVariable ["tag_currentAction", [...] call BIS_fnc_holdActionAdd];
//deactivation
[player, player getVariable "tag_currentAction"] call BIS_fnc_holdActionRemove;
this works great, thank you
Thanks again, unfortunately, this doesnt take into account headtracking head movement within the cockpit, I just tested again to be sure
I just wrote a script that checks for any world position change in every single selection position for every available LOD (and i mean every LOD, even the obscure ones) - the result: not a single player or vehicle player LOD selection position is changed due to headtracking movement (translation). Very sad times.
I'm gonna look into animations and see if maybe there is some animationPhase for the player or vehicle player for headtracking movement but I dont have high hopes ๐ฆ
is there a built in signum or is (x / abs x) the only way?
I think that's the only way. You need to take 0 into account as well, though
[1, -1] select (x < 0) is another slowish option.
anyone know of a script i can use to spawn fortification pieces in a specified location, for players to move and use in a custom fob
still getting this error: https://pastebin.com/0hqfbiBP sometimes. I checked that all parameters passed to BIS_fnc_addRespawnPosition are valid. don't know what else to check?
Arma 2: OA! https://sqfbin.com/caloquwimosimuxacede <- player is null object sometimes, why's that? There's a check for null player object in init code: ```sqf
waitUntil {!(isNull player)};
```2022/10/12, 4:17:50 "_associatedSupplyTruck: 148e6080# 1055990: mtvr.p3d REMOTE, leader group: <NULL-object>, getPlayerUID leader group _associatedSupplyTruck: , _iteratedPlayerUID: 76561198021140xxx, _playerObject: <NULL-object>"
check the method code and see how the variable itself is declared
if it is an error in the method itself there is nothing you can do
I see no usage of player in your code
also you should check if you can sleep in this code (is it scheduled or unscheduled
The code in above message is on server. This is how it's called (from client), and there's the null check before elsewhere in code ```sqf
WFBE_Client_PV_SupplyMissionStarted = [player, _associatedSupplyTruck, _sourceTown, sideJoined];
publicVariableServer "WFBE_Client_PV_SupplyMissionStarted";
it is also a terrible way to create/broadcast a mission, just saying o__o
How would you do it? It's custom mission ๐
The code in above message is on server. This is how it's called (from client), and there's the null check before elsewhere in code
ta-daaa - you are sending the server'splayeras argument
oh wait, I read that wrong
It needs some client side code to run, ofc could rewrite it to handle it better but it's hard to get rid of the client side completely here
I'm just wondering how can the player object be null during the code execution because the mission ensures that the client init won't complete until the player object is not null
no idea
maybe the server didn't connect perfectly at that time, a dirty fix would be to add a static arbitrary sleep 5;
What makes it weird is that the code worked on the same client (same connection / no reconnection in between) just a moment ago
line 4: _playerObject = objNull; @tender fossil
so it's not the object that is null; it is your calculation line 25 that might not return the expected result
Yes, it's the init for the variable - the RPT shows the following, but only occasionally, it's random: 2022/10/12, 4:54:48 "_associatedSupplyTruck: 16342080# 1055980: kamaz.p3d REMOTE, leader group: <NULL-object>, getPlayerUID leader group _associatedSupplyTruck: , _iteratedPlayerUID: 76561198021140xxx, _playerObject: <NULL-object>" 2022/10/12, 4:54:48 "_playerObject/_currentSupplyTruckDriverLeader: <NULL-object>, _match: false"
The debug shows that when the script iterates through the self made player list, it works but the player object somehow becomes null object now and then
you diag_log before assigning variables e_e
Ok, I got more info. The null object error happens only when the PV EH is run instantly after triggering the mission from client. I even added a sleep in the beginning but it still fails
There's second diag_log near the end, it shows null object too
2022/10/12, 4:57:21 "_playerObject/_currentSupplyTruckDriverLeader: <NULL-object>, _match: false"
IDK, you are checking leader id, etc etc
it's illegible
something somewhere is wrong, and it is not the passing of player
so check with WFBE_SE_PLAYERLIST that there is the data you want in there, too
There is: 2022/10/12, 4:53:36 "WFBE_SE_PLAYERLIST after iterating: [[<NULL-object>,"0"],[O 1-1-C:1 (xxxx) REMOTE,"76561198021140xxx"]]"
(The first null object is intended, don't mind that)
ยฏ_(ใ)_/ยฏ
Should I file a bug report for Arma 2? 
you mostly should check your code logic
I don't see the game failing a == operation ใ
2022/10/12, 5:13:43 "_x select 0: <NULL-object>" ```sqf
_playerObject = _x select 0;
diag_log format ["_x select 0: %1", _x select 0];
I was going thru the method code and the call stack but lot of code there, hard to pinpoint to the problem
yeah, you are going through your WFBE_SE_PLAYERLIST no?
Yes
if ((getPlayerUID (leader group _associatedSupplyTruck)) == _iteratedPlayerUID) then {
_playerObject = _x select 0;
diag_log format ["_x select 0: %1", _x select 0];
_match = true;
};
``` The code is only run if the IDs match
(Should've included this initially) ๐
Also I don't know why the intendation goes crazy like that, it's perfectly fine in my editor ๐
you use spaces and not tabs, that's why
There are 2 kinds of whitespace character, one long and one short, and Discord uses the other one when you press tab
It's....weird
I have the same problem when I copy directly from Notepad++
what's the name of default sound for holdAction? I've been going through LoW campaign files for way too long to find it and I can't get either its classname or file name/location
open fn_holdActionAdd?
sorry, by default I mean default for BI campaigns, holdAction won't play any sound if not added by the missionmaker
whenever you start a memory fragment in LoW it plays a sound, I checked every file that had anything to do with memory fragments and there's nothing
I did find it and even use it, can't remember though

how to optimize a "what enemies do you have in sight" further as checkVisibility in the end is quite expensive?
- targets to limit to known, enemies and within viewdistance
- if in FOV
- seen already in the last second
- not blocked by terrain (terrainIntersect) or another object (lineIntersects)
playSound3D ["A3\Sounds_F_Orange\MissionSFX\Orange_Action_Wheel.wss", objNull, false, getPosASL _caller, 1, 0.9 + 0.2 * _progress / _maxProgress]; where _caller, _progress and _maxProgress are from codeProgress
That's a neat trick on the pitch shift, I'll have to remember that
so should it work just after pasting this into the codeProgress? I'm getting undefined variable error for _progress
You will also need this:
params ["_target", "_caller", "_actionId", "_arguments", "_progress", "_maxProgress"];```
@velvet merlin Well, the game does a lot of that for you, right? targets etc
Those checks run on players, not just AIs.
anyone know why script given move waypoints dont have AI get into their vehicles?
sorry dont get your point
checkVisibility is very expensive command
so you want to limit to absolute minimum amount of executions
- targets to limit to known, enemies and within viewdistance
yes i used it already
its not that cheap if you work with VD and a good amount of targets either
but anyhow its not the problem at hand
oh, I see.
its to avoid checkVisibility either as you can rule out the unit by other means or you can ensure its visible by other means
doesn't targetKnowledge lastSeen cover most of this?
Or is this some sort of every-frame application?
params["_faction"];
systemChat str _faction;
// init stuff
private _motorized = ("true" configClasses (configFile >> "CfgGroups" >> "East" >> _faction >> "Motorized"));
private _spawnpoint = getMarkerPos selectRandom ["spawn_1", "spawn_2", "spawn_3"];
private _group = [_spawnpoint, east, selectRandom _motorized] call BIS_fnc_spawnGroup;
_group deleteGroupWhenEmpty true;
// _group allowFleeing 0;
// _group setSpeedMode "FULL";
_wp2 = _group addWaypoint [getmarkerpos "wp", 0];
_wp2 setWaypointType "MOVE";
When I run this, it spawns the group, gives them a move waypoint, then the vehicle with them takes off and the infantry start running behind it. Even if I start with a get in waypoint and add the move waypoint at index 1, the vehicle just takes off without the infantry.
What if you give them the get in waypoint but not a move waypoint?
the vehicle very slowly drives to the position of the waypoint, with infantry in wedge behind
Function is bugged, I guess. If it's spawning the right number of units then you could just run moveInAny over the units.
If it's not spawning the right number of units then you'll have to DIY.
spawns the right number of units, but that number isnt consistent across group types
the thing about moveInAny is that it requires a reference to the vehicle
assignedVehicles isnt available outside of dev branch according to the wiki
ugh I might jsut have to hack together a check for units in vehicles
probably better off doing it from scratch at this point.
createVehicle + createVehicleCrew + fullCrew alt syntax to get cargo seats.
Just used this code that worked before, but no longer it does
on description.ext
respawnOnStart = 1;
respawn = 3;
respawnDelay = 2;
reviveMode = 0;
respawnTemplates[] = { "Tickets" , "Counter" , "MenuPosition" };
on initPlayerLocal.sqf
_playerTickets = [player, 3, true] call BIS_fnc_respawnTickets;
what is wrong here?
What's not working?
the tickets
As a rough rule of thumb, temporal optimization can often be achieved by letting spatial optimization to decrease, and vice versa (source: university CS course). In other words, you could maybe utilize caching (maybe HashMaps would be helpful here too?) to decrease the load if increased memory usage was not a hard limitation? You probably know this already though ๐
hard to say with so little information
the "respawnTemplates[] = { "Tickets" , "Counter" , "MenuPosition" };" or the " _playerTickets = [player, 3, true] call BIS_fnc_respawnTickets;" seem to have a problem or soemthing
do you see the respawn dialog? or nothing happens?
no message
it simply doesn't want to work
yes. 3d target indicator with drawIcon3d
good idea - will check
tried it again in other map
and doesn't works now
wtf
@proven charm ok, what it happens is that the ticket system for the respawns doesn't want to work
wich is really odd
since it worked las time i've used it
What would be the most correct way to attach a player to another one ?
I'm experimenting with a perFrameHandler updating the position but so far, it tends to end in blood and broken bones and very messy things
attachTo seems to be a better idea
attachTo is usually the best idea for attaching things to other things
don't forget about BIS_fnc_attachToRelative, it can be useful for on-the-fly attaching
Someone able to assist me? I'm trying to make an addaciton that only appears when aiming at rocks on the map.
Hi,
You can use on AddAction condition to check cursorObject is rock or nearObjects is kind of rock.
https://community.bistudio.com/wiki/cursorObject
https://community.bistudio.com/wiki/nearObjects
I have in tree cut mod where i check is cursorobject kind of tree
{
!isNull cursorObject && {
(("SawToolClass" in (items _player)) && ((_player distance2D cursorObject) < 3)) && {
(((getModelInfo cursorObject) # 1) find "\tree\") != -1
}
}
}
https://community.bistudio.com/wiki/BIS_fnc_moduleMPTypeGameMaster anyone got a definition for this?
@tough abyss You can try checking that function's code in the Functions Viewer in-game and maybe figure out how it's supposed to be used
Advanced Developer Tools mod makes it easier to read
That worked perfectly, thank you, by chance do you know of a way to setvariable on the cursorobject of a rock? It doesn't seem the be as straight forward as I thought.
cursorObject setVariable ["alreadyharvestedstagestone",1,true];
Doesn't work for me for some reason, whereas most other objects do.
I'm trying to set that to 1 so the addaction doesn't appear on the thing infinitely, and without deleting the rock from the map, as some rocks of the same classname make up parts of large map pieces.
how are you running the mission? 3den? multiplayer/singleplayer?
You can check via systemchat on action --
private _rock = cursorObject;
systemChat str(_rock);
througout 3den on a multiplayer hosting
i'll recall that the script worked a month ago or so
ok
that's the issue i have, i don't understand why, if the scripted worked before, now it doesn't
If i remember correctly you can't set variables on all types of terrain objects, only some depending on simulation type. Workaround for that could be map with the obj as key and whatever data you want to save as value.
wich makes even less sense
because the only part that doesn't seems to work is the tickets
it posts in the systemchat, but doing the setvariable then ```sqf
cursorObject getVariable ["alreadyharvestedstagestone",0];
it returns 0 still.
cursorObject setVariable ["SNM_harvested",true,true];
cursorObject getVariable "SNM_harvested"
Just doesn't return anything with the getvariable, its a rock on the map, is that why?
Yep, one way is check can get to array with nearestObjects and select if it typeOf rock, i do not know is there possibility to set var to rock.
What are you trying to do for it?
Trying to make a "mining" system, Goal was to add "harvest stone" to all of the rocks, dice roll the yield of the stones, then set it as already harvested without deleting it, but leaving it unable to be used again by players. I wanted to use the map ones to avoid spawning them across the map
can't you just add the stone to hashmap?
every stone should have unique ID, or am I wrong?
thats above my head sadly
harvestedStone = createhashmap; harvestedStone set [str cursorObject , true];
something like that
I thought about doing somekind of script where it randomly places triggers, the triggers just set a variable to true, if the variable is true, let the player use "dig" which maybe spawns a rock then the rock has options, it being spawned i could make it disappear afterward
it wouldn't mess the map up by adding more things to the map aside from triggers, which aren't saved, i could make use a unique rock from the editor for it too since the map ones are causing me problems.
doing the digging system I can even adapt it to have random rewards, but then editing the trigger area might be funky, to stop the thing from being abused.
@proven charm any idea on my problem?
If get objects from inThisList or inAreaArray, findIf type is rocks and selectRandom some of them, hide orginal and create new , when you can attach your actions etc for those?
No, sorry ๐ฆ
oh, don't worry
still
disapointing that the code now decided to not work
same files?
literally the sames
as discussed here
literally the same
copasted
Hello,
I do have a small syntax question with alive
is there a better way to write that condition to check if all vehicles are not alive ?
if ((!alive vhl_1 && !alive vhl_2) && (!alive vhl_3)) exitWith {}
?
Thanks ๐ฌ
make sure there's no typos in the file names
you could place then on the same group, and check if all group member are alive
and maybe put hint "TEST"; in the sqf file to see its running
?
how is that done?
Description.ext
initPlayerLocal.sqf
those are the file names
do you see any goof?
hint "script running";
_playerTickets = [player, 3, true] call BIS_fnc_respawnTickets;
Actually no cause it's vehicles
ah, if so that's the best way
alright thanks ๐
yes, the script runs
ok
mind if i dm you a thing
i mean, it doesn't want to work, since you have infinite tickets
but it shows up that the hint
try using ``` _cnt = { alive _x } count [vhl_1 , vhl_2, vhl_3];
if(_cnt == 0) then { /* all dead */ }; ```
oh maybe you can reset that somehow then
what do you mean by that
to make tickets zero
@bright robin maybe you had set some respawn setting in the 3den editor before
sorry for the dms
had it disabled
but i think they're necesary
its ok
instead of _playerTickets = [player, 3, true] call BIS_fnc_respawnTickets;
try just doing
[player, 3, true] call BIS_fnc_respawnTickets;
Because what you're doing there is getting how many is left
Hello! I am novice with sqf. I have some errors with this script I made for a mod.
`private _detonator = _this select 0;
if (typeof _detonator == "EUG_Clacker_4000" OR typeof _detonator == "EUG_Clacker_4000" OR typeof _detonator == "EUG_Clacker_4000" OR typeof _detonator == "EUG_Clacker_5000" OR typeof _detonator == "EUG_Clacker_10000" OR typeof _detonator == "EUG_Clacker_15000" OR typeof _detonator == "EUG_Clacker_20000" ) then
{
private _result= nearObjects [_detonator, ["tfw_rf3080Object"], 6];
if count _result > 0 then
{
_detonator setVariable ['ace_explosives_Range', 99999, true];
hint "Detonator is cable linked to SATCOM. \n Satellite connection: ON.";
}
else
{
_detonator setVariable ['ace_explosives_Range', 1, true];
}
private _result= nearObjects [_detonator, ["tfw_rf3080Object"], 20];
if count _result > 0 then
{
hint "Detonator is NOT cable linked to SATCOM. \n Stay max 5 meters from SATCOM \n Satellite connection: OFF.";
}
};`
nope, doesn't works neither
_detonator is a variable error
That probably means _detonator isn't being passed to the script properly (i.e. _this select 0 isn't returning anything useful)
Hello collective hivemind 
This time I'm not around here to ask how to do X or Y, but to ask how it would be best to iterate through a VERY long array
for "_i" from 0 to _itemCount do
{
_verifier = _removedItems pushbackUnique (selectRandom _objectArray);
if (_verifier > 0) then
{
(_removedItems #_verifier) hideObjectGlobal true;
};
};
The full code contains a known list of A LOT of data (900k+ indexes at maximum) represented by _objectArray. The list is not always the same each time the mission begins, as this is ideally done once per mission due to how long it takes to do it.
_itemCount is a percentage based on the number of entries for the _objectArray.
Is there an effective way to do a looping of that magnitude without taking fucking forever?
The code itself is not complex, and it's very fast in small amounts (i.e < 100k entries) taking around a minute or so to complete, however, after certain threshold I could swear this loop bogs down and become incrementally slower the higher the data amount is. Any suggestion in how to improve this?
how can I fix it @hallow mortar ?
try
[missionNamespace, 3, true] call BIS_fnc_respawnTickets;
but do it in init instead of initPlayerLocal
hmm....ok
the problem is that the script has to work for each player
How would I refactor this code so that I could put it in addAction condition? ```sqf
{
if (_x isKindOf "Base_WarfareBUAVterminal") then {
_friendlyCommandCenterInProximity = true;
};
} forEach (nearestObjects [(getPos _associatedSupplyTruck), [], 100]);
The problem is likely to be with how you're calling the script - the execVM, call, or spawn that causes the script to run. The detonator object needs to be defined in that context (I don't know what context this is) and passed as an argument, e.g. [_detonator] execVM "your_script.sqf"
Ok understood, thank you I will check asap
@tender fossil maybe ```sqf
_friendlyCommandCenterInProximity = false;
{
if (_x isKindOf "Base_WarfareBUAVterminal") then {
_friendlyCommandCenterInProximity = true;
};
} forEach (nearestObjects [(getPos _associatedSupplyTruck), [], 100]);
_friendlyCommandCenterInProximity
I need to combine it with other conditions
I mean, I want to add the code directly to addAction parameters to get rid of these annoying bugs that happen otherwise
I think I could use count ... > 0 but I can't even think about how to do it anymore because I'm too tired and annoyed ๐
Also, instead of using 11 million OR constructs, use this:
_validObjects = ["detonator_class1","detonator_class2",...] apply {toLower _x};
if ((toLower typeOf _detonator) in _validObjects) then { ...```
Much cleaner and makes the classnames not case sensitive
Have I to write the private _detonator = _this select 0; before your code?
count (nearestObjects [(getPos _associatedSupplyTruck), ["Base_WarfareBUAVterminal"], 100]) > 0;
That must always be at the start of the script because it defines something that's used in the script. What I wrote replaces the if condition you already have, so it goes in the same place.
ok thanks
Error position: <nearestObjects [(getPos _associatedSuppl>
Error 0 elements provided, 3 expected
Do I need to pass the _associatedSupplyTruck variable in some special way to addAction?
Here's how I have it now: ```sqf
player addAction [
"<t color='#00e83e'>" + 'UNLOAD SUPPLIES FROM TRUCK' + "</t>",
'Client\Module\supplyMission\supplyMissionComplete.sqf',
[_associatedSupplyTruck],
70,
false,
true,
"",
"(count (nearestObjects [(getPos _associatedSupplyTruck), ['Base_WarfareBUAVterminal'], 100]) > 0) && (cursorTarget == _associatedSupplyTruck)"
];
The condition code doesn't support passing arguments. You'd have to make it a global variable.
Ah, I see. Thanks! ๐
Or add the action to the truck instead of the player so you can use _target
@hallow mortar I need more info about how to define _detonator in the context. I created a config.cpp with the new detonators (works fine) and now I wanna link the script (the sqf I attached before) to them.
I am testing in the editor and so I put in the init of the scenario
if (isServer) then { [_detonator] execVM "satcom.sqf"; minesarray = []; };
You need _detonator to refer to a specific inventory object, presumably of one of those types in your list. The game does not automatically know this or know which detonator you're thinking of; you need to tell it. You need to identify the specific item and define _detonator as a reference to it.
I have it like this now:
player addAction [
"<t color='#00e83e'>" + 'UNLOAD SUPPLIES FROM TRUCK' + "</t>",
'Client\Module\supplyMission\supplyMissionComplete.sqf',
[WFBE_CL_VAR_ASSOCIATED_SUPPLY_TRUCK],
70,
false,
true,
"",
"(count (nearestObjects [(getPos WFBE_CL_VAR_ASSOCIATED_SUPPLY_TRUCK), ['Base_WarfareBUAVterminal'], 100]) > 0) && (cursorTarget == WFBE_CL_VAR_ASSOCIATED_SUPPLY_TRUCK)"
];
supplyMissionComplete.sqf: ```sqf
private ['_associatedSupplyTruck'];
_associatedSupplyTruck = _this select 3 select 0;
diag_log format ["SupplyMissionComplete.sqf: _associatedSupplyTruck: %1", _associatedSupplyTruck];
WFBE_Server_PV_SupplyMissionCompleted = [player, _associatedSupplyTruck, side player];
publicVariableServer "WFBE_Server_PV_SupplyMissionCompleted";
RPT (supplyMissionComplete.sqf): ```"SupplyMissionComplete.sqf: _associatedSupplyTruck: <NULL-object>"```
...
Both files are being executed on client
So again a mysterious null object error
Here's the whole file: https://sqfbin.com/nayocesipaxivujoqidi
The added action also appears twice in the action menu ๐
using in the config.cpp the _generalMacro ?
I don't know what that means so almost certainly no
class CfgWeapons { class ACE_Clacker; class EUG_Clacker_500: ACE_Clacker { author="[EUG] Eughenos"; displayName="Detonator M57 500m"; ace_explosives_Range=500; };
here is the config.cpp
This sounds like either locality things or you actually have a second instance of addAction somewhere. Nothing in the action code itself causes that
This is a cfgWeapons, which means it defines a type of weapon that can exist. It does not define a specific instance of that weapon, it only defines that a weapon of this type is possible.
I'm not certain that cfgWeapons works in mission config, and I'm not certain that setVariable works on weapons properly - I don't think they exist as true unique objects with persistent properties
Why pass the argument as a single element array? Just pass the variable alone, then _this select 3 is all you need, no select 0.
Also I still think adding the action to the truck instead of the player will let you skip a lot of this hassle
@meager spear What do you need to do in your satcom.sqf?
I need to increase a specific value of the detonator if is closed to a satcom
Have you a better idea of how to realize this concept?
shrugs
The problem's what Nikko said. Weapons aren't objects so you can't store variables on them.
In this case I'd have thought that storing the var on the player would be fine.
sadly
just remove the ACE one and add yours?
hey, how do supports work? like how do I add them to the command menu