#arma3_scripting
1 messages · Page 683 of 1
isEqualTo [] instead
ok
yes and ↑ yes
if (units west inAreaArray theTrigger isEqualTo []) should work
ok
I replaced the function with the hint, it gave me another error a few lines above regarding the same variable.
this is my current initplayerlocal.sqf in its entirety
// Wait until player is initialized
waitUntil{!isNull(player)};
//Scripts___________________________________________________________________
execVM "scripts\briefing.sqf";
setTerrainGrid 25;
teleport addAction ["<t color='#ff0000'>Teleport zum Commander</t>", "(_this select 1) setPos position s0", nil, 100, false, true, "", ""];
teleport addAction ["<t color='#ff0000'>Teleport zu Shrew</t>", "(_this select 1) setPos position s1", nil, 100, false, true, "", ""];
teleport addAction ["<t color='#ff0000'>Teleport zu Spike</t>", "(_this select 1) setPos position s7", nil, 100, false, true, "", ""];
teleport addAction ["<t color='#ff0000'>Teleport zu Fist</t>", "(_this select 1) setPos position s13", nil, 100, false, true, "", ""];
loadouts addAction [("<t color=""#0e12ed"">" + ("Ausrüstung: Commander") + "</t>"), "loadouts\commander.sqf",[],98,false,true,"",""];
loadouts addAction [("<t color=""#0e12ed"">" + ("Ausrüstung: Truppfuehrer") + "</t>"), "loadouts\trpfhr.sqf",[],98,false,true,"",""];
loadouts addAction [("<t color=""#0e12ed"">" + ("Ausrüstung: Scout") + "</t>"), "loadouts\scout.sqf",[],98,false,true,"",""];
loadouts addAction [("<t color=""#0e12ed"">" + ("Ausrüstung: Doktor") + "</t>"), "loadouts\doctor.sqf",[],98,false,true,"",""];
loadouts addAction [("<t color=""#0e12ed"">" + ("Ausrüstung: Demolition") + "</t>"), "loadouts\demolitions.sqf",[],98,false,true,"",""];
loadouts addAction [("<t color=""#0e12ed"">" + ("Ausrüstung: RTO - Funker") + "</t>"), "loadouts\rto.sqf",[],98,false,true,"",""];
loadouts addAction [("<t color=""#0e12ed"">" + ("Ausrüstung: MG-Schütze") + "</t>"), "loadouts\mg.sqf",[],98,false,true,"",""];
/*--------- Functions - Pflicht ---------*/
hint name s1;
"teleport" and "loadouts" are configured variables and the action in itself is working.
Its giving me an error for every variable except s0. s1, s7 and s13 are returning errors aswell.
then something is wrong
ok im not sure if I did it right but this is what i have: #arma3_scripting message
oh, I think I know.
because they are not on the server or active as players? im playing with disabled AI
it's an MP mission.
you are trying it alone.
other players are not spawned.
their variable does not exist.
ta-daaa
no
ok
one count too much
ohhh
also, better get the triggers' units, less taxing on resources
list
a list of the trigger's units?
list theTrigger = units triggering the trigger
no need to go through everyone, only the ones in the trigger
ohhh
yeah
but how would I get the trigger to be triggered by any players on blufor and any players on opfor
because i want to check for both sides to wait until they have no one left
"anybody"
ok
yeah i havent used too many triggers before
so i have to take a look at the options
wait
wouldnt that just return a list of all units in the trigger instead of blufor and opfor units seperately?
list theTrigger;
yeah
if you don't need the trigger just remove it
replace it with an area
use inAreaArray
ok
im just gonna do it this way:
if ( (units west inAreaArray theTrigger) isEqualTo [] or (units east inAreaArray theTrigger) isEqualTo [] ) then {
//code
};
since there are only 8 players
is there something wrong with it?
not ideal but will work
any ideas?
as I said before, actions are local, so they must be executed for everyone
remoteExecCall ["call"
don't do that
use a function
my bad, did not see the response. thanks...
is there any way to make the variable of an EventHandler local and remove it from another script?
🤔
wat?
wave5Icon = addMissionEventHandler ["draw3d",
{
_k = 12 / (player distance pos);
drawIcon3D
[
"\a3\ui_f\data\map\mapcontrol\waypoint_ca.paa",
[0,0.9,0.2,1],
wave5Marker,
1 * _k,
1 * _k,
0,
"Opens on wave 5",
0,
0.04 * _k,
"RobotoCondensed",
"center",
false,
0.005 * _k,
-0.05 * _k
];
}];```
So this is being exec'd from the initplayerlocal.sqf, and I'm wanting to remove the eventHandler from another script. To reduce the amount of global variables, is there a way to pass the name to a different script
do you mean wave5Icon?
and I'm not even sure why you'd want to remove that?
if you want to remove it and add another code to show another icon, just create a "dynamic" drawIcon3D
How I can setPos in world coordinate frame rather than AGL
I'm trying to set an altitude for spawning on the USS Wasp
And setPos seems to sometimes spawn on Wasp, and sometimes spawn under it in the water
use setPosATL and getPosATL
or ASL 👀
ASL is constant in Arma right? No bs like "changing with the waves"?
ASLW is with waves
Can't figure out why setPos seems to vary by +/- 0.5m
but idk if ASL changes with environment. so that's why I use ATL. its always gonna be the same
setPos uses (a weird form of) AGLS
that variation is due to waves
it doesn't
ASL is even better than ATL
alrighty I'll try ASL here in one sec
seems pretty consistent now! Thanks
The trigger I'm putting this into is giving me a "generic error in expression", but it's a pretty simple script. Anyone see any flaws with it?
player setPosASL [12440.6,20571.9,7.69761];
sleep 0.5;
player allowDamage true;```
yes, meaning the variable name. I'm wanting to remove the marker entirely from a different script
Spawn it.
You need scheduled
why? It's just a trigger exec
whelp, that's annoying, but that worked
so just use removeEventHandler.
If your concern is that you have something like wave5Icon, wave6Icon, etc. variable names because you have many other event handlers, that's what you should avoid
use a single event handler
do many things in it
not create many event handlers to do a single thing in each
pos = player getPos [10, 0] vectorAdd [0,0,2];
wave5Icon = addMissionEventHandler ["draw3d",
{
_k = 12 / (player distance pos);
drawIcon3D
[
"\a3\ui_f\data\map\mapcontrol\waypoint_ca.paa",
[0,0.9,0.2,1],
wave5Marker,
1 * _k,
1 * _k,
0,
"Opens on wave 5",
0,
0.04 * _k,
"RobotoCondensed",
"center",
false,
0.005 * _k,
-0.05 * _k
];
}];
I'm essentially wanting some icon markers for objects in the world, but they need to be removed and added at different points, so surely creating one eventHandler wouldn't work
yes it would
but if they're added in different times I guess removing them isn't a terrible thing
there's two objects with markers at mission start, and these markers should disappear after a certain amount of time. Then 2 more markers should appear after that. Surely I can't do that on one event handler?
I'm also getting a Error Type String, expected Number on this, even though it works fine?
_surv = surv1;
_survPrimMag = primaryWeaponMagazine _surv;
_surv addMagazine _survPrimMag;
(part of larger code that is also working fine)
draw_markers = [];
addMissionEventHandler ["draw3d",
{
{
_pos = _x;
_k = 12 / (player distance _pos);
drawIcon3D
[
"\a3\ui_f\data\map\mapcontrol\waypoint_ca.paa",
[0,0.9,0.2,1],
_pos,
1 * _k,
1 * _k,
0,
"Opens on wave 5",
0,
0.04 * _k,
"RobotoCondensed",
"center",
false,
0.005 * _k,
-0.05 * _k
];
} forEach draw_markers;
}];
draw_markers pushBack ASLtoAGL getPosASL player;
when you want to remove something just delete them from the array
resetting the array also means no icons
the markers also have different texts as well, so that would cause problems too
nested arrays
I don't think the error is there
non of those commands need a "Type Number"
_surv addMagazine _survPrimMag;
systemChat for>
20:17:13 Error position: <addMagazine _survPrimMag;
systemChat for>
20:17:13 Error Type String, expected Number```
that's the full log
the error is from the previous line
ter than 2 " + str _survPrimMag
it's not that cause i added them in to check that error and it was happening before and after i added that line
and the systemChat still appears in game
well the error is not what you sent either
wait I got it
it returns an array of all magazines in primary weapon muzzles
https://pastebin.com/BR9aqr9Y so with this script, i'm having issues. The survhand section repeats 5 times and i can't figure
sleep 5;
if ( player !inArea "SpawnMarker" ) then {
_ifrit = createVehicle ["O_MRAP_02_F", position player, [], 0, "NONE"];
sleep 120; deleteVehicle _ifrit;
};
why am I getting error: missing ) on line 2?????
because it has syntax errors?
player !inArea…
spanky spank time 👀
!(...)
only for unary commands ^^ e.g```sqf
if (!alive player)
For that if you not even need the () 🥴
hehe = {not alive player call {if _this}};
hehe2 = [{hint "ded"}, {hint "alive"}];
call hehe then hehe2;
😂
how can I set the orientation of a vehicle that I create using createVehicle?
setDir
ok thanks
Is it possible to check which unit opens a door?
ifrit1 = "O_MRAP_02_F" createVehicle [23671.2,18317.8,0];
ifrit2 = "O_MRAP_02_F" createVehicle [23672,18309.6,0];
clearItemCargoGlobal ifrit1;
clearItemCargoGlobal ifrit2;
does anyone have an idea why this isnt actually clearing inventory?
clearItemCargoGlobal does not include backpacks and other crap
need clearMagazine and other stuff too
/*
Author: IR0NSIGHT
Description:
Will clear a container with all its inventory
Parameter(s):
0 :
OBJECT - container to clear of vanilla inventory
Returns:
none
*/
params [["_crate",objNull,[objNull]]];
if (isNull _crate) exitWith {
["target object is nil."] call BIS_fnc_error;
};
clearItemCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
clearBackpackCargoGlobal _crate;
clearMagazineCargoGlobal _crate;
{
deleteVehicle _x select 1;
} forEach everyContainer _crate;
and i have been told that addItemCargoGlobal works for anything that can be carried on your person, wouldnt it also work for clearItemCargoGlobal?
ifrit1 = "O_MRAP_02_F" createVehicle [23671.2,18317.8,0];
ifrit2 = "O_MRAP_02_F" createVehicle [23672,18309.6,0];
clearItemCargoGlobal ifrit1; clearItemCargoGlobal ifrit2;
clearWeaponCargoGlobal ifrit1; clearWeaponCargoGlobal ifrit2;
clearBackpackCargoGlobal ifrit1; clearBackpackCargoGlobal ifrit2;
clearMagazineCargoGlobal ifrit1; clearMagazineCargoGlobal ifrit2;
so could I just do it like this?
yeah or just do it in a foreach loop
np
you can also take my function, and use that one. clearing cargo is a very often needed thing
how can I create a light source?
createVehicle
#lightpoint
no
at least not that I know of
so for the type I put #lightpoint?
ye
lightpointRed = "#lightpoint" createVehicle [0, 0, 0];
lightpointBlue = "#lightpoint" createVehicle [0, 0, 0];
lightpointRed setLightColor [0.5, 0, 0];
lightpointBlue setLightColor [0, 0, 0.5];
so something like this?
@little raptor
ohhh
if you copied it from the wiki then why do you ask?
deleteVehicle _x select 1; is (deleteVehicle _x) select 1 precedence issue
myLight setLightColor [0.5,0,0]; // produces red
but the entire line being orange kinda makes me think i did something wrong
yeah
but the createVehicle i mean
is it supposed to be a string?
yes
ok
you have to change it to a string
thanks
@past wagon but I think lights are local 🤔
at least light commands are. idk
if you don't care about MP, you can just use that.
But I think createVehicleLocal is the safe way to do it
ok
I just tried putting the code i had into initPlayerLocal and it didnt work
but now im trying createVehicleLocal
yeah its still not working
are you trying it in day?
no not rlly
more like 4:30 am
_light = "#lightpoint" createVehicleLocal [0, 0, 0];
_light setLightColor [0,0,0];
_light setLightAmbient [1,1,1];
_light setLightIntensity 5000;
_light setLightAttenuation [2*30, 0, 0, 0, 2*30, 2*30];
_light setLightDayLight true;
try this
yeah it's very bright
what should we set the light intensity to?
read the wiki
is it possible to make lights point in a direction?
or would you have to do that by making an addon
_light = "#lightpoint" createVehicle [23594.7,18209.8,10];
_light setLightAmbient [1,1,1];
_light setLightIntensity 50;
_light setLightAttenuation [2*30, 0, 0, 0, 2*30, 2*30];
_light setLightDayLight true;
while { true } do {
_light setLightColor [10,0,0];
sleep 3;
_light setLightColor [0,0,10];
};
will this work?
what's not working?
this
I mean what part of it?
setLightColor [10,0,0]
does 10 look like a color to you?
For some reason the following code results in multiple hold actions being created and visible for all players, with one being created for every player online (including the dedicated server itself). Isn't "BIS_fnc_holdActionAdd" a local effect, meaning that it's only created where the command is run (hence the usage of remoteExec)?
https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd
//add arm script
[
bombObject, // Object the action is attached to
"Start Bomb Countdown", // Title of the action
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Idle icon shown on screen
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Progress icon shown on screen
"_this distance _target < 3", // Condition for the action to be shown
"_caller distance _target < 3", // Condition for the action to progress
{}, // Code executed when action starts
{ playSound3D ["A3\Sounds_F\sfx\Alarm.wss", bombObject]; }, // Code executed on every progress tick
{ execVM "bombArmed.sqf"; }, // Code executed on completion
{}, // Code executed on interrupted
[], // Arguments passed to the scripts as _this select 3
4, // Action duration [s]
0, // Priority
true, // Remove on completion
false // Show in unconscious state
] remoteExec ["BIS_fnc_holdActionAdd", 0, bombObject]; // MP compatible implementation
are you executing it from init/initPlayerLocal?
this particular one is in init.sqf, I have other similar ones in other files that get execVm'd, cant remember if those broke or not
Does putting in it init.sqf break something?
then you should already see the problem
you can put it in initPlayerLocal
without remoteExec
true, that makes sense
or you can put it in initServer.sqf
with remoteExec (not recommended)
does anyone know how to loop a say3d sound from an object? 😮 (referenced from an in-mission description.ext sound file (.ogg format) 😮
(or any kind of 3D positional audio for that matter)
thanks for the help, I think I understand it now
AFAIK a mission-defined sound shouldn't behave much differently than a normal sound in that context so just do a normal thing
Probably this code plus some kind of loop
https://community.bistudio.com/wiki/playSound3D
I did something similar a while ago for an "run from the base as it self destructs," try using this but replace the classname with your custom sound (this example plays it from several objects)
//alarm goes brrr, run boi run
while {true} do
{
{ playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", _x] } forEach [speaker_power, speaker_control, speaker_junction, speaker_tunnel1, speaker_tunnel2, speaker_tunnel3, speaker_exit];
sleep 10;
};
I think it worked but it's been a while and I don't quite remember that part of the op clearly
Lemme have a gander and i'll get back to you with it, thank you so much!!! o.o
no problem, also you'll need to adjust the sleep to match the length of your music or you might get overlapping sounds/awkward silence between repetitions
perfect, thank you so much! it's only for one sound emitter sadly but i'll have an adjust on this ^^ thank you so much 😄
could try this for one object, edited it in a cramped discord window so beware of typos
//alarm goes brrr, run boi run
while {true} do
{
playSound3D ["soundClassname", soundObject];
sleep 10; //adjust sleep for sound length
};
fat fingered a double quote, should work now
Get rid of { before the playSound3D
done, dunno how that snuck in, thanks
o.o thank you! ^^
A little update, I pinpointed the issue while it seems to be something I can't fix. Everything points towards the issue being with mbg walls (yes, I was talking bout jbad walls yesterday, but close nuff :'D.)
Started with vanilla shoot house walls and blufor riflemen, ended with testing exact same code as the one which causes the crash except this time disabled spawning mbg_cinderwall_5_WoodDoor_InEditors... (The original code had two different mbg wall types, the other one of which doesn't have a door and was included in the code that didn't crash.)
[] spawn {while {shit} do {
[[0,0,0],100,100,0.7,0.2,true] spawn PK_fnc_create_box;
sleep 5;
};
};
^can be left running for a while without any signs of crash, but if I also use the problematic walls, crashes :D. Might as well check the config out while I'd be surprised if I actually found sth :D.
well why not use a different wall then?
I doubt it's a config problem
sounds like a model issue
or you can try repairing the mod via Steam
maybe something's broken
Could try that.
Otherwise, the idea of the scripts is to create a "building/something not too far from one" of the walls, and the measurements of the model are important. The mod does have a few other walls with doors, tho, and I'll check if those work any better.
Otherwise I'll see if some workaround with spawning units can be figured out. In practice Zeus is also an option, while at that point the whole purpose of script which puts something together quickly is kinda missed.
Well, it's pretty late again, will be heading off. This is really puzzling me, tho. Most of the other walls didn't cause issues, altho some of the doors didn't have interaction which they should afaik. As for the ones of the exact same class name, I could construct the conpound a few times aaaand crashes :D.
hi, need to know the animation name to cause units to sit Indian style?
Does that even exist? 
Just check in the animation viewer
yes... there is an animation viewer?
I found it, but there is a viewer? that's interesting... "AmovPsitMstpSlowWrflDnon"
Eden Editor > Tools > Animations Viewer or from Debug Console
Is there a way to get objectexture from a simple object like with getObjectTextures ?
Simple Object, yes. Super Simple Object, can't
It's created via createSimpleObject and CfgVehicles config class name, but i get a empty array if i use it 🤔
Which vehicle?
a base building object from a mod
Then most unlikely it has
the non simple object of the same types work like intended
getObjectTextures only returns retexturable textures
for debugging i just used getObjectTextures cursorObject in the debug console
The createSimpleObject part?
_constructionObject = createSimpleObject [(_data select 1), ATLToASL _position];
data select 1 is the classname
getObjectTextures _constructionObject?
i need the information on the clientside ^^ for non simple objects getObjectTextures was used in a another script i intend to use
Just to test. Make sure it returns it properly
already on it 🙂
Same on the server side, empty array. Even tho setObjectTextureGlobal was successfully used on the object 🤷♂️
Hello,
Is there a faster way to find out the number of wheels on a vehicle than my code?
nb=0;
for "i" from 1 to 10 do
{
test=((vehicule modelToWorld (vehicule selectionPosition [format["wheel_1%1_bound",i],"Memory"])) #2)-((vehicule modelToWorld (vehicule selectionPosition [format["wheel_1%1_axis",_i],"Memory"])) #2);
if (test==0) exitwith {nb=2*(_i-1)};
};
count (configfile >> "CfgVehicles" >> typeOf veh >> "Wheels");```
I thought we needed a variable wheels = 6; for example in the config file to be able to read this value.
it actually works
thanks
Hello! I can't figure out how to get an array of all units that belong to one faction - I'd appreciate your help.
I mean how to extract the information from the Config
"getText (_x >> 'faction') == 'BLU_F' and configName _x isKindOf 'CAManBase' and getNumber (_x >> 'scope') == 2" configClasses (configFile >> "CfgVehicles") apply {configName _x}```Not tested but should work
Im having issues adding a lightsource to a wreck on fire. It is running in a sqf inside a pbo. Has anyone experience with this ? It works in editor but not on exile server.
@willow hound It is a pbo file that is run on the exile server.
_light = "#lightpoint" createVehicleLocal position _heliCrash; [_light,[0,0,0,1.6]] remoteExec ["setLightAttenuation",0,_light]; [_light,1600] remoteExec ["setLightIntensity",0,_light]; [_light,1.0] remoteExec ["setLightBrightness",0,_light]; [_light,[5, 2.5, 0]] remoteExec ["setLightColor",0,_light]; [_light,[5, 2.5, 0]] remoteExec ["setLightAmbient",0,_light]; [_light,[_heliCrash, [0,0,-1]]] remoteExec ["lightAttachObject",0,_light];
There is no _light object on the other machines, it only exists on the machine that runs this code.
That's how createVehicleLocal works 🙂
Throw all this code without the remoteExec statements into a file (or better yet a function) and then remote execute that file / function on every machine.
I also tried with createvehicle command without any luck.
Because createVehicle can't make #lightpoint. Do createVehicleLocal on remoteExec also
Thx 🙂
_light = ["#lightpoint", position _heliCrash] remoteExec ["createVehicleLocal", 0];
```Is unfortunately not going to work 
What you need to do is something like this:
fn_heliCrashLight.sqf:
params ["_heliCrash"];
private _light = "#lightpoint" createVehicleLocal getPos _heliCrash;
_light setLightAttenuation [...]; //No more remoteExec here
_light setLightIntensity 1600; //No more remoteExec here
... //No more remoteExec here
```And then to create the light (not in `fn_heliCrashLight.sqf`):
```sqf
[_heliCrash] remoteExec ["POR_fnc_heliCrashLight", 0];
what are the disadvantages that make it bad?
You send the whole code over the network and it has to be interpreted at runtime. So its a lot slower than precompiled(come at me bro!) Functiond
So instead of sending one parameter, you send a whole block of code. Dont recommend for repeat usage
@spark turret How can i do that with this ?
_light = "#lightpoint" createVehicleLocal position _heliCrash;
[_light,[0,0,0,1.6]] remoteExec ["setLightAttenuation",0,_light];
[_light,1600] remoteExec ["setLightIntensity",0,_light];
[_light,1.0] remoteExec ["setLightBrightness",0,_light];
[_light,[5, 2.5, 0]] remoteExec ["setLightColor",0,_light];
[_light,[5, 2.5, 0]] remoteExec ["setLightAmbient",0,_light];
[_light,[_heliCrash, [0,0,-1]]] remoteExec ["lightAttachObject",0,_light];
from docu:
{player setAmmo [primaryWeapon player, 1];} remoteExec ["call", MyGroup]; // Statement 1
the code which should run local to every player goes into the {} brackets
gotta set target machines to 2 as well
or 0 if its a local host MP
Don't forget the _heliCrash parameter 🙂
hm right, thats server local. how do you get that into the remote block
other than making it public
huh nice, why didnt i think of that
["uwu",{hint _this select 0}] remoteExec ["call", 0];
should do
I have made a seperate file called fn_heliCrashLight.sqf
params ["_heliCrash"]; private _light = "#lightpoint" createVehicleLocal getPos _heliCrash; _light setLightDayLight true; _light setLightColor [5, 2.5, 0]; _light setLightBrightness 1.0; _light setLightAmbient [5, 2.5, 0]; _light setLightIntensity 1600; _light lightAttachObject [_heliCrash, [0, 0, 0]]; _light setLightAttenuation [0,0,0,1.6];
this is part of a script that spawns a wreckage with fire.
-```sqf
So where do i place the file ? and where do I put this [_heliCrash] remoteExec ["POR_fnc_heliCrashLight", 0];
the main script is located in a pbo
folder doesnt matter, but you have to give that folder in the description.ext where you declare the function
ah a mod
my knowlegde ends here. i have forgotten everything about mods
[east, "taskno1", ["First task", "task one"], getPos firsttrigger, "ASSIGNED"] call BIS_fnc_taskCreate;
//or
[east, "taskno1", ["First task", "task one"], position firsttrigger, "ASSIGNED"] call BIS_fnc_taskCreate;
I'm trying to create a task, with destination exactly on trigger position (since I'm trying to make capture the area task, but both of the methods I tried above doesn't work, task is created but without any destination, whats the actual way of grabbing trigger position?
uh tasks mostly dont care about their own position. theres no need to have them be anywhere specific
also getPos might not work on trigger, let me check
what
when I put [x,y,z] in task destination it perfectly works thou
@spark turret It is a mod now run by the server but it could also just be implented in server files.
the problem is I'm not finding a way to grab a triggers position
neither ```sqf
position //or
getPos
have you made sure your variable names are correct?
come on man lol
if its not correct, it would say undefined variable
but its just asking for object when using getPos
¯_(ツ)_/¯
_grp = createGroup (side player);
_grp createUnit ["B_Soldier_F", (player modelToWorld [200, 0, 0]), [], 0, "NONE"];
_trigger = createTrigger ["EmptyDetector", (getPos player)];
_grp addWaypoint [getPos _trigger, 10];
works for me
@drifting portal
submarineCueFloodSirenAudio = {
_source = getPos sogFloodSiren;
if (isNil "AlarmHasGoneOffC") then {
AlarmHasGoneOffC = true;
_alarmC = createSoundSource ["SOGSubmarineFloodSiren", _source, [], 0];
sleep 30;
deleteVehicle _alarmC;
};
};
When i delete this, if i go back and recall this? (it's on an addAction) the Alarm sound isn't recreated (using createSoundSource) is there a way to ensure the sound is recreated every time? 😮
big thanks to @foggy hedge for the assistance last night 🙂
use
if (isNil "AlarmHasGoneOffC" || !AlarmHasGoneOffC) then {
and set AlarmHasGoneOffC to false, then you can call again
Okay will try!
are you sure?
it never works for me
lol
alright
now it works with another trigger
this is weird
even when I changed the trigger name
it still doesn't grab it
is this possibly a bug of some kind? lol
Unlikely
its working on only one trigger thou
_grp = createGroup (side player);
_grp createUnit ["B_Soldier_F", (player modelToWorld [200, 0, 0]), [], 0, "NONE"];
_trigger1 = createTrigger ["EmptyDetector", (getPos player)];
_trigger2 = createTrigger ["EmptyDetector", (player modelToWorld [200, 0, 0])];
_grp addWaypoint [getPos _trigger1, 10];
_grp addWaypoint [getPos _trigger2, 10];
Also works with 2 Triggers
@signal kite @drifting portal why do you use a trigger?
I don't want to create trigger
waypoints have completion statements
I already have a trigger set to activate when Opfor capture the area
and because I want the players to know where to go
I give them a task with the destination of the trigger position
so they know that they are required to capture the parameter of the task etc
since I already have one placed
did you place it in 3DEN editor?
yes
so you assign a Variable Name to your trigger and use this to get the position
yes
look here is the trigger name
both won't work
your code (getPos) works for me. Proof:
https://clips.twitch.tv/StormyWittyLasagnaDancingBaby-_xvjDE-suE-tEGZ8
gotta stop claiming bug at multiple failures. The game will do exactly what you tell it to. especially on something that has been so tested as the task framework
do you want a mission sample?
I would be happy if its not a bug don't get me wrong lol
I will upload mine, just wait for my slow upload speed
sleep 5;
if !( player inArea "SpawnMarker" ) then {
_ifrit = createVehicle ["O_MRAP_02_F", position player, [], 0, "NONE"];
sleep 120; deleteVehicle _ifrit;
};
I am getting Error: missing ) on line 2
did you try putting ! inside the brackets?
doesn't make any difference
there is nothing wrong with that code
Ok
you've probably placed an invisible character or something
Idk
try copying your own code again
from here:
#arma3_scripting message
Ok
I tried your code
it works
where did you create the trigger?
its the one in the start of the video
and where are you executing that code?
sqf
tried debug and same results
wat?
file.sqf
where means something like init, etc.
execVM "tasks.sqf";
where do you execute it from?
a trigger
and the trigger works, since the task is created, but the destination is not set
tried creating it from debug menu, same result no destination
tried it with 5 triggers as the destination of the task, same result
but when I tried it with another trigger (to set destination on that trigger's position) outside these 5 triggers I already tested, it worked and thats why I'm confused
your firsttrigger doesn't exist
what
what I said
it does
it doesn't
hmm why
that's why the command doesn't give you anything
maybe you're using the wrong name, or the trigger is in another layer, etc.
if you have watched the video, I tried getPos of the trigger shown in the video, but it doesn't return anything
and tried a second trigger, same thing
but when I tried the third trigger it worked
and in the video you can see the first trigger is placed, it exists
the first two triggers don't exist
check the names again
but I tried running other commands on them and they work fine?
in video I copy pasted the name lol
what happens when you just paste their names and press exec?
task is created
no destination for the task
wat?
yes
oh ok
so it doesn't exist
wait
{
_x enableAI "all";
}forEach units independent inAreaArray firsttrigger;
then why does this work?
check your triggers again
make sure their names are valid and the codes are correct
it shouldn't because it's wrong
because this is what executes:
{
_x enableAI "all";
}forEach units independent
@drifting portal now try this:
{
_x enableAI "all";
}forEach (units independent inAreaArray firsttrigger);
and it won't work
yep
it wasn't a question
yes It doesn't work
like I said, your triggers don't exist
but is it possible that its placed in eden and doesn't exist?
yes
why?
eden has multiple layers
for mission making
see the wiki
Yes but only for mission making, they don't impact object creation or variable names.
then make sure your trigger names are correct, and what you put in them is correct (activation code, etc.)
my problem was solved, but I'm curious why does it execute that?
why is brackets needed in this case
precedence
forEach is binary
units is Unary
inAreaArray is binary
this is what executes:
({} forEach (units bla)) inAreaArray blabla
thanks
Hi guys, Can I make a system chat that visible only to Zeus?
Do you have the example for it?
["Look at me!"] remoteExec ["systemChat", allCurators];
actually, it looks like allCurators returns logic units, not the units assigned. would have to test that theory
So, If I change the "allCurators" into "z1", It will only appear on z1 units, right?
if z1 is an object, it will go on the client that is z1
so you make a unit, you then make a zeus module. you name the unit "z1" and you give the module ownership to "z1". if you remote to "z1" it will only show on the client that "owns" "z1"
Ahh thanks, got it ^_^
or you can do this:
_allCurators = allPlayers select {synchronizedObjects _x findIf {typeOf _x == "ModuleCurator_F"} != -1}
works with "dynamic" zeus too
looks like synchronizedObjects is local 
but still you can just remote exec it to all players and check the condition there
[{
if (synchronizedObjects player findIf {typeOf _x == "ModuleCurator_F"} != -1) then {systemChat "bla"};
}] remoteExec ["call", 0];
Thanks!
Hello everyone I would like your help for understand something. How use "Or" condition. On my case I would like to add a bit of randomness to my game, I play with Unit Capture and made two fly path after that I made 2 script.sqf . But on the editor I don't know how to use the "Or" condition something like : [execVM "v1Flying.sqf"] or [execVM "v2Flying.sqf"];
or can only be used with conditions (booleans). what you have there is not a boolean.
this is what you need
execVM selectRandom [ "v1Flying.sqf", "v2Flying.sqf"];
PERFECT ! Thank you very much
If i wanted to attach 2 objects together via the eden editor i would just use this attachTo object; in the init field of 1 of the objects right?
The target object is called object
{ _x setPos [0,0,0]; } forEach west allPlayers;
would this put all blufor players at the given coords?
is west allPlayers an array of every blufor player?
forEach (units west select {isPlayer _x})
is that just exactly the same as what I was invisioning?
i dont really understand that at all tbh
it seems you try to assemble English sentences with scripting commands; that is not how it works 😉
no
read the wiki page for attachTo
you can't just assume that commands accept what you want. you have to check the wiki
allPlayers is a nular command. it has no arguments.
units is a unary command. it has 1 argument. which is why you can do units blabla. more importantly, the argument can be a side, which is why units west works
that's how EVERYTHING in sqf works
The 2nd gif fits better 😄
it works but it's a different thing
if you only want players:
{
if (isPlayer _x) then {
_x setPos [0,0,0];
}
} forEach units west;
Hi guys I'm modifying a script by GOM on the BI forums, his script is a timer and I'm attempting to display the timer on the map via marker text (maybee this is a bad way)
CK_fnc_coloredCountdownHint = {
_color = "#45f442";//green
_timeLeft = CK_fnc_countdownEndTime - time;
if (_timeLeft < 900) then {_color = "#eef441";};//yellow
if (_timeLeft < 300) then {_color = "#ff0000";};//red
if (_timeLeft < 0) exitWith {
//exit and remove eventhandler while politely closing the door
removeMissionEventhandler ["EachFrame",_thisEventHandler];
hintSilent parseText format ["<t color='%1'>--- Time is up! ---</t>",_color];
};
CK_Timeleft = parseText format ["Time Left:<br/><t color='%1'>--- %2 ---</t>", _color, [(_timeLeft/3600),"HH:MM:SS"] call BIS_fnc_timetostring];
"CK_Timer_marker" setMarkerText CK_Timeleft;
}; // Curtousey GrumpuOldMan
I get a genereic error in expression for the line
"CK_Timer_marker" setMarkerText CK_Timeleft;
When I use CK_Timeleft in a
hint format ["Time left is %1", CK_Timeleft];
It outputs the text just fine, I get thet setMartkerText is looking for a string, but i thought thats what BIS_fnc_timetostring is doing...
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
sqf goes alongside the three ` (and no spaces)
```sqf
(next line) code
```
can you verify that "CK_Timer_marker" exists?
Huh, so this is an interesting way to set or unset a variable, _obj setVariable ['test_myvar', if (_condition) then { _value; }, true]
yes it exists
I can send commands to change its name
i get this as a return Time Left:--- 13:37:08 --- which is not a string
and ck_timeleft isequaltype "" is false
Excellent I didnt know there was such an easy way to compare types
I was just smooth braining that BIS_fnc_timetostring was converting the whole thing into a string
thank you @fair drum
_var = typeName ck_timeleft;
hint format ["we got %1 ", _var];
returned TEXT which =/= STRING
its probably the parseText which creates structured text
yup that was it thanks!
{ if (isPlayer _x) then { _x setUnitLoadout redLoadout; _x setDamage 0; } } forEach units east;
am I missing a ; after the if then statement?
or does it not need one?
are you missing a ; on line 3 or no?
You dont need ; for last line inside codes -> forEach's code has only one line so you dont need there.
ok sweet
yeah makes sense
since you wouldnt need a ; here:
hint "hello";
sleep 5;
hint "hello again"
``` because its the last line of code
because no more commands follow. ; is a separator:
hint "hello"; sleep 5; hint "hello again";
you can even put next line between command arguments:
player //line 1
setDamage //line 2
1; //line 3
: is only used in switch case statements
switch (_number) do {
case (1) : {
};
};
you probably meant ;
yup missed it lol thanks
its your code
oh yeah
redLoadout = getUnitLoadout vegetableRed;
blueLoadout = getUnitLoadout vegetableBlue;
this code is in initServer.sqf. the variables vegetableRed and vegetableBlue are units we placed and disabled all of their simulation. They are appearing properly in-game but whenever we try setting the players loadout using the code below, in onPlayerRespawn.sqf, it sets the blufor player's loadout correctly but not the opfor player's. Can anyone see why it's not working?
if ( side player == blufor ) then {
player setUnitLoadout blueLoadout;
} else {
player setUnitLoadout redLoadout;
};
this code is in initServer.sqf.
those global variables only exist on the server
other players don't see it
is he the server?
yup
🤦♂️
so how can we make onPlayerRespawn.sqf recognize that variable?
broadcast it
but if your "vegetables" are still alive why not just use them?
huh?
oh
you mean assume the role of a new character?
thats not how our mission is set up
redLoadout = getUnitLoadout vegetableRed;
blueLoadout = getUnitLoadout vegetableBlue;
those vegetables 
ok wait
if ( side player == blufor ) then {
setUnitLoadout getUnitLoadout vegetableBlue;
} else {
setUnitLoadout getUnitLoadout vegetableRed;
};
like that?
yeah
missing player tho
setUnitLoadout getUnitLoadout vegetableBlue;
who?
Where do I put event handlers what I want to happen for every unit I put down in Zeus during a mission?
In what .sqf or so on?
Check out the cba extended eventhandlers. They offer one for every unit, editor and/or zeus too
Yeah, that's the exact one Im looking for.
The issue I have is that where do I put the code?
Do I put it in a description.ext or init.sqf or....?
Since eventhandlers need to be local to the machine its run on, i would use init.sqf
Right.
There are others like initServer.sqf or initPlayerLocal for other stuff
Also, in this case, which one is correct? Is it:
_unitsEast = units opfor; _unitsEast addEventHandler ["CuratorObjectPlaced", { this addHeadgear "headgear classname"; }];
OR
addEventHandler ["CuratorObjectPlaced", { _unitsEast = units opfor; _unitsEast addHeadgear "headgear classname"; }];
Im trying to trying to have a unit spawn with a certain headgear in Zeus, but I want the only effected units to be OPFOR
(P.S Im quite new to coding, so be merciful 😅 )
say3D returns the sound source, you could add Deleted eventhandler to it, to restart the sound once the old soundsource is done and deleted itself
And to the bot too?
eventhandler on the person being zeus module/object. So player addEventHandler... see quicksilvers code
For the inner code see the documentation: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#CuratorObjectPlaced
use params ["_curator", "_entity"]; Now you have the created unit and you can check the side, ```side _entity isEqualTo EAST```` and apply the headgear accordingly.
yeah sorry. linking the wiki with that note and still telling it wrong. 
0 spawn {
waitUntil {
!isNull (getAssignedcuratorLogic player)
};
(getAssignedCuratorLogic player) addEventHandler [
'CuratorObjectPlaced',
{
params ['_logic','_object'];
}
];
};```
In params ["_curator", "_entity"];, do I have to define what "_entity" and "_curator" is in their place (so replace _curator and _entity with what I define them as), or does
curator: Object entity: Object
already mean that it's been defined?
it's gonna be defined. you can also change the naming. but the second one is gonna be the spawned unit (_entity or in quicksilvers code example _object)
ah, okay, copy.
0 spawn { waitUntil { !isNull (getAssignedcuratorLogic player) }; (getAssignedCuratorLogic player) addEventHandler [ 'CuratorObjectPlaced', { params ['_logic','_object']; _object = units opfor; _object addHeadgear "classname bla bla"; } ]; };
So like this?
no. why the _object = units opfor; What do you think that does?
Ah, I think I see the issue.
By typing "_object = units opfor;" I make all the units that I place OPFOR?
units returns an array of objects
by doing units opfor you get all units that are opfor
Right.
for your script that's not needed, as you only need the object that is placed, right?
so leave that out, because _object is already the object that is placed by the zeus
I need it to apply to any unit that's OPFOR.
So that's why.
in that case you need to check if it's opfor
Isn't that what units does?
because the eventhandler gets triggered when any object is placed
if(side _object isEqualTo EAST) then {...};
no because as said, it returns an array of objects in opfor, so it returs all opfor
Ah, I see now.
if your eh gets triggered it keeps requesting all opfor units
what mcdodelijk just typed is what you need
It will return all of the OPFOR units in the scenario.
yes
Right, I see it now.
Deeply apprieciated.
i suggest reading the documentation when you get unexpected behaviour
even when the function itself is inconsistent it sometimes has discussions on the same documentation page on how to use it
Right, will keep that in mind.
Do you know of how I could possibly add the headgear i want to add in an array that the command picks from randomly?
since addHeadgear doesn't work for arrays
selectRandom > https://community.bistudio.com/wiki/selectRandom
ah, yeah, okay
it replaces the regular select or #
sort of
not really, anyways that's the one you need
so
_randomheadgear = ["classname bla bla", "classname bla bla"]; _object addHeagear _randomheadgear; ?
you forgot the selectRandom
_randomheadgear = selectRandom ["classname bla bla", "classname bla bla"];
_object addHeadgear _randomheadgear;
no, selectRandom selects a random item from the given array
in your case, each item is of type string
ah, okay, copy.
deepest thanks @patent lava @rancid mulch
also, how do i add the syntax highlighting to my code in discord?
put sqf behind the opening 3x`
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
@frosty cairn↑
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
!when_arma_4_?
cheers dude
lol you even made an entry for it
bUt i SaW tHaT yOuTuBe gUy ClaIm aRmA 4 dRoPs soOn
maybe i should starting making arma 4 clickbait videos as well
it's the new trend apparently
"hurr durr we are disappointed with patch 2.00 you did not announce Arma 4!!1!"
…you overhyped yourselves guys, drop it
btw, you know by chance where a list of wounds on a guy is saved by ace?
maybe setVariable'd, and most likely documented on their wiki
alright, ill snoop some more
How can I accurately determine the side of a Zeus remotecontrolled unit? I've got a fired EH on the AI unit, but the EH then reports the player and not the AI doing the shooting.
Yup it works otherwise 😄
which EH are you doing?
FiredMan
try fired, firedman _unit is the instigator or the controller
Ah thanks, that works. Now if only this one worked for vehicles too
could do a check for _gunner existing
Does anyone have a script to allow vehicles more torque for traveling uphill? The new DLC is so mountainous. Jeeps and other vehicles crawl to 4-10 kmh on most parts of the map for several hundred meters at a time. Almost unplayable
not off hand. I'm sure you can write one that detects the angle of a vehicle then add velocity to the vehicle
so, CfgMagazines "B_BlankRound" only exists if you load the DLC at game start I guess. unfortunate.
Anyone aware of a way I can add a working rescue winch to a helicopter (not a sling load - a winch that goes up and down, like you would use to pull someone out of the water)?
have you searched for a mod for it yet? seems like someone would have done that in 8 years
yeah, and I haven't found anything
well you have these commands to play with:
ropeAttachedObjects
ropeAttachedTo
ropeAttachEnabled
ropeAttachTo
ropeCreate
ropeCut
ropeDestroy
ropeDetach
ropeEndPosition
ropeLength
ropes
ropeSegments
ropeUnwind
ropeUnwound
thanks but I don't think I have the skills to code what I 'm looking for. It would be a rescue basket or hook at the end of a line that can be lowered/raised and then move a player/object into the chopper..... way beyond my skills
no better time to start learning =p.
otherwise #creators_recruiting 😉
sort of related/unrelated... I think that in this upcoming age, everyone should learn to code at least a little bit. People that can't will fall behind. (coding is a hobby for me)
falling behind is your hobby?
y u do dis
tee hee
Yes, but time and real life......
I´m trying to spawn a light cone on a marker but it alway spawn to the side instead of on the marker
"Reflector_Cone_01_wide_orange_F"
show us the code
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
_spawnPos = player getRelPos [0, 0];
_heliCrash setDir (random 360);
_heliCrash = createSimpleObject ["Land_UWreck_MV22_F", _spawnPos];
_heliCrash setPosATL _spawnPos;
_heliCrash setVectorUp surfaceNormal position _heliCrash;
_dir = getDir _heliCrash;
_Crater = createSimpleObject ["CraterLong", ATLToASL _spawnPos];
_crater setdir _dir;
_lightveh2 = "Reflector_Cone_01_wide_orange_F" createVehicle (getPos _heliCrash);
_lightveh2 setDir 180;```
look at createVehicle's alternative syntax - "CAN_COLLIDE"
also, its always better if you are using setDir to create the vehicle at [0,0,0] then setDir THEN move to the spot you want it
The idea is to make the crash have fire burning but since it is running exile server and im having a hard time getting remoteexec to work im just trying to give the impression of a fire with the cones ligthing up the place
try what I said
You wrote setdir 2 times ?
look at createVehicle's alternative syntax first
someone has an idea how to check if the yellow chain is shown?
@fair drum ill look 🙂 thx. Do you have any experience with exile mod and remoteExec
_lightVeh2 = createVehicle ["Reflector_Cone_01_wide_orange_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_lightVeh2 setDir 180;
_lightVeh2 setPosASL (getPosASL _heliCrash);
no for exile mod, yes with remoteExec
@fair drum im just testing in the editor but your code doesnt work. This works but the cone spawns 2 meter in the air 🙂
_lightveh1 = createVehicle ["Reflector_Cone_01_wide_orange_F", _heliCrash, [], 0, "CAN_COLLIDE"];
_heliCrash = createSimpleObject ["Land_UWreck_MV22_F", _spawnPos];```
again this spawnpos is just for use in the editor.
using my code, this is the result I get
https://imgur.com/a/IVPl9Py
because the model center is not the center of the plane
so you have to account for that in your positioning when you move the crashVector as this is just normal placement
@stone coral
this is the result of my code + your code.
https://imgur.com/a/UWRKaFR
@fair drum That plane wreckage is not the best as it´s center is a bit off as you wrote.
_spawnPos = player getRelPos [0, 0]; _heliCrash setDir (random 360); _heliCrash = createSimpleObject ["Land_UWreck_MV22_F", _spawnPos]; _heliCrash setPosATL _spawnPos; _heliCrash setVectorUp surfaceNormal position _heliCrash; _dir = getDir _heliCrash; _Crater = createSimpleObject ["CraterLong", ATLToASL _spawnPos]; _crater setdir _dir; _lightveh1 = createVehicle ["Reflector_Cone_01_wide_orange_F", _spawnPos, [], 0, "CAN_COLLIDE"]; _lightVeh1 setPosASL (getPosASL _spawnPos); _lightveh1 setDir 90;
This seems to put the cone on the ground and in the middle as intended. It does however gives me a generic error in the editor when spawned
In line 2 you use _heliCrash without having defined it previously.
@willow hound Ahh yes i think it has been moved up by mistake. 🙂
_lightVeh1 setPosASL (getPosASL _spawnPos);
This line gives the error but maybe i dont need it.
Well you can't get the position of a position.
haha 🙂 But "can collide" fixed it and the cone now centers on the correct spot 🙂 Just need to add more to get the effect
@fair drum @willow hound Thx for helping 🙂
it is a mod the is run by server. I originally had some lightsource code _light = "#lightpoint" createVehicleLocal position _heliCrash; but that didnt work with remote exec in exile and I dont know how to make it run in a separete file when its a mod.
its always hard taking a full framework and modifying it to suit your needs if you don't know that framework inside and out
Yes im learning but I spent ALOOOOT of time trying to get it to work because ARMA told me it should work.. Exile did not agree though 🙂
this little tidbit I show people who get too invested in a small part of a project https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting#Before_anything
🙂 I should have stopped reading the first line 🙂 But Its like im getting obsessed by figuring it out and solving the issue 🙂
@fair drum https://imgur.com/a/iH93xbx
very nice. so you had issues with fire and not smoke effects?
yeah so what you would do is create a function in a separate file, define it in cfgFunctions, then you would remoteExec that function to allPlayers
for the future
Is the functions like BIN_fnc_empVehicle (From Contact) only available to use in custom scripts if contact is loaded on the server? And thus requires every player to have contact as they have to load it? Or has these functions been integrated into base-game for scripting?
I have tried to use them without contract loaded and I see no errors or effects. So trying to toubleshoot if I am doing something wrong, or it does require the contact actively loaded on the dedicated server?
probably need contact loaded. I ran into this issue when wanting to use the blank magazines from contact
hmm. So thus it wouldn't work on players that loaded without contact but isn't using contact gear. Thats too bad.
And not sure if I can load contact active without messing up other mods. But guess I'll have to test it out.
Yeah the issue is that its a server mod (pbo file ) and im not sure where to put the fn file and where to execute it from 🙂
@fair drum _light = ["#lightpoint", position _heliCrash] remoteExec ["createVehicle", 0]; [_light,[0,0,0,1.6]] remoteExec ["setLightAttenuation",0,_light]; [_light,1600] remoteExec ["setLightIntensity",0,_light]; [_light,1.0] remoteExec ["setLightBrightness",0,_light]; [_light,[5, 2.5, 0]] remoteExec ["setLightColor",0,_light]; [_light,[5, 2.5, 0]] remoteExec ["setLightAmbient",0,_light]; [_light,[_heliCrash, [0,0,-1]]] remoteExec ["lightAttachObject",0,_light];
Hello is there anyway i can make the spawn happen in air so planes and helis are already flying? Sorry i am still really noobish at sqf but learning as i go
_typeVehX = selectRandom _typesVeh;
//_pos = [_positionX, distanceSPWN * 3, random 360] call BIS_Fnc_relPos;
_vehicle=[_posOrigin, 50, _typeVehX, _sideX] call A3A_fnc_spawnVehicle;
_heli = _vehicle select 0;
_heliCrew = _vehicle select 1;
_groupHeli = _vehicle select 2;
_pilots = _pilots + _heliCrew;
_groups pushBack _groupHeli;
_vehiclesX pushBack _heli;
What is a good debug command that prints to screen (i.e. literally anything better than hint)
systemChat
is this your code or are you pulling it from somewhere?
this is not mine no its an open source mission but the people who make it dont really help lol understandable tho they are busy on their own stuff
still best to go to them. you are going to want to do some vectorAdd stuff to any position in this script to add a "z" value.
thats what i thought to and was trying it out but could not find the right spot i guess for it ill keep trying tho thanks for the info it will help point me in the right direction 🙂
Hey people, I'm having trouble creating a display during the mission intro.
createDisplay, titleRsc, cutText and cutRsc commands do not seem to work. Dialogs on the other hand can be created, but I do not want to use one for unrelated reasons. Is there something obvious that I'm missing or is this a known behaviour of these commands.
On a dedicated server, when you place an addaction in an objects init field, how should one handle using the params ["_target", "_caller", "_actionId", "_arguments"]; ?? im having problems with locality
what specifically are you having a problem with. paste the code.
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
john^^
this addAction ["My addAction",
"params ['_target', '_caller', '_actionId', '_arguments'];
[[3,'Core\Resources\Images\Market\arifle.paa',_caller], 'Core\Scripts\Market\WeaponStoreCaller.sqf'] remoteExec ['execVM', _caller]; ", [], 3, false];
you need squigly brackets for the code pretty sure
this works on local hosted server but dedi its not
also, don't remote exec execVM or call if you can. make a separate function and remoteExec that
you can use a STRING for code if you want
but yes, he should use squiggles
yeah i was using the string code format there
oh cool. didn't know add action let you do that
theres more wrong with it anyways. thats not the only thing
do tell please
Hello, I am making an assassination operation in Arma 3. However I cannot continue because of this weird bug, the line of code is ''!alive Latif Ghafurzai;'' and whenever i press continue it says its missing a semicolon, but as you can see it is not. Can anybody help me out?
remove the space or use _ instead
and do the same thing with the variable name on the unit... Latif_Ghafurzai
It just worked man thank you.
now I have no idea whats in those .sqf files but I would create it as a function, then remoteExec that function.
// place inside init.sqf
TAG_actionFunction01 = {
params ["_target", "_caller", "_actionID", "_arguments"];
[3, "Core\Resources\Images\Market\arifle.paa", _caller] execVM "Core\Scripts\Market\WeaponStoreCaller.sqf";
};
// object init box
this addAction [
"My addAction",
{
params ["_target", "_caller", "_actionID", "_arguments"];
_this remoteExec ["TAG_actionFunction01", _caller];
},
nil, 1.5, true, true, "", "true", 5, false, "", ""
];
thank you for the info , scripting for use on a dedicated server has been adding some difficulty for sure.
this addAction ["Go to PVE area", {params ["_target", "_caller", "_actionId", "_arguments"];
_pos = getPos BunkerAiArea;
_posAdjusted =_pos getPos [10, 160];
_caller setPos _posAdjusted;}]; ``` so this is a better example of my main problem , on dedicated it doesnt seem to define/know who the _caller is
on local host its fine
hence my question of locality
i feel like i'm not getting the whole picture here. as is, caller is pulled into _caller already as part of addAction. and an object init's box is fired on all clients + server at the time of init
do you have any additional server checks?
I have another problem, I added the trigger, task and task state and connected them all. Yet when I kill the target it doesn't show that I killed him, it does not complete the task. The names are all correct on every module, what could be the problem? I will send the script
send me a picture of the connections between triggers/modules etc
@fair drum the latest example is just in the init field of a placed object so everyone gets the addaction, and yeah i just need the unit who activated the addaction hence the use of _caller, it should be that simple right? no additional checks just that in the init, thats why im confused as to why it wont work on dedicated
let me see if I can replicate it
@dense galleon what data is put in BunkerAiArea
i think the BunkerAiArea is my problem after all
it is a bunker that is spawned by the server
Anyone have any suggestions for a limited arsenal that won't make my server segfault?
maybe I'll just rip the one from current antistasi
then you have to make BunkerAiArea a public variable
clients don't know what that is if its only created on the server
oh i see, that makes sense since the code works for a bunker that is placed in the editor
after its creation do
publicVariable "BunkerAiArea"
thank you for your help and patience @fair drum i understand much better now
np dude
Hello, got problem with freezes when player getting damage.
Checked damageHandle event handler, but there nothing special and it can't be a reason for freeze.
What is the reason for this?
like an actual game freeze? lets see the code you got so far
@winter rose did you notice this?
#arma3_scripting message
yes 😬
so what do you think?
meh from me, waiting for others' mind on it
others?
geez let him down easy lol "meh"
he will deal with it then ^^
He doesn't have a PC 🤣
then he won't ¯_(ツ)_/¯
good luck finding a graphics card. been without one since august
Is it possible to set differend respawn times for differend respawn points?
is there a way to wait until after the 'continue' button is pressed?
How to detect that aerial vehicle has been locked by another vehicle? NOTE: Arma 2!
#arma3_gui would know
i don't believe so. when you change the respawn time, it seems to work on the NEXT respawn that the player does
well I want it to run on the server..
sorry I looked at the names of things and what I want is to run a script after the briefing screen is done
oh... just do a waitUntil {alive player} then execute your script after
err
player gets initialized after the briefing screen iirc
wouldn't that only work on the client
you'd do it in init.sqf or initplayerlocal.sqf
i guess i could do waitUntil {alive player}; remoteExec
no, just use a local script instead. some things are better off letting the client do
big security things, keep on server. UI and smaller things that won't matter as much, do local
then make a function, load it into cfgfunctions, then remoteExec it. it will be final compiled for security if you are that worried
but if your players know jack about scripting, then it doesn't matter
Hey peeps need some help, whats wrong with this script
?
if (isServer) then {
[
_respawnlaptop,
"Move to Command Vic",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"(_this distance _target < 3) && (speed _commandervic <= 10)",
"(_caller distance _target < 3) && (speed _commandervic <= 10)",
{},
{},
{_caller setPos(_commandervic getRelPos [5,180])},
{},
[],
20,
0,
false,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, _respawnlaptop];
};
Error: https://prnt.sc/131vl3n
_commandervic does not exist within this scope
you have to add that to the arguments array
@oblique arrow
So like that? Assuming I dont need to add the params
if (isServer) then {
[
_respawnlaptop,
"Move to Command Vic",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"(_this distance _target < 3) && (speed _commandervic <= 10)",
"(_caller distance _target < 3) && (speed _commandervic <= 10)",
{},
{},
{_caller setPos(_commandervic getRelPos [5,180])},
{},
[_commandervic],
20,
0,
false,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, _respawnlaptop];
};
Sorry been a bit since my last scripting 
conditionProgress: String - Condition for the action to progress; if false is returned action progress is paused.
Special arguments passed to the code: _target, _caller, _id, _arguments
So I need to add it to _arguments?
_this select 3 select 0 should get you the vehicle passed in the arguments
ah so replace commandervic with that?
yes
ah wait
it's different depending on the condition
conditionShow: String - Condition for the action to be shown.
Special arguments passed to the code: _target (action-attached object), _this (caller/executing unit)
Condition start doesn't even seem to take arguments, at least according to the biky

_commanderVeh is the same for all players?
still getting the 'error type any' error btw
its just a vehicle with that variable name so
missionNamespace setVariable ["PI_CommanderVeh", _commanderVeh, true];
Then you can access it on all clients inside the condition with PI_CommanderVeh
man no wonder I stopped scripting stuff
Is that a simple teleport ?
yeah just a teleport from a laptop to the getrelpos behind the vehicle
Does anyone know of a nice and reliable way to detect when somebody has started a reload (can use CBA/ACE)? I have been messing around and found that
[
"loadout",
{
private _oldMags = player getVariable ["test_oldMags",[]];
private _newMags = magazines player;
if (_oldMags isNotEqualTo _newMags) then {
player setVariable ["test_oldMags",_newMags];
if (count _newMags < count _oldMags && {isNull (findDisplay 602)}) then {
hint "startedReload";
};
};
}
] call CBA_fnc_addPlayerEventHandler;
works but it also fires for false events such as using the arsenal, throwing grenades or using some other scripted loadout system
is there a better way of doing this ugly stuff? 😂 ```sqf
// Visiblity check
private _bbr = 0 boundingBoxReal _target;
private _p1 = _bbr select 0;
private _p2 = _bbr select 1;
private _canHit = false;
// Checks the 8 bounding box points to see if any part of the object is visible. Horrible, right?
for "_i" from 0 to 1 do {
private _posX = [_p1#0, _p2#0]#_i;
for "_j" from 0 to 1 do {
private _posY = [_p1#1, _p2#1]#_j;
for "_k" from 0 to 1 do {
private _posZ = [_p1#2, _p2#2]#_k;
private _pos = AGLtoASL (_target modelToWorld [_posX, _posY, _posZ]);
if !(lineIntersects [_barrelPos, _pos, _unit, _target]) exitWith {_canHit = true}
};
if (_canHit) exitWith {}
};
if (_canHit) exitWith {};
};
if !(_canHit) then {continue};
how would I make a player switch to spectating another player?
I am looking at the wiki page for camCreate and I cant tell if I just need to set one of the parameters to do it
or if I need to use another scripting command
I basically need the spectating player to see exactly what the spectated player sees
um. what am I even looking at?
some sort of AI visibility check?
Yeah. Checks the 8 corner vertices of an object to see if ANY of them are viisble, so it's more reliable for big objects like houses
@cold pebble https://community.bistudio.com/wiki/inputAction
Still can't detect reload via drag&drop in the inventory
can i use the functiojn CSTRING instead of a xml strring table?
For what?
im making an addon for ace medical and i need text to appear on the medical gui
and what do you want with CSTRING and xml now?
i want to keep everything in the config file and not have to rely on an outside document
https://discord.com/channels/@me/788269171217530890/844003166948556822
Anyone know why it's saying this?
don't have access to that link
what does it mean?
copy paste the whole init box here
ok
typically nothing means you are missing a bracket or something somewhere
while { true } do {
if ( started == 1 ) then {
this addAction ["Spectate","spectate.sqf",nil,6,true,true,"","", 3, false, "", ""];
} else {
removeAllActions this;
};
this isn't allowed in an init box. this requires scheduled environment
you need to spawn it
you also need to add a sleep to that loop
its going to fire way way WAY too fast
and probably crash stuff
also with it being in an init box, its going to create a spawn for every client that joins. that's no bueno either
while { true } do {
sleep 0.25;
waitUntil { started == 1 };
sleep 12;
SpecSign addAction ["Spectate","spectate.sqf",nil,6,true,true,"","", 3, false, "", ""];
waitUntil { started == 0 };
removeAllActions SpecSign;
};
Where would I put this if I want it to be accesible for all players?
we want the action to be visible to all players, where should we put it?
initPlayerLocal.sqf but you need to make sure that started is a public variable so all clients know when it changes
and you want to have a separate file with this in it, and execVM it from within initPlayerLocal.sqf
Hello! I'm looking for a script that will temporarily disable simulation on vehicles. In short, I've built a small base in EDEN where I've cut out some of the trees in a jungle to make room. When I load in the map however, the trees and vehicles load in, causing the vehicles to explode. What I believe is happening is the vehicles are initializing or whatever before the edit terrain modules are removing the trees. A solution I believe would work is to simply disable sim on vehicles for ~30s upon initialization. Any help would be appreciated! If you do respond, please @ me, thanks!
give me a center pos [x, y] and a radius and I'll make one
ok wait a few
Awesome man. Really appreciate it
your base is 40 meters in the air?
ah okay
lmao
try this
//Init.sqf
if (isServer) then {
private _vehicleArray = [13530,2630] nearEntities ["AllVehicles", 200];
_vehicleArray apply {
_x allowDamage false;
_x enableSimulationGlobal false;
};
_vehicleArray spawn {
sleep 10;
_this apply {
_x allowDamage true;
_x enableSimulationGlobal true;
};
};
};
You're a saint
Question, With the XYZ
Is it possible to enter multiple sets of coordinates?
Or would I just have to paste a second chunk of script in with new coords
//init.sqf
if (isServer) then {
private _vehicleArray = [];
private _base1 = [13530,2630] nearEntities ["AllVehicles", 200];
private _base2 = [15302,3050] nearEntities ["AllVehicles", 200];
//etc etc
_vehicleArray append _base1;
_vehicleArray append _base2;
//etc etc
_vehicleArray apply {
_x allowDamage false;
_x enableSimulationGlobal false;
};
_vehicleArray spawn {
sleep 3;
_this apply {
_x allowDamage true;
_x enableSimulationGlobal true;
};
};
};
@fair drum https://community.bistudio.com/wiki/allowDamage 👀
what about it? hes not going to change locality in 10 seconds in that vehicle
how can I check to see if the number that a variable is equal to is even?
muh muh muh modulo
you're only executing it on the server
what lol
%
those vehicles are local to the server on mission start since no one has gotten in them yet though?
its LA and GE... what are you saying I'm missing?
Remainder of a divided by b.
4.5 % 3 // Result is 1.5
I am confused lol
is that not just subtraction?
is it about how many times b goes in to a?
10 % 2 returns 0
okokok
it gives you the remainder
10 % 3 returns 1
so if a number is even, then modulo it by 2 would give you a 0 remainder
I'm not entirely sure that would work
the physics on the vic would still flip the fuck out after being inserted into a tree, no?
the ol arma shake
he's getting that the command only lasts while the vehicle is local. shorten the sleep timer because once a driver gets in it, the vehicle changes locality to the client that is the driver
it shouldn't matter because when a vehicle is created at mission start, its locality is owned by the server
its only needed for the split second as the mission loads
Gotcha, I misunderstood
Thought he meant to just use the allowdamage
and the reason I added it was just to be safe. if you take a unit, disable simulation then shoot it, when you enable simulation again, it drops dead. just being safe so damage isn't recorded.
yeah, nw
another problem with that code is that init.sqf is scheduled
Hi, a lot of people said - do something like:
function = {};
publicVariable "function";
is bad practice, but why? It can be reason of game freezes, and server don't do the same when client downloading mission file?
it's bad because you're broadcasting a relatively large variable
functions should be processed and defined by the clients
unless you have a reason not to do that
concerned its not going to fire when he wants it to? I guess he could just add that code to a random initbox in the editor like a gameLogic or something @unborn drum
define it as a postInit function
how would some one do this, if he knows how?
aozone = [getMarkerPos "ao", 800, 800, 12, 0, 0.5, 0] call BIS_fnc_findSafePos;
newPosr1 = [aozone, 12, 12, 12, 0, 12, 0] call BIS_fnc_findSafePos;
newPosr2 = [newPosr1, 12, 12, 12, 0, 12, 0] call BIS_fnc_findSafePos;
newPosr3 = [newPosr2, 12, 12, 12, 0, 12, 0] call BIS_fnc_findSafePos;
newPosr4 = [newPosr3, 12, 12, 12, 0, 12, 0] call BIS_fnc_findSafePos;
newPosr5 = [newPosr4, 12, 12, 12, 0, 12, 0] call BIS_fnc_findSafePos;
newPosr6 = [newPosr5, 12, 12, 12, 0, 12, 0] call BIS_fnc_findSafePos;
wat?
huh?
yeah you right. didn't cross my mind
hm, understand. Thank you @little raptor!
But concerning the server/client - what consequences can there be if I transfer functions in this way (I mean the drop in fps and game freezes on the client) - can this be the cause?
well i create a random spawn for some objects like a heli, a car, a ammo box, a repair depot, and some more smaller items.
how loaded up is your init.sqf? if there is a ton of things, that code may not fire when you want it to. to prevent that, you make that code into a function, then define it in cfgFunctions with a postInit tag
stuff tend to explode if i "create" at one position
depends how many times you do that.
once at startup is fine.
but again only do that if you have a reason. (the only "good" reason is to prevent people from stealing your code)
and even then, if someone wants to steal your code, they will find a way
though I've always wondered how sa-matra locks down his PBOs. I wanted to learn how some of his UI works to make my UI's faster/more efficient but I can never open the PBO.
is there a reason you use so many global variables?
do you need them later?
ah no, i forgot about that.
Mikero's tools.
It can easily be opened if you know how
I don't use init.sqf, lol
i am quite a beginner in coding https://pastebin.com/WW9pbrSu
I'm not building a scripted mission or anything, just putting together a file with respawns and settings and some assets for a zeused campaign
yes, wanted to secure it somehow 🙂
i send it once (when server started), but there is a lot of functions, so i think about move them to client files and find the way to secure it somehow else.
if that makes sense
I've got a bit in my initPlayerLocal.sqf and a small description.ext
the way you're doing it is not safe
you must grab a safe position, create the vehicle, then grab another safe position
based on the position of the created vehicle

