#arma3_scripting
1 messages · Page 754 of 1
Heya - I'm quite new to scripting, so any help would be appreciated. I'm looking for a way to display an image on the screen of all players in the game.
Lovely. I'll give it a go. I already played around with cutRsc, but I think this should work. Cheers.
if I remote execute a command that returns a variable, how do I obtain that variable?
you don't
what is your use case?
camcreate
local to a player that drives a certain vehicle
but I can't do anything with the camera without having it as a variable
why not write a function instead of remote executing every command?
because remoteExec can't execute local functions
also its only the camCreate
I'm global executing
well to be precise
I'm executing to a single player on their client side
I’m not following.
You can remote exec whole functions and pass args
Camera controls are entirely local as well
1/ create a function that does all the camera's work
2/ declare this function in CfgFunctions
3/ remote exec that function
don't do myFnc = {}, that's the unsafe way
so it has to be global basically
cameras aren’t global
The function has to be declared on the client
if you publicVariable such function, you saturate network
Oh my bad misread
@drifting portal save yourself some time and efforts, do it the proper way ;-)
thanks
I gotta say Lou the first scripting tutorials I watched used execvm exclusively rather than CfgFunctions
it really did me dirty
That's such a good idea
You guys had acripting tutorials?

they pretty much consisted of putting 'execVM' in a trigger activation
its the straightforward, easy way
one of them had me make a .sqs 
okay maybe dont trust that one 😄
Long time since i oast used a trigger
Like... 6 years?
Just feels like a curse word to me
obj = (_this select 0);
pos = position (_this select 1);
rotateClockWise = (_this select 2);
rotatespeed = (_this select 3);
object = obj createVehicle pos;
posASL = AGLToASL pos;
t1 = time;
t2 = time + rotatespeed;
onEachFrame{
if(rotateClockWise == true) then {
object setVelocityTransformation[
posASL, //fromPosASL
posASL, //ToPosASL
[0,0,0], //fromVelocity
[0,0,10], //ToVelocity
[0,0,1], //fromVelocityDir
[0,0,1], //toVelocityDir
[0,1,0], //fromVectorUP
[1,0,0],//ToVectorUP
linearConversion [t1, t2, time, 0, 1] // how to make this infinily loop ?
];
} else{
object setVelocityTransformation[
posASL, //fromPosASL
posASL, //ToPosASL
[0,0,0], //fromVelocity
[0,0,0], //ToVelocity
[0,-1,0], //fromVelocityDir
[0,1,0], //toVelocityDir
[0,0,1], //fromVectorUP
[0,0,1],//ToVectorUP
linearConversion [t1, t2, time, 0, 1]
];
};
};
Hi guys i am trying to make object rotate in place.
Is there a way to make this interval loop between 0 and 1 infinitly ?
I mean it goes from 0 to 1 and once it reaches 1 goes back to 0?
if {t1 < t2 } then {
linearConversion [t1, t2, time, 0, 1]
} else {
t1 = time;
t2 = time + rotatespeed;
}
am I understanding this correctly?
can't you just reset t1 and t2 once t1 exceeds t2
like
my syntax is very wrong
hold on
private _rotation = linearConversion [t1, t2, time, 0, 1, true] // how to make this infinily loop ?
if (_rotation == 1) then {
t1 = time;
t2 = time + rotatespeed;
}
object setVelocityTransformation[
posASL, //fromPosASL
posASL, //ToPosASL
[0,0,0], //fromVelocity
[0,0,10], //ToVelocity
[0,0,1], //fromVelocityDir
[0,0,1], //toVelocityDir
[0,1,0], //fromVectorUP
[1,0,0],//ToVectorUP
_rotation
];
}
you can also pass local arguments and stack by using EachFrame event handlers
Ty very mutch this actually works.
yw
i am sorry i have a question how would i pass local variable to event handler in this example ?
there's a couple spots where I forgot underscores but you get the idea
addMissionEventHandler ["EachFrame", {
params ["_arg1","_arg2"];
},[_arg1,_arg2]];
params ["_obj","_pos","_rotateClockWise","_rotatespeed"];
_obj = (_this select 0);
_pos = position (_this select 1);
_rotateClockWise = (_this select 2);
_rotatespeed = (_this select 3);
private _object = _obj createVehicle _pos;
private _posASL = AGLToASL _pos;
private _t1 = time;
private _t2 = time + _rotatespeed;
id = addMissionEventHandler["EachFrame",{
params ["_obj","_pos","_rotateClockwise","_rotateSpeed","_object","_posASL","_t1","_t2"];
private _rotation = linearConversion [_t1, _t2, time, 0, 1,true]; //error type any expcted number
if!(_rotation == 1) then {
_t1 = time;
_t2 = time + _rotatespeed;
};
if(_rotateClockwise == true) then {
_object setVelocityTransformation[
_posASL, //fromPosASL
_posASL, //ToPosASL
[0,0,0], //fromVelocity
[0,0,10], //ToVelocity
[0,0,1], //fromVelocityDir
[0,0,1], //toVelocityDir
[0,1,0], //fromVectorUP
[1,0,0],//ToVectorUP
_rotation
];
} else{
_object setVelocityTransformation[
_posASL, //fromPosASL
_posASL, //ToPosASL
[0,0,0], //fromVelocity
[0,0,0], //ToVelocity
[0,-1,0], //fromVelocityDir
[0,1,0], //toVelocityDir
[0,0,1], //fromVectorUP
[0,0,1],//ToVectorUP
_rotation
];
};
},(_this + [_obj,_pos,_rotateClockwise,_rotateSpeed,_object,_posASL,_t1,_t2])];```
now i have error type any expected number.
How would i fix this ? error line is marked.
Mission EH's arugments are _thisArgs, not _this
around 100 MP EventHandlers("MPHit") on buildings affect on server performance?
why are you writing both params and _this select #
params does all that for you
params ["_variable"]
_var = _variable; //_var = _this select 0;
Why?
And pueely depend son what code you execute in the EH
If it's just empty, no, no performance impact what so ever
https://community.bistudio.com/wiki/addMissionEventHandler
_thisArgs once again
ok i get that now second question so those local parameters can enter in EH parameters ? or do i have to again have params in EH? Also how _thisArgs works i am not 100 % clear on that
most arguments are passed through _this, but in the mission eventhandler it's _thisArgs
Also params takes _this by default (if you don't specify) so you need to do like _thisArgs params []
Do you have any practical example of how _thisArgs are meant to be ? i am still confued. Sry.
Check out the link I posted above
i did not know this thanks
Since Mission EHs also had _this you can't just refer _thisArgs w/o specifing it
oh that's right, because the passed args are separate
this is why you make the mods and i make the funny go-kart scripts

@fleet sand in case you're still confused, this means it should be
addMissionEventHandler ["EachFrame", {
_thisArgs params ["_obj","_pos","_rotateClockwise","_rotateSpeed","_object","_posASL","_t1","_t2"];
_thisArgs params ["_obj","_pos"];
does the same thing as
private _obj = _thisArgs select 0;
private _pos = _thisArgs select 1;
Yea i was still confused ty for explaning that. Also dose that mean i have to still put at the end where additional arguments are all those parameters ?
yes, the additional argument array is what becomes _thisArgs
so what I wrote out for you combines your original arguments with the newly defined variables and passes it all to the event handler expression
I should clarify you can't access local variables without passing them as arguments in the event handler expression
onEachFrame, which you had previously, couldn't pass arguments at all which is why you had that mess of global variables
Also, the answer to the possible why (what he said tho): You need to specify what variables to be used in the Mission EH, because by default are undefined in it. Keep it mind that every EHs use their own scope, every local things out of them can't be used w/o decrearing it
and in case you didn't catch it
params ["_obj","_pos","_rotateClockWise","_rotatespeed"];
_obj = (_this select 0);
_pos = position (_this select 1);
_rotateClockWise = (_this select 2);
_rotatespeed = (_this select 3);
is redundant. you can just write
params ["_obj","_pos","_rotateClockWise","_rotatespeed"];
except _pos since you modify that
private _pos = position _pos
``` would work
or better yet
private _posASL = getPosASL _pos;
``` considering the context
two birds with one stone
Technically pointless execution works everytime, but is just pointless
params ["_obj","_pos","_rotateClockWise","_rotatespeed"];
private _object = _obj createVehicle _pos;
private _posASL = AGLToASL _pos;
private _t1 = time;
private _t2 = time + _rotatespeed;
_id = addMissionEventHandler["EachFrame",{
_thisArgs params ["_rotateClockwise","_rotateSpeed","_object","_posASL","_t1","_t2"];
private _rotation = linearConversion [_t1, _t2, time, 0, 1,true];
if!(_rotation == 1) then {
_t1 = time;
_t2 = time + _rotatespeed;
};
if(_rotateClockwise == true) then {
_object setVelocityTransformation[
_posASL, //fromPosASL
_posASL, //ToPosASL
[0,0,0], //fromVelocity
[0,0,10], //ToVelocity
[0,0,1], //fromVelocityDir
[0,0,1], //toVelocityDir
[0,1,0], //fromVectorUP
[1,0,0],//ToVectorUP
_rotation
];
} else{
_object setVelocityTransformation[
_posASL, //fromPosASL
_posASL, //ToPosASL
[0,0,0], //fromVelocity
[0,0,0], //ToVelocity
[0,-1,0], //fromVelocityDir
[0,1,0], //toVelocityDir
[0,0,1], //fromVectorUP
[0,0,1],//ToVectorUP
_rotation
];
};
},[_rotateClockwise,_rotateSpeed,_object,_posASL,_t1,_t2]];```
Ty guys for explaning. This is what i have now and _rotation once its reaches 1 it never gets reset any tips on that ? @open fractal
not coded yet, but try to:
{
_x addMPEventHandler ["MPHit", {
params ["", "", "_damage", "_instigator"];
if (_damage > 0.1) then {
_x setVariable ["attacker", _instigator];
};
}];
} forEach _buildings //arond 100 buildings
if!(_rotation == 1)
is the ! intentional?
also, use https://www.sqfbin.com/ if you're going to share the whole script so you don't take up the whole chat
otherwise you might get moderated
yea no and i removed that as well still dosent work
I think I know what happened. It's probably pulling the original _t1 and _t2 values from params
so just move the if then above _rotation i think
so that the variables actually properly update before they're used
wait
that won't work
I'd remove _t1 and _t2 from params and just define them on the first iteration
_id = addMissionEventHandler["EachFrame",{
_thisArgs params ["_rotateClockwise","_rotateSpeed","_object","_posASL"];
if (isNil {_t1}) then {
_t1 = time;
_t2 = _t1 + _rotatespeed;
}
private _rotation = linearConversion [_t1, _t2, time, 0, 1,true];
if (_rotation == 1) then {
_t1 = time;
_t2 = _t1 + _rotatespeed;
};
edited that one ^ accidentally made the variables private
will clean up the code in a minute
its still not reseting.
this is the code now: https://www.sqfbin.com/latuwidocudafaqusini
you did not remove _t1 and _t2 from params
I did it wrong anyway
im not smart enough to tell you if you can store the local _t1 and _t2 between iterations
mm yeah there's the issue
until someone more experienced can chime in I'd say just settle for a global variable or setVariable for your t1 and t2
I just put t1 and t2 as global variables and it works but as soon they are local it dosent
yeah those specifically can't be local variables because they have to carry over between iterations
my bad
if you want to create multiple objects you can assign it to the object itself with setVariable
Bro dont worry you help more then you know Ty.
now how would i do that sry if am asking to mutch still learning.
i'll show you
https://www.sqfbin.com/lujerayumojuwofezeno @fleet sand peep this
probably won't work perfectly but
_object setVariable ["t1",serverTime];
this basically attaches the t1 variable to _object and stores serverTime in it
private _t1 = _object getVariable ["t1",0];
this grabs that stored value, and if it isn't found it substitutes 0
hence ```sqf
if (_t1 == 0)
i think t1 is the only variable that needs to work like this since everything else is a constant
Ty very mutch it works only thing is you had 1 more argument in EH _reset witch wasnt in EH in the code. but it works ty i will need to play more with EH setVariable and GetVariable.
my bad, that's from me writing a function and then changing my mind
but yes setVariable and getVariable are great to fall back on if you need to work outside of the local scope
here it can be even more efficient
wait i lied i dont know what i was going to do
I learnt code logic with OFP… and goto 😄
i remembered what I was going to do
@fleet sand you can put ```sqf
_object setVariable ["t1",serverTime];
before the event handler
and cut out ```sqf
if (_t1 == 0) then {
_object setVariable ["t1",serverTime];
_t2 = _t1 + _rotateSpeed;
};
that way it won't run that check on every frame
i tried to learn to code when I was like 11 years old but the python book my dad got me was for the wrong version so here I am learning from arma
have you guys been trying to make an object rotate for 6 hours? 
i was trying to make object rotate around but this is good learning curve about EH, Variables, variables scopes.
tbf the object worked a while ago we've just been mashing brain cells together to make it cleaner
well first of all you don't need a whole new EH for every object you want to rotate
you can just make 1
you know that colony collapse thing that happens with bees
that's what my neurons are doing
do you mean passing an array of objects to the EH or something else
yes
well that is good to know and how would i make multiple objects rotate around
ah well i was trying so i can dinamicly create the object to rotate around so mission would be running and i can on flip of a switch make object rotate around.
objectsToRotate = [];
if (missionNamespace getVariable ["rotationLoop", -1] < 0) then {
_EH = addMissionEventHandler ["EachFrame",{
{
....
} forEach objectsToRotate;
}];
rotationLoop = _EH;
};
//then add objects to the loop
objectsToRotate pushBack [obj1, _from, _to, ...];
to stop rotating you can just remove the object from the array:
_deleted = false;
{
....
if (_rotationDone) then {
objectsToRotate set [_forEachIndex, 0];
_deleted = true;
};
} forEach objectsToRotate;
if (_deleted) then {objectsToRotate = objectsToRotate - [0]};
there's really no need to remove the EH
that check if the eventhandler already exists is a large cranium maneuver in my eyes
it's almost like you've done this a while
I have
also never use server time for local stuff
use time
i was running this in server enviormente at least i hope.
you should still use time
is time more efficient?
dosent that mean that diffrent players would see in diffrent position the object that is rotating ?
no
"Returns time elapsed since mission started (in seconds). The value is different on each client. If you need unified time, use serverTime." This is form wiki on the time.
well they always do see it differently from each other, due to ping
but using serverTime won't fix it
it's just inherent to the MP environment
What is the benefic then of using time instead of serverTime ?
no jitter when serverTime syncs
this script should only be run on the server (or object owner's machine) anyway as far as I can tell
just because the time is "unified" doesn't mean they all see the same thing
it purely depends on the local machine's perspective, since you're dealing with a "relative" event. the start and end time are set for the local machine, so everything should be relative to this machine
server has a different FPS than the local machine (and others)
the only thing that matters is the local machine's time
All of this would be nice edition to wiki for others to learn as well.
Also ty for your input learned a lot today still a lot to learn.
Is there a way to make Portable Helipad Lights IR only?
you can make it emit your own lights...
is there a method to creating an object with createvehicle so that is shows up in 3den?
create3DENEntity?
yes
cheers
I have an ai unit ordered to target another unit, but it completely ignores the order and proceeds to shoot anything else, i have no clue as to why. When i do it in like an isolated environment it works fine, but if the target is on a roof still completely visible to the shooter, it just ignores the target and shoots the player next to it. Anyone have a clue as to whats going on?
disable its "autotarget". maybe "target" too
tried that
does it have a leader?
its a solo unit in its own group
Its almost like diasbling its autotarget has no effect
like it will just do whatever it want, im so confused hahaha
what about doFire?
init?
don't use it in init
if that's what you're doing no wonder it doesn't work
Nah was just trying to quickly test it
for now just try in debug console
I "think" it works
Idk if theres a delay between exec or not
ok yea it works
Cheers man, idk why orders arent working tho, first time ive experienced it
"message" remoteExec ["hint", -2]; ```
if I play as a hosted server, the message is displayed to me or not?
no
why not just try? 
I tried. as you said. it's not. but I just thought me as a hosted server and player as well, the message will be displayed.
-2 skips the server, it doesn't matter hosted by who
thx
this is why one should usually use 0
Use 0 or whatever the fuckin limit is. The servers standard for what I've seen on purchased dedicated servers, is -2 or -1. You should always set it to 0 or it messes it up.
documentation? What’s that?
Is there a way to make a Mk82 bomb to fall out of the sky with out a air craft?
createVehicle ["Bo_Mk82",_posATL];
Thanks mate
Hi I wanna increase the gunner camera shake when firing with the rhs bmp2 I need help pls
That sounds like something that would be best done with a config mod, not a script
I can't tell you how well it would work but you could try running a camera shake function with a fired event handler https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired
Ye I just realized that
Thx
Do you know how to make one or a site on how to make one?
No
hey all: I am trying to dynamically create some little side credits.
[["STARRING", 0.2, 1],
[format ["%1, %2, %3, %4", name (units group a1 select 0), name (units group a1 select 1), (units group a1 select 2), (units group a1 select 3)], 0.2, 4],
[format ["%1, %2, %3, %4", name (units group a1 select 4), name (units group a1 select 5), (units group a1 select 6), (units group a1 select 7)], 0.2, 4],
[format ["%1, %2, %3, %4", name (units group b2 select 0), name (units group b2 select 1), (units group b2 select 2), (units group b2 select 3)], 0.2, 4],
[format ["%1, %2, %3, %4", name (units group b2 select 4), name (units group b2 select 5), (units group b2 select 6), (units group b2 select 7)], 0.2, 4, 1]
] spawn BIS_fnc_EXP_camp_SITREP;
This method poses a problem in mutliplayer if the units are dead or empty because nobody joined. Does anybody have any ideas on how can I approach this dynamically so i dont run into that issue?
fear
where are the variables
you can construct the arrays first with forEach loops first instead of writing out arguments for each unit individually
private _lines = [["STARRING", 0.2, 1]];
private _fnc_unitNames = {
params ["_group"];
private _units = units _group;
for "_i" from 0 to count _units - 1 step 4 do {
_lines pushBack [
_units select [4*_i, 4] apply {name _x} joinString ", ",
0.2, 4
];
};
};
a1 call _fnc_unitNames;
b2 call _fnc_unitNames;
_lines spawn BIS_fnc_EXP_camp_SITREP;
not nested
ill give it a try thanks @little raptor u are and continue to be the goat
but there is no check if the unit is valid?

i can most likely add that myself i just needed an idea on how to do it
units won't return units that don't exist
The returned array on MP clients is not updated when team members die (only when they are deleted). (Tested on VBS2)
according to biki
I'm confused as to what that means. units will return dead units rather than respawned players?
Is there a way to disable squads Pathing but not target alignment. Then have thier pathing enabled again
_AI disableAI "PATH"
Is it possible that a trigger could reactivate it?
yes
forEach loop
😬
no that refers to ai units i guess. players are brought back to life after respawn
My question is about this
how does the game detect a weapon switch when the player switches?, don't want to use a loop for obvious reasons
check the attachment I replied to
I don't believe you can use an event handler for that. You can detect if the key is pressed withinputAction "nextWeapon"
hmmm good idea
Doesn't that just catch switching between weapons on a weapon? Like a underbarrel GL. As it is mapped to the F key
now
I need to figure out how to check always
correct?
or does it work like an EH?
gui for a vehicle
gui shows the weapon name, so when the player switch I just want it to detect the switch so I can change the gui text to currentWeapon vehicle
how did I not notice that
bruh
I need to find the dikcode
this will help I think
got a workaround
deleting an EH will delete its children EHs too?
elaborate?
What is a "parent EH"?
getin eh has a bunch of ehs in it
such as ui eh
if I delete getin, will the ui eh get disabled too?
well
I will just post the script
to save you the headache
this addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
disableSerialization;
"someLayer" cutRsc ["RscTitleDisplayEmpty", "PLAIN"];
private _display = uiNamespace getVariable "RscTitleDisplayEmpty";
uiNamespace setVariable ["thecurrentdis", _display];
uiNamespace setVariable ["vehiclelol", _vehicle];
_veh = _vehicle;
_ammocount = _veh ammo (currentWeapon _veh);
_ammocount = str(_ammocount);
_RscFrame_1800 = _display ctrlCreate ["RscFrame", 1800];
_RscFrame_1800 ctrlSetText "Weapons system";
_RscFrame_1800 ctrlSetPosition [0.768125 * safezoneW + safezoneX, 0.027 * safezoneH + safezoneY, 0.237187 * safezoneW, 0.11 * safezoneH];
_RscFrame_1800 ctrlCommit 0;
_RscPicture_1200 = _display ctrlCreate ["RscPicture", 1200];
_RscPicture_1200 ctrlSetText "#(argb,8,8,3)color(1,1,1,1)";
_RscPicture_1200 ctrlSetPosition [0.938281 * safezoneW + safezoneX, 0.027 * safezoneH + safezoneY, 0.0670312 * safezoneW, 0.11 * safezoneH];
_RscPicture_1200 ctrlCommit 0;
_RscText_1000 = _display ctrlCreate ["RscText", 1000];
_RscText_1000 ctrlSetText ([configFile >> "CfgWeapons" >> (currentWeapon _veh)] call BIS_fnc_displayName);
_RscText_1000 ctrlSetPosition [0.773281 * safezoneW + safezoneX, 0.038 * safezoneH + safezoneY, 0.159844 * safezoneW, 0.044 * safezoneH];
_RscText_1000 ctrlCommit 0;
_RscText_1001 = _display ctrlCreate ["RscText", 1001];
_RscText_1001 ctrlSetText _ammocount;
_RscText_1001 ctrlSetPosition [0.783594 * safezoneW + safezoneX, 0.082 * safezoneH + safezoneY, 0.128906 * safezoneW, 0.044 * safezoneH];
_RscText_1001 ctrlCommit 0;
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_veh = uiNamespace getVariable 'vehiclelol';
_dis = uiNamespace getVariable 'thecurrentdis';
_ammocount = _veh ammo (currentWeapon _veh);
_ammocount = str(_ammocount);
systemChat _ammocount;
(_dis displayCtrl 1001) ctrlSetText _ammocount;}];
If I remove GetIn, will Fired event handler at the bottom get removed too?
the code is too long
assume it ends at
(_dis displayCtrl 1001) ctrlSetText _ammocount;}];
this addEventHandler ["Fired",
this is not defined here
you're also trying to modify local variables within the "Fired" event handler
oh my bad
you got a system
_vehicle addEventHandler ["Fired", {
for the sake of sanity, i would suggest to have everything inside the eventhandlers to be a different script/function, but answering your question, no, every event handler has to be removed manually as they do not follow any kind of hierarchy. afaik, only displays do and they are removed if the display get deleted/destroyed The EH will be removed unless persistent if something is destroyed.
Sanity is long gone since I started to code lol
I think there's some redundancy with adding the "Fired" event handler when someone gets in
since that event handler isn't going to fire unless someone is in the vehicle
?
a new eventhandler will be added every time someone gets in
^
they do not follow parent hierarchy, afaik, only displays do and they are removed if the display get deleted/destroyed
it has nothing to do with "parent hierarchy". when something doesn't exist ofc its event handlers don't trigger either. this applies to objects, displays, controls, etc.
and there's no such thing as "parent hierarchy" in the first place. event handlers of a certain type are stacked
yep
I didn't finish the code yet
thats why I asked this
use a setVariable to store the EH ids
yes
same difference
you aren't adding an event handler to the event handler, you're adding both to the vehicle
if 3 people get in the vehicle you will have 3 fired event handlers
the point being, no, deleting orignal eh wont delete the lastly added eh
attached to the vehicle
why does it need to be removed?
why not just set the ammo count to a variable and call it a day?
how would I go about updating it on the gui?
you can just do that the exact same way
it doesn't help you that the eventhandler is added by getIn, it's a separate scope
How can I make a bullpup rocket? It should be controlled by the principle of an airplane, not by a laser. I have already made a blank for it and there is a camera in it.
I will be waiting in creativity lounge
(Remote control)
what, a cruise missile?
umm, radio controlled rocket?
I think that involves vectors, Leopard20 can help better than me in this case
do you mean to script it? or a config?
I don't even know, apparently a separate script is needed.
idk what that is or what it does. ask in #arma3_config first
the game already has several missile flight modes
to have a manually flown missile (if i got this right?) you probably have to create a new missile type that allows for control. #arma3_config might be better.
Probably looking for
cameraViewAvailable
and
manualControl
Thanks
How can I determine if a map building is "dead"?
or is there even a dead state for buildings
Yes. You can detect if buildings are damaged or destroyed
I believe you can use “alive” condition and “killed” eventhandlers on buildings
If not you can fall back on this
You can store the building object to a variable during init by placing a game logic entity in the building and using nearestTerrainObjects
Mightve gotten the command wrong
Thank you!
How do I get the camera direction of a player who's using a vehicle's commander's optics? getCameraViewDirection and eyeDirection don't seem to work properly in this case
It seems like it might be possible to use animationPhase with "obsturret" and "obsgun" to get the camera direction in degrees, but I'm really struggling with the process of converting that to a usable vector
Looks like it's a vehicle-relative angle in radians, and counter-clockwise for some reason.
Not sure if it's possible to get the pitch angle or just the yaw.
obsturret is yaw, obsgun is pitch
I found a thing describing a yaw relative-to-world conversion, but I'm not sure how it could be done for pitch since there's no vertical getDir
For now I'm settling for cursorObject, which is adequate if imperfect. It would have been mighty convenient if getCameraViewDirection worked here, but oh well
pitch is possible but you'd need to work from vectorDir
kinda surprised that eyeDirection and getCameraViewDirection are busted.
It seems like they "work" but don't take into account the turret, like they're returning a fixed forward view
Yeah, just returning vehicle direction I think.
how to attach an object to a player model selection so that when I attach it to their head for example, when they go prone the object will follow the head and not just float above the model?
thing attachTo [player,[0,0,0],"head"]```
trueto follow rotation I believe
B-but he didn't asked that
Thou art forgiven, son
So I want to make a 2 stage attack in different areas. I'm curious is it possible to hide everyone and everything at the 2nd location and have them reappear with a trigger?
Other than syncing everything to the two hide show modules
I suppose you can use layers

is there a way to find different body part names? im loking for back
Use selectionNames
(it might be spine1, spine2, spine3)
_RscButtonMenu_2400 buttonSetAction 'remoteExec [uiNamespace getVariable "www32",(uiNamespace getVariable "zeusplayerarray") select (lbCurSel ((uiNamespace getVariable "displayforzeus") displayCtrl 1603))]';
```remoteExec expects a string, not a code, problem is, how do I string the script???
buttonSetAction
I recommend a button click EH instead
remoteExec [uiNamespace getVariable "www32"
what is www32?
(uiNamespace getVariable "zeusplayerarray") select (lbCurSel ((uiNamespace getVariable "displayforzeus") displayCtrl 1603))
you can store text and values into list box items
used to addaction
what?
was asking this question for troalnism talk to him about other questions
who are you calling idiots here? 🤨
wait autocorrect or im too tired to type
better 👀 👀 👀
so what is your question again?
been VERY tired with helping a guy make a script work and school
so
I have made a variable
with a code value
using setVariable
how can I run that code through remotexec?
since orders is string
remoteExec ["variableName",...]
assuming it also exists on the target machine
see this pinned message:
#arma3_scripting message
is there a projectile tracing for 2d map?
You mean is there any way to do, or ready-to-use function?
Guess that's possible though, using drawLine or some commands
on comment, why is the action not being added to the player?
I told you: use CfgFunctions
here you are locally declaring a camsetup1 function and trying to ask others (who don't know it) to execute it
remoteExec ['addAction',(lbCurSel (_display displayCtrl 1500))]
also what guarantee is there that the lb selection is the correct target?
hmm
how can I make it accurate ?
¯_(ツ)_/¯
you are real silly
what does your list box contain anyway?
go ask someone else for help then
man I'm joking chill
allplayers
use netids + lbSetData or set var the players array onto the control, then retrieve the correct one by index
I am currently running this code on an empty mission file with 1 player placed in the debug menu.
private ["_display", "_mapCtrl"];
disableSerialization;
waitUntil {_display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; !isNull _display};
_mapCtrl = _display displayCtrl 101;
_mapCtrl ctrlAddEventHandler ["Draw", {
(_this select 0) drawIcon [
"iconStaticMG",
[1,0,0,1],
getPos player,
24,
24,
getDir player,
"Player Vehicle",
1,
0.03,
"TahomaB",
"right"
]
}];
};```
It works until I spawn a helicopter or jet in the debug menu.
```createVehicle ["B_Heli_Transport_01_F", position player, [], 0, "NONE"];```
When I get in as a (co)pilot nothing is shown on the minimap, when I get out it is shown again.
If I spawn a flight object first and then execute the code for the minimap it is the other way round, when I am in the plane it is shown and when I get out it is no longer shown.
Can someone explain to me why this is the case and how it can be fixed?
getPosATL vehicle player
Hi, I have adjusted it but still the same problem, what I forgot to mention is that land vehicles (MBT or other) work. Only not for flying objects.
shouldn't matter
if it still doesn't work set the position manually after creation
createVehicle ["B_Heli_Transport_01_F", getPosATL vehicle player, [], 0, "NONE"] setPosATL getPosATL vehicle player;
it'll probably explode tho 
I commented on the issue inside the code
problem being I'm getting a zero divisor (aka the game can't get the variable) but It doesn't make much sense to me?
can someone explain it lightly? I have placed two comments where I made the variable in question and where its throwing the error
Lines 21 and 60
playMoveNow, despite being global effect, doesnt seem to work if executed server-side
is the unit local to the server?
hmmm, something else
nope
it seems some animations do work and some dont
well it should be local arg
the plot thickens
(allplayers#0) playMoveNow should be enough
it was
it works with some animations but some not
as the wiki says it's local arg. effect is irrelevant (ofc it's global...)
this doesnt matter
well, i'll jsut remoteExec it
flatout some animations work server-side executed, some dont
but everything seems to work if executed where the unit is local
Still the same problem.
hello, i'm having a problem, I deleted my Diary records in favor of a diary.sqf, but i can't see the briefing in the game(not in the briefing state or in the map), can someone point to where to learn how to do this right?
what's a diary.sqf? 
it's not a thing afaik
I was fallowing a video tutorial. can i paste here the link?
yeah
what have you done so far?
I have a diary.sqf with the briefing background and all the information about the mission, a initLocalPlayer.sqf calling diary.sqf in all connected players
it's not initLocalPlayer 
it's initPlayerLocal
hahaha damn, im bumb
also make sure Explorer file extensions are on
or else you might end up with a .txt file
yup, those are ok, im actualy using VSC to code
BIS_fnc_typeText is being really slow
and i mean like, 0.5 digits per second
any ideas?
its scheduled
it shouldnt be?
But it is?
scheduler has a 3 ms per frame limit
when there are too many scripts in the queue the queue takes longer to loop back to a script
Most of the BI stuff is scheduled.
yeah, so how can i fix it being slow?
my scheduler is hardly used
Bad mods?
try diag_activeScripts
In clean game it should work okay.
see how many active scripts you have
40-42 active scripts
ok, something weird:
while {!isNil {_this}} do {
_this ctrlSetFade random [0.4,0.5,0.6] ;
_this ctrlCommit random [2,3,4","PLP_AnimFuncs\Functions\fn_disabling.sqf",true,39],["<spawn>```
what's your FPS?
this repeats like.. 36 times
capped at 60
while {!isNil {_this}} do {
wat?
it's not that low 
doesn't fully explain the "0.5 second per digit" thing
it looks like it might be caused by polpox art supporter tool
let me load without it and see
actually it does 😅
40/60 = 0.6
if all those 40 scripts are active every iteration of the scheduler
if it's basically a while true loop without any sleep in it will exhaust the 3ms all the time.
@warm hedge 👆
bad code 
I'm pretty sure it's specifically not intended to be used in actual missions, so performance probably wasn't a major concern
still does not make sense to do the thing multiple times a frame
like...
_this ctrlSetFade random [0.4,0.5,0.6] ;
_this ctrlCommit random
this won't be visible until next frame anyway
if it absolutely needs to try to execute every frame, something like
waitUntil {
// do the stuff
isNil {_this}
};
would be 1e10 times better.
or simple sleep 0.01 at the end.
how can _this become nil all of a sudden? 
while {<some form of TRUE>} is 90% of times a BIG code smell.
_this = nil
I don't see that anywhere 
we don't see whole code here so maybe it happens, eventualy.
sure, but not in this script 😄
isNull perhaps, isNil nay
BTW do we have someting about this in code perf article?
I've seen while {true} being badly used by inexperienced scripters quite a few times.
for now I'll add a warning to the while page
https://community.bistudio.com/wiki/Code_Optimisation something here too perhaps if it is not there already
open question... the briefing supports some basic css... <br/> <font color='' size='' face=''> what else is supported? I'm trying to "redact" some text so it apears like this
<br/> is not CSS 😛
I don't think there's a way to strikethrough, but it supports hex color so you can gray out text and stuff
If you have time, you can take a look at it and see if you can think of anything else, no mods active, new mission file, all settings should be reset to default.
for now added this:
https://community.bistudio.com/wiki/while
oh sorry I didn't even read your problem 😅
I saw Lou replying with getPosATL vehicle player and I thought that was the question 
yeah that has nothing to do with your problem at all 
actually Lou's answer was about the draw part, not the createVehicle 
I should really read the conversation more carefully... 
[] spawn {
private ["_display", "_mapCtrl"];
disableSerialization;
waitUntil {_display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; !isNull _display};
_mapCtrl = _display displayCtrl 101;
_mapCtrl ctrlAddEventHandler ["Draw", {
(_this select 0) drawIcon [
"iconStaticMG",
[1,0,0,1],
getPosWorldVisual vehicle player,
24,
24,
getDirVisual vehicle player,
"Player Vehicle",
1,
0.03,
"TahomaB",
"right"
]
}];
};
so does this not solve your problem?
also:
disableSerialization;
this is not needed as far as I see
you're not doing any UI serialization
I would suggest to use sleep
uiSleep is specialized and most of the begginers script stuff that's related to objects/simulation etc. and their scripts should pause when game is paused.
But I guess it won't work in this example.
I tested this myself. seems like a game issue 
don't know what's wrong exactly
The counter will break 
yeah that's why I used uiSleep 
How does one. Hide a layer then get it to pop up with a trigger?
you can't hide a layer afaik 
you can only hide its entities...
you can use something like this:
{
_x hideObjectGlobal false;
} forEach getMissionLayerEntities "myLayer"#0
this should be executed on the server
if you use it in a trigger, use a server-only trigger
can't you just select multiple and sync?
should be possible afaik
No as units don't have a sync too thing
also why do you want to use modules? I just showed you how to use layers
Because.. I've no actual idea how to actually do that 😫
they do 
and I just tried and could sync multiple ones as well
Eh I don't have that option
just create a layer, then select the units/groups from the left panel and drag and drop them into the layer
Then wheres the code go?
in 2 places
one in initServer.sqf which hides them:
{
_x hideObjectGlobal true;
_x enableSimulationGlobal false;
_x allowDamage false;
} forEach (getMissionLayerEntities "myLayer"#0)
and one in your trigger which unhides them:
{
_x hideObjectGlobal false;
_x enableSimulationGlobal true;
_x allowDamage true;
} forEach (getMissionLayerEntities "myLayer"#0)
change myLayer to the name of your layer
if you're doing this for units you need to disable their simulation too
right good point
and could disable their damage as explosions in the area can still affect hidden units.
initServer.sqf executes in single player too
you'll be the "server"
"server" just means whatever machine is hosting the mission
Here's your chance to do another video 😂
@little raptor thank you kind sir for the help
np
@coarse dragon see this GIF for layers:
https://community.bistudio.com/wiki/Eden_Editor:_Layer
seems like you can just select the units and click on New Layer 😅
no need to drag and drop
I think when they're hidden they don't take damage anymore tho 
except maybe explosion dmg 
oh you already said that 🤣
I don't know why I read stuff halfway today... 😅
waitUntil {_display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; !isNull _display};
_mapCtrl = _display displayCtrl 101
_mapCtrl here will be the minimap when inside the vehicle, to get the minimap when outside the vehicle, you have to do some uiNamespace looking up:
private _displays = uiNameSpace getVariable "igui_displays";
private _ctrlGPS = _displays select (_displays findIf {!isNull (_x displayCtrl 101)}) displayCtrl 101;
yes. why?
I was in an attack chopper but it never recorded me firing my missles. Just the gunner and his machine gun. Any idea why
it records it but the playback function only works for gunner when it comes to firing.
You can assign the pylons you've used to the gunner and it should work.
^ super useful
Will this work for JIP too?
it should 
tho there's a locality problem
allowDamage is arg local
[_x, true] remoteExec ["allowDamage", _x];
with that it should work
👏
if the object changes locality again, you'll have to rerun allowDamage where the object is local, fyi
really? 
yeah
then why is it "Global Effect"? 
well, it is in a way
it's global effect if executed on a local machine and locality never changes, i think that's the correct phrase
I think remoteExec 0 would not need to reapply it
that needs testing
i'd imagine it wouldn't
otherwise this issue wouldn't even be a thing
Can someone help me with this script?
["Start Training", _start = (getMissionLayerEntities "Layer 1") select 0;
{
allowDamage true;
} forEach _start ];```
On phone sorry for format
It's saying its missing a ]
you should wrap this part in {}:
_start = (getMissionLayerEntities "Layer 1") select 0; { allowDamage true; } forEach _start
also it should be_x allowDamage true
Perfect thank you mate
Anyone got an idea on how to get Location-names?
I have tried:
name nearestLocation [getPos player, "NameCity"];
What I am trying to achieve is to get a string with the name of the nearest city
Using this command I only get ```sqf
""
Use nearestlocations instead
Namecity, namevillage, namecapitalcity
It will return an array, pick the first one for closest
If you want to be sure, loop the locations till one has a name
private _ret = "Wilderness";
private _allLocationTypes = ["NameCity", "NameVillage", "NameLocal", "NameCityCapital"];
{
if ((text _x) isNotEqualTo "") exitWith {_ret = text _x; _ret};
} forEach nearestLocations [player, _allLocationTypes, 1500];
_ret;```
it's not optimal, but it's what i use
slap that into a function and call it
takes no arguments, returns the name of the nearest named city, including airports
doesnt work for airports on tanoa
remove "NameLocal" if you dont want airports
increase the radius if you need to
you know how it works
Howdy all, could someone take a peek at this code: https://sqfbin.com/ikotahenurogivupinay that I made and help me figure out why only the first section out of three is working?
(Expected result: when combined with area markers in-game called pulse_1, pulse_2, and pulse_3 as well as objects called pulseObject_1, pulseObject_2, and pulseObject_3 there should be a pulsing marker on the map over each of these objects.
Actual result: only the first marker "pulse_1" pulses, nothing happens with the others.)
Do I need a different sqf file for each of them or is there a way to get all of them working within a single sqf?
Any help is appreciated =)
Beautiful! Thanks it is exactly what I needed!
Well your first while never finishes soo it gets no opportunity to jump to 2nd or 3rd... Just move everything in 1 while loop like ...
sleep 2;
"pulse_1" setMarkerPos position pulseObject_1;
"pulse_2" setMarkerPos position pulseObject_2;
"pulse_3" setMarkerPos position pulseObject_3;
sleep2;
...
Since I believe that is your intention...
Oh, I suppose it would be just that simple wouldn't it lmao
Thank you 😅 facepalm
dont sweat it. Arma 3 is about sharing, not hoarding.
You can make a function and pass the marker names as arguments, that way you don’t have to rewrite it if you change the markers
But if you have what you need already then it isn’t strictly necessary
That would be pretty good, but it's above my current skill at the moment. I think this way will be fine for now at least
Isn't there a module to skip time?
There is one for Zeus, might not be in the Editor. Fortunately you can use https://community.bistudio.com/wiki/skipTime
I don't know, I'm not in game either. But...either there is, and you use it, or there isn't, and you use skipTime for exactly the same effect and a similar amount of effort.
scripting is easier than trying to manhandle modules to make things like that work
When one skips time. Will fires and smoke still be burning from bombings?
should be. skipTime just changes the in-game time
Happy days thanks
You know that's why I'm making a new one
right on, then
what do the different modes for BIS_fnc_camera do?
for internal use
right
so it wont have any effect on simulation being disabled in my intro-scene?
because this is being a real bumber
check the code, but I don't think so
im sort of cross-posting here, but i cant really say im getting anywhere
simply put, simulation wont work in my intro-scene
and music wont play
« the issue is out there » I would say
that's nearly not helping 😅
"almost"
Copy the mission, remove elements, see when it works
but "no simulation", it looks like setAccTime 0 or all objects enableSimulation(Global) false
tried to do setAccTime 1 in the initIntro.sqf to no avail
rpt doesnt give any script errors
Hey there, I am new to this, so I have no idea if it's even possible... BUT.
What I need:
I'd love to add two (RHS) "RHS_weap_gau19" to A-10, preferably at pylons position. And one to the main turrets position (easily done with addWeapon).
Is there a way to add the gaus at pylons and make them all shoot at once?
I hate that I want to do this, but the group I play with just hates vehicles with bug guns that can hurt something...
How were the animated intros in the TacOps DLC missions achieved? They looked very nice but I have a slight gut feeling they were just .OGV files
They aren't OGVs. The same tech with Old Man so you can check it out
not without some modding and config work I'm afraid
Damn, so I won't be able to do this with the mission file itself. Unfortunate.
One Gau has to be enough then. Thanks for the info!
Thanks, before I go to bed Old Man's files are not in .EBOs, right?
OM files are PBO
👍
Hello everyone,
I need your help, please, to create a script for my attack helicopter, I would like a "turbo" action that allows to increase the speed very quickly and that a flame animation comes out of the reactors. The animation already exists, it starts with the user action "Turbo on" and closes with the user action "Turbo off".
Thank you in advance for your help
heads up you'll get moderated if you crosspost like that
and that seems familiar 
it doesn't count as crossposting in this case
it's more like a "bump"
did you try what I mentioned before?
Yes, thank you, but I can’t create the turbo user action with the reactor animation
didn't you say the animation already exists?
animation already exists
Yes indeed, I already created it, but I would like that when the animation is done with the user action "turbo on" the speed increases, sorry I start in the script.
Go to the wiki and look for "animated briefing" 🙂
I don't think there's any event handler for vehicle animations...
so I guess you'll have to use some delay or something.
example turbo on:
_veh animate ["reactor_or_whatever", ....];
sleep 3;
_endTime = time + 10; //boost up to 10 seconds
_acc = [0,10,0]; //acceleration vector
while {alive _veh && time < _endTime} do {
_vel = velocity _veh;
_vel = _vel vectorAdd (_veh vectorModelToWorld (_acc vectorMultiply diag_deltaTime));
_veh setVelocity _vel;
sleep 0.001;
};
what's diag_deltaTime
seems pretty sus
better to track yourself. the script is not guaranteed to execute each frame
and yeah yeah I know that doesn't run every frame 😐
Thanks, I’ll try this script, should I put it in the mission file in the "init"?
it's not a complete script
didn't you say you already made the "turbo on action"?
Yes in the helicopter config
good. then change the first line (animate thing) and define the _veh variable and use that for the action code
you can also try it in debug console first to make sure it works the way you want
just put your vehicle in eden, change _veh to the var name of your vehicle and execute the code
you should also wrap it in [] spawn {} if you use the vanilla debug console:
[] spawn {
_veh = myHeli;
_veh animate ["reactor_or_whatever", ....];
sleep 3;
_endTime = time + 10; //boost up to 10 seconds
_acc = [0,10,0]; //acceleration vector
while {alive _veh && time < _endTime} do {
_vel = velocity _veh;
_vel = _vel vectorAdd (_veh vectorModelToWorld (_acc vectorMultiply diag_deltaTime));
_veh setVelocity _vel;
sleep 0.001;
};
}
thank's you very much, i try this, You are very friendly
has somebody made some experience with the setMaxLoad command? Im trying to increase vestLoad but im not quite sure how to go about it. the wiki says
container setMaxLoad load
and container is an object. do I just insert the classname of the vest?
classname = name = string
so ofc no
yeah thats what i thought. so what else then?
there are commands to get the container
e.g. backpackContainer
ahhh
yeah gimme a second, i saw this earlier
hint str vestContainer player;
This command should return the container ID. executing this in the console returns
22f644b2b00# 1174189: dummyweapon.p3d
in my example. I guess dummyweapon is just a placeholder. the numbers belong together or are they separate things?
wat? why would they matter anyway?
vestContainer player setMaxLoad _load
that's it
Hey !
quick question: I added this in an init: this disableAI "Move"; I would like to addthis setUnitpos "UP" . Can i do like: this disableAI "Move", setUnitpos "UP"; Or how do i write it ? Cause it's not working for me :/
no
you can only write it the first way you wrote it. there's no other way
this disableAI "Move"; this setUnitpos "UP";
// better
this disableAI "Move";
this setUnitpos "UP";
this disableAI "Move", this setUnitPos "UP"; is valid
okay so i need to use the "this" always noted thanks a lot mate
yep, but was missing a second this
yeah
Okay so the really important part is the this that was missing i'm stupid
and we also try to discourage people from using , as ; 🤣
sure, don't do it. but you can do it. but don't.
You are not gonna believe me but i have another problem 😄
I try to use this in multiplayer: this addAction["Sector Targets","popup.sqf",[[target_1,target_2,target_3,target_4,target_5,target_6,target_7,target_8,target_9,target_10,target_11,target_12,target_13,target_14,target_15,target_16,target_17,target_18,target_19,target_20,target_21,target_22,target_23,target_24,target_25,target_26,target_27,target_28,target_29,target_30,target_31,target_32,target_33,target_34,target_35,target_36,target_37,target_38,target_39,target_40,target_41,target_42,target_43,target_44,target_45,target_46,target_47,target_48,target_49,target_50,target_51,target_52,target_53,target_54,target_55,target_56,target_57,target_58,target_59,target_60,target_61,target_62,target_63,target_64,target_65,target_66,target_67,target_68,target_69],0,1,true]];
It's in a laptop and this should pop up targets that have the numbers as variable cause they are down with an init. But in server it just doesn't work.
Is there something important i should know ? I wanna rip off my hairs that i don't have...
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
+ indent plz
this addAction ["Sector Targets", "popup.sqf", [TheBigTargetsArray, 0, 1, true]];
```basically
@pine saddle "popup.sqf" is the important part here - what's in there?
well a lot of things that i took of a free compo for CQB things. It works fine so i don't know if i need to change things
please use https://sqfbin.com 🙂
ofc sorry forgot about it
Wel i have to remove all the comments but everything is working nice in SP so i don't know what to modify for working in MP
// Check to make sure this script is executed on the server ONLY
if (!isServer) exitWith {};
sooo yeah, here's why
addAction is local, so the client is not the server
according to what I see, if you comment this line out, it should still work globally
that or remoteExec it on the server from the client
(but they will pop up again if not remoteExec'd)
Okay so it works perfectly now 😄
So what do this line do ? Cause i don't really understand the website https://community.bistudio.com/wiki/isServer
it says "if this machine is not the server, then exit the script"
okay it makes much more sense now !
Code is really tricky damn
Tanks a lot again for the time taken to explain my dumbass brain ^^
no worries and with pleasure, the channel is here for that - also not knowing things is not being stupid 😉
Like Lou said, not knowing things isnt stupid, it's having an opportunity to learn. Not askign things is stupid, because you refuse to learn. This channel is for smart people 
Hello Leopard20, thanks again for your help, I tested your script, I can not make it work,
There’s probably something I didn’t understand, if my model has one as not h2, should I replace _veh by h2 in the whole script?
_veh is the variable name for the object you created in the game
it has nothing to do with your model
yes, h2 is the my variable name.
you can just define _veh yourself then. I already showed you how
_veh = myHeli
or in your case: _veh = h2
also you should fix the first line, as I said before:
_veh animate ["reactor_or_whatever", ....];
that line does not work and you must fix it yourself
That’s good!! it works, with the Debug console, could you tell me what to do with the script now? Thank you again you are very good!
did everything work the way you wanted? I think the acceleration and its duration are too big?
acceleration works as soon as I validate the command, not with the animation, I increased the time a little
ok. there are a couple of problems with that code tho. the main one being that it doesn't run every frame as it should
do you use CBA in your mod?
Or I installed CBA. In fact the helicopter leaves all alone, the animation is done well, I have no control on the turbo
how do you want to control the turbo?
with menu action if possible
this is a script : []spawn {
_veh = h2;
_veh addaction [ "Turbos Go",
_veh animate ["Turbos",3]];
sleep 3;
_endTime = time + 30;
_acc = [0,10,0];
while {alive _veh && time < _endTime} do {
_vel = velocity _veh;
_vel = _vel vectorAdd (_veh vectorModelToWorld (_acc vectorMultiply diag_deltaTime));
_veh setVelocity _vel;
sleep 0.001;
};
}
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
you can do:
h2 addAction ["Turbo On", {
params ["_veh"];
_veh animate ["Turbos",3];
_veh setVariable ["disable_turbo", false];
[
{
params ["_veh", "_endTime"];
if (!alive _veh || time > _endTime || {_veh getVariable ["disable_turbo", false]}) exitWith {true};
if (_endTime - time > 27) exitWith {false};
_vel = velocity _veh;
_vel = _vel vectorAdd (_veh vectorModelToWorld [0, 10 * diag_deltaTime, 0]);
_veh setVelocity _vel;
false;
},
{_this#0 animate ["Turbos",0];},
[_veh, time + 30]
] call CBA_fnc_waitUntilAndExecute;
}];
h2 addAction ["Turbo Off", {
params ["_veh"];
_veh setVariable ["disable_turbo", true];
_veh animate ["Turbos",0];
}];
needs CBA
YES YES thank's You !!! the script is very good, the helicopter is more difficult to fly, especially to right it tends to go down, but what satisfaction!! Thank you again, thank you.
I found what is was looking for, animated opening https://community.bistudio.com/wiki/Arma_3:_Animated_Opening
It should work in MP too, right?
it is local effect so I expect it to yes
thank you
https://gyazo.com/aea685070eda731267e44c58f113e565
Someone knows why the RPK mags are the only ones that have a lowercase R at the Rnd?
because whoever wrote the classname wrote rnd instead of Rnd
So there is no real reason for it?
no. it's just a class name. they could've named it awesome_mag_haha
Yeah but i would have thought that they would have followed the trend that they used before with the 75Rnd
it's a mistake
casing of classnames generally does not matter as good practice is to toLower them anyway for string comparisons
true tho, i just forgot it, and was wondering why the RPK mags where the only ones to make problems
mag class names you get from the vanilla commands are consistent with their config names tho
so you can just ignore the case
This one came from magazinesDetail
don't crosspost - I deleted your post in #arma3_feedback_tracker for you.
magazinesDetail doesn't even have class names
Sorry i meant the normal magazines command
the case is the same the one in config for magaiznes too
And another bug i found, is that the Ifrit HMG windshield doesnt have a hitbox
Hey, how do I use this script thingy to fix a bug in HETMAN Warstories in which the AI keeps getting in and out of vehicles constantly? https://community.bistudio.com/wiki/setUnloadInCombat
you can just one hit though it with any weapon
Is it possible to put this script in the vehicle config?
not like this. no
Ha OK thank's
How do I exactly do what the hetman warstories dev told me to do to fix the problem I got with the AI? https://cdn.discordapp.com/attachments/873621415142756365/956922591824736337/unknown.png
you can do something like this:
[] spawn {
while {true} do {
{
_x setUnloadInCombat [false, false];
} forEach vehicles;
sleep 5;
};
};
Ok, but where do I put it?
It works
I have a question regarding Unit Insignias. I've been running into a brick wall in the past few weeks.
AFAIK if you want to apply unit insignias (doesnt matter if its the ones from vanilla or custom ones), you have to remove and reapply them (if you have applied an insignia before).
What I'm trying to achieve is set unit insignias for different squads on mission start and if players JIP (because, afaik, players who join AFTER a patch has been applied, its invisible for the JIP).
In my initPlayerLocal.sqf:
[player, ""] call bis_fnc_setUnitInsignia;
[player, "CombatPatrol"] call bis_fnc_setUnitInsignia;
This does not work at all. The insignia is invisible for me and other players. If I try to remoteExec the function globally, it works 40% of the time, but it appears entirely random if it does or not. Anyone got maybe some pointers in the right direction?
use some delay
If I try to remoteExec the function globally,
the function already does that
don't
I know, but if I use call, it does not work at all
like I said, use delay
like what, sleep 1?
yeah
alright, brb
also instead of using "" use what I wrote here:
https://community.bistudio.com/wiki?title=BIS_fnc_setUnitInsignia
what you wrote is inefficient
the respawn thing?
no. this thing:
_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil]; // you can also do [_unit, ""] call BIS_fnc_setUnitInsignia, but this way is faster (plus no network traffic)
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
alright, ill try this
Hey, so after using the script, everybody has pretty much gone into their vehicles and stopped moving
alright, this works consistent now. thank you. currently I'm using this in a loadout script via AddAction. but I have a follow up question.
If players JIP now, they wont be able to see the insignia I'm guessing, because they were not present when it was applied. correct? so I added this in my initPlayerLocal.sqf, because different squads are supposed to have different insignias. meaning:
{
player setVariable ["BIS_fnc_setUnitInsignia_class", nil];
sleep 1;
[player, "CombatPatrol"] call BIS_fnc_setUnitInsignia;
}
forEach [s_45,s_46,s_47,s_48,s_49,s_50,s_51,s_52,s_53,s_54,s_55,s_56];
Will this work aswell? I guess its way to overcomplicated, but I'm unsure how to go about this
maybe game bug 
try this too. if it doesn't work then idk
[] spawn {
while {true} do {
{
if (_x getVariable ["disabledUnloading", false]) then {continue};
_x setUnloadInCombat [false, false];
_x setVariable ["disabledUnloading", true];
} forEach vehicles;
sleep 5;
};
};
they wont be able to see the insignia I'm guessing, because they were not present when it was applied. correct?
the game usessetObjectTextureGlobalfor that
afaik that already supports JIP
So there is no need to reapply Insignias if someone JIPs, right?
no
alright. Meaning I can define this in my loadout script, which is working already, and in my initPlayerLocal for when they spawn with
forEach [_unit];
(we use a persistent loadout so not every mission everyone gets to pull their loadout out of a box). right?
There's now a seek and destroy marker up 1.5 km, but nobody is going for it. https://cdn.discordapp.com/attachments/873621415142756365/956929212592304148/unknown.png
it's a game bug then
Oh hey, it started moving
maybe it can't find a path
put it in a better place
The HETMAN Warstories mod does not allow me to become zeus
if you're playing in SP you can try my mod and make yourself Zeus at any time:
https://steamcommunity.com/sharedfiles/filedetails/?id=1893300731
That RHS RPK magazine issue that @pulsar vigil mentioned is a case mismatch between the magazine well entry and the magazine classname, IIRC. I don't know if that technically counts as a bug but it tripped me up once. RHS would probably fix it eventually if someone reported it.
So currently you can't reliably use in to compare the magazine classname with magazine well lists.
in toLowerANSI
So since the bohemia interactive UGV "Follow" command doesn't work, i'm trying to script it in as an addaction that creates a waypoint on the UGV operator's position. I haven't figured how to turn it off just yet, but right now the follow script looks like this:
_grp2 = group UGV2;
_unit2 = DROP2;
while {true} do {
if (!alive (leader _grp2)) exitWith {};
_wp = _grp2 addWaypoint [position _unit2, 0];
_wp setWaypointType "MOVE";
sleep 35;
};```
So it creates a waypoint on the operator's position every 35 seconds and moves the UGV over, great. If the UGV manages to get to the player's position, the waypoint deletes itself and the next waypoint will be the one the UGV goes to.
The issue i'm having right now is that if the player moves and the drone isn't able to reach the waypoint in time, a new one gets created and added to the waypoint queue. Does anyone know of a good way of deleting the previous waypoints and make every new waypoint the one the UGV goes to?
Maybe waitUntil getPos player and deleteVehicle could work
apparently this does only work in SP or for the host, but not in MP for other players or JIP. any idea why?
If you prefer to allow AIs in certain combat situations to disembark, this put into HWS advanced setup window may work (unless I did some mistake while writing this, not tested):
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
also please don't post that big of code here, use https://sqfbin.com/
"sqf" code
Seems not working for me. It used to in the past... Weird.
```sqf <line return> <sqf code> ```
and thank you for editing 🙇♂️
okay follow up to this, apparently the command has to be executed on the server for it to work (as far as the wiki goes). so this command should not work anyway if I pull a loadout via script since its completely local? Unless if I execute this via execVM or am I mistaken?
this is what the documentation says indeed, server-side execution 🙂
it should not have a local if run by a client, but it actually may
so how do I go about setting a maxLoad for vestContainer if I equip a player with a new vest (via script, that is)? Do i execute the command via execVM (or remoteExec, i dunno the difference) inside the loadoutscript or does this not work aswell?
remoteExecute it on the server
meaning target for remoteExec is 2 and not 0 (meaning server and not global)?
correct
I will report back! 😎
Okay so I implemented this into my loadout script after removing all gear and before implementing the new stuff.
[...]
player addWeapon "Rangefinder";
//setMaxLoad Vest
[] remoteExec ["scripts\maxLoadVest.sqf",2,true];
comment "Add items to containers";
[...]
and its not working 🥲
maxLoadVest.sqf
{
uniformContainer player setMaxLoad 60;
vestContainer player setMaxLoad 350;
} forEach [s_49,s_50,s_51,s_52,s_53,s_54,s_55,s_56];
player doesn't work on the server
pass the player unit to the script like this:
[player] remoteExec ["scripts\maxLoadVest.sqf",2]
then access the passed unit at the start of the script like this:
params ["_unit"];
(to make the unit available as the variable _unit to use in the rest of the script)
your forEach is kinda weird, you're just repeating those two setMaxLoad commands once for each of...whatever s_49 etc. is, but that just means you're repeating the same commands on the player like 7 times in rapid succession. Technically functional but seems pointless
will try this.
s_49 til s_56 are player variables, since I only want certain players to increase vestContainer space //instead of// for each and everyone on the server.
Problem is, since we're using a persistent loadout mod, I have to think about two things:
- increase vestSize everytime a player pulls out a new loadout from spawn
- player does not pull a new loadout and gets the new one from a database init
s_49 til s_56 are player variables, since I only want certain players to increase vestContainer space for each and everyone.
Okay, so you want s_49 etc to be the units affected by your setMaxLoad commands. In that case, you don't need to pass the player unit to the script; just replaceplayerwith_xinside your forEach.
yes exactly
A forEach means "do this one time per item in the array". It doesn't automatically mean "do this one time to each of the items in the array", although that is one of its primary uses. To reference the current item that the forEach is operating on (each time it does the operation) you need to use the magic variable _x.
Which namespace does CBA put the settings values into, missionNamespace?
okay, so i guess the params ["_unit"]; is obsolete then? I will try it with _x like you said. the init of the remoteExec function stays the same?
Yes, you don't need params now your forEach is set up properly, and you can remove player from the remoteExec argument.
Note that while I understand what you mean here, init and function have specific meanings in Arma scripting. remoteExec is a command, not a function, and writing a command is not an init.
im sorry
thank you for the small lesson, i learned a lot. i will try this and report back, gimme a sec
update: it did not work. the loadout applies correctly but the containersize does not change unfortunately
you can't remoteExec script path
make a function or use execVM (not recommended)
i will try reading the wiki, but i think this is a little too much for me. im not good with this kind of stuff. thanks for the help anyway so far
alright. I think I was able to create a function, because the function viewer says the function I created exists and is correct like @hallow mortar stated (sorry for ping). But, still, no dice on remoteExecuting the function. 😞
how are you doing it?
description.ext
class CfgFunctions
{
class RNG
{
class loadouts
{
class maxLoadVest {};
};
};
};
mylocalboxloadout.sqf
remoteExec ["TEST_fnc_maxLoadVest",2];
sleep 0.5;
fn_maxLoadVest.sqf
{
uniformContainer _x setMaxLoad 60;
vestContainer _x setMaxLoad 350;
} forEach [s_49,s_50,s_51,s_52,s_53,s_54,s_55,s_56];
this seems to work now
RNG/TEST mismatch?
If it works then it's probably not mismatched in what you're running :P
How would i make an object play an MP3 or whatever i need for arma, like 4 meters or so.
say3D
ty!
how would i make an add action disappear for a set time?
Time dependent on what? You could add a time check in the addAction's condition statement.
so basically im trying to make a radio toggleable but i dont wanna keep the action there once enabled because if pressed again it overlays the sound.
set a variable to the object and use it for the condition ^^
what sound command are you using?
uhh
c1 say3D [ "3Dsound", 5, 1];
(idk how to script so i used google XD)
say3d allows the object that is "saying" to only "say" one sound at a time already
i'd like a scale of 1 - 10 how blind i'm being here, attempting to do an oldie of putting some custom .ogg tracks into a mission file and i'm getting some errors on line 8 asking for a }
{
sounds[] = {01,02};
class 01
{
name = "01";
sound[] = {"Music\Chroniko.ogg", db+10, 1.0};
titles[] = {0,""};
};
class 02
{
name = "02";
sound[] = {"music\warhorn.ogg", db+10, 1.0};
titles[] = {0,""};
};
};
if this is the wrong spot to ask i'll delete and repost elsewhere
Try using a letter as the first character for each classname, numbers as classnames are usually a nono 🙂
i'll give that a shot
{
sounds[] = {01,02};
class chroniko
{
name = "Chroniko";
sound[] = {"Music\Chroniko.ogg", db+10, 1.0};
titles[] = {0,""};
};
class warhornspook
{
name = "warhornspook";
sound[] = {"music\warhorn.ogg", db+10, 1.0};
titles[] = {0,""};
};
};
something more to this effect yes?
Yes, but also adjust the sounds[] entries.
class CfgMusic
{
tracks[] = {};
class chroniko
{
name = "Chroniko";
sound[] = {"music\chroniko.ogg", db+10, 1.0};
};
class warhornspook
{
name = "warhornspook";
sound[] = {"music\warhorn.ogg", db+10, 1.0};
};
};
Actually, https://community.bistudio.com/wiki/Description.ext#CfgMusic uses tracks[] instead of sounds[], so that might also be a problem. I've never used CfgMusic, only CfgSounds (which uses sounds[]).
{
sounds[] = {};
class chroniko
{
name = "Chroniko";
tracks[] = {"music\chroniko.ogg", db+10, 1.0};
};
class warhornspook
{
name = "warhornspook";
tracks[] = {"music\warhorn.ogg", db+10, 1.0};
};
};
i think i catch the meaning there hypoxic. i'll throw that in and see what it throws back
That works
Thank you @fair drum.
Ill read more into this as well
how do you add an addAction to where the player has to hold Enter key
like the launch from the carrier
I am tryin got add a intro video to my mission
yet it will only play after the briefing, and players are able to walk around and shoot during the video.
I would like the video to play before the briefing--is this possible?
no, but you can play it after briefing while locking down players and keeping their screens black until its done
how do i do that?
locking down players
do i put that in init.sqf
no, those are the commands you will end up using. i'm assuming now that you've asked that that you have no scripting knowledge so far?
i have limited scripting knowledge with sqf, i use python and java
right now i am trying to put in _video = ["ira_video.ogv"] call BIS_fnc_playVideo; in init.sqf
do you want something written for you? or do you want to learn it yourself?
either is fine
if you wrote it for me that would be amazing
i will learn by analyzing it
i actually happen to be working on something similar right now
i just dont know how to disable the players from fucking around during the video
what i was trying to do was disableUserInput true; _video = ["ira_video.ogv"] call BIS_fnc_playVideo; disableUserInput false;
but what happens is that it executes before the briefing preventing anyone from being able to user input during the briefing
correct, it also kills the ability to leave and use the esc menu
you can simply run on the server:
if (isServer) then {
allPlayers apply {
_x enableSimulationGlobal false;
};
};
then reverse it when you are done with the video.
then where would i put the video script? How do i reverse it?
sorry for noob questions
When storing information using profilenamespace, is there a limit to what can be stored? I'm concerned about it possibly bugging peoples accounts.
The more data you save to a profile the longer it takes to load. Besides that you would have to try and store quite some data to actually start messing with things.
https://community.bistudio.com/wiki/saveProfileNamespace
Only real limits are that variable names in profileNamespace cannot be commands besides that every data type could be stored to the profileNamespace.
although some aren't useful, like references to objects or group e.g. https://community.bistudio.com/wiki/setVariable
Would you still need to use the third variable in setvariable to make something public while using profilenamespace? For example;
profileNamespace setVariable ["randomvar",1,true];
the third argument is for which machines you want to set the variable on
I've never used profileNamespace but I presume that would set the variable for every player
in their profiles
removeItemFromUniform causing desync issues if run where the unit is not local
i open my inventory and an item is still there that was previously removed with removeItemFromUniform
if i remoteExecute on the server magazineCargo uniformContainer (allPlayers#0), the item is not listen in there
dropping the item and picking it up again makes the item appear serverside aswell
if i drop the item, pick it up, then run removeItemFromUniform, the result is updated to both the client and the server
hmmm, the plot thickens
it seems to be a related to items the unit spawns with
if the unit spawns with the items, removeItemFromUniform wont work as intended
if the item is picked up, the command works as intended
How can i check if the mission is in intro?
i figured out the issue...
BIS_fnc_camera forces a pause on simulation
hey, is someone online? im trying to rotate a prop to attach to another prop, but setVectorDir[0,0,0]; rotates it and resets to initial position... someone knows anything about this?
Have you checked the BIKI documentation for the command? https://community.bistudio.com/wiki/setVectorDir + you might also need this https://community.bistudio.com/wiki/setVectorDirAndUp
Use setDir and setVectorUp
Ease up there satan, he could just use setVectorDirAndUp like the rest of us normal people
Please dont take it too rough, just a bit of humour
iirc, setVectorDirAndUp also resets it. But I am not sure as I might be simply confusing due a logic like "anything that has setVectorDir causes that" 
resets in what way?
I had a weird experience that setVectorDir was exclusively causing some positional issue when used on attached objects, although my case was with following bone rotation. Could not recreate it now though and I dont even remember what it actually was. It is actually probably unrelated to this issue actually thinking now. 
setVectorDir when used alone would
that's why setVectorDirAndUp
hence I wrote the message above comparing setVectorDirAndUp / setVectorDir, but yeah couldnt recreate what I meant now anyways.
Wrote setVectorUp + setDir solution additional to setVectordirAndUp as someone else mentioned it already, in case he faces an issue with it too like I did before...
is there a scripted command to get the IP of the currently joined server?
Which WeaponHolder classname is created when you place/spawn a 3D item, such as "Headgear_H_Bandanna_blu"? Can't seem to find it. The holder appears to be local though -- can't loot on a dedicated server if server spawned the item.
player nearEntities 5 and see
nearEntities only returns living characters I think
typeOf cursorObject is enough
Is it possible.
That when the player crosses a trigger it in turns delete everything units and objects?
Doing a intro sort of thing at a airport then want to fly off and delete all the clutter
Yes it is possible
Interesting
Hmm wonder if putting em in thier own layer and deleting that would be better
camCommitPrepared stutters when i give it a long time
Any reason why a Hide module tied to a trigger isn't working?
I did synce everything to it. Vehicles objects blueforce civilian
Thank you, everything now works as it should.
/* */ private _OBJ1_PEL2 = getMarkerPos "Bat1_OBJ1_PEL2, true";
private _vanguardart = "rhs_D30_msv";
private _vanguardartammo = "rhs_mag_3of56_10";
artstrike = {
params ["_gun","_targetarea","_ammotype"];
private ["_gun", "_targetarea", "_ammotype"];
_gun = _this select 0;
_targetarea = _this select 1;
_ammotype = _this select 2;
_gun doArtilleryFire [[_targetarea], _ammotype, 3];
TRUE
};
private _vanguardartgrp1 = createGroup east;
private _vanguardart1 = createVehicle [_vanguardart, _VangArtPos, [], 0, "NONE"];
_crew2a = _vanguardartgrp1 createUnit [_vanguardcrew, _VangArtPos, [], 0, "FORM"];
_crew2a moveInGunner _vanguardart1;
["_vanguardart1","_OBJ1_PEL2","_vanguardartammo"] call artstrike;
Hey, this is my second attempt at writing a function for my MP-Mission thats supposed to call in an artillery strike on a predefined possible enemy position, however i keep getting the error message "Error: doArtilleryFire: Type string, expected Array,Object". I dont know exactlyl where the error is supposed to be in the script and my attempts to fix it have so far been not successfull. Can someone help me out with this maybe?
There's a easier way to do it
Place arty down with a hold waypoint and forced hold fire. Then a fire mission
Then a trigger to skip waypoint. And it will shoot. And be random
Then skip waypoint Sync to the Hold waypoint
that might be "easier" per say but you get a lot more control with scripting it yourself
but fire mission wp always shoots HE-rounds doesnt it? id like to maybe shoot some smokescreens etc. too.. i ideally wanted to keep everything in a modular script that can easily be copied and modified for future missions, so i'd prefer to get it working with a script, but im not that experienced with them
your error is with _targetarea in the doArtilleryFire
right now, after the variable imports it, its going to look like....
_gun doArtilleryFire [["_OBJ1_PEL2"], "rhs_mag_3of56_10", 3];
do you see the issue?
ìs it with the ""?
aye, you don't put "" around arguments when you go to call something
secondly, what does getMarkerPos return? an array doesn't it? so you now have...
doArtilleryFire [[[5,5,5]], "magclass", 3]
when it wants
doArtilleryFire [[5,5,5], "magclass", 3]
so remove both the [] from the function and also the "" from the parameters i feed into the function (in front of the call artstrike)?
well the _OBJ1_PEL2
your calls should look like
[_var1,_var2,_var3] call HYP_fnc_something
and
_gun doArtilleryFire [_target, _mag, 3];
also, something wrong here
getMarkerPos "Bat1_OBJ1_PEL2, true";
see it?
you also don't need this nonsense
private ["_gun", "_targetarea", "_ammotype"];
_gun = _this select 0;
_targetarea = _this select 1;
_ammotype = _this select 2;
params takes care of that for you
okay, then i'll remove that part
getMarkerPos "Bat1_OBJ1_PEL2, true"; and yeah, i messed that up, should be getMarkerPos ["Bat1_OBJ1_PEL2"; true]; right?
params already imports the arguments and assigns them to private variables you put there
you:
getMarkerPos "Bat1_OBJ1_PEL2"; true;
should:
getMarkerPos ["Bat1_OBJ1_PEL2", true];
i think discord highlighting should use a different color for bools than the string color 😤
That is a valid marker name though.
yet most likely sign of a user error, worth checking at least 😆
I fixed all the issues you told me and its working very well now, thanks a lot! This is going to make a lot of things a lot easier for me now