#arma3_scripting
1 messages · Page 705 of 1
It works! Thanks!
Just a side question to improve my knowledge and skills, why do we net have to state logic an units before the main script, but we have to define the activated?
what?
oh
why do we net have to state logic an units before the main script,
because you didn't need them in that script (before the spawn)
but we have to define the activated?
because you did need it before the spawn (if (_activated) then)
I think I get it.... Put stuff before which you need to activate the script _activated
Then once script is activated the params tells the script to find whatever is inside of it i.e. _units or _logic from the main game logic?
Does SQF support elseifs? If so what's the syntax?
no
only
else {
if ()
}
```
you can just use switch or call with if () exitWiths
call {
if (bla) exitWith {//if
//do bla
};
if (blabla) exitWith {//else if
//do blabla
};
//else
//do blablabla
}
params tells the script to find whatever is inside of it i.e. _units or _logic from the main game logic?
wat?
params just maps elements of an array to variables
[1,2,3] params ["_var1", "_var2", "_var3"];
params with no left arg is equivalent to: _this params [...]
params ["_logic", "_units"];
//is the same as
_this params ["_logic", "_units"];
_this is just an array
same thing applies to param:
private _activated = _someArray param [2, true]; //select element 2 from _someArray; default to true if doesn't exist
Ahh. That should actually work for what I am looking at. Second thing, is there a check datatype function?
Thank you much
question about standards when it comes to passing variables to a function in a script, say we have this:
`
fn_something = {
_someMath = 1 + _someVariable;
// do other things
};
// script execution
_someVariable = 1;
call fn_something;
is this acceptable? from my understanding, _someVariable is able to be directly edited by fn_something. should this be done instead for variable safety?
fn_something = {
params["_someVariable"];
_someMath = 1 + _someVariable;
// do other things
};
// script execution
_someVariable = 1;
[_someVariable] call fn_something;
`
now _someVariable inside fn_something is a copy and not a direct reference, correct?
should this be done instead for variable safety?
it's still a reference
but you're not modifying it by reference
at least if all you're doing is summing numbers
_a = [];
[_a] call {
params ["_b"];
_b pushBack 1;
};
_a //_a is now [1]
but:
_a = [];
[_a] call {
params ["_b"];
_b = _b + [1];
};
_a //_a is still []
what matters here is what operator you use, and whether it can modify the original value by reference
_c = [];
_a = [_c];
[_a] call {
params ["_b"];
_b = _b + [1];
_b#0 pushBack 0; //_b is [[0], 1]
};
_a; //_a is [[0]], and _c is [0]
This is giving me ERROR MISSING ; ```sqf
_dir = ((_source selectionPosition "PiP0_pos") vectorFromTo (_source selectionPosition "PiP0_dir"));
what is _source?
param from script, it is set to a Darter.
Yeah, I didn't think there was either. But the game is telling me there is an error in line 23, which is that line.
Got to love it.
when it tells you a missing ; error on a line, look at the previous line
NVM found it
no actually next one
no previous one 🤣
It was in the previous line. I forgot the ; at the end of the call statement.
anyone has a clue on how to make the commander of a vehicle force reload?
is there a way to see how the reload command works internally?
no
it only seems to work until turret path [0]. if the unit is in a turret with turret path above 0 it doesn't works
_objectsArray = []; = https://www.sqfbin.com/unepekovoyikematijom
I'm trying to spawn a composition but on the first surface below it. I ran a hint to see the positions of _creationPos and (_mapperObjects select 0) (Is the object that is at the center bottom/spawn pos of comp) and the Z axis was different for each even though they should be the same. Anyone know a solution for this?
_unit = (_this select 0);
private _begPosASL = (_unit modelToWorldVisualWorld [0,1,1]);
private _endPosASL = +_begPosASL;
_endPosASL set [2, 0];
private _intersections = lineIntersectsSurfaces [_begPosASL, _endPosASL, objNull, objNull, true, 1];
private _newPos = (_intersections select 0 select 0);
private _creationPos = [(_newPos select 0),(_newPos select 1),((_newPos select 2) + 0.1)];;
_objectsArray = [];
_mapperObjects = [_creationPos, (random 360), _objectsArray, 0] call BIS_fnc_objectsMapper;
hint format ["%1\n%2",_creationPos, (getPos (_mapperObjects select 0))];
{
_x enableSimulationGlobal false;
_x allowDamage false;
}forEach _mapperObjects;
I already told you to use getPos. Read this to understand why:
https://community.bistudio.com/wiki/getPos
I added the new notes recently
You said to never use getPos again which I realize I did
if you use it properly it's ok
I said never use setPos
if you simply read this carefully it'll answer all your questions:
even solves your current problem
no need for lineIntersectsSurfaces either
Well the positions are the same now
but I'm not smart enough to know how to do that yet
The only correct use case for this command is to determine the placement height of an object.
in other words, getPos _obj select 2 is what you should use to go down to snap to surface
So create a dummy object run that then use that position to create the comp
or the object itself
first put it in front of yourself
then getPos
then subtract height
ezpz
And this is for all surfaces like buildings and such right?
Just want to make sure cause I can be confusing sometimes
yes
(as long as it has a roadway LOD)
how can I stop AI pilots from randomly flying straight up for no reason?
like helicopters, my AI needs to land but just decides to fly up for like 500 meters then slowly back down.
that's because of the way they slow down
not fixable
try flyInHeightASL
ill give it a go
maybe it'll work
should I set that on the helicopter or unit flying it?
So umm... what am I subtracting by?
What I have so far ```sqf
_unit = player;
_dummyObject = "Sign_Sphere25cm_F" createVehicleLocal [0,0,0];
_dummyObject setPosASL (_unit modelToWorldVisualWorld [0,1,10]);
_baseHeight = getPos _dummyObject select 2;
hint format ["%1\n%2",getPos _dummyObject, _baseHeight];
_allMags = [];
for "_c" from 0 to (count magazinesAllTurrets vehicle player) do {
_allMags append (((magazinesAllTurrets vehicle player) select _c) select 0);
}; ```
I'm trying to make an array with all the class names of all the turrets in a vehicle. is this the best way to do it? yes it might be throwing a "generic error". I'll take a look at it later. probably syntax. If you manage to fix it i'll be thankful, also
private _allMags = magazinesAllTurrets vehicle player apply {_x select 0};
and anyway, the error was for append, it takes an array, not string
settPiPEffect is setting the effect for all of my r2t textures instead of just the one I want with the effect.
Am I doing something incorrectly, or is that just the way it works?
_faction = gettext (_x >> "faction");
_type = gettext (_x >> "type");
_vehicle = gettext (_x >> "value");
_ctrlValue lnbsetdata [[_lnbAdd,0],_vehicle];```
I'm a bit stuck on adding more values so I can call it in a function later on, I'm wanting to have _side _faction _type along with _vehicle but have no clue how to achieve it
can anyone give me some guidance on this?
Do you mean, like in a single variable?
Yeah I think so, not entirely sure with this 😅
_ctrlValue lnbsetdata [[_lnbAdd,1],_side];
_ctrlValue lnbsetdata [[_lnbAdd,2],_faction];
_ctrlValue lnbsetdata [[_lnbAdd,3],_type];```
this seems to carry all my values over, I just need a way in getting all the values to spawn my units
I wouldn't do it like that myself.
Does _ctrlValue have anything but these values in it?
_ctrlValue = _display displayctrl DEGA_IDC_RSCATTRIBUTEUGV_VALUE;
its is that currently
So from what I'm understanding, you want to save all the values you just pulled into a single variable and then be able to reference them later in order to control things about units that you spawn?
Yeah, firstly this will run (still wip, currently playing around with it) https://pastebin.com/jHWWek4M
then this is where all the values are needed https://pastebin.com/DQWnb9aW
It could probably be done better but I'm using this as a learning process as I'm not very good
what do you think? it's the base height, measured from the current object ASL height
If you put all those values into a global array together, you would then be able to access them in any script in the mission.
If that's all you need to do, access them in another script, that should work.
use setVariable
while global array would work, it won't be destroyed until the end of the mission
better use setVariable to bind the lifetime of the array to the ctrl itself
I think I've managed to get the value to translate over to the next part its just calling everything together to get it to spawn now
Fair.
Most of my coding has been done in programs, rather than games, so a variable existing the whole time it's running doesn't mean much, and it's often the only way to go about it.
is it possible to learn more information about a given weapon from cfgweapons? example, know if a weapon on a vehicle is countermeasure, gun, missile, laser designator, etc?
hello, Q: is it possible to #define SOMETHING(...) ... in an .sqf file? or do I actually need an .hpp file to facilitate that?
early indications lead me think the latter; like, as though the function does not seem to be invoked whatsoever. I see none of the artifacts, global variables, etc, that the function defines, consequently. and the function does not even return anything, which it should.
yes
yes
I've managed to figure it out!
yes A || B? 😉
_type_spawnCfg = configfile >> "CfgGroups" >> _type_spawnSide >> _type_spawnFaction >> _type_spawnType >> _type_spawnClass; was wondering if someone could tell me how I could add "" to the following _type_spawnSide _type_spawnFaction _type_spawnType
A
but note that whether you define it in the sqf file, or in an external file and include it, the script itself must be preprocessed for it to work
this is done using preprocessFile(LineNumbers)
excVM does it too
West is codename of blufor
I'm not sure what that means... i.e. a config function?
no
not necessarily
cfgFunctions, execVM, compile preprocessFile(LineNumbers) and compileScript all preprocess the file
those are the only places you can use preprocessor macros. (e.g. doing that in Debug Console won't work)
I need West to be in quotes, it comes from a config value
Oh, that's what you meant, I didn't see the second pair of ""
I don't think there is a way to do that.
str west
I see; well, that's what I asked above. so config functions is out. makes sense. thank you.
or ```sqf
format ["%1", west]
I believe if you do "side" when you need it, that might work too.
it comes from a config value
config values are always strings, numbers, or arrays of these
Better to do an "_side"
no
Does that one not work?
no
{
//name = "$STR_A3_CfgVehicles_B_Plane_CAS_01_F0";
side = "West";
faction = "BLU_F";
type = "Infantry";
value = "BUS_InfSquad"; //B_Plane_CAS_01_F
//value = "configfile>>""CfgGroups"">>""West"">>""BLU_F"">>""Infantry"">>BUS_InfSquad";
default = 1;
}; ```
Couldn't remember my own code and if that's what I ended up doing.
I use setvar, getvar etc to get these values
side = "West";
that is from my config
it's already a string
if I added the extra "" in the config it won't show up on my ui
I still have no idea what exactly it is that you want
@mortal forum
I read this
and if that's the question, then the answer is:
config values are always strings, numbers, or arrays of these
in your case, "west" is already a string (it is already in quotes)
ah okay
How can do it,so only the player itself can see its onw drawings?
and markers
and etc
basicly a personal marker system
create them locally
what? no
I mean so that the marker is only created on the player's computer alone
so it won't be broadcast to other computers
and thus only whoever created it can see it
now i get it
so now just use the local version of marker commands:
https://community.bistudio.com/wiki/Category:Command_Group:_Markers
that would make all player made markers be only displayed to the player?
or even better yet
yes. but I'm wondering if you even wanted to script it?
you don't seem to know much about scripting
not sure what you meant there
anyway, I think you can create markers locally in the base game just fine
what i mean is that player can only see either their onw markers,or the ones from their enemy
My question from earlier.
settPiPEffect is setting the effect for all of my r2t textures instead of just the one I want with the effect.
Am I doing something incorrectly, or is that just the way it works?
you're doing it wrong
two different r2ts
Hmm. I don't know how I'd fix it in my case.
I have. That's why I am confused.
this is the (relevant parts of) the code I used:
_cam = "camera" camCreate [0,0,1e3];
_r2t = format ["dbug_r2t_%1", TAG(cams) pushBack _cam];
_cam cameraEffect ["terminate", "back", _r2t];
_cam cameraEffect ["Internal", "Back", _r2t];
_pic ctrlSetText format["#(argb,512,512,1)r2t(%1,1.0)", _r2t];
if (TAG(cfgObjs) pushBack _obj == 0) then {
_r2t setPiPEffect [1];
};
take from it what you want
¯_(ツ)_/¯
1st one executed.sqf "uavrtt" setPiPEffect [0]; 2nd one executed.```sqf
"uavrtt_1" setPiPEffect [2];
so the error is somewhere else
Indeed, but I have no idea what could be causing it.
and we cannot know from there, unless…
Executed by script call in an init field.(Greyhawk)sqf /* create r2t */ tv setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"]; /* create cam, send to r2t */ uavcam = "camera" camCreate [0,0,0]; uavcam cameraEffect ["External", "Back", "uavrtt"]; /* attach cam gunner cam */ uavcam attachTo [uav, [0,0,0], "laserstart", true]; uav lockCameraTo [tgt, [0]]; /* make it zoom in a little */ uavcam camSetFov 0.01; /* set cam vision mode */ "uavrtt" setPiPEffect [2]; Then this one in a different init field.(Darter)```sqf
sleep 0.5;
/* create render surface /
tv_1 setObjectTexture [1, "#(argb,512,512,1)r2t(uavrtt_1,1)"];
/ create camera and stream to render surface /
cam_1 = "camera" camCreate [0,0,0];
cam_1 cameraEffect ["External", "Back", "uavrtt_1"];
/ attach cam to gunner cam position /
cam_1 attachTo [uav_1, [0,0,0], "PiP0_pos", true];
uav_1 lockCameraTo [tgt_1, [0]];
/ set cam zoom /
cam_1 camSetFov 0.05;
/ set cam vision mode */
"uavrtt_1" setPiPEffect [0];
what if you set cam mode to internal?
also use terminate like I did
I'll try now.
also it's safer to just create a system which does this automatically
copy pasting code is not a good idea
what if you wanted more cameras?
I know. These 2 are tests to try to figure out what the issue was.
with a code like the one I posted you can create virtually an infinite number of cameras
I have a moduler version.
Switching to Internal was the fix.
Thx for the extra set of eyes and knowledge.
np
looking at making a field manual for my unit to hand to recruits along, my idea is to make a book like item that can be opened through a keybind or ace, can anyone give me some pointers to start with
Heya, I created custom groups and loadout classes in the description.ext but when I try to spawn a group, it doesn't find the loadout classname (Cannot create non-ai vehicle A_O_G_Soldier_TL_F)
class AOI_Infantry {
name = "Infantry squad";
side = 0;
faction = "OPF_G_F";
icon = "\A3\ui_f\data\map\markers\nato\o_inf.paa";
class Unit0 {
side = 0;
vehicle = "A_O_G_Soldier_TL_F";
rank = "SERGEANT";
position[] = {0,0,0};
};
How do I tell it where to find the config for the classnames? (A_O_G_Soldier_TL_F, ...)
This is the class for the first loadout (I cut some parts to make it shorter in discord, but the loadout itself works when being called with getUnitLoadout)
class CfgVehicles
{
class A_O_G_Soldier_TL_F
{
uniformClass = "U_BG_Guerilla1_2_F";
backpack = "";
weapons[] = {"arifle_AK12U_lush_F", "hgun_Rook40_F", "Throw", "Put"};
magazines[] = {"30Rnd_762x39_AK12_Mag_Tracer_F", ...};
items[] = {"ACE_fieldDressing", "ACE_fieldDressing", ...};
linkedItems[] = {"V_CarrierRigKBT_01_light_Olive_F", ...};
};
the reload scripting command is driving me nuts. it doesn't works with countermeasures and some of the turrets in a vehicle.
It's ok to run a 30 lines code inside a isNil {...30 lines code...}; or i need to keep the code to a minimum?
Possible so its okay if I define your ok “runnable”
30 lines of change weather and simulWeatherSync code intensifies
@warm hedge@crude vigil most lines are simple calcs, but i also create a Static Weapon and put an AI inside it.
Still I don't know what is the question. If you wish to do that, just do that
hello, i am trying to make it so that my players can chose their patch for their dynamic group
I am looking around but i can't seem to find any documentation surrounding dynamic group and patches (or how it randomly chooses one)
hi guys. I'm making a custom module for a first time and it's kinda wrecked now... can you guys gives me advice?
params ['_array', '_object'];
[_object, !(captive _object)] remoteExec ["setCaptive", _object];
};```
so this is the module that my friend gives me.... and now I'm trying to make it to target the "all players"
and I failed. yeah.
(are you dan yet?)
(lol)
anyway, the goal I'm looking for = place the module on a zeus, make all players go captive
on the wiki or in the data, there are module functions models you can use :)
see the input format, use forEach, profit
welp, I still don't know how exactly put those and failed multiple times......
params ['_array', '_object'];
private _units = units (group _object);
{
[_x, !(captive _x)] remoteExec ["setCaptive", _x];
} forEach _units;
};```
this one applies to group I select...yeah it worked. I tried to edit some words from here and..... failed :/
changed units to allplayers, but it didn't work as I thought....
are you trying to do a module or are you trying to (simply) do a script?
@subtle sinew
1/ you are creating a code variable (toggleSetCaptiveGroup), which by itself does nothing
2/ a module uses such parameters: [logic, objects, isActivated]
3/ your forEach seems correct
params ['_array', '_object'];
private _units = units (group _object);
{
[_x, !(captive _x)] remoteExec ["setCaptive", _x];
} forEach _units;
};
["Custom Modules", "Toggle setCaptive Group", toggleSetCaptiveGroup] call zen_custom_modules_fnc_register;```
this was full script, it goes through zen addon :/
1/ oh, a full script thanks for telling 😛
2/ IDK Zen, see their doc
3/ you can use a local variable (_toggleSetCaptiveGroup)
time to go back a little, those 2 works as I thought, now I wanted to target the all players for setCaptive...and there's the problem started :/
just keep in mind that the game freezes while your code executes.
You can run hundreds of lines that won't be any bad, or you can also run a single line that will cause a very noticable lagspike or gamefreeze
I got a issue when I am hosting my scenario (Both playerServer and dedicated), the issue is that every time a new player Joins in Progress the whole server freezes for like 2 seconds (Mega-Lag spike). Anyone got any Idea of where I should start to look in order to fix that issue?
OnPlayerConnected and such?
also, all your remoteExec with JIP set to true
additionally, setUnitLoadout has been spotted for always adding something to the JIP queue
@somber radish ↑
JIP to true?
well, do you use remoteExec
Ooh, ok I thought it was the oposite (making the load-in process bigger)
Yeah
A lot
I got a bunch of commands executed using remoteExec, After I noticed the lag-spike I started changing them to JIP false)
So that is wrong?
don't do it randomly 😄 check what you want to do
Does JIP only fire on the conecting machine, or on all machines every time someone connects?
I just want to diagnose what is causing the spike, so I can find a work-around
you should really read the remoteExec page before using the JIP parameter
I have, Can't remember it saying anything about a lag-spike. Afaik using 0 sends the command to all machines (however what I dont know is if ```sqf
[] remoteExec ["Function", 0, true];
will cause the fnc to repeat on all machines once someone new connects
no
it will exec the function on the connecting machine, that's it
Can't remember it saying anything about a lag-spike
like scripting doesn't tell you that abusing it will tank perfs - it's just "don't JIP everything that is not needed"
Good to know!
Thank you!
let's say (I might breach open doors here too):
[unit, 1] remoteExec ["setDamage"];
```this is useless, as `setDamage` has a global effect
```sqf
[unit, "face1"] remoteExec ["setFace"];
```makes sense, it has a local effect - **but!** a player joining later will not have the info (everyone had a local change)```sqf
[unit, "face1"] remoteExec ["setFace", 0, true];
```makes sense
```sqf
[group unit, leader unit] remoteExec ["selectLeader", group unit];
```makes sense - then, the leader has been selected for everyone
```sqf
[group unit, leader unit] remoteExec ["selectLeader", group unit, true];
```**makes no sense** because when joining, the global information (who is the leader) is **already** transmitted with all the current info to the JIP machine
Would spawning in a few 100's of objects maybe affect that. I have used JIP true for textures and abilities
IDK, you tell me (MP sync, most likely?)
how is spawning objects related to JIP though 🤔
I was thinking about the lag-spike (If the spike is related to a bunch of functions being executed when someone joins / the info of those new objects being transferred to the new client)
well, creation of 100 network-synchronised objects may have some impact yes
1/ transferring all the remoteExec about creating objects (why not one function?)
2/ creating those and sending them to other machines
if you have doubts, shoot! (a question)
Disclaimer: this advice does not apply to a war zone
The first one actually makes sense when my precious pc is too lazy to work and has the need to socialize with other pcs.
Jokes aside, I would like to see you destroying a locally created object on target without remoteExecing it. 
Yes I only wrote that to create an objection against you. 
a local function?
I don't care if you do remoteExec it
just don't JIP it
and/or remove from the JIP queue the creation of it too
it's OK
I will mute you 😈
Is there a way to make respawn wave a set thing where it waits till x amount of people dead then respawns them
So it feels like more of a wave.. per say
In my experience wave respawn is just a random timer it doesn't necessarily feel like a wave respawn
per se, it is a latin locution 🙂
you could set player respawn remotely to +5, +5, +5 until the "good" amount of dead peeps are reached, then remote them all to 0
@idle jungle
Ok can you explain it like I'm 5? 👶 lol is it via init.sqf or?
player switchMove "AmovPercMstpSnonWnonDnon_exercisePushup";
I want to force the player into the push up animation, playMove works but the problem is the player has to finish their animation to start the push up animation if I use playMove
so I'm using switchMove to force them into the animation whenever I want, problem is when I run the command the player just hostlers their gun then go back to their normal animation and point their gun forwards as if the animation played for half a second and stopped, any possible fix?
other animations will work if I use switchMove btw (such as going prone or sitting)
you shouldn't be playing Arma, this game is for adults! 😄
Have i just over looked something.. Adding 'player addAction ["test", call fn_test];' in the init will add the action but not call fn_test at all. adding it into the debug console will work as intended but also call fn_test as soon as the addaction action is added to the player. wot.jpg
you should provide string or code value
if fn_test doesn't return any of those, meep it's wrong
how come it would work correctly if adding via the debug console and fire before called by the addaction?
because your action is not calling fn_test
it's returning the result already
and uses it for the action code
{ call myFunction }
wait nevermind, complete brainfart lol. Forgot arma's sleep is in seconds not milliseconds. working perfectly.
lul ^^
switch (_kind) do {
case "Rifle": {
_resupplyTime = 30;
if (_weapon isKindOf "Rifle_Long_Base_F") then{
_resupplyTime = 45;
};
};
case "Pistol": { _resupplyTime = 15 };
case "Launcher"; { _resupplyTime = 60 };
case "GrenadeLauncher": { _resupplyTime = 45 };
default { _resupplyTime = 30 };
};
so, what good options do I have here to define "_kind"? else ifs, checking isKindOf?
else ifs
#arma3_scripting message
checking isKindOf
the special version of isKindOf
call {
if (_weapon isKindOf ["Rifle", configFile >> "CfgWeapons"]) exitWith { //if
_resupplyTime = 30;
if (_weapon isKindOf ["Rifle_Long_Base_F", configFile >> "CfgWeapons"]) then {
_resupplyTime = 45; // lmg or sniper
};
};
if (_weapon isKindOf ["GrenadeLauncher", configFile >> "CfgWeapons"]) exitWith {//else if
_resupplyTime = 45;
};
if (_weapon isKindOf ["Launcher", configFile >> "CfgWeapons"]) exitWith {//else if
_resupplyTime = 60;
};
if (_weapon isKindOf ["Pistol", configFile >> "CfgWeapons"]) exitWith {//else if
_resupplyTime = 15;
};
else {
_resupplyTime = 30;
};
}
I done this right?
no
I said the special version of isKindOf
what's that special version? I'm not following 
look at the wiki
ah, the alternative syntax? got it
syntax 3
there, I edited the original post
probably
¯_(ツ)_/¯
I didn't spot anything wrong
I'll run it
except for this
if (_weapon isKindOf ["Pistol", configFile >> "CfgWeapons"]) exitWith {//else if
_resupplyTime = 15;
};else {
_resupplyTime = 30;
};
what on earth is that last else?
magic
yeah I removed it don't worry
I tried calling _resupplyTime outside of the call and it said undefined variable
nvm I just defined it before the call and apparently it is working
how do I omit an optional parameter/ not specify it?? I'm trying to call playSound3D but soundPosition is overriding soundSource
I have to admit I'm 30 🤣
basically @idle jungle
when a player is dead, remoteExec setPlayerRespawnTime to e.g 10e10
when enough players are ready to respawn (and still connected), remoteExec them setPlayerRespawnTime to a value of e.g 1
https://community.bistudio.com/wiki/setPlayerRespawnTime
[10e10] remoteExec ["setPlayerRespawnTime", _guyThatJustDied];
private _respawnList = [];
waitUntil { count _respawnList > 9 };
[1] remoteExec ["setPlayerRespawnTime", _respawnList];
```_PSEUDO CODE_ but you see the idea
10e10 is 1e11 😛
shaddap
wat?
1*1*1*1*1*1*1*1*1*1*1 == 10*10*10*10*10*10*10*10*10*10 ? really? is it?
are you joking?! I can't tell!
are you joking?! I can't tell!
it's not "power", it's "×10^n"
/ moodkiller

5e3 = 5000
plz tell me you're joking! 😄
he's in charge of A3's engine!! 
I see what you mean now got it thank you!
@coral sky that sort of thing you was on about?
I'm using BIS_fnc_objectsGrabber and can someone tell me what each value is for?
["Land_Ammobox_rounds_F",[-0.0800781,-0.578125,0],20.2942,1,0,[0,0],"","",true,false],
I created a config.cpp and put it inside a pbo and now it works but I'd rather have it in the mission folder, is that possible?
no
From the BIS_fnc_objectsMapper
_type = _x select 0;
_relPos = _x select 1;
_azimuth = _x select 2;
//Optionally map certain features for backwards compatibility
if ((count _x) > 3) then {_fuel = _x select 3};
if ((count _x) > 4) then {_damage = _x select 4};
if ((count _x) > 5) then {_orientation = _x select 5};
if ((count _x) > 6) then {_varName = _x select 6};
if ((count _x) > 7) then {_init = _x select 7};
if ((count _x) > 8) then {_simulation = _x select 8};
if ((count _x) > 9) then {_ASL = _x select 9};
if (isNil "_ASL") then {_ASL = false;};
_x being an element from the object grabber array
private _allMags = (magazinesAmmo [vehicle player, false] apply {_x select 0}) + ((magazinesAllTurrets (vehicle player) apply {_x select 0}) - (magazinesAmmo [vehicle player, true] apply {_x select 0}));
// all Mags = vehicle mags + ((all turret mags including empty) - (vehicle mags including empty))
// all Mags = vehicle mags + ( all turret mags - vehicle mags)
// all Mags = all turret mags (which include vehicle mags)[Empty mags removed!]
all this to remove empty mags from magazinesAllTurrets doesn't works. if only magazineAllTurrets didn't include empty mags...
@undone flower Try something like this 🙂
private _noEmptyMags = magazinesAllTurrets MyVehicle select {_x # 2 > 0};
Not sure if this exactly goes in here, but anyone have any suggestions for existing addons that improve tank mechanics? There's that smarter tanks addon that makes the AI better, but I mean stuff that changes how armor pen works etc
thanks... will see how it works out
seems to be working well. next step is finding the gunner that triggered a reload event handler in a vehicle
Would it work if only the server starts with the pbo or does every client need it too?
Is there no way to prevent a plane from exploding when damaged?
addEventHandler["Dammaged",{0}]; does nothing in this regard, the only way i found to stop it from exploding is to use allowDamage false, but that just prevents ALL damage.
I remember this being an issue years ago, but i would expect this to be addressed by now. So, still no change?
how would I disable vcom on all aircraft?
"HandleDamage" would be the EH
see VCOM's doc
But it is not. Like i wrote, _plane addEventHandler["Dammaged",{0}]; does not prevent the plane from exploding.
....hmmm, unless i would be doing allowDamage false inside and then setting limited damage to particular hitpoints... worth a try
How do I get the parent path of a nested tvCurSel
HandleDamage
by going one level higher
_parent = _curSel select [0, count _cursel - 1];
ah you do literally just - 1 it
LOL, ok, thank you 😄
okay ty!
are there any difference between || and or and and && ?
no
lol then why having two identical operators ?
there must be something
shorter, easier to distinguish
There are tons of duplicated commands that do the same
many languages implement a keyword version, and operator version, sqf is not an exception
whats the best way to debug? i usually just use systemChat format ["%1, %2...." _var1, var2]
Use the way that helps you best to debug ¯_(ツ)_/¯
There is also https://community.bistudio.com/wiki/BIS_fnc_log and logFormat
as well as diag_log
The exact same thing but you don't have to use format, just cast the array as str
systemChat str [1, typeOf player, time]
Quick remoteExec question
if I put this : ```sqf
Payout = {
Cash = (Cash + 5000);
};
While {true} do
{
Sleep 300;
{[] RemoteExecCall ["Payout", _x]} ForEach AllPlayers;
};
In the InitServer.sqf file and only there, will the clients be able to execute this function?
no.
when you put a function name in it, it doesn't say "send the code and run it there" but "run this function on the client"
either have a function for that (also, "Cash" is quite… generic, don't forget to prefix it with a tag e.g TALLY_Cash) or awfully send the code itself over the network.```sqf
// OK
while { sleep 300; true } do
{
[5000] remoteExec ["TALLY_fnc_addMonies"];
};
// big meh
while { sleep 300; true } do
{
[{ Cash = Cash + 5000 }] remoteExec ["call"];
};
// biggest meh
[{ while { sleep 300; true } do { Cash = Cash + 5000 } }] remoteExec ["call", 0, true];
@little raptor it's ok, it was just a nightmare. close your eyes, it is gone already
Ait, got it thnx again!
if (("hit_engine" in _selection) or ("motor" in _selection))
this may sound stupid but how can i avoid the repetition of the _selection expression when i have big conditional statements ?
i tried (("hit_engine" or "motor") in _selection) and got generic error in expression 
I believe you could combine the conditions into a single variable before the if, then use the variable as your condition.
At least I've done that in other languages, I don't know for certain if it works in sqf.
Example: ```sqf
_condition = (("hit_engine" in _selection) or ("motor" in _selection));
if (_condition) do {
Blah
Blah
Blah
};
If it works, it will make the if statement shorter, but you'll still have to type it all out.
["hit_engine", "motor", ...] findIf {_x in _selection} > -1
but you can also use regex (after v2.06 update)
count (_selection regexFind ["hit_engine|motor|.../io", 0]) != 0
which will be faster if you have many words to search
I'd be glad if devs took a look into the reload command. it works so funky. I've been trying to find a workaround for its wonkyness for a day or two now
devs don't really check this channel. make a ticket
your method didnt work btw
feedback tracker?
yes
there's a ticket about it already. looks like a dev replied to it
I hope they work into it
Good to know.
_u action ["Eject", _v] doesn't work if the vehicle is too damaged?
It works at the mission start, but not few seconds later when the vehicle is damaged (the only difference i am aware of).
I can still exit using player action, but the scripting command does nothing.
Never mind, i am a moron.
When you say
round random 3
does that mean 1, 2, or 3
Or does it mean 0, 1, 2, or 3
Basicly does it inculde or exculde zero?
random 3 can be a number in range from 0 to 2.9999999
So after rounding the result of random 3 you can get 0, 1, 2, or 3.
How do you exculde zero then?
What is the proper MP-compatible way of ejecting units from vehicle?
And i mean eject, right now, like its an emergency, not "open door, pick nose for 5 minutes and then sloooowly exit"
Using u action["Eject", v] keeps doing the slow exit animation, and the vehicle explodes before the driver gets one foot out of the vehicle.
@supple matrix ignore the last comment, i can just use 1 and 0 lmao im dumb
You can use ceil or floor:
_x = ceil random 3 // gives you 1, 2, or 3
_x = floor random 3 // gives you 0, 1, or 2
That worka great too! Thanks
is sqf like other languages where if you use an or condition and the first condition is true, it does not read the second condition?
for example,
i = 1; if (i == 1 or i select 4) then { do something };
i isnt an array but i == 1, does it skip the second condition?
it does
use lazy eval
"unit setSkill number" Does that set every sub skill to number? Or only certain sub skills? Or does it do something else?
I need some help, when I put this
taki1 say3D ["mosque_1", 500, 1];
sleep 75;
};```
in On Condition in my trigger the game crashes. My trigger is activated by blufor and is repeatable
I have this in my description.ext
```class CfgSounds
{
sounds[] = {};
class mosque_1
{
name = "mosque_1";
sound[] = {"\sounds\soundfiles\mosquesound_1.ogg", 300, 1};
titles[] = {0, ""};
};
};```
All obviously
is there a way to detect "double tab" key input via actionKeys or otherwise? [and not block other input like when using inputAction]
say you have grenade throw bound to 2x T
action based or key based?
with a liiiiiittle luck for it to be 0 still
1 + floor random 2 🙂
either way if working (reliable enough) (without side effects)
can be more helpful if you describe what you are trying to do exactly
oh I had read that as "double tap" meaning double clicking, buuut 2xT is confusing me now which one exactly 😅
Why not selectRandom [0, 1, 2];
that too
@ivory lake @velvet merlin If I had such issue, I would simply write like this, not sure if there is another way(that could be thought in 5 mins
). You may wanna test it though.
#define KEY_DIK 20
#define MAX_DOUBLECLICK_TIME 0.5
finddisplay 46 displayaddeventhandler ["keyDown", {
if (_this select 1 == KEY_DIK) then {
hint "T clicked";
private _lastTClickTime = uiNamespace getVariable ["fnc_LastTClickTime", 0];
private _deltaTClickTime = time - _lastTClickTime;
systemChat str _deltaTClickTime;
if (_lastTClickTime > 0 && _deltaTClickTime > 0 && _deltaTClickTime < MAX_DOUBLECLICK_TIME) then {
hint "T double clicked";
} else {
uiNamespace setVariable ["fnc_TClick", true];
};
uiNamespace setVariable ["fnc_LastTClickTime", 0];
};
}];
finddisplay 46 displayaddeventhandler ["keyUp", {
if (_this select 1 == KEY_DIK) then {
if (uiNamespace getVariable ["fnc_TClick", false]) then { //This condition is to ensure T was not pressed in another dialog/display then released in this dialog.
uiNamespace setVariable ["fnc_LastTClickTime", time];
};
uiNamespace setVariable ["fnc_TClick", false];
};
}];```
Probably to prevent any catastrophe if he actually wants something between 0 and 100. 😅
easy!
you just add selectRandom [0, 1, 2, 3, 4, 5, 6, 7, 8, (…), 98, 99, 100]
that's how you get a 500kb SQF 😄
_i = 0.5;
while {"." in (str _i)} do {
_i = random 100
};
_i
this is perfect code, you literally cant do it better
disclaimer: That is bad and dumb
private _fnc_randomInt = {
private _result = random _this;
if ("." in str _result) exitWith _fnc_randomInt;
_result
};
100 call _fnc_randomInt;
to avoid while unscheduled limit, even better

🔨😄
We need more meow emotes.
NO WE DON'T
ofc you dont feel the need of it, you are able to post any pics here
_fnc_randomInt = {
selectRandom (magazinesAmmo selectRandom (allUnits)) select 1
};
``` one liner baybee
gniiiiiiiii!!
That's how I'd have done it too
Does BIS_fnc_objectsMapper always spawn on the ground? Because I know I'm passing in a Z axis but the composition keeps going to the surface
I gues you have your answer
if you see https://community.bistudio.com/wiki/BIS_fnc_objectsMapper doc, position is apparently 2D
editing the page so it's clearer
I'm really good at missing the information I'm looking for. Literally read the page like 10 times
page fixed
if you need to move them up, you have all the objects so you could setPosASL vectorAdd forEach of them
the On Condition in triggers is unscheduled. pretty much skips the "sleep" part and you're playing that same sound many, many times a second.
Thank you for your reply! I managed to get it to work.
How to detect client disconnecting from (dedicated) server on the client itself? (Arma 2: OA!)
play Arma 3 already!
NO! 😄
onPlayerDisconnected, rings a bell? 🔔
I hope to finish my pet project some day so that I can move to Arma 3 completely... 😄
But it's triggered on server only in MP?
Waiting for 4 like the rest of us?
ah, on the client…
just don't disconnect
I love both Arma 2 and Arma 3, but Arma 3 still lacks that killer gamemode for me... So I'm trying to create one myself, with poor success so far 😄
Arma 3 still lacks that killer gamemode
you can port 👀
In theory yes... But I don't think it's worth it, as so many things need fixing in the A2 mission(s) that I host. And I'd like to make a certain style next generation version of Life gamemodes in Armaverse anyways...
Tbh I've been considering even a standalone since I don't like SQF at all (looking forward to Enscript even with all its quirks), but it would increase workload on other areas significantly and I don't think I'd be able to handle such a large project in my current life situation
Is it my thought process that is messing this up or the code?
The objects are generally in the position they are supposed to be but the Z axis is a little off by like a meter or two
_mapperObjects = [_creationPos, (random 360), _objectsArray, 0] call BIS_fnc_objectsMapper;
{
_x setPosASL ((getPosASL _x) vectorAdd [0,0,(((getPosASL _x) select 2) - _creationPosZ)]);
_x allowDamage false;
}forEach _mapperObjects;
_creationPosZ is the Z axis of where the composition should have spawned so I'm getting the difference of the Z heights and adding that to the object right?
(((getPosASL _x) select 2) - _creationPosZ)
(getPosASL _x) vectorAdd [0,0,(((getPosASL _x) select 2) - _creationPosZ)]
....wat?
(((getPosASL _x) select 2) - _creationPosZ)
if you still have no idea what my "what" means, that is why
Are the () unnecessary?
...
So
(getPosASL _x select 2) - _creationPosZ
why would I care about unnecessary ()?
your equation is wrong
Maybe I should take a brake and come back when my head can think straight
you can just picture a scenario if you have trouble figuring it out
what happens here if the object is above _creationPosZ, i.e. (getPosASL _x select 2) - _creationPosZ is positive?
((getPosASL _x) vectorAdd [0,0,(((getPosASL _x) select 2) - _creationPosZ)])
(also side note: you don't need vectorAdd at all)
@fair drum i'm having a issue w/ the markers script,it seems to not be working
the one from a while ago? you using it in a different scenario this time?
yes...
i'll redoit
(simply copypasting the code)
and redoing the markers
pm me what you got so far again
i'll check it that works
no,it worked again redoing the markers
so idk what happened
you probably missed a string somewhere or something
So this is closest thing I've got so far. Thing is each object is at a different height which is why I think I was suggested to use vectorAdd
_xHeightZ = getPosASL _x select 2;
if (_xHeightZ < _creationPosZ ) then
{
_movePosZ = _creationPosZ - _xHeightZ;
_finalPosZ = _movePosZ + _xHeightZ;
_x setPosASL [position _x select 0, position _x select 1, _finalPosZ];
};
you can use set if you want
_x setPosASL (getPosASL _x vectorAdd [0,0,_xHeightZ]);

fite mi
first of all what you wrote here means:
z = z + z - _creationPosZ
z = 2*z - _creationPosZ
so you're taking the object higher
it should've been:
((getPosASL _x) vectorAdd [0,0,_creationPosZ - (getPosASL _x select 2)])
i.e
z = z + _creationPosZ - z
or z = _creationPosZ
so like I said, you don't need any vector ops at all
_p = getPosASL _x;
_p set [2, _creationPosZ];
_x setPosASL _p
love me some set
I swear I’m usually good at thinking and at math 
Thanks for working with my stupidity
It is always a pleasure watching you either facepalm or constantly sweat.
even worse when its directed at you
anyways
how could i make a ACE arsenal that only loads gear currently used from one side?
see ACE doc
that's the how, but for the gear to only be one side, you'll have to do some class filtering.
it's ok don't beat yourself up over it. just try to think outside the box. and sometimes a little imagination can help too, which is what I tried to say here:
you can just picture a scenario if you have trouble figuring it out
what happens here if the object is above_creationPosZ, i.e.(getPosASL _x select 2) - _creationPosZis positive?
obviously in that casedz > 0, so you'll be taking the object higher (but in this case you wanted to take it lower)
stuff
less obvious
non-obvious stuff
guys... given a vehicle, weapon, muzzle and magazine from EH "Reloaded", how can I find the crewmember that reloaded 'muzzle'?
I need this because currentMagazine returns "" if the crewmember is using the commander's turret gun, for example
you can't 
currentMagazine, currentWeapon only works for driver and gunner turrets I think 💀
Just open the attributes and manually choose what stuff should appear in the ACE Arsenal (Which is the one with the sorted sections and search bar)
maybe this is a better place for this:
How do you get dead units out from a destroyed vehicle?
soon ™️
Are you trying to say that it is not possible?
not yet
you can probably delete them tho
well, i don't want to delete them, i want them to drop out of the vehicle.
still, i tried deleting them using deleteVehicle and it doesn't do anything either.
So, i guess there is just no way doing anything with those units.
you have to use deleteVehicleCrew
I just find it hard to believe, because i would expect this to be kinds common and often required feature, so it is hard to accept that there is no solution 🙂
there isn't as of v2.04 (at least not possible with scripting; the engine can do it of course)
but will be added in v2.06
Aha, i see, deleteVehicleCrew does work.
Still, not what i need, i don't want them deleted, just outside 🙂
OK, thanks, at least i know i can stop trying to find a way.
yeah, i know... its just "in the works" is completely useless to me NOW 🙂
Ive done something like this, although its not the most performance friendly. You have a event handler on all AI then if they're in a vehicle, and their health reaches below a variable they become immune eject themselves, force ragdoll and then 'kill themselves' But thats alot of effort.
Small edit, no idea if that even works still this was about 3 years ago.
you can probably force eject them with an animation
I've never tried it
That wouldn't work for me, because my units are already dead - they are literally dead bodies transported in a vehicle.
that doesn't seem to do anything.
I mean it does force "AI" to eject
just wasn't sure about the dead
so now I know
if they're already dead, you can just 'replace them' and do the same process?
what do you mean "replace them"?
Delete them and spawn a alive unit back in the same place
do the thing it needs to do. and set them dead again
If it stupid but works 😂
That is too much work - i would need to copy their identities and looks, what they are wearing, their equipment, magazines and ammo in them, ...nope, i am NOT going to do that 🙂
not really a lot of work...
I'll just wait and hope that this really does get addressed in the upcoming patch.
We can argue all day about what is or isn't a lot of work, so maybe its not a LOT of work, but it makes no sense to waste time on this IF the core issue is supposed to be solved in next patch (i just hope that it does).
IF the core issue is supposed to be solved in next patch
it is. just try the dev branch
anyway, thanks
class cfgdeadguy
{
class thedeadguy
{
face="theirface";
};
};
--
itemsofDeadGuy = getUnitLoadout deadguy;
aliveguy setUnitLoadout itemsofDeadGuy;
aliveguy setIdentity "thedeadguy";
pseudo^
In theory that is all you'd need to set them to be the same
what does worries me a bit, is that it seems to be focused on "getting dead units out of vehicle", while "getting dead units out of destroyed vehicle" may be slightly different problem - i hope the fix works in both cases.
i hope the fix works in both cases.
it does
wait a second current is 2.04 and dev is 2.06.. what happened to 2.05?!
2.05 is DEV
Yeah, but this is really not the way forward. You need to create a real clone, that has everything the same. And lets not forget about variables - you need to find which script/mission/JIP variables may be pointing to any of those units and set them to the new unit - i am not even sure if there are means to do that.
all odd versions are Dev
it is doable, but anyway
you want to wait 😉
Modding since 2009 and I'm today years old when i just noticed this.. 
what do you mean is doable? to delete the units and make clones? or to get them out of the vehicle?
If its about the clones, then nope, not interested, but if its about getting the actual units out of the vehicle, then please share, i am all ears.
anyone know which addon file contains the location logic modules?
what location modules? 
locationArea_F, locationBase_F, etc etc want to pull their activation functions to know how they work as there is barely any documentation on them
are you sure they're even modules?
honestly, no. they are under the module tab and logics. their config files ingame leave me no pointers on where to look to investigate them
Ok, so... you can actually get dead units out from a destroyed vehicle using unassignVehicle and setPos, or maybe other/similar command combinations.
BUT ONLY if the units were alive when the mission started!
If you set the unit health in editor to 0%, it won't work with that unit anymore.
Which makes me wonder what exactly is it that those units lack (group? center?).
Can it happen that even units that used to be alive, after enough time loose whatever it is those insta-dead units never had, causing it not to work anymore even on units that used to be alive?
I found this in the function viewer:
but locationArea_F, locationBase_F are not modules
(they don't have module attributes at least)
¯_(ツ)_/¯
yeah i was looking at that but not sure how using the editor locationBase_F or others contributes to that function as it looks like they somehow get registered to locations before this function
well they have a special "systemLocation" class...not "Modules"
maybe they're handled by the engine
just interesting that the game has been out this long and there is minimal documentation on the logic modules and what they truly do.
Can it happen that even units that used to be alive, after enough time loose whatever it is those insta-dead units never had, causing it not to work anymore anyway?
yes. AI
Does the moveOut update in 2.0.5/6 solve this problem too?
the problem that once unit dies, after some time it looses its group/center/AI/whatdoyoucallit and as a result of that it becomes impossible to move it out of a vehicle (like i desribed in my previous post)?
yes
😄 by "yes" you mean this problem will persist even in the 2.0.5/6 update, or that the update solves this problem too?
it's fixed. dead units can be moved out of vehicles (even if the vehicle itself is dead). it doesn't matter how long either have been dead.
Hopefully my brain isn't stuck in another language but I seem to be blank walling on this in SQF
Without using a bunch of count, is it possible to product a if/for that checks its an players has x amount of items in an array ie [["FirstAidKit",1],[ "ToolKit",1]]
not sure if there's a command that already gives you that, but there are several ways you can do that if there's not
there's a new command coming in 2.06 called uniqueItems or something
which does
Leopard have you turned into the 2.06 salesman? 
yes! 😄
but anyway, the fastest way is probably this:
_items = ...;
_uniqueItems = _items arrayIntersect _items;
_itemCounts = _uniqueItems apply {
[_x, count _items - count (_items - [_x])]
};
this is the command:
https://community.bistudio.com/wiki/uniqueUnitItems
question about the mission event handler "Group created". does it includes groups already created, like in the editor?
seems simply enough via that!
yeah. it's also faster than using {} count _array
I don't think so - but what are you trying to achieve?
why not try it out?!
if only we could just do 'include system.linq' 
trying to add EHs to units automatically. my current script takes allUnits at mission start and attaches the EHs to them. new units are not affected
allGroups can help
perhaps I'll use this later on. still have to figure out how to add the event handlers to new units
like ones spawned by scripts
group eh + delay (as the EH fires on group creation, before unit creation)
mhm, I was thinking on the delay too
anyone knows a tutorial to make and package a script mod? I pretty much got all the scripts done
dev is 2.07
How would you make a foreach only trigger if all elements are possible
_stuff = [["FirstAidKit",2],["ToolKit",2]];
{
_nested = _x;
_Varitem = _nested select 0;
_VarQty = _nested select 1;
varKits = { _Varitem == _x} count (items player);
{
systemchat format ["%1 %2", _Varitem ,_VarQty];
} forEach _nested;
if(_varQty <= varKits) then {
for "_i" from 1 to (_varQty) do {
player removeItem _Varitem;
};
};
} forEach _stuff;
ps Leopard if you say 2.06..
. its getting late ok. 😂
the syntax highlighting your should use is SQF btw
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Fixed 😉
varKits = { _Varitem == _x} count (items player);
why do you do this again?
isn't _VarQty already the number of _Varitem in items player?
So _VarQty is the amount of items to remove from the player inventory
just do it the way I wrote then
make a foreach only trigger if all elements are possible
not possible without looping already
a few mistakes I spotted in your code:
- using items in every iteration of the loop(
items player). this is slow-ish. save it into a variable outside the loop varKitsis a global var
{
systemchat format ["%1 %2", _Varitem ,_VarQty];
} forEach _nested;
```you need only 1 system chat
system chat is just there for testing
yeah I know
just saying
¯_(ツ)_/¯
anyway, like I said {} count _array is slow
doing it the way I wrote is faster
im not on 2.06
you only need 2.06 if you wanted to use uniqueUnitItems command
although this is case sensitive
I'm sure im going potato brained. Might be worth a break as im completely blank walling at this
(and its not even hard stuff. #LearningNewSyntaxWillBeFunTheySaid )
does vectorDir also change object pitch at all?
yes
how would you calculate a vectorDir such that it doesn't affect the pitch, only orientation on the xy plane?
if possible
why not just use setDir then?
possible, yes
surely
_varI=0;
_stuff = [["FirstAidKit",2],["ToolKit",2]];
_itemReq = count _stuff;
{
_nested = _x;
_Varitem = _nested select 0;
_VarQty = _nested select 1;
varKits = { _Varitem == _x} count (items player);
if(_varQty <= varKits) then { _varI = _varI + 1; };
} forEach _stuff;
if{_varI == _itemReq} then {...}else{...};
Would do the same and not much performance difference ?
I don't know what you're referring to
but what you wrote is still slow (probably even slower than before)
0ms though
its needs to have a check to make sure if the player has 2 ToolKits before it even takes a single FirstAidKit
_stuff = [["FirstAidKit",2],["ToolKit",2]];
_items = items player;
_cntItems = count _items;
{
_x params ["_item", "_cnt"];
_cntItem = _cntItems - count (_items - [_item]);
if (_cntItem >= _cnt) then {
for "_i" from 1 to _cnt do {
player removeItem _item;
}
}
} forEach _stuff;
0ms though
because it didn't even compile
your if is wrong
for the record, you can't have 0 ms
{
[_x] spawn |!!!|FABHH_fnc_infAmmoInfAttachEH;
} forEach (allUnits);
// FUNCTIONS
FABHH_fnc_infAmmoInfAttachEH = {
_infantry = param[0, objNull, [objNull]];
_infantry addEventHandler ["Fired", {
[blahblah]
};
};
``` on the |!!!|, it's throwing me an "undefined variable in expression". am I missing something ?
strange, on code performance it says 0.00007 ms. it has been compiled, wasn't it?
no scripting errors whatsoever when it's just the function
on code performance it says 0.00007 ms
what do you run?
also:
0.00007
sounds impossible
just the function:
FABHH_fnc_infAmmoInfAttachEH = {
_infantry = param[0, objNull, [objNull]];
_infantry addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
if ((_unit ammo _muzzle) == 0) then {
if (not ((_magazine) in magazines _unit)) then { // only add if no more magazines of a kind found in unit's containers.
[_weapon, _unit, _magazine] spawn FABHH_fnc_delayedAddMagazineInfantry;
} //end if
}; //end if
}]; //end EH
};
this would return 0 if im not mistaken
it looks correct here
but what you posted was wrong
but what? 
return 0? where?
_cntItem would return 0
that ammo should be _ammo instead?
if the case is correct it won't
_stuff = [["FirstAidKit",2],["ToolKit",2]];
_items = items player;
_cntItems = count _items;
{
_VarQty = _nested select 1;
_cntItem = _cntItems - count (_items - [_item]);
if (_cntItem >= _cnt) then {
for "_i" from 1 to (_varQty) do {
player removeItem _Varitem;
}
}
} forEach _stuff;
the _cntItem returns 0
dudeee it was the position of the code. the functions were bellow the {} forEach
I moved the functions above it and now it's recognizing
strange cus I defined functions like that before and it ran just fine
are you saying to copy and paste yours or that i just copy and pasted?
this:
#arma3_scripting message
should work correctly as it is
It works but it 'doesnt' It will still remove 2 firstaidkits even if they have no toolkits
hence why i put the second count
if (_cntItem >= _cnt) then {
it already checks that...
remove 2 firstaidkits even if they have no toolkits
so you don't want anything to be removed unless all counts match?
Yeah, what ive said the whole time 

well that requires two loops then
why i had the original 😂 loop doing the count
_stuff = [["FirstAidKit",2],["ToolKit",2]];
_items = items player;
_cntItems = count _items;
_allMatch = true;
{
_x params ["_item", "_cnt"];
_cntItem = _cntItems - count (_items - [_item]);
if (_cntItem < _cnt) exitWith { _allMatch = false};
} forEach _stuff;
if (_allMatch) then {
{
_x params ["_item", "_cnt"];
for "_i" from 1 to _cnt do {
player removeItem _item;
}
} forEach _stuff;
}
you can also use findIf
wait you can just do _allmatch like that?!

just going to go to the shame corner
Its getting way to late, think its time for sleep. Cheers for the help Leopard. 
also cool:
_allMatch = {
_x params ["_item", "_cnt"];
_cntItem = _cntItems - count (_items - [_item]);
if (_cntItem < _cnt) exitWith { false };
true
} forEach _stuff;
``` forEach returns the last evaluated expression of the loop
yes but you're returning the value every time at the end of the loop 
might as well use findIf
_allMatch = _stuff findIf {
_x params ["_item", "_cnt"];
_cntItem = _cntItems - count (_items - [_item]);
(_cntItem < _cnt)
} == -1;
¯_(ツ)_/¯
does too many functions performing sleep negatively impact performance in a significant way?
too many functions is the issue, not sleep
the functions i'm using are a couple of ifs and binary comparisons. should be fine
that's commands
what's a good way to terminate a script instantly when a condition is met? spawn another script that has the script handle, check the condition every second, then terminate using handler?
the main script cant always check since it's busy sometimes
Ahh, damn planes still explode when you ditch them in water.
Is this something hardcoded?
I am using "HandleDamage" event handler to prevent the plane from exploding when it crashlands on the land, but water still kills it.
Is it because i had to make some mistake in my EH, or do i need to look somewhere else for the reason why water+plane=explosion?
Hmm, when i add this allowDamage false into the plane's init field, it just peacefully submerges, no explosions.
But running this command inside the "HandleDamage" event handler after checking whether the surface is water, still has no desired effect (and it runs, logs verify the line was executed, so the water condition is fine, and i even tried it without it just to be sure).
Ain't understanding the context entirely but can you do plane setDamage [1,false]?
in theory yes, but where do you suggest i do that? in the "HandleDamage" EH?
...it can't hurt
wait what? no! i don't want to setDamage 1! 😄
Why would i do that, i want to prevent the destruction of the plane.
Or do you mean i should try to destroy the plane without accompanying effects (the "false" param), so when the game decides to destroy it later, it will be already destroyed so it won't do anything?
...that is an interesting idea 🙂 its one of those that sound so crazy it may just work 🙂
.
Well, using plane setDamage [1,false], be it inside the "HandleDamage" EH or a bit later but still on the dry land, makes the plane explode right in that moment.
Apparently, the "false" parameter is being ignored (or is misunderstood? but i don't know how else to interpret "false to skip destruction effects" than that if you use the "false" parmaeter, it will skip destruction effects like explosions, fire, brimstone, locusts, etc.)
.
I just want to prevent the plane from exploding when it goes underwater.
if i ditch it carefully enough, i can even see it float for a few seconds, then slowly sink, exactly as i would expect it to do, but after a while of it sinking, it usually explodes.
Or if i slam it into the water without even trying to slow it down, it explodes on impact (which wouldn't bother me so much, IF the careful ditching would also not result in explosion just a bit later).
But thats just the water, if i do the same thing on dry land, the "HandleDamage" event handler i use prevents any explosions (only if the damage seems to come from colliding with other objects. If it is the terrain itself, the explosion usually does happen, especially if the impact is hard and/or if the plane is flipped upside down).
Correction: it isn't working at all now.
Even with simple _this addEventHandler ["HandleDamage", {0}]; which afaik should prevent any non-scripted damage like due to collisions, the plane still explodes.
Oh wait, according to https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
Only the return value of the last added "HandleDamage" EH is considered
...so, if there is some other EH after mine, it could be what is screwing with my chi.
But where would that come from - i do not have any mods loaded, this is on vanilla game.
even if i do:
_this addEventHandler ["HandleDamage", {(_this select 0) setDamage 0; 0}];
...the plane still instantly explodes when i slam it into the ground.
Am i forgetting something? or is this normal???
If i start with the plane on one side of the runway and accelerate to ~120+kmh and slam headfirst into a concrete wall i placed on the other end of the runway, there is no problem.
In this case, the EH "HandleDamage" negates any damage the plane receives.
But if i take off and slam it into the ground - instant explosion no matter what.
This makes no sense and is driving me crazy, please save my sanity.
Something very weird is going on.
Speed is not a factor - even if i start with the plane in the air and fly it into that wall head first at ~300kmh, the plane does not explode (obviously thanks to the "HandleDamage" EH).
But if you substitute the concrete wall with a terrain, it results in an instant explosion (despite using the same "HandleDamage" EH).
This is bad, please tell me there is a way to fix this, that i am just doing it wrong.
EDIT: (in case it matters, this is all done with the Caesar BTT plane)
Even after setting the destrType to DestructNo in plane's config, the vehicle still gets destroyed on hard terrain impacts (starting with plane at 800m ATL, and slamming its nose into the terrain underneath).
And it is not just the visual effects (which would be still wrong of course), because damage MY_PLANE returns 1 after this happens.
And this is all while still using MY_PLANE addEventHandler ["HandleDamage", {0}];.
Water remains deadly as it ever used to be, but no explosion anymore, just the vehicle's associated damageEffect which in this case is AirDestructionEffects, and the player still gets ejected out of the plane which should only happen when it gets damaged enough (AI stays in though, which i find strange, but maybe its normal, i cannot say).
EDIT2: After setting vehicle config value of destrType to DestructNo, and damageEffect to empty string (mainly to make sure it isn't the damageType="fire", the fire effect has, that is destroying the plane), there are no more visual effects as expected, but the plane still gets destroyed in water, or on hard terrain impacts.
Still using MY_PLANE addEventHandler ["HandleDamage", {0}];
Still getting 1 from damage MY_PLANE
Still getting player ejected, but AI stays in.
My conclusion:
Even if the destrType set to DestructNo isn't supposed to prevent damage, it doesn't change that there is still something circumventing the "HandleDamage" EH.
A tiny bit of progress...
If i use the following EH code, the plane often does survive the crash into ground, except if i flip it upside down.
But crashing into the water is still a guaranteed explosion.
private _v = _this select 0;
_v setDamage 0;
_v setFuel 0;
_v setHitPointDamage ["HitEngine", 0];
_v setHitPointDamage ["HitHull", 0];
_v setHitPointDamage ["HitRotor", 0];
_v setHitPointDamage ["HitFuel", 0];
_v setHitPointDamage ["HitFuel2", 0];
0
}];```
(not sure if setting all those hitpoints is needed, its just how i have it at this moment)
Isn't this ripe for a ticket?
If there is a feature that is supposed to prevent damage (returning value from the "HandleDamage" EH), and it is not preventing damage, then... that must be a bug, right?
I've already asked in #arma3_feedback_tracker
Let's see what they respond
yeah, damage of a collision with other vehicle/water etc usually always goes through, even though you got a handledamage with a 0 constant return
Is there a scripting approach (without any config file creation) to increasing AI artillery dispersion or is the only answer essentially calling in each round as a doArtilleryFire with manual dispersion?
looks like BIS_fnc_AAN was changed at some point. does anyone still have the original function by chance? :/
i remember reading about a change there a long time ago. but i didn't expect the old one to be overwritten...
god damnit. looks like this is not a script, but some config change
i guess my day is ruined now
shoutout to polpox and his aan script on the workshop. seems this saved my day.
why can't the script itself check a condition instead of killing it from outside?
Is it possible to put a tab character in systemchat() ?
hello everyone can i have a question about ui,where can i ask?
do it in the source code, or get it via https://community.bistudio.com/wiki/toString
Thank you. I've been looking 20 minutes for this page 🙂
Wait, what do you mean via source code? in the sqf?
if by sqf you mean the file, then yes
yeah, that's why I was asking in #arma3_scripting 😉
Hmm, I don't think systemChat supports tabs...
What am I missing here? Using the following path with fileExists/loadFile doesn't work, pasting it into the File Explorer however, will open it up
"c:\users\XXXX\onedrive\dokumente\arma 3 - other profiles\r3vo\missions\testing\scriptlibrary.vr\functions\scriptLibrary\fn_exportFunctionsToWiki.sqf"
Have you tried it without the .sqf extension?
"c:\users\XXXX\onedrive\dokumente\arma 3 - other profiles\r3vo\missions\testing\scriptlibrary.vr\functions\scriptLibrary\fn_exportFunctionsToWiki"
What's actually going on? I'm pretty sure you cannot just access files on your computer from within a mission file
The path looks like something that should be declared in CfgFunctions?
yeah, you are right. It should be functions\scriptLibrary\fn_exportFunctionsToWiki.sqf"
Hello,
I want to call the specator mode via a function and immediately jump to a specific person in the 3PP view.
At the moment i have it like this:
["Initialize", [player, [], true]] call BIS_fnc_EGSpectator;
[_target] call BIS_fnc_EGSpectatorCameraPrepareTarget;
[_target] call BIS_fnc_EGSpectatorCameraSetTarget;
But there I only jump to the position of the target but don't track it auromatically like for example in the 3pp view.
Are there any other options?
["Initialize", [player, [], true]] call BIS_fnc_EGSpectator;
[_target] call BIS_fnc_EGSpectatorCameraPrepareTarget;
[_target] call BIS_fnc_EGSpectatorCameraSetTarget;
["SetFocus", [_target]] call (uiNamespace getVariable "RscDisplayEGSpectator_script");
["SetCameraMode", ["follow"]] call BIS_fnc_EGSpectatorCamera;
eh, this is for sure the "hacky" way, but it works 
it changes the camera mode to 3pp aswell, because there is a free look option too, which doesn't make the camera follow, only track
thank you, I will test it.
can someone double check my remoteExec? I can't get playMusic to work when specifying a start parameter (TAS_S14 is modded music, just replace with RadioAmbient3 if you try to run it)
["TAS_S14", 28] remoteExec ["playMusic"];```
See the pinned messages about remote exec
The one to last example
Thank you! Forgot that it would need double brackets
guys, do not make an event handler that calls itself without a stop condition, it's bad for your arma's health
Music event handlers do not seem to persist when game is loaded from save in singleplayer, anyone know if this is intentional behavior?
Does anyone know is its possible to control the curatorCameraArea ceiling via script commands. addCuratorCameraArea seems to set the ceiling to the default value of 2000m.
https://community.bistudio.com/wiki/camCommand 5th line in Example 2.
https://community.bistudio.com/wiki/curatorCamera To access camera.
I believe most codes that has to persist should be handled through Loaded event handler as I believe it would be virtually impossible for mission to predict which codes are supposed to stay and which are done.
Thanks for the tip, however the command does not seem to hook into curatorCamera. I wonder if its a timing issue as I am only setting the ceiling after the player has entered the curator view, not whenever that particular camera is created.
What are you doing to achieve it? The command is capable of working anytime after camera is created.
where can I paste my .sqf script so someone can take a look at it?
I think people mostly use www.sqfbin.com these days.
I am using a CBA_stateMachine to detect when the player enters the curator view (!isNull findDisplay 312) and then do the magic.
Iirc, it is unnecessary as the camera is not destroyed upon leaving the camera.
But how else would I detect the curatorCamera if the player is not in curator view? 😅
That is the command's job to handle that, when you are in UAV, does player command return something else or fail? :)
I do not follow. curatorCamera is a local command that returns ObjNull if the player is not using the curator view.
thanks, that's the site I was looking for
And I can't come up with any better ideas how to get the cameraObject that I need.
Thats why I said "iirc", apparently I dont recall it right then. 
Apparently "ceilingHeight" is actually not working
I guess that would explain it.😩
3:57:20 Error: Error during SetFace - class CfgFaces.Man_A3.whiteface_11 not found```
Getting this error in the RPT yet the face appears to be setting properly...
this setFace "whiteface_11";```
It actually works but not for curatorCamera for ... reasons I guess 😅 (tried on a camCurator created manually). If you really want to achieve that, you can maybe create a new camera and give it to the player.
maybe don't exec that in int
¯_(ツ)_/¯
Yeah, I'm not sure why I had it in there to be honest...must've had a problem with something when I was testing multiplayer maybe?
Way too much arma this last week. But it was a good vacation. 🙂
so trying to use this script to switch to a weapon after it's been added, however it won't work with underbarrel grenade launchers, because _muzzles select 0 is this , rather than the actual first muzzle. Is there an alternative?
_checkWeapon = primaryWeapon _caller
_muzzles = getArray (configFile / "cfgWeapons" >> _checkWeapon / "muzzles");
if (count _muzzles > 1) then
{
_caller selectWeapon (_muzzles select 0);
}
else
{
_caller selectWeapon _checkWeapon;
};
_caller is because it's from an addAction
print _muzzles and see what you get
i have, this is what happens on the SOG SKS ["this","vn_sks_22mm_gl_muzzle"]
it wont work with underbarrel grenade launchers
What is your purpose?
You want to make caller select GL?
add a weapon, and then automatically equip it with the first muzzle selected.
but just using _caller selectWeapon _checkWeapon doesn't work on weapons with 2 muzzles
And you want to do this because?
cause i'm removing a weapon earlier in the script and then adding a different one later, and wanting to automatically switch to it after adding it
You just took the code from selectWeapon's example I believe
i altered it to fit into my script yes, but then noticed that the first muzzle was this so wouldnt work
and it says on the wiki: Rather than simply using selectWeapon to select your default weapon after adding them to your player, it is recommended you use a script instead similar to the following, which caters for multiple muzzles:
I dont know why there is such example (it is from 2008 so maybe due that) but considering the muzzles array of a weapon always returns "this", it is not useful for you at all. I dont see the point of that condition at all if you wont choose muzzle bigger than 1.
_muzzles select 0 is this , rather than the actual first muzzle. Is there an alternative?
that's the correct behavior
if it's this you just have to use the current weapon class
You just need to use _checkWeapon itself
right, so do I want to alter the if statement to check if _muzzles select 0 == this?
if (count _muzzles > 1) then
{
_caller selectWeapon (_muzzles select 0);
}
else
{
_caller selectWeapon _checkWeapon;
};
both are doing the same thing
(after you correct it)
if (count _muzzles > 1 and _muzzles != "this") then
{
_caller selectWeapon (_muzzles select 0);
}
else
{
_caller selectWeapon _checkWeapon;
};
``` this should be right then?
sorry, mispelled
1st index of muzzles should always be "this" afaik so it is redundant.
which is why I said it's doing the same thing
it is from 2008, so maybe back then...
when things were different?
The ancestors left us goods that are not true anymore
maybe?
why dont you just do selectWeapon primaryWeapon of unit?
afaik it never works that way anyway
there was a note by KK on the BIKI
for force switching weapons by the player
cause of earlier on in the, script it could be a primary weapon or handgun that's removed and added
ah right, no point really using it then?
nvm it was for fire modes:
https://community.bistudio.com/wiki/forceWeaponFire
// Here is a neat workaround trick for firemode change from a script:
_weapon = currentWeapon player;
_ammo = player ammo _weapon;
player setAmmo [_weapon, 0];
player forceWeaponFire [_weapon, "FullAuto"];
player setAmmo [_weapon, _ammo];
it does work on AI, but not sure about players
it probably does work
I've never tried it on player
it seems dodgy, it works on the SOG MC-10, but not the SOG SKS, even though both of their primary muzzles are the same as the weapon classname
but anyway, your script is wrong. so it would never work the way you do it
great 😔
Basically, a weapon, be it primary or handgun gets removed, and then a different weapon gets added later (same slot as the one that was removed). I am then wanting the game automatically switch to the newly added weapon.
Why is your code then looking to primaryWeapon, that part I did not get.
i was just trying to get it working with primaryWeapon first
doesn't just selectWeaponing it work?
_unit addWeapon _blabla;
_unit selectWeapon _blabla;
nope, like I said, works with the MC-10, but not the SKS
i have to hop off the game for now so can't test further but that's how it was last time I checked
is there a way to know if a weapon is single-use or not?
as in disposable launchers?
yeah
You could try to detect eventhandlers.
RHS Launchers have their own eventhandler in configFile >> "CfgWeapons" >> "rhs_weap_rpg75" >> "Eventhandlers" >> "RHS_DisposableWeapon"
ACE version of NLAW uses CBA_fnc_firedDisposable in configFile >> "CfgWeapons" >> "ACE_launch_NLAW_ready_F" >> "EventHandlers" >> "fired"
Does anyone know how to calculate freefall time for bombs accurately?
I'm trying to make a script that makes planes drop bombs on things
The simplest solution I can think of is to "throw" the bombs in the direction of the target underneath the plane, it looks convincing enough if you don't look too closely, but it's still a bit hard to accurately aim
So... how do I make a friend take control of an AI by using "setOwner"?
How can I know the ID of the connected players?
the UID or the client number for remote executing?
UID is getPlayerUID
client number is clientOwner but has to be fired locally
setOwner is how to change locality of a unit, not that they control that unit. use selectPlayer is what you want
I'll test it later, thanks!
Anyone know where I can find the translation for "message Type_96" in the rtp file?
nowhere
uuh
these are intentionally listed as obscure names
useful for developers, useless for users
So is there any way I can do some exception handling for theese?
Server: Object 5:64 not found (message Type_96)
Warning: no type entry inside class Hud_1/controls/Attributes
Is there a way to use it on another player?
like me play a character and you control that character on the screen?
On this particular mission, I'll be playing as Zeus and some friends as soldiers.
I want to change the units they control after a certain point
@fair drum
It would be an existing AI
yeah then use selectPlayer just remote execute it to the machines you want. make sure you read the documentation under selectPlayer as far as what can go wrong.
I've read it, but I don't know how I am supposed to give an AI control to a player that is not me. When I select an AI and type "selectPlayer _this", I become that unit.
I am a layperson when it comes to scripting, so there is a possibility that I am misinterpretating the documentation.
you are going to be in over your head on this one then. you need to know about MP locality, remoteExec, clientOwner numbers and how to get them, etc etc
the simple answer is
[unitName] remoteExec ["selectPlayer", clientNumberHere]
but you won't know your client numbers without having those clients give it to the server, multiple ways to do that. THEN you need to sift through those numbers correctly.
you probably could do
[newUnitName] remoteExec ["selectPlayer", oldUnitNameControlledByPlayer]
but you need to make sure only the server is doing this
Hmm, I think I got it
SetGroupOwner
Is what u need for units (stuff that has AI)
that only changes locality
anyone able to see why i'm getting "undefined variable _jet?" wasn't getting this error at all earlier
`fn_patrol = {
params["_origin","_jet"];
_cruiseAltitude = 1000; // patrol altitude
// Cruise at altitude
_jet flyInHeight _cruiseAltitude;
// rest of function here
};
// initialize variables
_jet = _this;
_mapRadius = worldSize / 2;
_center = [_mapRadius, _mapRadius, 0];
[_center, _jet] call fn_patrol;
`
script is execvm'd on the vehicle
error as at _jet flyInHeight _cruiseAltitude;
whats your execVM line?
this execVM "jet.sqf";
theres more to the script that happens before and theres no issues with referencing _jet
don't post half stuff. use sqfbin.com and post all of it
It worked almost perfectly, the problem is that when I use the "selectPlayer", that unit becomes unable to revive downed players or be revived. Any idea on how to fix it?
oh
we can't just put images of errors in here
that's annoying
anyone know what this error means
the error is what it says. you didn't define the base class that you inherited from.
also that is related to #arma3_gui
I think the revive system actions are only added to the players? 
But if I have a playable AI and I switch its control to a player by using "selectPlayer", isn't it supposed to work just like a player?
no. the actions are added before the mission starts. they're not "transfered"
There is no way to make it work then?
you might be able to do:
[newUnit] call BIS_fnc_reenableRevive
after you transfer the player over
I'm gonna test it
@little raptor I'm just trying to fix a script so I didn't even know it was for gui oof, since I got you here though how would I define it? Or is there somewhere I can look to find it?
tanks my guy
if a mission:
import RscObject;
import RscText;
import RscFrame;
import RscLine;
import RscProgress;
import RscPicture;
import RscPictureKeepAspect;
import RscVideo;
import RscHTML;
import RscButton;
import RscShortcutButton;
import RscEdit;
import RscCombo;
import RscListBox;
import RscListNBox;
import RscXListBox;
import RscTree;
import RscSlider;
import RscXSliderH;
import RscActiveText;
import RscActivePicture;
import RscActivePictureKeepAspect;
import RscStructuredText;
import RscToolbox;
import RscControlsGroup;
import RscControlsGroupNoScrollbars;
import RscControlsGroupNoHScrollbars;
import RscControlsGroupNoVScrollbars;
import RscButtonTextOnly;
import RscButtonMenu;
import RscButtonMenuOK;
import RscButtonMenuCancel;
import RscButtonMenuSteam;
import RscMapControl;
import RscMapControlEmpty;
import RscCheckBox;
add that to your .hpp file before you do your hud stuff
if making an addon, use class instead of import
is that literally all the stuff to import lol
I appreciate it my man
I'll test it in a couple minutes
just make another file with all the imports and stuff and do a simple #include in your config file at the top
It doesn't seem to work
i didn't expect it to. you probably can't do what you want to do
Oh, that's unfortunate
right @fair drum @little raptor I sorted my crashing issue out and fixed the script thanks boys
Thanks for all your help, Hypoxic
One last thing, would you know how to force a player to join spectate mode once he enters an area, and leave spectator mode once he is out if that area?
how would he be able to leave the area if he can't control his character anymore
I would teleport him as Zeus
I wanted to make a checkpoint that instantly revives all dead players (excluding AI playable units), but this second alternative seems to be easier to do
why not just use the respawn system and add some respawn tickets at the checkpoint?
I wanted the dead players to spectate until the others reach the checkpoint.
And I didn't want to tell you this, but... well, I'm having a hard time trying to figure out how respawns work
Oh, another thing is that when a player respawns, they reset their loadouts for some reason
hop in a voice channel and stream your screen and i can show you
hopefully this is the right channel, so currently the unit im in has a ACE interaction to change the camos on a set piece of armour which overwrites the texture on the armour when you switch it I was wondering if there was a way to instead of having it overwrite the current texture to change it back to its base texture if there was a way to have it reset the texture
hi, im not sure what im doing wrong but i cant seem to get the setvectorup to actually change the direction of the vehicle im using it on (trying to make a tank sit upside down atm)
try setVectorDir(AndUp)?
What do you use?
tried both in zeus and eden
I mean the code you use
oh "this setVectorUp[0,1,0];" and the variatinos of - and 1s
no transform is done on any of them
im very new to scripting as a whole so might just be me not udnerstanding something basic here

To make it upside down you should put [0,0,-1]
Are you sure you're putting that in the tank's init?
as far as i can tell yes
maybe it's the crew
But sill there's no telling if it works at all in init
If you're using eden just rotate it in eden
you can do that?
Yes
i knew you can in the compas directions
thanks, this really isnt well documented online
It was iirc
thanks a bunch for this. il keep looking if i can get that into zeus. shame i was dug innto the wrong rabbit hole then
I don't understand what you mean
But everything you said is possible of course
im not very good at this so im just asking but how can I help you understand/what did I say that was confusing
I was wondering if there was a way to instead of having it overwrite the current texture to change it back to its base texture if there was a way to have it reset the texture
No punctuation or anything. I have no idea where your sentences end, and thus no idea what you want/mean
the current way we use the interaction it takes a texture and applies it to the pieces that the player is wearing (uniform helmet backpack). when you select another texture it overwrites the old texture and applies the new one. I was wondering if there was a way to instead of overwriting the old texture and applying the new one, you could reset the texture to what it original was when you equipped the uniform.
You can just get the default texture from the config.
I'm currently on mobile so can't really show you how
also one thing I still don't understand is, do you mean you want a toggle system? (switch between camo and original)
yes
its a ace interaction that we use to change camos each has its own interaction that applies the texture
I was trying to see if would be possible to just have a reset interaction so things like custom helmets can be reset too instead of having to add 10 different interactions to the list
if im still being confusing (which I probably am) I have a video of the interaction working but I dont have the exact script
As Leo said. You can always get the default camo from the vehicles' config.
So one action sets custom texture, another one gets default camo from config and applies it
right but that would require a separate interaction for each custom helmet right?
so one interaction can be done to reset the texture of the armour even if its a different helmet for each player
In theory yes
and that would require no extra effort for the player once the script is set up except pressing one button which would work for all of the helmets
If done correctly, yes
Hey
I have this MP issue where this works on my normal. but while testing on a server during an op it just doesn't go as it should.
that's locality issue for you!
if(isPlayer _x) then
{
_passengers pushback _x;
removeAllItems _x;
removeAllAssignedItems _x;
removeBackpack _x;
_x addBackpack "B_Parachute";
};
so this works
while i play off of my rig
and the main server when I tested this like 10 mins ago was all yeah nah
Where did you enter that
in a Sov_fnc_PlaneLineDrop
so if I add this ```_OdinPlayer = _x
{
[_OdinPlayer] remoteExec [_x,_OdinPlayer,true];
[_OdinPlayer] remoteExec [_x,2,true];
} foreach ["removeBackpack","removeAllItems","removeAllAssignedItems"];
I could be good?
[_OdinPlayer] remoteExec [_x,2,true];
why
don't set JIP to true here, it's useless and adds weight to the JIP queue
what does that last part mean?
you are saying "if a JIP player connects, re execute these commands"
I do have a for each with each command so i can shorten the length of the script
oh god
ok
the best thing would be to have one CfgFunctions function to do that, so you only removeExec the function's execution
so e.g addBackpack doesn't execute before removeAllItems
(as remoteExec order is not guaranteed…)
so how come a remoteExec isn't guaranteed?
the queue is not guaranteed, 3rd line can be executed before 1st or 2nd etc.
order is not guaranteed
Why are you even doing it that way, just use Global versions of the commands?
so is it like one of those things where it some times just doesn't go through with it?
or is the order not a thing that will happen all the time but will go through anyway?
All will go through, it is just a question which one will reach first and also which one will be executed first I believe.
But why are you doing it like that, that part I dont get it?
so a friend recommended I change my remoteExec to remoteExecCall
still doesnt guarantee
it is the difference of [] call {} or [] spawn {} for remote , nothing else
so remoteExecCall is just call but over the net?
I ll ask one last time, is there a reason u dont use global versions of these commands?
Yes
I didn't think there was
just use it , u dont need to bother with remoteExec at all
I thought those commands were the global in a sense
