#arma3_scripting
1 messages ยท Page 693 of 1
{ _x in thislist } count allPlayers > 15;
count (allPlayers inAreaArray thisTrigger) > 15;
oops forgot inAreaArray
@unreal scroll It is always better to script it "from ground up" not really. Reinventing the wheel just because we don't have access to some commands and functions is something that really irks me in arma. Like, there is no way to access the ballistic computer functions and good luck trying to get anything sensible on your own.
Anyway, you said you edited the ACE script to get the cover script. Could you share with one exactly?
#community_wiki looks like the place
thanks
hey ho my guys, anyone familiar with extensions?
Well maybe it's more of a cpp problem? It seems my dll file doesnt have the appropriate permissions to access another file in the same directory
that would be a filesystem permission issue, and not related to the dll itself
Yeah... not quite sure, maybe it's the way I'm compiling the whole thing
Anyway ArmA crashes with the error status_access_violation
that's not a file permission issue, your code has undefined behaviour
attach a debugger and check why its crashing
and this in memdump "The thread tried to read from or write to a virtual address for which it does not have the appropriate access"
check in debugger where exactly that happened. Probably somewhere in your code
How do I do that?
are you using visual studio by chance?
Yeah, just found a guide, I'mm a try it out
I'm pretty sure I know where it's crashing though
start arma
in VS: Debug > Attach to process...
then select arma3.exe or whatever it's called
cool doing that rn
@thorn saffron "Anyway, you said you edited the ACE script to get the cover script. Could you share with one exactly?"
As I said, it is deeply integrated into my mod mechanics, and it would be extremely hard for you to adapt it for your mission.
But, you can take a look at VCM_fnc_FindCover function in VCOM mod.
"Unhandled exception at 0x0000000000000000 in arma3_x64.exe: 0xC0000005: Access violation executing location 0x0000000000000000."
Im not quite sure where I should be looking
" GetModuleFileName(GetModuleHandle( TEXT("mydll_x64.dll")),lwpPath, MAX_PATH); " seems to be a problem point
you jumped through a null pointer
Hmm thing is , the extension works when I load it locally, but when it's uploaded on the workshop I'm getting these errors
you could put some breakpoints in your code and step through
something is different, you didn't handle it and now your code invokes undefined behaviour
Yeah, so here's the context. I'm using this line of code to get the path of a separate dll to load in and assign some functions "local" functions (as a method of dynamic linking apparently) . So Arma seems to crash or throw a hissy fit because the function that I defined is undefined - and I assume, hence the null pointer error
well did you check if they're null?
the pointers
okay, but presumably afterwards you call LoadLibrary and GetProcAddress?
yeah
well do you check the return value of LoadLibrary?
do you check the return value of GetProcAddress?
maybe that'sโฆ more appropriate in #arma3_tools?
not really...?
Well it's not quite a tool? Where do I draw the line
there's no #programming
hence my hesitation, indeed ๐
anyway, your code needs check if those functions are failing and handle the situation
meh, continue in here for that one ^^
you can't assume those calls will always succeed just because they happened to one time on your machine
Hmm alright, I can do the error handling part to prevent crashes - but I don't think that will solve the problem of the dll not being read/loaded properly, right?
no. one problem at a time
use GetLastError to get an error code for a bit of extended error information
Well im using the watches on vs19
seems give me some good information and indeed the result of loadLibrary is null
i expect you'll see ERROR_MOD_NOT_FOUND
you can use $Err in for the last error as well
so I added a check to make sure the result of LoadLibrary isnt null, and somehow it doesn't crash anymore and it doesn't return null
sounds almost like a quantum particle
waitUntil
{
scriptDone _handle;
};```
I keep getting an expression error if this part is on the end of a script. The script seems to work fine without it but I have a feeling it should be there to keep things running smooth. Any ideas?
(It's a script to do the intro text in the bottom right of the screen)
What's the error saying?
Generic Error in Expression
After that the only line is BIS_fnc_camp_showOSD__running = false; which turns off the on screen text (but it's not visible anyway).
(I spent a good 90 minutes on it last night including retyping the whole thing looking for misplaced ANSI/UNICODE characters too)
Im going through an making my own script to spawn MOODED AI for my dedicated server mission.
Are there any good resources out there to speedup my scripting process?
Im legit writing sqf files and triggers in mission to make stuff work.
Maybe the compiler has optimized something out? It is very unlikely but it happens sometimes. Also you can try to run a debug build of your DLL and see if it also produces the error.
unscheduled environment perhaps?
meaning _handle has already completed?
It literally just says "Error Generic Error in Expression" in the black error log that pops up on the screen. I tried removing the semicolon after _handle but that didn't change anything...
I pulled it from the last post on this page.
Oh! Okay. Well, this isn't my code but I get the meaning now. Thanks for pointing this out...
OK so i wrote up a script using some tutorials and references to wiki and got something to work. I'd like to clean some things up if anyone is willing to help
first off, im redefining the createUnit funciton multiple times and adding each one to the creaGroup variable i made
ill just post my script
group_1 = creategroup [independent, true];
enemy1 = group_1 createunit ["ModdedAI1", getmarkerpos "AISpawn_1",[],0,"form"]; enemy1 domove (getmarkerpos "AIMove_1");
enemy2 = group_1 createunit ["ModdedAI2", getmarkerpos "AISpawn_1",[],0,"form"]; enemy2 domove (getmarkerpos "AIMove_1");
enemy3 = group_1 createunit ["ModdedAI3", getmarkerpos "AISpawn_1",[],0,"form"]; enemy3 domove (getmarkerpos "AIMove_1");
I forget how to make it look like code
Looks fine to me, add more {}'s ?
yeah so how can i clean this up with an array so i can just have the units together with ocmmas
instead of redefining
it wants a string in the argument
also, how to i make the bot apply the code view to this?
ArmaBot?
'''?
I saw it somewhere but this discord is huge and im searching lol
Oh, you mean make it look like code in discord? three ` <<the key left of 1
there we go
ok, so how can i make the multiple units in an array, then tell all of them to spawn at my "AISpawn_1" then domove to my move waypoint
or how can i make this work with a predefined group, that will be easier too
and grab the string from the config viewer
I know how to get the config view string, need to plug it into the trigger
That was it...I was running the code in the debugger cause I got tired of loading the mission every time. Didn't know there was a difference. Thank you.
I have question. we can make difference pbo file private override pbo some mod ?
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
Hey. I tried making a inheritance for a ACE action on a object. But somehow it just refuses to show up. Anybody got any insight?
_action = ["convo", "Coversatie", "", {}, {true}] call ace_interact_menu_fnc_createAction;
[elder1, 1, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
_action = ["optie1", "Groet Dorpsoudste", "\a3\ui_f\data\igui\cfg\simpletasks\types\Talk_ca.paa", {["convo\convo1.sqf"] remoteExec ["execVM", 2]}, {true}] call ace_interact_menu_fnc_createAction;
[elder1, 1, ["ACE_MainActions", "convo"], _action] call ace_interact_menu_fnc_addActionToObject;
This is inside InitPlayerLocal.
what if you run it in debug console?
also why do you use 1?
isn't this supposed to be an object action and not a self action?
Leopard. I apologize. I indeed overlooked the 0, 1 after the object variable
anyone know how to delay the repeat of a trigger within the "On Activation" field?
For example, I have a trigger to go off when a player enters, but I want a delay to prevent it from being spammed if the player hops over the line over and over
i tried sleep
no worky
you can't use sleep
change the trigger interval
I know now that i tried and failed ๐ญ
Now I just need to figure out how to remove it after use, in a proper way, using:
[elder1, 0, ["ACE_MainActions", "convo"], _action] call ace_interact_menu_fnc_removeActionFromObject;
nets me the result I want, however it throws a 'undefined variable in expression' which I tried circumventing by using _action1 ect but that doesn't help.
is the trigger interval something I can set in the on activation field?
Is it paramount it goes off the moment a unit enters? if not you're probably better off using countdown
idk. read the function. I couldn't find a documentation for that one
countdown simply delays the units spawning
I want to prevent them spawning over and over and over and over by slowing it down
say a 5 minute wait period
would this work @little raptor
//
_trigger setTriggerInterval 5;
but make that as long as needed?
no
so what you mean is: you step into a trigger, once activated, the next activation should be in 5 min?
you can't do that with trigger interval then
so 5 players dont trip it 5 times
make sense
I want to spawn say 4 AI (i have that working) but if 5 players enter I dont want 20 AI
nor do i want it to respawn if the player goes back outside, then inside the trigger zone
you have to implement a timer system:
condition
time - (thisTrigger getVariable ["last_activation", -300]) >= 300
on activation:
thisTrigger setVariable ["last_activation", time];
also set the trigger interval to check every 5-10 seconds
ah oh so in the Condition box I define time
then add that at the top of my On Activation box
ohh ok so that checks it
no
in condition you check time
in activation you set time
it doesnt like that lol
what?
so i have to set "this" in the condition right
then add
time - (thisTrigger getVariable ["last_activation", -300]) >= 300
should that - be a =
I get an error
copying and pasting that
says Condition:
do i need to first define last_activation
that's what -300 does
300 seconds right?
right
i changed to 15 to test it
i should see the effect after 15 seconds but not before
lol it just triggered immediately before i got there
I have the sound to let me know
now its triggering every 15 seconds and im not in the trigger area
maybe it does need a this then
change it to:
this && {time - (thisTrigger getVariable ["last_activation", -300]) >= 300}
ill try now ty
just crashed lol ill see if that was related or just a regular crash
you got a better script that uses an array vs what im doing....the hard way
im defining each unit separetly
heres what i got which is working but i want to clean it up
group_1 = creategroup [independent, true];
enemy1 = group_1 createunit ["ModdedAI1", getmarkerpos "AISpawn_1",[],0,"form"]; enemy1 domove (getmarkerpos "AIMove_1");
enemy2 = group_1 createunit ["ModdedAI2", getmarkerpos "AISpawn_1",[],0,"form"]; enemy2 domove (getmarkerpos "AIMove_1");
enemy3 = group_1 createunit ["ModdedAI3", getmarkerpos "AISpawn_1",[],0,"form"]; enemy3 domove (getmarkerpos "AIMove_1");
I tried slapping the 3 different units in an array, but it wants a string
why do you use global variables?
_group = creategroup [independent, true];
{
_unit = _group createunit [_x, getmarkerpos "AISpawn_1",[],0,"form"];
_unit domove (getmarkerpos "AIMove_1");
} forEach ["ModdedAI1", "ModdedAI2", "ModdedAI3"]
and the true variable should delete them if i read correctly right?
true deletes the group when it's empty
perfect, need to prevent resource hogging
it doesn't delete units
it's not a matter of "resource hogging"
you can only create ~288 groups per side in Arma
i think its working
yup every 15 seconds while im in the zone
i think a 5 min delay should be good, plenty of time to grab the objective and roll out, or stay and deal with AI over and over
it shouldn't activate unless you leave tho ๐ค
im sitting in and it goes off every 15 seconds

if i make the timer long enough itll work just fine
i want my players to deal with threats when they move to zones
my server is a warlord server blue vs red with green AI frustrating both sides
๐
only crappy part, i cant make green retake zones..
in warlord
I want to destroy 3 tanks and once all three are destroyed it will complete the task. I know for one !alive _unit works but what about for all three? thanks
(!alive tank1) && (!alive tank2) && (!alive tank3) from what I can remember. Just in condition field of the trigger.
I was close in my attempts... lol. that worked. thank you
Does anybody know any documentation or use of BIS_fnc_moduleUnlockArea? Specifically how to use it.
Wiki just has "example needed" in every field.
It's the Eden module that allows for a Zeus to place objects inside of a sector afaik, like the one in the official Seize, Defend or Control gamemodes
just read the function:
_logic = _this select 0;
_units = _this select 1;
_activated = _this param [2,true,[true]];
if (_activated) then {
_curator = objnull;
_areas = [];
{
if (triggertype _x != "" && triggertype _x != "NONE") then {
_areas set [count _areas,_x];
} else {
if (_x call bis_fnc_isCurator) then {
_curator = _x;
};
};
} foreach (synchronizedobjects _logic);
{
[_curator,position _x,(triggerarea _x select 0) max (triggerarea _x select 1)] call bis_fnc_curatorAddEditingArea;
} foreach _areas;
};
Hey,
Does anyone know of a way for a multiplayer server to clear bodies every 5 minutes, so I am not playing with my friends at 15 FPS most of the time?
I recommend clearing bodies that have been dead for 5 minutes.
clearing bodies every 5 minutes will be weird (imagine if you kill someone when the timer is at 4:59 and it disappears)
but yeah you can do it
I think there are premade scripts too
Just use the garbage collection
oh right the game has garbage collection 
is that a module in the editor?
Mission Attribute โ Performance
Thanks, I'll have a look into it, so this means that I don't have to look for scripts to do this.
hmm...can anyone explain what BIS respSpecShowFocus exactly does?
What is that? A function?
seems to be something about showing player stats when spectating them
this page mentions it under "Conflicts"
https://community.bistudio.com/wiki/Arma_3:_Respawn
was going to illustrate that with an image but it seems I cant, but I think its the bit in the centre of the screen when you have a unit selected in spectator mode
Changing these variable has no effect for me. Dunno what they are for
that variable stands for BIS respawn spectator and should enable or disable features of the endgame spectator mode
Hi all, having an issue with a function I'm making. (I apologise in advance for not being very good at this)
The issue is that _vehicle removeMagazine _magazine; is removing that magazine class from the vehicle's turret ammunition, rather than the vehicle cargo / inventory as is wanted. Is there any way to remove the mag from the cargo rather than the turret?
Even if turret empty and mags of that class in the cargo, they are not removed. Any help much appreciated thank you!
I guess I need a removeMagazineCargoGlobal as the clearMags will remove all mags stored rather than just one, of a specific class. As far as I can see that doesnt exist
unless I need to store all the magazines in the cargo in an array, edit that to remove one of the specific type, and add the edited array back in, but that seems extremely difficult and long winded
this will have problems with half empty mags though right?
I guess I can use addMagazineAmmoCargo, Do you think it is possible to store, manipulate, and then re-add an array containing each magazine class, number, and ammo count?
If I wanted to create a script to occasionally A. make sure all vehicles are locked and B. make sure all AI's backpacks are locked... would running it off init.sqf with a sleep timer be a sane way to do so?
Single Player mission
yes it looks sane
but it's better to do it like this:
0 spawn {
while {true} do {
sleep 1;
...
};
};
Where? in init.sqf or an hpp file linked off it?
I guess WHERE is my main question...more than how..
well, I do not remember if the game waits till your init.sqf is done, anyway it's better to not block whole init.sqf just for your loop.
I suggest that you put the code above into init.sqf
init.sqf is not required to have any .hpp files attached to it
oh right, so SPAWN it from init.sqf, ok I think I understand.
yes
(not execute within)
you need two different codes
lockInventory has local effect, and takes global arg
so it must be in initPlayerLocal.sqf
setVehicleLock takes local arg, and has global effect
so it must be in initServer.sqf
yes but he said that he has a Single Player mission
I'll keep the multiplayer tips in mind. Appreciate it.
hardly appreciated
๐คญ
could be a tongue breaker:
_object getvariable ["bis_fnc_objectside_side",side _object] inside bis_fnc_objectside
Is there a way to prevent AI Fighter Pilots from landing?
afaik they land if they are out of fuel, damaged, or out of weapons. So if you make sure those 3 things never happen, they wont land
thx
there's no inside command 
I think he meant its a tongue twister in the guise of a script :p
Taking a poetic liberty like
but it is true ... xD Yes more poetic liberty in scripts please, we really need that ๐
Roast me! (a good burn is a good teacher).
Tally_Fnc_DesignateInfType = {
params ["_Unit"];
If ((typeOf _Unit IsEqualTo "B_T_Recon_Exp_F") or
(typeOf _Unit IsEqualTo "O_T_Recon_Exp_F") or
(typeOf _Unit IsEqualTo "I_C_Soldier_Para_8_F"))
exitWith {[_Unit] call Tally_Fnc_Operator_Equipment_Attributes};
If ((typeOf _Unit IsEqualTo "B_soldier_LAT_F") or
(typeOf _Unit IsEqualTo "O_Soldier_LAT_F") or
(typeOf _Unit IsEqualTo "I_E_Soldier_LAT_F"))
exitWith {[_Unit] call Tally_Fnc_AT_Soldier_Equipment_Attributes};
If ((typeOf _Unit IsEqualTo "B_Patrol_Soldier_MG_F") or
(typeOf _Unit IsEqualTo "O_G_Soldier_AR_F") or
(typeOf _Unit IsEqualTo "I_G_Soldier_AR_F"))
exitWith {[_Unit] call Tally_Fnc_MachineGunner_Equipment_Attributes};
If ((typeOf _Unit IsEqualTo "B_Sniper_F") or
(typeOf _Unit IsEqualTo "O_Sniper_F") or
(typeOf _Unit IsEqualTo "I_Sniper_F"))
exitWith {[_Unit] call Tally_Fnc_Sniper_Equipment_Attributes};
If ((typeOf _Unit IsEqualTo "B_soldier_AA_F") or
(typeOf _Unit IsEqualTo "O_Soldier_AA_F") or
(typeOf _Unit IsEqualTo "I_Soldier_AA_F"))
exitWith {[_Unit] call Tally_Fnc_AA_Soldier_Equipment_Attributes};
If ((typeOf _Unit IsEqualTo "B_Soldier_universal_F") or
(typeOf _Unit IsEqualTo "O_G_Soldier_universal_F") or
(typeOf _Unit IsEqualTo "I_G_Soldier_universal_F"))
exitWith {[_Unit] call Tally_Fnc_Soldier_Equipment_Attributes};
sleep 0.5;
hint "UnitType not specified";
};
Use CfgFunctions instead of Tally_Fnc_DesignateInfType = { ... };.
The if-statements are a prime usecase for a switch:
switch (typeOf _unit) do {
case "B_T_Recon_Exp_F";
case "O_T_Recon_Exp_F";
case "I_C_Soldier_Para_8_F": { [_unit] call Tally_Fnc_Operator_Equipment_Attributes; };
case "B_soldier_LAT_F";
case "O_Soldier_LAT_F";
case "I_E_Soldier_LAT_F": { [_unit] call Tally_Fnc_AT_Soldier_Equipment_Attributes; };
case "B_Patrol_Soldier_MG_F";
...
default { ["Unexpected unit type (%1)", typeOf _unit] call BIS_fnc_error; };
};
Dont forget that isEqualTo/switch makes case sensitive check, you got a B_soldier_AA_F there which wouldnt be equal to B_Soldier_AA_F
Same for LAT ones. (Ofc unless that they are actually returning like that which I'd doubt)
Is Switch faster than if ?
@little raptor would have something to say about that ๐
not sure about the use case but instead of a hint it could be better to use BIS_fnc_error instead, if the message is meant for the dev
["UnitType not specified"] call BIS_fnc_error;
?
like that?
maybe some more additional info:
["UnitType (%1) not specified", typeOf _unit] call BIS_fnc_error;
``` this will show an error on the bottom of the screen and also log to rpt
!rpt
Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.
To get to your RPT files press Windows+R and enter %localappdata%/Arma 3
Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files
To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.
Ooh so if is faster
nice good to know
_result = call {
if (false) exitWith {};
if (false) exitWith {};
if (true) exitWith {};
if (false) exitWith {};
if (false) exitWith {};
}; // 0.0032 ms
_result = switch (true) do {
case (false): {};
case (false): {};
case (true) : {};
case (false): {};
case (false): {};
}; // 0.0047 ms
don't forget that it is wrapped in a call, so exitWith only exits that scope ๐
its faster, but its so ugly. i use hashmaps now
depends on what you want, too
using a hashmap for switch cases with value โ code is dang ugly (but most likely more performant)
as usual, benchmark your code.
replacing a switch/case with like 2 or 3 values with a hashmap, might result in slower code
might he just wants to feel trendy
I dislike the term, but here goes. If you prefer the data driven approach...
params [
["_unit", objNull, [objNull]]
];
private _unitClass = typeOf _unit;
private _tallies = [
[
{ _this in ["B_T_Recon_Exp_F", "O_T_Recon_Exp_F", "I_C_Soldier_Para_8_F"]; }
, { _this call Tally_Fnc_Operator_Equipment_Attributes; }
]
, [
{ _this in ["B_soldier_LAT_F", "O_Soldier_LAT_F", "I_E_Soldier_LAT_F"]; }
, { _this call Tally_Fnc_AT_Soldier_Equipment_Attributes; }
]
, [
{ _this in ["B_Patrol_Soldier_MG_F", "O_G_Soldier_AR_F", "I_G_Soldier_AR_F"]; }
, { _this call Tally_Fnc_MachineGunner_Equipment_Attributes; }
]
];
private _selected= _tallies select { _unitClass call (_x#0); };
_selected params [
["_tally", [], [[]]]
];
_tally params [
"_0"
, ["_onTally", {}, [{}]]
];
[_unit] call _onTally;
Of course, if you wanted to invert the control a bit, you could have the functions return boolean on success/failure, and each of them do their own class name filtering internally.
Good luck!
params [
["_unit", objNull, [objNull]]
];
private _onTallyAttribs = [
{ _this call Tally_Fnc_Operator_Equipment_Attributes; }
, { _this call Tally_Fnc_AT_Soldier_Equipment_Attributes; }
, { _this call Tally_Fnc_MachineGunner_Equipment_Attributes; }
];
private _talliedAttribs = _onTallyAttribs select { [_unit] call _x; };
_talliedAttribs params [
["_retval", false, [false]]
];
_retval;
can I bother someone who have all DLC's to run this code for me? and send me output? thank you
private _allFaces = (configfile >> "CfgFaces" >> "Man_A3" ) call BIS_fnc_getCfgSubClasses;
{ diag_log format ["_face: %1", _x] } forEach _allFaces;
private _faceIdentityTypes = [];
{
_faceIdentityType = getArray ( configfile >> "CfgFaces" >> "Man_A3" >> _x >> "identityTypes");
{ _faceIdentityTypes pushBackUnique _x; } forEach _faceIdentityType;
}
forEach _allFaces;
{ diag_log format ["_type: %1", _x]; } forEach _faceIdentityTypes;
so i found this here piece of code that lets me turn any object into an ACRE2 rack radio, but would anyone happen to have enough knowledge about how ACRE works to make it have the speakers active immediately instead of me running to it and manually turning it on from the radios settings?
[variablename, ["ACRE_VRC103", "Upper Dash", "Dash", false, ["external"], [], "ACRE_PRC152", [], ["intercom_1"]], false, {}] call acre_api_fnc_addRackToVehicle;```
looking to use the system for loudspeakers in a zeus op, so it would be something of an inconvenience to have to run over to each one and turn the speakers on manually at mission start
oh, also having the radios tuned into something other than channel 1 would be neat, but i can just have people not use channel 1 if its not possible
is there any way to prevent AI teammates from drowning via scripting? They always seem to dive 500m deep before mounting a boat
Uuuh, I like what I see tho it fries my brain.
I'll give it a shot!
allowDamage i would assume
found this on google if you want to get fancy with it, the scripts on there are for players drowning but you could probably modify it for AI https://forums.bohemia.net/forums/topic/202320-make-player-not-drown/
@spark turret https://youtu.be/OjJuZCECRu4?t=12
lol yeah
hmm thanks a lot, my scripting knowledge is very bad but I can always start from there
my squad when they get ordered to mount a boat lol
anyone knows how the circle for zeus firesupport is created so its only visible for zeus? I have tried using _obj = createSimpleObject ["\a3\Modules_F_Curator\Ordnance\surfaceMortar.p3d", _pos]; to create it. And it does correctly scale and show in the world, but it shows for everyone, also players. (makes sense as its global).
Haven't been able to figure out how the default firesupport modules use it to only show for zeus'.
@wicked fulcrumcreatevehiclelocal?
wait. I am being stupid. createSimpleObject has a local option as a third parameter
Could do, but I seem to remember I tried it and found some other issue when doing it like that. Something with issues spawning the marker correctly.
you could use !isNull (getAssignedCuratorLogic <unit>) to check whether the player is a zeus, and hide the object if theyre not
I think the local instance on createSimpleObject which I missed will do what I need. Need to test with some players tomorrow.
That could also be an option, to do local hide for clients not zeus, but as the object is created by one (zeus) client, and then synced I am not sure how feasible that would be.
Thanks for the ideers! ๐
If i have a config path (aquired via BIS_fnc_turretConfig) , for example
_path= configFile >> "cfgVehicles" >> "SomeVehicleClass" >> "Turrets" >> "SomeTurretClass";
How do i get just the last "element" (so in this case "SomeTurretClass") as string? Is there a simple command for that, or do i have to convert that path to string and pluck it apart manually?
private _hierarchy = configHierarchy _path;
configName (_hierarchy select count _hierarchy - 1)
thanks
wait, isn't that just configName _path? XD
@austere hawk oops, sometimes i just think too far
๐ cheers. i cache the result anyway so it wouldnt have made a big deal... just didnt want to pluck apart the string <.<
anyone with experience scripting vectors?
Trying to script "wobble"
Player holding iPad in front of them , currently the model looks 2D because it is fixed
I want it to wobble slightly, to provide 3D depth
so some vectordir/vectorup/linearconversion stuff
Does the "Respawn" eventhandler get removed on unit Killed?
no
Is there a more efficient method of only allowing admins to enter 3rd person view other than waiting for the player to switch cam and then switch it back for them?
As far as i know you can not turn off third person per player using a function. Unfortunately.
would you happen to have alink to a list of what does and does not get removed on killed?
cool thanks.
Can use CBA player eventhandler with cameraView: https://cbateam.github.io/CBA_A3/docs/files/events/fnc_addPlayerEventHandler-sqf.html
Is there a way for me to get the init of an object that a mission maker set in 3den but during the scenario?
Which is best for the network:
- Client setting a public variable?
- Client doing a remoteExec to the Server only?
Logic would tell me it's the remoteExec but I've learned to be careful with how Arma 3 actually works ๐
publicVariableServer?
but usually remoteExec, if you can avoid publicVariable*
Ah ! That suits my need ! Thanks
Ah no it doesn't actually
because I want to use player setVariable ...
That actually answers my question
๐ ok
Best for network is it to not use it 
Related question:
I'm trying to _x getVariable "lastLoadout"; on my server.
To publish each players loadout to the Server only would this work ?
player setVariable ["lastLoadout", getUnitLoadout player]; publicVariableServer "lastLoadout"
*turns PC off*
nope, nope & nope
setServerVariable function
but you can add a true] to it, too
true dat
Ah nice !
player setVariable ["lastLoadout", getUnitLoadout player, 2]; // server only
Might be worth a note @lou?
also, "FLASH_lastLoadout" ๐ prefix your vars ๐
it's in the params description ๐
yes sure. Just don't like giving my prefix on a public Discord xD
I mean, there is no real security risk ๐ฌ
Number - The variable is set only on the client of given owner (clientOwner) id, or if id is negative, the variable is set on every client except the given one
Ok so 2 is the client ID of the Server right ?
0, isn't it?
0 is everyone
No wait
2 is server
yeah right.
@cosmic lichen here โ ๐
I'm all for the mission maker to be able to name his variables as he wants, but not for mods or framework makers ofc
I am not doing that much mp stuff, pardon me =/
yet you knew everything! ๐
make Eden Editor MP then :p
ok cool, that was actually my first idea but I got really confused about the description. Can you guys improve the description or add an other example to the wiki ?
Wait, did I never release the mp Eden Editor?
unfortunately ๐
meh, it's too late in A3 lifetime now. let us use it just the two of us โค๏ธ
Sure!
Hi, Today i was in a zeus game where there were functional base stuff, like, A person with a full arsenal and a vehicle spawner, and a ''Pylon editior'', i was wondering if someone got these scripts?
Could be the Zeus Enhanced mod, not sure
it was vanilla
GOM pylon script I believe
I see, thanks, and what about.. There was a guy who was called a ''Arms dealer'' and when you talk to him he has a full arsenal
Any idea the script?
In ARGO there is a command called clearKillConfirmations that will delete all kill feed messages.
Is there anything that would do the same thing in Arma 3 ? hand made maybe ?
there is no way to remove chat messages after they are shown
you could use the chat message eventhandler and build your own
argo has its own commands 
yes
like clear history
YEAAAAH that worries me A BIT
I see work incoming
well, humโฆ since it's dead, we may, y'knowโฆ dust it under the carpet? ๐
one day when we have nothing more to do ๐ผ
โฐ๏ธ
Thank you
Hi looking for a simple line that will teleport a player into any position of a vehicle. I understand how to do it via a trigger but I'm trying to do it via a flag pole or any other object. I know the 2 elements I need but a bit unsure how to combine them.
this addAction ["Teleport", {player setPos (getPos boat)}];
player moveInAny boat;
nvm figured it out
"I'll just...." 3 hours later
why with lbSetText the text of the list doesn't get updated and with lbSetTextRight it gets updated?
Add a couple of sine / cosine functions together with different frequencies, and recalculate the position and/ or angle each frame.
If you want "wobble" kind of simulate actual player movement it would become a bit more tricky.
for something that feels more like actual "shocks" you could do some function blending. Take a damped oscillation https://en.wikipedia.org/wiki/Damping#Damped_sine_wave
as starting point. But then to make it look less jerky (the jump fom t= -0.00001 to t=0 will look bad). Instead you might rather want something like this: (shitty drawing)
for a smoother transition between "unshocked state" and "shock start"
Damping is an influence within or upon an oscillatory system that has the effect of reducing or preventing its oscillation. In physical systems, damping is produced by processes that dissipate the energy stored in the oscillation. Examples include viscous drag (a liquid's viscosity can hinder an oscillatory system, causing it to slow down) in me...
hello, i am having some troubles with a teleport script
hey, I'm trying to make a cutscene where player sits in the drivers seat, but it's steered automatically, so he can just watch what's happening, but I have no idea how to make the vehicle drive with player in it. Is it even possible? I thought about using keyframes but to me it seems like definitely too much work for a cutscene so short. Maybe creating a camera directly in the head of the player, but I'm worried about 3D sound bugs because of the truck moving and camera not exactly being "in" the car in terms of Arma physics.
any suggestions besides simply recording everything and implementing as a video?
I am trying to have the players teleport out to a platform so they can mount up on landing craft
but even punching in the coordinates for a person standing there, on the platform will cause the player to teleport way into the air
i think its an issue with the water, does anyone know how to fix it?
selectPlayer another entity temporarily, apply switchCamera on driver. But AI will turn his head around randomly which may be annoying, doTarget / doWatch commands may limit that effect a bit...
https://community.bistudio.com/wiki/selectPlayer
https://community.bistudio.com/wiki/switchCamera
https://community.bistudio.com/wiki/doTarget
I believe there was a way to disable the headbobbing/turning of AI along with mimics, but I'd have to dig in to, anyway it is a cool idea, so thank you. So switchCamera in this case will let the player see through the AI's eyes like he was sitting there or should I expect some work with sounds due to the camera not being "in the car" but just "in the head"?
switchCamera allows all unit bound cams to be used so either eyes, 3rd person view etc etc is up to you. The camera that is being used is the same as ordinary cameras so no sound difference should be caused. But yeah go ahead test it. I just made it up according to your need, cant promise anything. ^^
okay, and how about making the vehicle drive other way than through waypoints? I'd like to make it not stop on every waypoint, so will UnitCapture/UnitPlay work in this case?
can anyone help me with my teleportation problem?
Try getPosASL and setPosASL
ah ok
If you are willing to record it, that is a solution but vanilla one does not save animations(and imo unitCapture feels quite cheap because it is a "recorded player movement"). Alternatively you can use setDrivePath if you do not want to bother with recording the path(It gives quite a good amount of ability no matter onroad/offroad, I usually tend to be happy with the outcomes of it). If you do not want to bother with anything, I suggest setting waypoints at the middle of one way roads (this way they do not slow down while calculating next waypoint pathing, most people tend to put waypoints at intersections which driver ai ofc wants to slow down specifically)
How would I go about getting the muzzle position of a units weapon? Tried using
(player selectionPosition ["Konec hlavne", "Memory"])
But it returns [0, 0, 0]. The player is a vanilla ammo bearer holding a MX rifle if that helps.
there is weaponPos iirc? look up eyePos, see if theres one for weapons too
I thought there was one but after checking https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands there doesn't seem to be one
I did a quick googled and didn't find an answer other than one or two forum posts where the author was recommended to use selectionPosition. Even believe one of the forum posts was from like 2010 or 2011
I appreciate your help and setDrivePath seems to be the most reasonable way to do that, I'll read more about it on biki if there's anything, waypoints will be my last solution as I noticed that between random number of reloads AI can approach same road in a different way, sometimes going as it should be, sometimes getting stuck on trees or anything on the offroad
You look for a weapon's selection on player which wont work, if you just plan to use a constant weapon, I would suggest you to retrieve left hand position (I'd assume it would be closest to muzzle) then try to randomly add up positions till u find one, although there must be a better way considering there are scripts that create firing effects.
I have an alternative which is just having a Fired EH where I get the position of the projectile. Not great but it get's the job done for what I am doing. Just wished there was a better solution.
It may be a bit annoying to use depending on how long your road is but you can make AI do anything u want with it so. ๐
Well if you will do something upon firing, then of course it is better than what I wrote. ๐
Currently making a "laser" rifle so I only need the muzzle position when it fires luckily.
How do I make a script select a group who was just spawned in with a function without giving them a variable name?
@frosty cairn What function? BIS_fnc_spawnGroup?
https://community.bistudio.com/wiki/BIS_fnc_spawnGroup
Why not use the return value?
How do make it use the return value?
Uhm, okay, I'll show you what I got here, it'll be easier to understand I think.
for "_i" from 1 to _randomLimit do {
//Bis_fnc_sqawn here
//select the group somehow here
//addWaypoint here
};
_returnValue = _blabla call BIS_fnc_spawnGroup;
according to the wiki the return value is a group so:
_group = _blabla call BIS_fnc_spawnGroup;
Ah, very simple:
for "_i" from 1 to _randomLimit do {
private _group = [...] call BIS_fnc_spawnGroup;
_group addWaypoint [...];
};
Wouldn't it throw out a error saying that the "_group" already exists and stop?
it's a local variable
plus it's not like eden
I see.
Variables can be reassigned and overwritten.
even if it was a global variable it'd just overwrite it
Out of curiosity, what does the "private" actually do?
I have seen it used a bunch, but never really understood what it does.
read the wiki to understand what local and private variables mean
to give you a short version:
local variable = variable that is only visible to the current script
private variable = variable that is only visible to the current scope
Ah, okay, understood.
so every private variable is a local variable
but not the other way around
lol how could you understand it without knowing what a scope is?!
the easiest way to explain it would be: something wrapped in {}.
altho that is not the best way to explain it...
I assumed as much.
it's not technically correct tho
even a script you write is "wrapped in {}"
but you don't see it
as in its confined to it's .sqf or...?
#arma3_scripting message, and then, you should use private whenever you can(if the context allows you), because its faster
so uhm, a question
is
_smth = here code
the same as
private smth = here code
?
no its not the same
no
also the second one is just wrong
_smth is a local variable
private _smth is a private variable
they technically act the same way(if not defined at all), but the first assignment can be a lot slower(if it is defined in upper scopes)
well let's not focus on "slower" just yet...
(also it's not that much slower; depends on scope depth)
free perf you're losing though ๐ like i said, if you can use private, just use it
@frosty cairn
I guess this example will clear it up:
_x = 1;
if (alive player) then {
_x = 2
};
_x //_x is 2
vs:
_x = 1;
if (alive player) then {
private _x = 2
};
_x //_x is 1
Ah, okay.
that's almost identical to what i linked too
{
private _x = 2
};
so in those brackets, will _x be 2?
in those, yes. but _x is a new variable.
once you leave the scope, it's gone
you're back to the old _x
Yeah, okay, now I get it.
Unless you get unlucky and happen to stumble into a situation where it does actually matter, scopes beyond global and local are not really all that important, you can go a long way (and then some) without them ๐
anyway, the rule of thumb for beginners is: always use private, unless you have a reason not to (e.g. the first example where I wanted _x to actually change, i.e become 2 if player is alive)
And if for example I wrote it like this at the start:
private _x = 1;
if (alive player) then {
...
_x will return 1, right?
In the brackets, that is.
if you mean:
private _x = 1;
if (alive player) then {
_x = 2
};
_x //_x is 2
then no. _x is 2
the _x in the brackets is the same _x
And it will return 2, because it's not a private variable?
the _x in the brackets is the same _x
_x, that is.
Right, okay.
I think I get it now.
Thanks a lot @little raptor @willow hound @copper raven .
kind of a silly idea
how hard would it be to show a PiP screen on the respawn screen?
or, hell. how hard would it be to pop open the arsenal and let a player edit their loadout in that before spawning in
i guess I do kind of want to avoid combat barbie with this mission
so i might just not have an arsenal normally
have them spawn on a "debug" island or something into the arsenal, then add a EH for when they leave it that teleports them to the actual spawn
also, for coop missions, it really is best to use premade loadouts to stop barbie
yeah that's probably the best way to do it
i was hoping to allow them to do it in the respawn menu
but that might not be easily possible
or what you do is make the first objective time sensitive, so they can just straight up lose if they barbie too long
and no, you can't do it in the respawn menu unless you create your own respawn menu (which you can, then you create a respawn template using onPlayerKilled and onPlayerRespawn)
What is the most MP friendly way to move a simple object from 1 point to another via transition? Like basically fake it's moving.
can you walk in Blackfish or Xi'an ? Want to use them as stationary vehicles to jump from ... possible ?
No
is there any way to eject a dead body from a destroyed vehicle? it seems like when a unit becomes a dead body and when a vehicle becomes destroyed, there's not a whole lot you can do with either and they don't behave like normal objects
Doesn't moveOut do the job?
How about setPos solution?
setPos on the body?
Yes, I believe setPos on a soldier makes him get out from the vehicle, so worth a try IMO
It's been fixed in the next build
Not out yet tho
2.06?
Yeah
Mhm
is it in the dev branch?
Not sure. Check the changelog on the forums.
You can use deleteVehicleCrew
Or is it also not released yet?
I don't want to delete the body, I want to get them outside of the vehicle
I need the body to still be present
What if you used a killed event handler?
to do what?
threw the body out as soon as it is dead
but how?
moveOut
moveOut on a player body doesn't seem to work
maybe it will if you do it as soon as it's dead
I did try it with a killed EH but it didn't work
ok 
but also it is kind of a special case here, I'm doing it to a body after that player has technically already respawned
which might throw a wrench in that
Well then technically it's not the player anymore
Anyway, I'll check dev branch later.
You can also check the wiki
It says the version with which the new command was released
(it's a new syntax: unit moveOut vehicle)
oh yeah there is a new syntax
I didn't notice that
2.05.147802 is the current version isn't it?
I will try it with the new syntax
or I guess 2.05 is not the current one
I'll try it on dev branch then
Yeah
It's not out yet
It's in 147819
current is 147802
So it'll be available in the next dev branch update
I'll try it when it's out then
@sage dawn what if you used switchMove?
Like this:
_body switchMove "amovpercmstpsraswrfldnon";
_body playMoveNow "amovpercmrunsraswrfldf"
(I typed this on phone, so there might be errors)
You did what? 
I know the animation names, if that's what you mean! ๐

yo bros init.sqf doesnt fire for JIP players right ?
only for everyone present at the briefing screen?
it says Executed when mission is started (before briefing screen)

Don't look at single player
hmm i see
so to make a script run only for player present at start of the game, i will have to remoteExec script from initserver.sqf right?
You can use initPlayerLocal.sqf
It has a parameter that tells you if a player JIPed or not
lol here I was trying to do the right thing!
#general_chat_arma message
I think they said we should post in discord server channel
yeah I forgot 
so i'll have to use if-construct?
wouldnt it be easier to just remoteExec from initserver?
if (_didJIP) exitWith {};
_didJIP is true or false. Just exit the script if it's true.
ah ok got it
another thing, you know how once the game starts after the briefing screen, players load into the game at different times, how do i hold a script execution until every player has loaded in and ready to play?
cause some missions in the workshop was able to achieve that (at start of game theres a hint saying waiting for players..)
https://community.bistudio.com/wiki/getClientState I guess you need to check the client state of each client.
But I've never done something like this so I can't help you really
ok i'll try to experiment, thanks for your help!
Is there a way to get the classname of the explosion of civilian zamak fuel?
Maybe its possible through the means of an eventhandler? But which one?
(It has a long burning fire ball effect thats why I want it)
Hello all
Do you guys know if the behaviours that are disabled with the disableAI command are re-enabled when a player respawns?
For example, I want to use player disableAI "CHECKVISIBLE" but don't know if I only need to do it once in the player init or on each respawn.
I think so
Have you checked the Config ?
Right click on the Zamak > View in config
Anyone ever mess with setting up custom loot boxes to request via the warlord request menu? I want to setup various weapon packs to give my players "upgrades" they can buy using the CP system.
Also, how can I script out the parachute spawn of an item in the warlord request? I dont want my aircraft to drop from the sky but rather appear in front of the player, or at a predefined location, such as an airstrip.
next question
Does anyone have a good configurable NPC vendor and/or loot script I can use? Something I can setup the specifics but the mechanics are already done. I've found some stuff bit alot points to dead armaholic links...
thanks
is there a way to play this effect using a command?
explosionEffect = "FuelExplosion";
I used ```sqf
_source01 = "#particlesource" createVehicleLocal getPos amongus;
_source01 setParticleClass "FuelExplosion";
but it didn't work
setting up particles is more complicated than that. You also need to set the particle params, and there was one more thing I don't remember (maybe drop interval?)
well I'm just using a predefined effect
I just need to make it appear
is too confusing for me lol
this?
thanks
Hey guys, trying to get a custom zeus module to work, so far I have the following cpp file
#define _ARMA_
class CfgPatches
{
class Demsoft6MD_ModuleResupply2
{
units[] = {"Demsoft6MD_ModuleResupply2"};
requiredVersion = 1.0;
requiredAddons[] = {"A3_Modules_F"};
};
};
class CfgFactionClasses
{
class Supports;
class Demsoft6MD_Supply: Supports
{
displayName = "Resupply (Air Drop)";
};
};
class CfgVehicles {
class Logic;
class Module_F : Logic {
class ArgumentsBaseUnits {
class Default;
class Edit; // Default edit box (i.e., text input field)
class Combo; // Default combo box (i.e., drop-down menu)
class Checkbox; // Default checkbox (returned value is Boolean)
class CheckboxNumber; // Default checkbox (returned value is Number)
class ModuleDescription; // Module description
class Units; // Selection of units on which the module is applied
};
class ModuleDescription {
class AnyPlayer;
class AnyBrain;
class EmptyDetector;
};
};
class Demsoft6MD_ModuleResupply2 : Module_F
{
mapSize = 1;
author = "Demsoft";
vehicleClass = "Modules";
category = "Supports";
side = 7;
scope = 2; // Editor visibility; 2 will show it in the menu, 1 will hide it.
scopeCurator = 2; // Curator visibility; 2 will show it in the menu, 1 will hide it.
displayName = "Resupply (Air Drop)"; // Name displayed in the menu
icon = ""; // Map icon. Delete this entry to use the default icon
picture = "";
portrait = "";
function = "moduleResupply2"; // Name of function triggered once conditions are met๏ปฟ
functionPriority = 1; // Execution priority, modules with lower number are executed first. 0 is used when the attribute is undefined
isGlobal = 2; // 0 for server only execution, 1 for remote execution on all clients upon mission start, 2 for persistent execution
isTriggerActivated = 0; // 1 for module waiting until all synced triggers are activated
isDisposable = 0; // 1 if modules is to be disabled once it's activated (i.e., repeated trigger activation won't work)
curatorInfoType = "RscDisplayAttributeModuleResupply2"; // Menu displayed when the module is placed or double-clicked on by Zeus
class ArgumentsBaseUnits : ArgumentsBaseUnits {
class Units : Units
{
property = "Demsoft6MD_ModuleResupply2_Units";
};
};
class ModuleDescription : ModuleDescription
{
description = "Resupply (Air Drop)";
sync[] = {};
};
};
};
class CfgFunctions
{
class Demsoft6MD
{
class Supports
{
file = "Demsoft6MD_ModuleResupply2\functions\fn_moduleResupply2.sqf";
class moduleResupply2{};
};
};
};
class cfgMods
{
author = "Demsoft";
};
Trying to execute the following
if (isServer) then
{
params [["_position", [0,0,0],[[]],3],["_attachedObject", objNull, [objNull]]];
_position = _this select 0;
_h = _position param [2,0];
_h = _h + 75;
_position set [2, _h];
_box = "B_CargoNet_01_ammo_F" createVehicle [0,0,0];
_box setPosATL _position;
parachute_1 = "B_parachute_02_f" createVehicle [0,0,0];
parachute_1 setPosASL (getPosASL _box);
_box attachTo [parachute_1, [0,0,0]];
clearItemCargoGlobal _box;
clearWeaponCargoGlobal _box;
clearMagazineCargoGlobal _box;
{
//Current Result is saved in variable _x
_box addMagazineCargoGlobal [primaryWeaponMagazine _x select 0, 5];
} forEach allPlayers;
_smoke = "SmokeShellRed" createVehicle [0,0,0];
_smoke attachTo [_box, [0,0,0]];
}
It shows in the Zeus Menu, but does not execute the Script, help? ๐
I'm pretty sure the params is wrong...
Also did you check to make sure the function is defined properly?
@digital vine oh wait, your function name is incorrect
Thank you! ......... Now being at risk of sounding like im in over my head (which I am), which line are you refering to? ๐
function = "moduleResupply2";
Pretty sure it needs to be TAG_fnc_moduleResupply2
Basically the name that is displayed in the Functions Viewer
function = "myTag_fnc_moduleNuke";
Yeah, it even says so in the example.
Also don't name your parachute parachute_1
You might wanna choose a shorter tag. DemsoftM6D? 
It's a module, TAG your variables
R3vo and/or Leopard20 would you be available to teach me your wisdom in a quick vc?
I'm on mobile so I can't
Just ask what you need to know. Might be interesting for others too
Ok, so starting with the 100% basic for it to be called TAG_fnc_moduleResupply2 what must I do?
Sort got pushed into the deepend with a lot of this stuff, so a lot of the basic stuff went straight over my head im afraid
Thank you
Might have more Q's shortly
Right so if I did the following
class CfgFunctions
{
class Demsoft6MD
{
class Whatever
{
class moduleResupply2 {file = "whatever.sqf";};
};
};
};
It should return Demsoft6MD_fnc_moduleResupply2?
which I can then call? with just a call command
Will do
So to save my given example, if I was to change
class CfgFunctions
{
class TAG
{
class Supports
{
file = "Demsoft6MD_ModuleResupply2\functions\fn_moduleResupply2.sqf";
class moduleResupply2{};
};
};
};
to
class CfgFunctions
{
class TAG
{
class moduleResupply2
{
file = "Demsoft6MD_ModuleResupply2\functions\fn_moduleResupply2.sqf";
};
};
};
It should work (if the scripting gods are on my side)?
what? no
when did we even talk about this?
Then in function I define the function used?
Shortened for this convo, instead of Demsoft6MD
So was fine as it was?
still
class CfgFunctions
{
class TAG
{
class moduleResupply2
``` this is incorrect
yes

you're supposed to change:
function = "moduleResupply2"; // Name of function triggered once conditions are met๏ปฟ
not that
thank you, think I have it now, just going to try it out
riiiight, to continue to be a burden, I am having the following error display on game start-up "Script Demsoft6MD_ModuleResupply2\functions\fn_moduleResupply2.sqf" Not found
My pathing looks correct and I have also corrected the CfGFunctions to
class CfgFunctions
{
class Demsoft6MD
{
class Supports
{
file = "Demsoft6MD_ModuleResupply2\functions";
class moduleResupply2{};
};
};
};
and what is your PBO name?
Demsoft6MD_ModuleResupply2.pbo
and inside you have the folder functions?
Affirm
what do you use to pack the pbo?
ok set the pbo prefix to be sure
set it to Demsoft6MD_ModuleResupply2
as in the pbo file name?
no there's an option called pbo prefix
done
so repack and test
same issue :/
dm it to me
@digital vine it's empty
you must specify what files to include
*.p3d;*.paa;*.sqf;*.fxy;*.xml;*.bisurf;*.rvmat;*.h
hmm... I haven't touched that setting and have done things in the past, let me re-adjust :/
welllllllllll that was embarrassing, it now loads! However, I now have an issue with the script file (which used to work when executing code whilst in zeus mode)
try a systemChat or something to make sure the params are correct
tbh I'm confusing myself more now :/
the error it is throwing is that it is expecting an object, rather than array
are you sure it's not the other way around?
you're doing this:
params [["_position", [0,0,0],[[]],3],["_attachedObject", objNull, [objNull]]];
that's not what a module passes to its function
I'm not sure where you got it from
You're right, Type Object, Expected Array
If I removed params from the sqf completley, it should work?
Q: re: bitwise... what are BIS_fnc_encodeFlags and BIS_fnc_decodeFlags actually doing? I'm not sure I see the pattern there...
encode creates a number using the bit flags you provide
decode breaks it into the bits.
So I have a funny code that gives me an error in the debug console even if I wrap it in a function. It's a check if all array elements are duplicates. It works if there are all duplicates. If there is a separate value, it does not return anything, and when I put the return value there at the end of the exitWith, it gives an error.
private _arr = [1,1,1,2];
private _i = 0;
private _start = _arr select 0;
private _return = true;
for[{_i = 0},{_i<count _arr},{_i=_i+1}]do
{
if((_arr select _i)!=_start)exitWith
{
_return = false;
_return; // <-- without this: no value is returned; with: gives an error
};
};
_return;
The error:
19:24:19 Error in expression <oleExpressionResultCtrl",
controlNull]) ctrlSetText str ([nil] apply {[] call (_>
19:24:19 Error position: <ctrlSetText str ([nil] apply {[] call (_>
19:24:19 Error ctrlsettext: Type Bool, expected Control
19:24:19 File A3\functions_f\Debug\fn_debugConsoleExec.sqf..., line 25
It seems to break out to the debug console function (?). It works fine if I just use if(...)then{break} or foreach instead of a for-loop. To my knowledge, the exitWith should escape the for's scope, right? I have already verified the integrity of files and I'm only running vanilla.
well, I can read that in the docs; encodes and decodes to/from what? that's my question. does not seem to be a bit position? raw value? etc?
here's my use case, I can get an array of what is bits that are set using BIS_fnc_bitflagsToArray. what I could really use is a reverse operation.
don't use that version of for
What about arrayIntersect to check for duplicates
e.g.:
[0,1] call BIS_fnc_encodeFlags; //gives 3
13 call BIS_fnc_decodeFlags; //gives [3,2,0];
in other words, BIS_fnc_decodeFlags returns the bits that are on
BIS_fnc_encodeFlags turns on specified bits and returns the number
This is my harebrained solution, I know how to fix it, it just surprised me.
Ok
did you change the for loop?
ok I think I see, thank you
well, foreach works fine with exitWith
no
I said change the for
there are two versions of for
you're using the "stupid" one
for "_i" from 0 to count _arr - 1 do
that should do it
Yuhp, it works with that one
the wiki already tells you not to use that one 
where?
it will soon โข๏ธ
Yo bros if i want to execute a script if a certain condition is false instead of true then this is how to do it right:
If (condition) then {} else {execVM โscript.sqfโ};
if !(condition) then { ... };
well that seems kinda...Fine, I'll use the ugly one
Ahh youโre right, my brain couldnt even think of this solution 
Thanks
Hey, im trying to script a group of AI to run as a platoon in a square route [theyre in PT Uniforms and its supposed to be a "Platoon Run"] i cant figure out how to get the run animation to play while they move and get them to not just either stand there stupid or immediately try to move into formation before running to the waypoints, i dont usually script and im really pulling my hair out
also is there a better place to learn scripting than the bohemia wiki because its kind of useless even for someone familiar with code like me
What is troubling you? On a side note, I can feel sudden change in Lou's aura due this comment already. 
its just not working, ive only ever scripted arma via the simple anims fnc and like i defined the entire Composition as a variable then fed said variable to the fnc which is activated via a player present trigger but it still wont work idk whats wrong with it at all
Does anyone have access to the script that goes through all openabe doors in a mission and locks/unlocks them?
show script
Then you come here and show your work, what you have tried and we assist you ^^
You could learn a bit through other people's code maybe?
i cant find a similar code to make a group of units run in formation
[myUnit, [getMarkerPos "wp1", getMarkerPos "wp2", getMarkerPos "wp3"]] call BIS_fnc_scriptedMove;
is the script im trying to use
instead of myunit i have the groups variable
if it is a groups variable, then you are clearly using wrong type of data for that as the unit has to be an object and not a group.
hence it is not working
so i need to have each man defined as a variable? and list all the variables for the script
you define the individual soldiers as objects right? for armas purposes?
yes, individual soldiers are each an object.
But you said you want to move a platoon (multiple groups in a formation) right?
its one big unit just bc its AI i didnt break it into squads or anything
one big unit? So it is just one group?
then you shouldnt need a function at all. By default, groups always walk in formations unless explicitly separated, or in combat mode.
yeah but there isnt a "cube" formation with the one guy on the outside just combat formations
(even in combat, by default , they tend to hold formation)
So you want a different formation from provided?
nope, you want something, you just gotta work for it
you can't create custom formations by script as I know
well, you can of course keep spamming orders to units to maintain formation but yeah it would be really painful haha
can i stream my screen in a chat for you or something? i have like 50 bohiwiki tabs open and 5 youtube videos and nothing is working
all the videos only show how to use like standing anims
you would basically get a group leader's location and continuously doMove each soldier of the formation relative to leader's position.
but does domove work for a running anim>
i thought it just makes them play the anim in place
so theyd be jogging in one spot
doMove is a command to order a unit to move, animation is unrelated
ok, let me try that, thanks for the help.
No worries, but I wouldnt say making such custom formation would be worth the pain. But in case you want to do it:
You would first get leader position,
get relative positions for each unit from leader position, then order each unit of the group to these said locations, and you would need to do this constantly for each unit. (then you would also need to tell them to stop cos otherwise they ll try to return to formation etc)
https://community.bistudio.com/wiki/doMove
https://community.bistudio.com/wiki/doStop
https://community.bistudio.com/wiki/worldToModel
https://community.bistudio.com/wiki/modelToWorld
https://community.bistudio.com/wiki/while
https://community.bistudio.com/wiki/forEach
https://community.bistudio.com/wiki/units
should get you started ^^"
Or
You can create a custom formation but that would require modding and I believe you want to do this for a mission so it is a no go without creating a mod.
https://youtu.be/00gBM3QYr5k
Rickoshay has a military cadence script which should be similar to the platoon run youre describing
question regarding triggers - is there any difference between:
a) Activation: Any player present
and
b) Activation: BLUFOR present with Condition: player in thisList?
Because I get the same output and I'm not sure if it means these are the same things with different approach or one is more "optimized" than another
I mean any other difference than the one activating for any player and the second one only for blufor player
I'm looking for an effect of plane crash - it should looks like a smoke pillar with a large fireball.
Wasn't able to find anything similar even on fuel trucks.
Does anybody know such effects?
Hi, me again, been tearing my hair out wrt, went away did lots of learning and still none-the-wiser.
This is what I've settles on so far
if (isServer) then
{
params [["_position", [0,0,0]],["_attachedObject", objNull]];
_position = _this select 0;
_h = _position param [2,0];
_height = _h + 75;
_position set [2, "_height"];
_box = "B_CargoNet_01_ammo_F" createVehicle [0,0,0];
_box setPosATL _position;
parachute_1 = "B_parachute_02_f" createVehicle [0,0,0];
parachute_1 setPosASL (getPosASL _box);
_box attachTo [parachute_1, [0,0,0]];
clearItemCargoGlobal _box;
clearWeaponCargoGlobal _box;
clearMagazineCargoGlobal _box;
{
_box addMagazineCargoGlobal [primaryWeaponMagazine _x select 0, 5];
} forEach allPlayers;
_smoke = "SmokeShellRed" createVehicle [0,0,0];
_smoke attachTo [_box, [0,0,0]];
}
But still returns an error with regards to line 7. How would one correctly work this?
I told you. That's not what a module passes to its function
I think if you look at some vanilla modules you'll see
I don't remember off the top of my head
but the first param is obviously the module object itself
don't remember the rest
e.g.:
params ["_module", ........];
you might be able to find info on this on the wiki
I created something where I attached a 'dead' fuel truck to a spawned aircraft, can have a look if I can find the script if that helps?
@digital vine Thanks. It is not a problem for me to add a fuel vehicle add use it's effects. The problem is the effect itself, it doesn't look like a fuel explosion at all ๐ So I'm looking for something more adequate. It should be up to 10 meters tall, I think.
Thanks, will try and open a vanilla module to compare, currently looking like a wall of text to me atm (novice-ness showing), but really really appreciative of the help so far
Any suggestions for placing 3D markers?
kind of want something like battlefield objective markers
vanilla tasks or drawIcon3D
gotcha. I assume drawIcon3D means I'd have to do it all myself?
you can create a system for it:
onEachFrame {// DON'T USE onEachFrame
{
_x params ["_pos", "_icon", "_text"];
drawIcon3D [....];
} forEach objective_markers;
};
objective_markers pushBack [getMarkerPos "mymark", "", "Go here"];
right but with the one on frame eventhandler
I might just do it with tasks, and only show the nearest few objectives
oh, tasks are global
is it possible to change some of these attributes locally?
I suppose you could just assign the tasks to specific players
not sure what you mean.
you can assign tasks to specific players
@little raptor i wanted to only show 3D markers to players if they were within a km of the marker
idk I think that's a difficulty settings?
but you can't set the visible distance. it just shows for some time and then hides 
if you want to fully customize it you might want to use drawIcon3D then
@little raptor oh ok. yeah I might just place down text on the map for right now and then use drawIcon3D later
dumb question, i cant save my file as a .ext, what kind of file does .ext stand for? does notepad++ not support it?
@brazen lagoon Use a show/hide module synced to a trigger that hides all objects in the trigger zone
and then a second that shows it when they get within a km
description.ext aka config uses an exclusive language. You can use some like language highlighter like cpp
is cpp something i need to download?
Npp had builtin cpp (aka c++) highlighter
does the armatools cfgconvert tool work?
?
the arma 3 tools window
it has a tool called cfgconvert
im just trying to get a description.ext file to actually read so i can import a sound for a mission
I think I get what you mean. Description.ext doesn't require to convert/binarize/anything to run but just a text file with custom file extension
When a while {} do {}; is launched within a [] spawn { }; on a specific unit, does that while loop delete when the player no longer exists?
so just name the file .ext?
Description.txt to Description.ext, yes
ok then i messed up somewhere else
because it says "cannot find (soundname)" when i hit the trigger
Depends on the while's condition
anyone know off hand what variable ace medical uses to store the triage tag color selection?
that a question for the ace forum
like go to aces discord i think the guys that make it have one
most of the fellas are on here regularly
currently it's;
while {!(player == vehicle player) || (player == vehicle player)} do {
why not just while {alive player} then
do either of you know how to add sounds to a mission
well i suppose that could probably work, but doesn't that deactivate on death?
yes how do you want them used
yes, but yours might as well due to objects changing when player dies
currently i'm having it executed one time on login, then when they're in a car either driving or passenger seat, the script when the vehicle is above 10mph or below triggers godmode on vehicle and passengers, that part works, but my concern is if the player keeps loggin in, will it clog up resources.
why not use an event handler then for that?
Probably should...
yeah it eliminates a whole scheduled loop
an AI is the source of it is a say3d command [R21, "USMCa"] remoteExec ["say3d"];
leme see if i have my old attempt with the EH
use this method for that usage
oh wait i forgot, my confusion was the in trying to make it trigger when the vehicle reached a speed. I was using the getin EH and getout EH
i already did that, its still cant find the sound
i think its why i defaulted to the while
post your config section
I see what you mean then. yeah you can do the while then, but only spawn the while loop when the get in is triggered, then terminate it when the get out is triggered
class CfgSounds {
sounds[] = {};
class USMCa {
name="USMCa";
sound[]={"sound\USMCa.ogg",21,1};
titles[] = {};
};
};
and its saved as the .ext
i forgot how does one terminate a while? that may be the solution to the problem.
a variable?
bump that volume down to something <= 5 and try it again
the volume is causing it to not find the sound? how? that wasnt something i even considered
if you need louder audio try amplifying them in audacity, i ran into the problem of using the highest volume adjustment
handle = [] spawn {};
terminate handle
ty
there used to be a cap on the volume you could do before the engine just wouldn't play it. don't know if it was ever patched out
but 21 is REALLY loud, no need
5 is already blaring
yeah, its really frustrating trying to learn to script arma lol
have you attempted to call the sound using playSound in the debug while game is running?
playSound "USMCa";
maybe a dumb question but i know it matters in context, can i do a _godmodedvehicle = [] spawn { }; then within the same file, but a different EH, terminate the private _godmodedvehicle??
my bad not literally private
i forgot that was a thing in arma
meaning just the _godmodedvehicle vs a godmodedvehicle
the event handler's code block is a different scope, so that's a no
Sound USMCa not found
if(!isServer) exitwith {};
player addEventHandler ["GetInMan",{
_godmodedvehicle = [] spawn {};
}];
player addEventHandler ["GetOutMan",{
terminate _godmodedvehicle;
}];```
no dice on either way i tried it
you can try it, but I don't believe that will work. I believe the code blocks are separate scopes in a EH
F
i have the desc and sound folder saved to C:\Users\James\OneDrive\Documents\Arma 3\mpmissions\ODST%20Base.Tembelan
if its not found, your config isn't good then
send me the whole description.ext file
actually, just send me the whole mission file
that IS the whole file
oh
theres the .sqm but i havent messed with it
i haven't been reading all of the issues you were having @wide fulcrum , but make sure your audio is the correct format too.
its a .ogg
and your structure is:
missionFolder
mission.sqm
sounds
USMCa.ogg
description.ext
did ya use a proper converter tho? I had a wonky program that literally just renamed them to .ogg claiming it converted stuff, it was my problem a few years ago.
his issue is the file isn't found, thats a config issue first and formost
ahhh
Just thought of something. Couldn't I do a spawn with the while in it, then have a waituntil that checks if the player exists then terminates it all within one spawn?
_script = while { } do { };
waituntil {player gone};
terminate _script;
};```
something like this
NVM i see terminate only works with spawns
Any reason something like this wouldn't work?
while { } do { };
};
waituntil {player gone};
terminate _script;```
_script doesn't exist in that scope
use _thisScript
is that a magic variable or something?
akin to _this for example?
ahh i see it is
so reading that, that should function then from within itself right
is there a way to delay the activation of a script from when the trigger is activated
yes, look at the bottom and look at timeOut
if I were to use these macros in something basic, like a mission rather than a mod/addon, what is it going to use for its name though?
what is the name of the command to make a unit turn to face a specific direction
i want them to turn that direction and then go to attention i know domove but how do i tell them to turn first
setFormDir on the group
you need to undefine a few things, and fix some macro definitions
easiest way is just using https://github.com/CBATeam/CBA_A3/blob/master/addons/main/script_macros_mission.hpp
Quick questions guys, what is the current difference between:
player setHit ["body", 0.9]; ```
And
player setDamage 0.9; ```
the first one only hits the body, not all selections
Won't hint str (damage player) also return 0.9 for the player setHit ["body", 0.9]; command?
maybe, but if you check head damage, it will be different
And how does setDamage distribute damage to all selections?
Also, doing a "player setHit ["body", 1]; " will kill the player right?
everywhere, iirc
most likely perhaps dunno
I will test both now
Ok, so doing a setHit "Body" of 0.9 and then checking via "damage player" returns 0
But "player setHit ["body", 1];" does kill the player
It is weird that the "damage player" command is not connected to the particular damage of such important part as the Body! ๐ค
it is connected to the "" part of the damage iirc
but you die when head or body or spine gets > 0.95 dmgโฆ again, iirc
I wonder why does "" exists? "setDamage 1;" could just be the same as "player setHit ["body", 1]; " instead of complicating things... I mean if you die it will always be due to damage to a body part and not a magical ""
I guess that was done because Arma originally was meant to be a vehicle simulator and so it treated units as vehicles... weird
Not entirely sure the context is but IIRC there's some damage config values in CfgVehicles entry. Might worth a look
I am trying to accomplish a rational Damage EH
if i have the trigger activation set to this && player in thislist would i need to have this && player not in thislist in the deactivation to make it repeatable?
just !(player in thisList)
Does anyone know the anim name for turning around
which stance you want
your basic standing stance is:
AidlPercMstpSrasWrflDnon_turnR
AidlPercMstpSrasWrflDnon_turnL
nvm, i just used domove
its less janky
now im trying to have a trigger change the side of an AI when it is activated
it seems like its something no one has managed to figure out
create the group on the target side, and join the unit into it
i want it to happen mid mission and i used the private creategroup thing bohemiawiki reccomends and it failed
what thing?
private _eastGroup = createGroup east;
[(the unit)] joinSilent _eastGroup;
it didnt work at all
should
private _eastGroup = createGroup east;
[Ga1, Ga2, Ga3] joinSilent _eastGroup;
Ga are the units variables
does it not work for multiple Ai
have you confirmed that the code runs at all?
how would i do that
you made sure it's a .sqf file this time not a .sqf.txt again? haha
it runs if i use it in the esc menu
but not on the trigger
and yes @fair drum lol
so, then you should be looking at the trigger's setup, not fixing code that doesn't even run
ok
i dont get why the trigger isnt firing im using the same conditions as all my other player activated triggers
it just isnt running
also... how do i get audio to stop playing if the character it is attached to is dead? for voice lines etc
what are you using to play it?
just this && player in thisList
this is the boolean of the trigger activation condition
so if that evaluates false, the trigger won't fire, regardless of player being inside it's area
also, where should i store arrays? in the desc? or do i just add a game logic?
its a buch of arrays of variable names to save space in triggers
so instead of putting domove and then listing 20 guys i can just say domove (array)
mp or sp?
MP
you could store them in initServer.sqf
im implying that the locality of the AI units never change, and that your doMove triggers are run serverside
otherwise initPlayerLocal.sqf
the AI unit is preplaced in the mission and the Domove trigger triggers on Blu present and the command line in this && player in thisList
so i think
i dont understand what you mean by locality but i hope that helps
if its player hosted its fine, but on dedicated it will fail
when making the array i just use Array = [(variables in array)];
or do i need to add Private _ to it
all of the examples on the wiki have private first but i dont understand its usefulness?
it seems like an added parameter
if an identifier is prefixed with a _, it means that a variable is local to the script(otherwise global), and private means private to the scope where it's assigned
so you don't want it to be local if you're gonna be using that variable outside that script(i.e triggers like you currently are), that means you should be using a global variable
so i just name it regularly
got it
i dont need to list it as globalvariable or publicvariable
public variable is something a lot different from those two
there is no "listing", there is only one modifier, private
private _privateLocalVariable = 0;
_localVariable = 0;
globalVariable = 0;
you don't write
global myGlobalVariable = 0;
no _ means GLOBAL
except in cases like this in init field, this is actually a local variable there
so in Init.sqf i have RunningODST = ["R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "R9", "R10", "R11", "R12","R13", "R14", "R15", "R16", "R17", "R18", "R19", "R20", "R21"]; where RunningODST is my array to be used by the triggers to run their code instead of having to type all those numbers 5 times
R* being the Object Variable
that's an array of strings
they don't evaluate to an object, if that's what you're expecting
ok, now im lost, how do i store the variables in the array? lose the ""?
you don't "store variables in the array", you store values
so as you said, R1...Rn are objects, then get rid of the quotes
ok, now i can just refer to the array instead of all the individual objects in my trigger?
yes
thanks
i also havent figured out how to get it to run one animation for a given time and then switch to another without using multiple triggers
i know the sleep function exists but i dont know how to use it properly
my current trigger now reads {_x disableAI "anim"; while {alive _x} do {_x playmovenow "AmovPercMrunSnonWnonDf"}} foreach [RunningODST]; [R21, "USMCa"] remoteExec ["say3d"];
sleep just suspends the script for +- time specified
i want it to sleep for the time it takes to run that code and then play the pushup anim