#arma3_scripting
1 messages ยท Page 690 of 1
oh, thanks, but why do I have to double array it? (it worked thanks)
if it doesnt have left hand side values, I think it is fine, lou?
do I recall it wrong
when argument is an array, you have to un-trick remoteExec
honesty was never an option
huh, well yeah I personally did that always but didnt know it was actually required, perks of playing safe always
but yeah thinking now, ofc how else could it understand the difference...
does anyone know how to make a gbu blow up? i have a function that uses createVehicle to create a gbu (bo_gbu12_lgb) but i want it to blow up immediately, i tried setting its damage to 1 but it didnt blowup
make it hit the ground
[myvehicle, "rhs_weap_s8"] call BIS_fnc_fire;
is there a way to make this command fire rapidly instead of 1 shell each second?
maybe change the reload time
setWeaponReloadingTime
thanks
but
its a rocket pylon
so does it count as "reload" ?
read the wiki ^.^
since when I manually use it I can fire it rapidly
then idk, maybe the function itself is slow
ยฏ_(ใ)_/ยฏ
fire
doFire
fireAtTarget (with a virtual one maybe)
forceWeaponFire
doArtilleryFire
doSuppressiveFire
action ["UseWeapon"]
etc ๐
thanks for the dopamine drop
anytime! ๐ ๐
yeah but i want it to be able to explode mid air, so is there another way?
none I know, maybe you can create it on the ground then teleport it immediately to where you want to
btw many people have an issue with firing weapons, maybe you want to pin this
maybe teleport an object in front of the bomb that is 0.5 away from the bomb in the altitude (under the bomb)
then remove the object when it explodes
nah, because all may not work ๐
also all of them are linked in the fire wiki page ๐
setSpeaker
ah
so if I have custom identities and I don't them to have a voice I can just do:
speaker = nil;
?
maybe speaker = "";
No 
I think you can use speaker = "noVoice"
check it in the wiki
_firesrocket =0;
while {_firesrocket < 35} do {
driver myplane forceWeaponFire ["rhs_weap_s8", "Burst"]; sleep 0.01;
_firesrocket = (_firesrocket +1);
};
``` when running this in console (debug console), the unit fires at the desired rate, but when I put it in an sqf it fires 1 rocket per second, any reason behind that?
the console cannot sleep
then ยฏ_(ใ)_/ยฏ
does anyone know how to use remoteExec for something like groupChat where it has a parameter before and after it (player groupChat "string")?
yes, the wiki ๐ ^^
[leftArg, rightArg] remoteExec ["command"];
ah ok thank you
is a variable defined inside a while loop not accessible from outside the while loop?
no
see https://community.bistudio.com/wiki/Variables#Scopes for detailed explanations
any method to make this execute on all machine? without changing the code's sqf location
{deleteVehicle _x} forEach nearestObjects [getMarkerPos "screamer_1", ["Land_Statue_02_F","B_Soldier_VR_F","Sign_Sphere25cm_F"], 200];
{} remote exec call, but meh
but how?
like only the delete vheicle part? or the nearest obejct?
not sure which one to use
how would you treat the foreach?
it's a deletion, deletion has a global effect
you cannot delete a terrain object though
or maybe i ran the code on private local
should still work
yea, they are deletting added object.
it works on multiplayer
not on dedicated
weird
maybe where i ran the code is the problem
that and/or you have some commands disabled for clients
how would i know if i had commands disabled for clients?
that's server administration, idk too much
GL!
is there a scripting command to replace a specific element of an array?
_index = 0;
_newData = "test";
array set [_index,_newData];
also would there be a quicker way to do this:
var1 = 1;
var2 = 1;
var3 = 1;
var4 = 1;
var5 = 1;
something like this maybe:
var1, var2, var3, var4, var5 = 1;
( i know the bottom one isnt actually correct )
Its hard to say exactly what you want but something like this in this exact case:
for "_i" from 1 to 5 do {
missionNamespace setVariable [("var"+_i),1];
};
yeah that makes sense
i only have 8 variables, so its not a problem
i was just curious if there was some way to set a bunch of variables to the same thing at once
[] spawn {
setTimeMultiplier 120;
waitUntil {(date select 3) == 19 && (date select 4) == 35};
setTimeMultiplier 0.4;
};
I'm trying to make a time lapse, but I can't figure out why this code is not working
I tried dayTime too
try >=, it might go too fast IDK
ah yes
wanted to try that too
it worked
https://community.bistudio.com/wiki/BIS_fnc_ambientAnim
myunit call BIS_fnc_ambientAnim__terminate;
it says BIS_fnc_ambientAnim__terminate is an undefined variable ?
tried ```sqf
BIS_fnc_ambientAnim_terminate
is defined only when the ambientAnim function has been called
oh ok, I should use BIS_fnc_ambientAnim in inti instead of eden editor's built in ambinet animation selector, thanks
Here is my current code. I am using variables opforflag1, bluforflag1, opforflag2, bluforflag2, etc. for each respective "scenario". How could I condense this into one piece of code, using the value of scenario and adding it on to opforflag and bluforflag? could I do something similar to this: #arma3_scripting message ?
if ( scenario == 1 ) then {
{ if ( isPlayer _x ) then { _x setPos getPos opforflag1; } } forEach units east;
{ if ( isPlayer _x ) then { _x setPos getPos bluforflag1; } } forEach units west;
};
if ( scenario == 2 ) then {
{ if ( isPlayer _x ) then { _x setPos getPos opforflag2; } } forEach units east;
{ if ( isPlayer _x ) then { _x setPos getPos bluforflag2; } } forEach units west;
};
if ( scenario == 3 ) then {
{ if ( isPlayer _x ) then { _x setPos getPos opforflag3; } } forEach units east;
{ if ( isPlayer _x ) then { _x setPos getPos bluforflag3; } } forEach units west;
};
if ( scenario == 4 ) then {
{ if ( isPlayer _x ) then { _x setPos getPos opforflag4; } } forEach units east;
{ if ( isPlayer _x ) then { _x setPos getPos bluforflag4; } } forEach units west;
};
The end result might be something like this:
{ if ( isPlayer _x ) then { _x setPos getPos ("opforflag" + scenario); } } forEach units east;
{ if ( isPlayer _x ) then { _x setPos getPos ("bluforflag" + scenario); } } forEach units west;
getPos doesn't take string
There's unfortunately no such thing but a kind of stupid workaround:
call compile format ["opforflag%1",scenario];```But not sure if this works in this situation
Oh yeah, I forgot that solution
is just need to use the variable scenario (which equals 1, 2, 3, or 4) and at that to the end of "opforflag" to get opforflag1, opforflag2, etc.
ok
what does this return?
missionNamespace getVariable ("car" + str _i)
does it return a string, or the variable?
ohhh
("car" + str _i) //returns a string
missionNamespace getVariable ("car" + str _i) //returns a variable
I kinda want to see a command to return a identifier itself than a variable, yes
ok
So would this work?
_posBlue = getPos (missionNamespace getVariable ("bluforflag" + str scenario));
_posRed = getPos (missionNamespace getVariable ("opforflag" + str scenario));
{
if ( isPlayer _x ) then {
_x setPos _posBlue;
};
} forEach units west;
{
if ( isPlayer _x ) then {
_x setPos _posRed;
};
} forEach units east;
this is pretty simple(assume we're in missionnamespace):
a = 5;
diag_log a; // 5
missionNameSpace setVariable ["a", 6]; // identical to a = 6
diag_log a; // 6
a = 0;
diag_log (missionNameSpace getVariable "a"); // 0
ok
you should save the position into some local variable before looping
ok
i.e private _position = getPos (missionNamespace getVariable ("opforflag" + str scenario))
i added the missing ')'
why private? I still dont understand what private does
i added the missing ')'
oh yeah
private makes it a private variable, which means... well, read this one
https://community.bistudio.com/wiki/Variables#Local_Variables_Scope
how does this look now?
#arma3_scripting message
I don't see a flaw there, not tested
ok
can I make a for loop count backwards? for example, what if I wanted something to do a countdown?
for "_i" from 10 to 1 do {
hint str _i;
sleep 1;
};
step -1
how can I use structured text for strings inside variables? _weaponName and _scopeName are strings
[parseText "Your Loadout: " + <t color='#ffff00'>_weaponName</t> + <t color='#ffff00'>_scopeName</t>] remoteExec ["hint", _caller, false];
mb i forgot to use parseText
still not working...
use format or +, you're missing quotes everywhere
ok
im already using +. am I using it wrong?
[parseText "Your Loadout: " + "<t color='#ffff00'>" + _weaponName + "</t>" + "<t color='#ffff00'>" + _scopeName + "</t>"] remoteExec ["hint", _caller, false];
is this what you mean? ^
"</t>" + "<t color='#ffff00'>" just put them in a string together, no need to add like that
and wrap the whole thing(after parseText) into ()
because precedence
ok
[parseText ( "Your Loadout: " + "<t color='#ffff00'>" + _weaponName + "</t>" + "<t color='#ffff00'>" + _scopeName + "</t>" )] remoteExec ["hint", _caller, false];
thanks
any one know a script for inidbi2 for keep vechiles and there invtory and how to make shops
or a garrage systym
im having some issues with BIS_fnc_spawnCrew, it seems to populate all FFV slots too
is there a way to use something with the same functionality as BIS_fnc_spawnCrew but only fill crew slots that are not ffv?
so turrets+copilot only
thanks that worked fine
Im porting a mission (with permission) to another map + fixing some issues with it. I've solved most problems I wanted to fix but theres one I cant really figure out. This script is run to pick a landingzone from an array list (lzList). It currently checks if it is within allowed distance from another active task (the LZMinDistance part) but I would like it to also check the distance from the player to make it only select a lz within a max allowed distance from player position. Anyone happen to have an idea of how to go about it?
//diag_log format["selectLZ called, _this: %1", _this];
private _excludeList = _this select 0;
private _returnValue = false;
private _candidates = lzList;
if (!(_excludeList isEqualTo false)) then
{
_candidates = _candidates - _excludeList;
};
private _taskLocations = [];
{
[_taskLocations, ([_x] call BIS_fnc_taskDestination)] call BIS_fnc_arrayPush;
} forEach ([west] call getSideActiveTasks);
scopeName "main";
private _i = 0;
while {true} do
{
scopeName "selectloop";
private _usable = true;
private _candidate = _candidates call BIS_fnc_SelectRandom;
{
scopeName "checkloop";
private _dist = _candidate distance _x;
if (_dist < LZMinDistace) then
{
_usable = false;
breakOut "checkloop";
};
} forEach _taskLocations;
if (_usable) then
{
_returnValue = _candidate;
breakOut "selectloop";
};
_i = _i + 1;
if (_i > LZCOUNT) then
{
_returnValue = false;
breakOut "selectloop";
}
};
//diag_log format["selectLZ returning: %1", _returnValue];
_returnValue
Some err, interesting code there. You'll need to loop through all players (playableUnits) and check if that is within your desired distance, similar to your check on _taskLocations
params [["_excludeList", []]];
private _candidates = lzList;
if (_excludeList isEqualType []) then { _candidates = _candidates - _excludeList; };
private _taskLocations = [west] call getSideActiveTasks apply { [_x] call BIS_fnc_taskDestination };
for "_i" from 0 to LZCOUNT do {
private _candidate = selectRandom _candidates;
if (_taskLocations findIf { _x distance _candidate < LZMinDistance } == -1 && { allPlayers findIf { _x distance _candidate < /* ... */ } == -1 }) exitWith { +_candidate };
false
}
should add tags for your global variables though
_candidates is no (deep) copy of lzList ๐
It should only be a shallow copy
sure, fixed, only matters if they modify the result outside somewhere
But it's not that either 
That's not what I meant ๐
The problem is that this is pointless because you are still modifying the original lzList array:
private _candidates = lzList;
if (_excludeList isEqualType []) then {
_candidates = _candidates - _excludeList;
};
what?
- doesn't modify anything here
and there is no need for copies here, ONLY when returning exitWith { +_candidate }; here, incase the user modifies this (position? idk what it is) outside this function(i.e set), THEN it would modify lzlist (if done without the unary +)
Ah, my bad, I didn't think about that 
Error in expression <te > LZMaxDistace } == -1 }) exitWith { +_candidate };
false
}>
13:25:04 Error position: <+_candidate };
false
}>
13:25:04 Error +: Type Object, expected Number,Array,Not a Number,HashMap
ah so you have objects, then omit the +
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
thanks revo
!purgeban @willow sequoia 0 scam link
*fires them railguns at @willow sequoia* ร_ร
Pew pew
i have named multiple things base and no matter what i cant get the action to pop up when im in vicinity of whatever i have labeled player addaction ["Virtual Arsenal", { ["Open",true] call BIS_fnc_arsenal; }, [], 1, false, true, "","(getpos player distance getpos base) < 350 "];
([base1, base2, base] findIf {player distance _x < 350}) > -1
still doesnt work
then you re doing something wrong
make sure the base objects actually exist
can also put this into your watch fields in admin console:
[base1, base2, base] apply {player distance _x}
it tells you have far you are from each base.
(getpos player distance getpos base)
fyi here you can just useplayer distance baseasdistanceaccepts objects as inputs
thanks i will give it a try
I notice your "show window" addAction parameter is set to false. This means that the action will not automatically display in the centre of your screen when it's available; you must open the action menu in order to see it. Double-check whether it appears when you open the action menu.
Also, make sure that your objects are named correctly. This is done by double-clicking on the object in the editor and typing a name in the Variable Name field. If you put the name anywhere else (e.g. in the init field or the role description field) it won't work.
Now the question I came to ask: is there any way to control the burst length of scripted fire commands for non-artillery units? _ArtilleryFire commands have a burst length parameter, but none of the non-artillery ones do. I'm hoping to script a CIWS firing for atmospheric purposes, and getting the proper long brrrts is important.
you could force fire on a loop for absolute control
did that in the past with scripted MG nests
I have done disableAI "all"; to bots, but when for example a grenade explodes near them they go prone for a second and then return back to their normal posture, is there a way to stop this "panic" behaviour ?
sounds horrible but I guess that's the thing to try
Don't forget to set them to Careless using editor attributes or setBehaviour. Also, if you're using any AI mods, some of them add suppression stuff so you might need to see if they have any per-unit disabling options.
say I have an action that only the server host can use. (it is added on initServer.sqf). It runs a script that takes some time, and I don't want the script to be ran more than once at a time. So, at the beginning of the script I remove the action from the object, and at the end of the script I add the action back. Will the action still be visible only to the server host?
if you execute the script only there, then yes
ok, thanks
I use this in a init field in an object as a teleporter
this addAction ["Teleport to Paradise", {player setPos (getPos IUNSParadise)}]
Does anyone have ideas on how to make this team specific, only blufor players can access it?
https://community.bistudio.com/wiki/addAction
Have a look at the condition parameter ๐
Thanks
is there anyone who can help me make a trigger that activates on a units death? I'm trying to have it where the trigger that activates disables simulation and the unit that dies stays in the animation where he is sitting in a chair
Singleplayer or multiplayer?
multiplayer
there is not currently a dead in a chair animation or anything as far as im aware
hell i don't even know if stop simulation will keep him sitting in the chair
what does this mean?
||
or
np
I don't know that either, but it might be worth trying.
Either way, you can probably use a Killed Event Handler (https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed).
If you really want to use a trigger (e.g. because you also use that trigger for something else) you can simply use !alive PersonInChair as the Activation Condition.
ok thanks for the help Ansin11
Just be cautious with the Killed EH in multiplayer, it needs to be added on the machine where the unit is local.
hey! sorry to bother yall, but is there a way to use the arma 3 support modules while also having acre on a server? with acre, the radio slot/radio itself is removed from the player preventing them from using the support functions. is there a workaround for this?
@drifting girder One could certainly create a workaround, but it's probably rather complicated.
Either a mod copying the vanilla support modules and the functions behind them, just minus the player-needs-radio-item restriction or a mod patching ACRE to readd the vanilla radio slot, but I don't know if this in turn could break ACRE.
Here's a fun trivia SQF function; not meant for serious digestion, just fun trivia. Assuming you have a HASHMAP setup and know its keys. What in your opinion does this do?
// Assume we know _keys belonging to _bundleMap
// Assume also that _bundleMap is a HASHMAP
// Finally, assume also that all keys are known to be underscore ('_') prefixed
(_keys apply { _bundleMap get _x; }) params _keys;
I'm assuming that the keys are strings
In which case it just creates private variables with the same identifier as the keys and the values are the mapped values
Yep; pretty nifty, ey?
i figured out that this code player addaction ["<t size='1.4' shadow='2' color='#FF8C00'>Virtual Arsenal</t>", { ["Open",true] call BIS_fnc_arsenal; }, [], 1, true, true, "","([base] findIf {player distance _x < 350}) > -1"]; will work in single player but it wont in multiplayer... whats the workaround for that?
nevermind sorry
it looks like if you have the respawn menu template, it will interfere with scripts
Is this a good channel to ask about a scripting question or should I ask in a different channel? The number of channels on this server is a little overwhelming
Is it possible to create another slot for clothing? (e.g. glasses, hats, nvgs slots) I want to make all my custom clothing barefoot and then have shoes as a different object.
Yes
Good to know. Thanks! I had a scripting question, but of course it was just a small typo...
creates a variable named after key with a value from hashmap?
Hi, is possible to get maximum load or uniform/vest/backpack without adding them to player?
to show how much of items it can space inside
config maybe
ah, figured out with that ๐
stacked on the same problem with vests and backpacks
getNumber(configFile / "CfgWeapons" / vest player / "ItemInfo" / "MaximumLoad");
//returns 0
I think you should get values from CfgVehicles class
check this
getNumber (configfile >> "CfgVehicles" >> "B_AssaultPack_khk" >> "maximumLoad")
thank you! Works fine for backpacks, but for vests - return 0 always
for vests it is a bit diffeerent story
once sec
for uniform worked this one:
_container = getText(configFile / "CfgWeapons" / uniform player / "ItemInfo" / "containerClass");
_load = getNumber(configFile / "CfgVehicles" / _container / "MaximumLoad");
yes, actually vest and uniform has a reference to dummy container, that defines cargo capacity
oneliner
getNumber (configFile >> "CfgVehicles" >> (getText (configfile >> "CfgWeapons" >> "V_PlateCarrierGL_rgr" >> "ItemInfo" >> "containerClass")) >> "maximumLoad")
same for uniform
@void arrow that worked, thank you a lot!
i just was searching for same settings in examples (Arma 3 Samples) and just didn't find that
Thank you again! ๐
yw
one more way
getNumber ( configFile >> "CfgVehicles" >> (typeOf vestContainer player) >> "maximumLoad")
You can also reference vest or uniform or backpack as object ๐
i just worked without container object - because don't add them on player ๐
is something like info menu about backpacks, vests, uniforms etc
haha I recall back in 2013 or 2014 we spawned a unit on map, giving him same gear as for player to test if item fits inventory
in 2013
vestContainer appeared autumn 2013
funny thing - i tryed the same way first time ๐
anyone know if it's possible to change zeus group icons?
Quick question: does the addVest command keep the old vest's inventory or do I have to copy it over and paste it?
and whats the usecase?... You now have a bunch of local variables but you don't (when writing the code) know for certain which.. whats that useful for?
Anyone know how to make a camera to follow a missile or bomb
no, doesn't keep inventory
Thanks
nothing 
Hi guys. Is it possible to create Shape Marker in Eden Editor via script in debug console?
I can create simple marker with something like create3DENEntity ["Marker", "mil_dot", [100,100,0]]; But I do not see the way to make a shape.
Thanks.
setMarkerShape/setMarkerShapeLocal mostly ๐
I don't think that does for Eden Editor. set3DENAttribute instead?
oh mb
I completely went through
Yes, set3DENAttribute may work here. But what attribute should I set to get Shape Marker?
Thanks, I saw that. According to the manual it should be markerType, but it does not work.
What are you trying to do now?
_m = create3DENEntity ["Marker", "mil_dot", [3350,4500,0]];
_m set3DENAttribute ["baseColor", "colorGreen"];
_m set3DENAttribute ["markerType", "RECTANGLE"];
It's always looks like mil_dot
Try "Rectangle" instead, maybe it is a case-sensitive
The same.
Try to check the value used with get3DENAttribute for a rectangle marker you made via GUI
get3DENAttribute gives me [0] for Rectangle and [1] for Ellipse. But setting these values via set3DENAttribute does nothing.
I have a guess that another value instead of "mil_dot" have to be used. But not sure.
Do [1] or "1" work? If not... maybe a bug
Neither [1] nor "1" works
Lou, can you slap Dedmen right now to check it out?
I looked through the "mission.sqm" , and changed the values accordingly but with no success.
_m = create3DENEntity ["Marker", "rectangle", [3350,4500,0]];
_m set3DENAttribute ["baseColor", "colorGreen"];
_m set3DENAttribute ["markerType", "RECTANGLE"];
Seems bugged.
Quick question
There are more things wrong with markers.
What kind of data types are triggers?
object
Okay, thanks!
Good day. Is there a way to disable all player-controlled units chat and radio messages, but keep other units voices?
I tried using in initPlayerLocal:
showSubtitles false;
Works good, but from time to time group leader unit spams 'regroup' message. Then tried:
enableRadio false;
or
enableSentences false;
Both commands seems to disable all units voices, while my goal is to hear enemy bot chatter.
try disableAI command on player
disableAI "RADIOPROTOCOL"?
yes
Will try, thank you
Hi, anyone have the latest all-in-one-config file with Laws of War config files added...looking for the parade uniform configs
https://forums.bohemia.net/forums/topic/191737-updated-all-in-one-config-dumps/?page=2
Doesn't look like it, but you can get it yourself following this: https://community.bistudio.com/wiki/Arma:_All-in-one_Config
Hi, I'm hoping someone might be able to help me with a script for a SOG OH-6 Cayuse mission or let me know if it's even possible. I'm wanting a Cobra to follow me around in my OH-6 and when I drop smoke from the chopper, the Cobra fires a pair of rockets on the smokes position once it's lined up a shot, and then joins back in formation with my OH-6 until I drop another smoke to do another rocket run, would this be possible to do?
possible, but you need to script it
thanks ๐ I figured that was the case. Unfortunately I have no experience with scripting so i'm hoping someone might be able to help me out with it
Is there a way to leave the parachute in air?
moveOut? 
I think it works yeah ๐
Ah, thanks ๐
can you select groups via script when using zeus?
I found it useful when I wanted to bundle a bunch of variables together. yes, I may know the names, or not, simply their order, whatever the case may be. then I needed to deconstruct them in order to pass them along.
here's how I found it useful:
params [
[Q(_sector), locationNull, [locationNull]]
];
private _active = _sector in MVAR(_allActive);
private _captured = _sector getVariable [Q(KPLIB_captured), false];
private _bluforOnActivation = [_sector getVariable [QMVAR(_sideOnActivation), KPLIB_preset_sideE]] call {
(_this#0) == KPLIB_preset_sideF;
};
if (!_active || _captured) exitWith { false; };
[
_sector getVariable [QMVAR(_capUnitsE), []]
, _sector getVariable [QMVAR(_capUnitsF), []]
, _sector getVariable [QMVAR(_capTanksE), []]
, _sector getVariable [QMVAR(_capTanksF), []]
] params [
Q(_capUnitsE)
, Q(_capUnitsF)
, Q(_capTanksE)
, Q(_capTanksF)
];
private _unitDivisor = count (_capUnitsF + _capUnitsE);
private _tankDivisor = count (_capTanksF + _capTanksE);
// ...
private _bundleKeys = [
Q(_unitDividend)
, Q(_tankDividend)
, Q(_unitDividendOffset)
, Q(_unitDivisorOffset)
, Q(_unitRatioBias)
, Q(_unitThreshold)
, Q(_tankDividendOffset)
, Q(_tankDivisorOffset)
, Q(_tankRatioBias)
, Q(_tankThreshold)
];
private _bundleValues = [
[
count _capUnitsF
, count _capTanksF
, MPARAM(_capUnitDividendOffsetF)
, MPARAM(_capUnitDivisorOffsetF)
, PCT(MPARAM(_capUnitRatioBiasF))
, PCT(MPARAM(_capUnitThresholdF))
, MPARAM(_capTankDividendOffsetF)
, MPARAM(_capTankDivisorOffsetF)
, PCT(MPARAM(_capTankRatioBiasF))
, PCT(MPARAM(_capTankThresholdF))
]
, [
count _capUnitsE
, count _capTanksE
, MPARAM(_capUnitDividendOffsetE)
, MPARAM(_capUnitDivisorOffsetE)
, PCT(MPARAM(_capUnitRatioBiasE))
, PCT(MPARAM(_capUnitThresholdE))
, MPARAM(_capTankDividendOffsetE)
, MPARAM(_capTankDivisorOffsetE)
, PCT(MPARAM(_capTankRatioBiasE))
, PCT(MPARAM(_capTankThresholdE))
]
];
private _bundleMap = _bundleKeys createHashMapFromArray (_bundleValues select _bluforOnActivation);
(_bundleKeys apply { _bundleMap get _x; }) params _bundleKeys;
private _evaluation = [
[
_sector
, _unitDividend
, _unitDivisor
, _unitDividendOffset
, _unitDivisorOffset
, _unitRatioBias
, _unitThreshold
]
, [
_sector
, _tankDividend
, _tankDivisor
, _tankDividendOffset
, _tankDivisorOffset
, _tankRatioBias
, _tankThreshold
]
] apply {
_x call MFUNC(_canCaptureEval);
};
_evaluation params [
Q(_unitEval)
, Q(_tankEval)
];
(_unitDivisor > 0 && _unitEval)
&& (
_tankDivisor <= 0
|| (_tankDivisor > 0 && _tankEval)
);
Basically the bundle is evaluated in one of two ways, whether sector currently aligned to BLUFOR or OPFOR, with the appropriate OPFOR versus BLUFOR challenge, respectively.
[
_sector getVariable [QMVAR(_capUnitsE), []]
, _sector getVariable [QMVAR(_capUnitsF), []]
, _sector getVariable [QMVAR(_capTanksE), []]
, _sector getVariable [QMVAR(_capTanksF), []]
] params [
Q(_capUnitsE)
, Q(_capUnitsF)
, Q(_capTanksE)
, Q(_capTanksF)
];
wuht the hell....
Just assigning variables instead of using extra params command would be cheaper I'm sure.
Also if you directly assign, you can wrap it all into a macro instead of having the risk of typoing one of the two variables
don't we have a values command now? ๐ค
also, I'm assuming it's in the same order as keys right?
yeah
there is, however, considering it's a HASHMAP, not truly an ARRAY, I would not count on the order. The only thing you can know for certain is value at key.
it's a fair point; although stylistically speaking, I am leaning into more of the data flow nature of it these days, than procedural. i.e. value-assignment pattern, versus true data flow pattern.
afaik it iterates and returns the keys/values
iterators are not invalidated unless you make a change to the hashmap
so they'll be in the same order
is it possible to script a display/panel with head/character preview based on p3d/head+face?
also we have a command that converts the hashmap to an array (I think it was called toArray)
(only in dev branch ^)
I think so, as it's a base p3d you can spawn with createSimpleObject
you mean like the "rotating head" in profile?
yea kinda
like the idea was onHover on 2d map when you point on units
to personalize them
good to know
I don't think there's a way to customize models in displays (like changing the texture)
I think one way to do what you want is to create a camera and use pip 
at least that's the way I decided to do it in my mod 
pip is an interesting angle. can these be shown in 2d map/custom RscMapControl tho?
as for displays - there was one to show/preview p3d i am pretty sure
if you use the map control as the background, you can show a picture control on top of it.
which shows the PIP
yeah but you can't customize it (you can only change the model, and animate it)
ty
For custom objectives in the editor, would I need to make a script to have the custom objective be successful? When I add one in I have to hop in Zeus to mark it successful.
I have a video I can DM someone to explain what I'm referring to. I don't wanna self promote just looking for guidance is all
how to make the below code work on dedicated server? Currently working on MP but wish for DS.
Tried scratching my head a few day and still not sure.....
{deleteVehicle _x} forEach nearestObjects [getMarkerPos "screamer_1", ["Land_Statue_02_F","B_Soldier_VR_F","Sign_Sphere25cm_F"], 200];
what's the problem?
it does nothing on dedicated
but it work on multiplayer
how to make it work on dedicated server
do you execute it on the server?
I know but where 
what do you mean where?
basically editor to sqf#1 then to sqf #2
_part = _this select 0 select 0;
_dmg = _this select 1;
if(_part == "head")then
{
screamerhp_dmg = screamerhp_dmg + _dmg + 20 ;
}
else
{
screamerhp_dmg = screamerhp_dmg + _dmg;
};
if(screamerhp_dmg > random [1,2,3])then //Max HP = 2000 or 6 RPG-7 hit
{
//_entitate allowDamage true;
//_entitate setDamage 1;
//_screamer_anomally setdamage 1;
//deletevehicle (_this select 0);
//deletevehicle _part;
//deletevehicle _screamer_anomally;
//deletevehicle _entitate;
//deletevehicle _grp;
{deleteVehicle _x} forEach nearestObjects [getMarkerPos "screamer_1", ["Land_Statue_02_F","B_Soldier_VR_F","Sign_Sphere25cm_F"], 200];
//["{deleteVehicle _x} forEach","[getMarkerPos 'screamer_1', ['Land_Statue_02_F','B_Soldier_VR_F','Sign_Sphere25cm_F'], 200]"] remoteExec ["nearestObjects"];
//playsound "earthquakes";
//playsound "miscare_screamer";
"scream" remoteExec ["playsound"];
//_emit = _this say3D ["scream", 200];
"Screamer dead" remoteExec ["hint"]; "Screamer dead" remoteExec ["systemchat"];
};
there is something called "remote execution" 
you can execute that code on any client
yea ik, i tried making ti remote exec but bc of the for each and nearest. idk how to include in the remote exec
i am used to small simple remote exec
not sure how i can remote exect he above
tried that but it didnt make sense
["{deleteVehicle _x} forEach","[getMarkerPos 'screamer_1', ['Land_Statue_02_F','B_Soldier_VR_F','Sign_Sphere25cm_F'], 200]"] remoteExec ["nearestObjects"];
remoteExec the whole code
if it's a function, remote exec the function
otherwise, use execVM
the function on the above would be delete vehicle and nearest object right?
justโฆ why would you remoteExec deleteVehicle, which is global effect?
ยฏ_(ใ)_/ยฏ
i am not sure that why. cuz i know on debug deletevehicle is global
actually I wanted to ask what nearestObject returns
just wanted to select any object that place within X meters to delete
are you sure nearestObjects works?
lmao i think i am dumb
where u exec -> in a global sqf?
how-> editor trigger to sqf to another sqf
like what command do you use, etc.
oh mb
for example, init.sqf, executed by action, execVM, etc.
_entitate addEventHandler ["HitPart", {[[_this select 0 select 5, _this select 0 select 6 select 0] execVM "AL_Screamer\screamer_hp.sqf"];}];
so execvm
the problem is probably the object's locality
does it execute at all?
so you see the hint?
what hint?
"Screamer dead"
i didnt put the hit
oh yea
i see it
the hint and system chat works
only the delete part dont work
the custome eventhandler for hp also work
try another one:
str (nearestObjects [getMarkerPos "screamer_1", ["Land_Statue_02_F","B_Soldier_VR_F","Sign_Sphere25cm_F"], 200]) remoteExec ["systemchat"];
see what it gives you
well I told you it never executes 
or at least I thought I did! ๐คฃ
@digital torrent
While you can add "HitPart" handler to a remote unit, the respective addEventHandler command must be executed on the shooter's PC and will only fire on shooter's PC as well. The event will not fire if the shooter is not local, even if the target itself is local.
lmao
but it work before haha
let me think what i changed
ok well that fun
guess i need to find another hp script then
or how can i solve this lol
i dont see any note on hit, does it mean hit can be my solution?
use handleDamage
hit doesn't have a selection
does handle damage use the damage value?
bc i am using it on a statue
which, well dont take any damage at all
then how does hitPart work?!
anyway, I guess the other solution is adding the event handler to every PC
if it hit kind of head, +20 damage
well true, there is no "head" on a status
that was dumb
i copied that script from internet tbh
@digital torrent try this:
[_entitate, ["HitPart", {[[_this select 0 select 5, _this select 0 select 6 select 0] execVM "AL_Screamer\screamer_hp.sqf"];}]] remoteExec ["addEventHandler"];
note that you should NOT use execVM, but for testing you can do it
lol ok
let me test
it works
hint and message only
with some weird chat
remote,1fc92f6b580# 620179: statue_02_f.p3d remote
is that from my systemChat?
is the reason bc of this maybe?
str (nearestObjects [getMarkerPos "screamer_1", ["Land_Statue_02_F","B_Soldier_VR_F","Sign_Sphere25cm_F"], 200]) remoteExec ["systemchat"];
yea
from system chat
makes no sense
no it's showing that it is detecting the objects and it should work
what about this?
[_entitate, ["HitPart", {
[[_this select 0 select 5, _this select 0 select 6 select 0], "AL_Screamer\screamer_hp.sqf"] remoteExec ["execVM", 2];}]] remoteExec ["addEventHandler"];
wat?
why
on your note
it remoteExecs on the server
just want to check
also copy it again
I just fixed an error
ok
same thing
remote,1fc92f6b580# 620179: statue_02_f.p3d remote
for each object that i listed for the nearest each
deletevehicle didnt happen or work but hint and system chat work
otherwise, is there a better method to add a hp system within the same script maybe
without creating a new sqf, maybe it will solve the problem
no (I mean it won't solve the problem)
mm ok
wdym?
I didn't really read that script 
bc currently idk if the above hp sysem script is correct
idk what it does
it is really short tbh
if hit head = damage+ 20
otherwise damage
and u define the max damage before your desired script is executed
which in my case is delete vehicle
didn't you show this script to me before and I said use setVariable/getVariable?
yea, but i was thinking if there was a method to avoid the setvariable given i dont really get it.
like u set the variable in the init then u use them in sqf?
you're calculating the damage to a specific object. you can't use a global variable for that
yes agree
(unless it's just a predetermined number of objects, which you need a global var for each, which is dumb)
agree
setVariable = save this variable
that's it
player setVariable ["damage", 1, true]; //give player the variable damage with value 1; true means make it public
_dmg = player getVariable ["damage", 0]; //get var damage from player's var space; if it doesn't exist, assume it's 0
it allows you to have the same name for a certain variable for any object
in that case i already did it wrongly as a public variable i guess
screamerhp_dmg = 0;
publicVariable "screamerhp_dmg";
that was in the init
yes
ok so assuming that i change it,
by taking out from the init
and adding the setvariable withtin the same SQF file, will it solve the problem?
no 
wut
that was a different problem
show me the current code
so i have 2 problem?
1- variable (public/ setvariable -> local?)
2- the execution of the script
1- use setVariable (with public flag)
init:
screamerhp_dmg = 0;
publicVariable "screamerhp_dmg";
Editor
null=["screamer_1"] execvm "AL_screamer\screamer.sqf"
SQF Screamer
[_entitate, ["HitPart", {
[[_this select 0 select 5, _this select 0 select 6 select 0], "AL_Screamer\screamer_hp.sqf"] remoteExec ["execVM", 2];}]] remoteExec ["addEventHandler"];
screamer_hp
_part = _this select 0 select 0;
_dmg = _this select 1;
if(_part == "head")then
{
screamerhp_dmg = screamerhp_dmg + _dmg + 20 ;
}
else
{
screamerhp_dmg = screamerhp_dmg + _dmg;
};
if(screamerhp_dmg > random [1,2,3])then //Max HP = 2000 or 6 RPG-7 hit
{
//_entitate allowDamage true;
//_entitate setDamage 1;
//_screamer_anomally setdamage 1;
//deletevehicle (_this select 0);
//deletevehicle _part;
//deletevehicle _screamer_anomally;
//deletevehicle _entitate;
//deletevehicle _grp;
//{deleteVehicle _x} forEach nearestObjects [getMarkerPos "screamer_1", ["Land_Statue_02_F","B_Soldier_VR_F","Sign_Sphere25cm_F"], 200];
//["{deleteVehicle _x} forEach","[getMarkerPos 'screamer_1', ['Land_Statue_02_F','B_Soldier_VR_F','Sign_Sphere25cm_F'], 200]"] remoteExec ["nearestObjects"];
str (nearestObjects [getMarkerPos "screamer_1", ["Land_Statue_02_F","B_Soldier_VR_F","Sign_Sphere25cm_F"], 200]) remoteExec ["systemchat"];
//playsound "earthquakes";
//playsound "miscare_screamer";
"scream" remoteExec ["playsound"];
//_emit = _this say3D ["scream", 200];
"Screamer dead" remoteExec ["hint"]; "Screamer dead" remoteExec ["systemchat"];
};
wat? there's no deleteVehicle 
๐
I didn't say remove the deleteVehicle
? i didnt remove it
I said paste that code there to see what it gives you
๐ถ
let me try it
no need it'll work
just fix that global variable screamerhp_dmg too (use this note)
#arma3_scripting message
huh?
i mean the setvariable can be written within the sqf right?
no need to put it in init
the screamer_hp.sqf
getVariable has a default value. you don't need to initialize variables when you use it
oh perf
see this note again:
#arma3_scripting message
@digital torrent also where is the object? you don't need nearestObjects. just use the object itself
i am spawning multiple of thos object aka boss area
so i only want it to delete the one within the marker
that's why there are params
i know it is dumb given i need to create the same thing for each boss area but that my current skill for now
what do you mean
the screamer_1?
that the marker name

(_this select 0) params ["_target"...
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart
_target is what you added the event handler to
as for the rest of objects, you can use setVariable again to save them:
_someObj setVariable ["other_objs", [obj1, obj2], true];
it would be the faster solution 
writing bad code will result in bad performance
yea true
ima crying now
rip
thanks for the help. i will add thos setvariable
I've got a weird issue here, mission modules and the init scripts are not being applied to remote players when joining. Using the Prairie fire DLC, the exact same script works fine outside of the DLC.
I see to have made a lag machine, and I'd rather it didn't. Near as I can tell, the code in question is somewhere around this;
waitUntil {sleep 1; Dragonfly distance NatoGunnery <= 50 OR Dragonfly distance NatoGunnery >= 500};
The mission runs smoothly up until there, when it hits one-second lag spikes.
Okay, I block comment out the section I thought was the problem, but now it's causing a general slowdown and every terrain object to flicker in and out of existence? o.0
What exactly is the full script?
It's happening in the editor now, outside the mission
It's nearly 300 lines of code, can't really share practically :/
pastebin or sqfbin
A lot of it is dialogue, as well.
It's occuring in this chunk, though;
sleep 34;
["Investigate","SUCCEEDED"] call BIS_fnc_taskSetState;
sleep 20;
[East, ["Investigate2","InterruptCore"], ["NATO's training is disruptive, but it's their own region. CSAT getting involved may set some of the locals at ease, but will harm relations. Leave the region.", "Leave", "cookiemarker"], Objnull,1,1,true,"",false] call BIS_fnc_taskCreate;
[East, ["Investigate3","InterruptCore"], ["NATO is causing a disruption, and CSAT needs to explore any opportunity to show them up. Fly close to the fireline, that will break them up.", "Stay", "cookiemarker"], Objnull,1,1,true,"",false] call BIS_fnc_taskCreate;
waitUntil {sleep 1; Dragonfly distance NatoGunnery <= 50 OR Dragonfly distance NatoGunnery >= 500};
Are you sure about it?
The prior sleeps are following a camp_playSubtitles section, but right as those two objectives are starting to load, it craps out.
reasonably sure.
Uhh. Did you changed waitUntil part to something else? Like, just true?
if (skipTask == true) exitWith {
What the
@manic sigil are you sure dragonfly and natogunnery are defined?
Yeah, they are.
Did you enabled -showScriptErrors?
And that's me playing with a debugging script attempt, just setting skipTask = true will advance the mission to the end of the current phase, moving the player and vehicle to the proper positions, etc ๐
I have not ๐ฎ
Ye but still 
Is there a better way? o_o
If (skipTask) then
well okay if you just say it out loud it makes sense but :C
Yeah, I thought it just throw out an error so it's impossible to spot it out. I was wrong
Nah, that works fine, so long as I can easily define what the end state is - where the player should be, what should have happened in the course of the task, etc
@manic sigil anyway, if you say it lags around the waitUntil that means one of two things:
- Undefined variables
- You're running the code in unscheduled environment
My bet is on the second
Yeah could be. How did you run this script?
Okay, time for me to sound crazy.
I have initServer.sqf setting up world events (weather, time, faction alliances if not default), calling variables (task1done = false) just to get it out of the way, then finally ExecVM "Staging.sqf";
execVM sounds fine?
Staging.sqf is the sequencer of the tasks, in the vein of 'wait until task1done, execvm task2
Specifically, in this instance; execVM "Scripts\Tasks\T6.sqf"
As I understand it, that should be a scheduled environment.
so if im using remoteExec to do setVehicleInit i would only need this to execute on server?
Im adding a respawn.sqf to init field of a created vehicle that was spawned with script
@manic sigil your issue is probably an rpt spam because of some error. open the rpt file and check for error spams
setVehicleInit is really a nonsense in Arma 3. Why would you need to use?
to add the respawn script into the init after using createvehicle
Im adding a respawn.sqf to init field of a created vehicle that was spawned with script
Just execute the script when you spawn it
the script uses the init field for the respawn to set the abandoned time and destroyed time till respawn
@little raptor Crap, you're onto something.
22:52:24 Suspending not allowed in this context
22:52:24 Error in expression <waitUntil {sleep 1; Dragonfly distance NatoGunnery >
22:52:24 Error position: <sleep 1; Dragonfly distance NatoGunnery >
22:52:24 Error Generic error in expression
I told you
That repeats about a hundred times
You're executing the code in unscheduled environment
It does switch over to
22:52:27 Error Generic error in expression
22:52:30 Error in expression <OR Dragonfly distance NatoGunnery >= 500};>
22:52:30 Error position: <};>
22:52:30 Error Missing ;
Which is weird, because that's the same environment i've run everything else in? o.0
When you spawn a vehicle with scripts, you don't need init.
I mean, T6.sqf begins with a waitUntil.
It's a follow up to the previous error probably
Frequent error log output kills the performance really efficiently. That would be the issue
k ill look at a alternate option for respawns unless i can get this one to not use the init field
Okay... executing the taskcreators and waitUntil in a test.sqf file, same way, doesn't throw an error.
The file is irrelevant. What matters is how you execute it
But why would it matter for one waitUntil, and not the other?
In the same file, I mean.
Like I said, it matters how you execute it
If they're both in the same .sqf, aren't they executed the same?
Show me what you mean here
Okay, the pastebin above is the entirety of T6.sqf
It begins with a waitUntil, waiting for the player to approach a location.
That works fine, no problems.
Then another waitUntil for the player to get close to another position. No issue.
Two, actually.
THEN the final waitUntil, which just cycles until the player is either too close or far enough away from a position, and that's the one that hangs.
Executed T6.sqf via the debug console, same as my test.sqf... same hangup.
Same with my backup plan, putting that whole section into a separate .sqf to call on.
I've narrowed it down to just that specific waitUntil, something about it just throws a fit.
Quick question, could I use stuff like onPlayerRespawn.sqf in a workshop mod?
So, I'm trying to make a bunch of VBIEDs rush a position but don't know how to activate them separately. Current I stick a basic trigger on the place I want them to explode on, call each car "car1", "car2", "car3" (etc) and then put the trigger on activation (and set to repeatable) : bomb="BO_GBU12_LGB" createVehicle getPos car1, car2, car3;
but only the first car explodes
That's no how to use getPos
that was just what I copypasted from a forum thread, works fine for car1
That's no how to use getPos after all
{
"BO_GBU12_LGB" createVehicle getPos _x;
} forEach [car1,car2,car3];```
hmm, if any of the cars drives over the trigger, the other one explodes as well, even if it's not near the trigger
Oh yeah, I didn't read your goal carefully
If you want to do it in one trigger, maybesqf { "BO_GBU12_LGB" createVehicle getPos _x; } forEach ([car1,car2,car3] select {_x in thisList});IDK
now none of them blow up 
{
"BO_GBU12_LGB" createVehicle getPos _x;
} forEach ([car1,car2,car3] select {_x inArea thisTrigger});```
I am using respawn template "Tickets". I setup that every player have 3 respawn tickets locally to player. When player kills enemy AI, mission is adding additional respawn ticket to side of player for some reason. How to prevent adding respawn tickets to side when enemy is killed?
hey couple of zeus questions if anyone knows... can you select groups via script command? can you change the group icon?
Got a problem, maybe i did not understand how to use the remoteExec right. I use the simple bomb defusing script (https://forums.bohemia.net/forums/topic/196588-release-simple-bomb-defuse-script/) it works, when i use the init line from him. But as i use like 100 bombs ( protecting vehicles with this bomb, you have to defuse to use the vehicle) there is a performance problem - i guess while using to many while loops.
I did decide to use a function which only adds an addAction which then will add the bomb. In SP/MP it works, but not on dedicated. Did try many things, but no luck. Maybe someone has time to explain me, what im doing wrong?
I'll post now the code of the files
-> This is the script (rebru_fnc_protectVehicleWithBomb), which is in the init line of each vehicle ( the commented line was a try to get it working, but no luck on dedicated, on sp/mp it works)
Initline
init="call{null = [this, 30, false, false] spawn rebru_fnc_protectVehicleWithBomb;}";
params ["_source","_timer","_kit","_debug"];
//if(!isServer) exitWith {};
_source setVehicleLock "LOCKED";
_source addAction ["Fahrzeug knacken", rebru_fnc_addBombToVehicle, [_source, _timer, _kit, _debug], 1, true, false, "", "", 10];
//[_source, ["Fahrzeug knacken", rebru_fnc_addBombToVehicle, [_source, _timer, _kit, _debug], 1, true, false, "", "", 10]] remoteExec ["addAction", _source, true];
-> This is the script, which then should add the bomb (rebru_fnc_addBombToVehicle)
params ["_protectedVehicle", "_caller", "_actionId", "_arguments"];
_arguments params ["_source", "_timer", "_kit", "_debug"];
// Ursprungs Action lรถschen
_protectedVehicle removeAction _actionId;
// Fahrzeug mit Bombe ausstatten
{ null = _arguments execVM "Scripts\bomb\bomb.sqf"; } remoteExec ["call",0]; // Not working
//call { null = _arguments execVM "Scripts\bomb\bomb.sqf"; }; //Not Working
// Fahrzeug abschliessen, solange die Bombe noch aktiv ist
while { _protectedVehicle getVariable ["a3f_bomb_active", true] } do
{
sleep 1;
};
// Fahrzeug aufschliessen, wenn Bombe entschรคrft
_protectedVehicle setVehicleLock "UNLOCKED";
removeAllActions _protectedVehicle;
and as i said, in SP/MP this works, but not on a dedicated server - on dedicated Server it works until the line, where i want to execVM the bomb.sqf
Started scripting a gamemode recently... I'm so happy when we get rid of this shiet called SQF ๐
Your remoteExec on that line is not formatted properly
about that:
i read somewhere that running arma without dynamic checks (or whatever its called that tests for errors and writes them to logs) improves performance. is that true and how risky is it?
No risk if you don't care about the logs. This might be true in some context, but mostly doesn't help well
[[_arguments],"Scripts\bomb\bomb.sqf"] remoteExec ["execVM"]```
Hmm ok - thanks, i'll try it
Nope still the same - the AddAction "Defuse Bomb" (from bomb.sqf) is not added to the vehicle ๐
https://community.bistudio.com/wiki/setTriggerArea
is the third number (angle) height?
No, its the direction of the TriggerArea
yes, and therefore it is not necessary because a sphere is on every direction the same
yeah thats why i asked q:
trying to figure out why my gamelogic flags end up on ground level even when i place it further up in the eden editor
Try adding diag_log commands at various points throughout the scripts to see how far it gets
as in this badboy
https://i.imgur.com/AHZaH8S.jpeg
ends up on ground in the actual mission
It's possible game logics might be affected by gravity
Figure it out - your line was not proper its [_arguments,"Scripts\bomb\bomb.sqf"] remoteExec ["execVM"] - saw it in the logs - now it works! Thanks a lot
any suggestion on where i should start looking to solve this?
use the fifth parameter
https://community.bistudio.com/wiki/setTriggerArea (look for c at the end) -> c: Number - (Optional) trigger area Z size / 2, in meters. -1 for infinite height
oh angle isnt c
thats why i was confused about the height thing
i see now that c comes after the boolean
x)
does getPosATL ignore buildings and only care about the actual terrain?
would visiblePosition instead also take into account objects such as buildings?
Yes, or getPosAGLS
https://community.bistudio.com/wiki/getPosAGLS
does that even exist?
I mean. Allegedly https://community.bistudio.com/wiki/Position
One other question: Now the script is working, but when the defusing fails, the vehicle is moved away (30m) before it explodes - do you have an idea why this happens now? I'm clueless about that...
i could technically swap to https://community.bistudio.com/wiki/isTouchingGround but then i cant allow low altitude hovers since it will only check if its on ground. (assuming this command works on buildings too?)
Oh, hold on
getPosAGLS doesn't, but the commands listed on the Position page under PositionAGLS will help
could i instead look at the position relative to a gamelogic flag instead?
and check the vertical distance from the flag?
It's not anything in any of the scripts you've posted so far. It could be in the defusal script, but I haven't seen that.
doesnt appear to be a getPosAGLS?
ok, thx anyway - ill look further into it - because its not the helicopter which was moved, its a rocket fired - the helicopter was deleted (in the script). Seems to be, that the settings.sqf isnt loaded properly, because there the explosion type is defined.
Like I just said, that command doesn't exist by that specific name, but if you look at the Position page I linked, under the PositionAGLS section there is a list of commands that use it
For example, getPos
ah so getPos seems to default to AGLS from reading that entry
so i can basically just use getPos with no further scripting needed then?
Yo can someone explain to me wtf scope means, currently learning to write the configs and i keep getting an error about scope in one of my classes
gniiiiii
yeah ive already got the answer from someone else. i got confused because of the c part setting height and i just assumed c would follow b in the order, it was just sloppy reading by me
no worries, it just "triggers" me as a wiki writer ๐ no harm done ^^
Because c was added really late
Right track, wrong tree to bark up.
I think the problem was my ancillary script for making NatoGunnery shoot at an empty truck; I forgot to put a Sleep in a while-do that both gave the order to fire, and slips them a magazine. I think my script just chugged once their backpacks got full and it kept trying to pile rounds in like grandma heard they hadn't eaten since an hour ago.
Howdy all. Working on a build system script at the moment for a community project, Ive finished the script to my liking and everything was working perfectly using local hosted mp server, but then when moved to dedicated most of my add actions became client specific and other scripts failed to call at all. Is there some major difference between local hosted and dedicated mp with regards to evecVM usage that I'm missing??
Also. Trigger being placed by script only working on the player who activated the script which calls it. Doing me a major confused
Any clue how to remote control a turret? Using a console without a Zeus
local hosting is no different than single player
MP scripting is a whole other world
Hey guys!
Any way to spawn RHS OPFOR units (mod units) in AI Spawn?
In config viewer?
If it actually reads the faction, you can use setVariable and give it a custom faction
Yeah open the module config
See what function it uses
Then open the function in function viewer
Got it! Thanks bud!
Np
I'd like to apply some basic syntax highlighting to strings similar to this
"1. Call in support elements and secure <marker name = 'BIS_mrkDorida'>Dorida.</marker><br />2. Locate the enemy's beachhead.<br />3. Destroy any hostile units encountered there."
Basically anything between < and > should be highlighted. What's the best way to do that?
I tried regexReplace but there seems to be no way to replace every single match with the replace string (at least I dunno how)
Hello all. I'm working on an ambitious project and joined here to seek some help along the way
Nevermind. My regex was screwed 
@warm hedge , @winter rose , So, is it a bug with Eden editor when it's not possible to create shape markers via create3DENEntity ?
Yes it probably is.
create3DENEntity expects a CfgMarkerClass but shape markers are no class.
mayhaps, dunno
@blissful flower I'd open a ticket on the FT if I where you. Chances are good it's going to get looked at.
@cosmic lichen feedback.bistudio.com right?
yes
wait no 
wait yes 
Lol ๐ Thanks
theoretically, could I use an array to add multiple items with BIS_fnc_addCommMenuItem?
a comm menu is an array anyway 
but no
So I would have to add a new BIS_fnc_addCommMenuItem function for every single comm Item in my description?
did you create a custom menu yourself?
Yas
like I said, they are arrays themselves
you can append the items you want to the menu array
then reopen it to see the effects
what exactly do you mean by that
this is what a comms menu is:
My_Comms_Menu =
[
["Menu Name",true],
["Item Name", [], "", -5, [["expression", "code"]], "1", "1"]
]
it's just an array
Yea, so is that the one in the description? Cause mine looks kinda different
if you want to add something to it:
My_Comms_Menu pushBack ["New Item Name", [], "", -5, [["expression", "code"]], "1", "1"]
no that's the scripting way to create it
ah okay, I have pre defined ones
Soo Remote Control of turret? Without being Zeus
_menu = _unit getvariable ["BIS_fnc_addCommMenuItem_menu",[]];
and turret not being UAV?
https://community.bistudio.com/wiki/remoteControl
or
selectPlayer and switchCamera
Thanks!
@fervent kettle if you have no idea what that is, look at BIS_fnc_addCommMenuItem
Had a look but I don't really get it
how do you use the BIS_fnc_addCommMenuItem function rn?
[player, "cCMag"] call BIS_fnc_addCommMenuItem;
but I would like to add more menu items at once
you can just use a loop
why not do that?
{
[player, _x] call BIS_fnc_addCommMenuItem;
} forEach ["cCmag", "bla", "blabla"];
@fervent kettle you can also do it this way:
#arma3_scripting message
_menu = player getvariable ["BIS_fnc_addCommMenuItem_menu",[]];
_menu append [
["New Item Name 1", [], "", -5, [["expression", "code"]], "1", "1"],
["New Item Name 2", [], "", -5, [["expression", "code"]], "1", "1"],
["New Item Name 3", [], "", -5, [["expression", "code"]], "1", "1"]
];
(without predefined items, so that you can have dynamic menus)
I think that's the easier option for me. But it only added the first thing
what are you adding?
show me the code
wait, typo
Hey does someone mind going over something simple with me that i really need to actually learn because its probably useful as fuck
I know roughly what it is, but i dont know how to write it
If i have a group of units with the group variable name 'groupA' (for an example)
Is there a way i can affect all units within that group by using forEach or something else?
For example
forEach unit in groupA;
disableAI "PATH";
this is probably written wrong and most likely wont work, but hopefully someone gets the idea of what im trying to do ๐
units
Is that all that needs changing?
no 
I was gonna say lol
{
_x disableAI "PATH";
} forEach units groupA;
So i also wrote it backwards ๐
it was completely wrong 
- no {}
- backwards as you said
- disableAI was noneense (you're using it as a unary command)
Im assuming _x just means any unit within the group
Ah, well thanks a lot anyway ๐
apply ๐ฟ
no
no ๐
but apply more elegant (bc its edgy)
https://community.bistudio.com/wiki/Code_Optimisation#Iterating_elements
apply also returns an array you don't need
and forEach is more human-readable anyway
human readable is the opposite of elegance, is what my college prof told me
code is meant to be read by hoomans
always code as if the future guy maintaining your code has the keys to your placeโฆ and a gun
don't get me wrong, I love the audacity and beauty of one liners ^^ but I keep them for custom projects, nothing that would be released
(and I love refactoring, too)
Hey, does anyone know how to stop AI from re-spawning at spawn point? They seem to be spawning non-stop! I want them to stop spawning at a trigger.
Wouldn't it be better to spawn on a trigger? So the spawn happens when you want.
hey hey, where do i complain about broken module (weather change in zeus)
make a ticket on feedback tracker
Will do thanks
@spark turret I don't think elegance necessarily has to be at odds with readable but if it's a choice between them, absolutely pick readable
like in my mind elegant code is simple, and simple is usually readable
Hi, is possible to somehow get mass of weapon?
I find that for magazines, but not exists in weapon config
it does afaik
@dusky pier ```sqf
configFile >> "CfgWeapons" >> _wpn >> "WeaponSlotsInfo" >> "mass"
or
```sqf
configFile >> "CfgWeapons" >> _wpn >> "ItemInfo" >> "mass"
for items
thank you a lot! ๐
note that the mass unit is arbitrary (it's probably ounce)
Iirc that field is useless. But inventory size resembles mass
I use this to keep a set of items that fit exactly into my pre-selected backpack, vest, and uniform ๐
how do I get the player name of a unit controlled by a player?
what does player return?
does it return the object name, or the player's name?
name player 
ok thanks
it returns the object
ye
I remeber, my first script was using weapon mass, since i couldnt read that from config, i did the only logical thing.
On gamestart an invisivle unit is created. Weighed, addweapon, weighed, noted in array, next weapon
Am I doing it correctly if I put this in onPlayerKilled.sqf? should I use params instead?
_oldUnit = _this select 0;
_killer = _this select 1;
_killedPlayerName = name _oldUnit;
_killerName = name _killer;
params does the same thing
plus it's shorter
ok
when I do params, do I need to do the full array or can it just be for the first couple elements of the array (the ones I need)
params ["_oldUnit", "_killer"];
_oldUnitName = name _oldUnit;
_killerName = name _killer;
only the ones you need
but note that if you don't need something in the middle, you should skip it with "" (not just leave it out completely)
e.g.:
params ["_oldUnit", "", "_nextStuff"]; //skipping the killer
yeah makes sense
thx
np
can I remoteExec a function? such as BIS_fnc_dynamicText? the execution is spawn.
thats exactly what remoteExec is for ๐
[parameters for function] remoteExec ["nameofmyfunction",numberfortargets];
ok
["uwu"] remoteExec ["hint",2,true];
pretty much, but the right argument is a bit more complex. it needs teh number for target machines and the JIP bool
yeah
np
Hey, quick question
So I'm launching a dedicated server from the launcher for testing purposes
But I want it to load a specific profile which has custom settings for difficulty
How would I go about specifying the -name parameter within the launcher server settings? Will the server listen for that?
if a player dies without getting killed by another player, would the variable _killer in onPlayerKilled be nil?
params ["_oldUnit", "_killer"];
_oldUnitName = name _oldUnit;
_killerName = name _killer;
so if the death message just says "Player was killed." then _oldUnit and _killer are the same?
ok
how would I disable collisions for an object?
(for multiplayer)
is there an easy way to disable accessing inventory of dead players?
thanks
this is all I have so far. How do I use this to make it so players can't open their inventory?
player addEventHandler ["InventoryOpened", {
true;
};
You can use true in the event handler scope to override the opening of the inventory.
is this correct now?
and the wiki says that the unit doesnt have to be local when you add the event handler, but it must be local for it to trigger.... does that mean it will work if I put this code in initPlayerLocal.sqf?
Yes
ok, thanks
You can put it in initPlayerLocal.sqf. The event handler won't be destroyed so you only need to add it once.
yep
I just read your context.
This will prevent the opening of all inventories by the player, not just dead bodies.
To make it prevent the opening of a dead body's inventory only, you'll need to use targetContainer. I can't help you with that though because I've never used it before.
yeah I know
i never mentioned it, but its more convenient to just prohibit opening inventories in general
If the two objects you want to disable collision between aren't PhysX objects, you can use this.
Will this event handler remain on the player if they respawn?
player addEventHandler ["InventoryOpened"], {
true;
};
I tried putting it in onPlayerRespawn as well as initPlayerLocal and it is still not working. I can open my inventory just fine
nvm im stupid
Whats the proper way to do this? neither of these ways work:
waitUntil { player !inArea "myMarker" };
waitUntil !{ player inArea "myMarker" };
waitUntil {!(player inArea "myMarker")};```
the goal is to make the player invincible only while inside spawn. I dont understand why this code is making the player always be invincible. this is in initPlayerLocal.
while { true } do {
waitUntil { player inArea "SpawnMarker" };
player allowDamage false;
waitUntil { !( player inArea "SpawnMarker" ) };
player allowDamage true;
};
I know there are other ways to do it, and for now I am doing it this way, which works:
while { true } do {
sleep 1;
if ( player inArea "SpawnMarker" ) then {
player allowDamage false;
} else {
player allowDamage true;
};
};
I prefer using waitUntil though because if I use an if then else statement, then I have to add a delay for performance and that leaves a small window of time where you could potentially still take damage in spawn.
I just dont see how there would be a situation where the player is not inside the spawn marker, but they are still invincible
@past wagon If it supposed that you can return to spawn and you need the damage to be disabled again, you better to run PerFrameEventHandler to check position.
[{
_handle = _this select 1;
(_this select 0) params ["_player"];
if !(alive _player) exitWith {
[_handle] call CBA_fnc_removePerFrameHandler;
};
_player enableDamage !(_player inArea "SpawnMarker");
}, 1, [player]] call CBA_fnc_addPerFrameHandler;
"and that leaves a small window of time where you could potentially still take damage in spawn."
You can set the time interval to one frame: ...}, [player]] call CBA_fnc_addPerFrameHandler;, it is identical to waituntil, but I wouldn't recommend to use per-frame checking in complex missions.
"that leaves a small window of time where you could potentially still take damage in spawn."
So just disable damage at entity spawn, with EH ๐
Also you can use events to enable/disable damage, like EntityRespawned + EntityKilled, or MPRespawn + MPKilled.
I recommend 1 or 2-second PFH + EH to detect kills/respawns, it is much more reliable.
thank you
I will update script soon. next thing I will look into the CBA scheduler to improve performance if needed
anyone happen to know the ppEffect for really darkening a players screen when incapacitated?
or u can very easily setAperture
im already applying a setaperture
its in tunnels on SOG dlc
right now when the player goes down, their head can glitch thru the wall and they can see the entire tunnel network outside geometry
so i want to apply real darkening when they go down in tunnel
cutRsc "BLACK" then ๐
bis_revive_ppVig ppEffectAdjust [1,1,0,[0.15,0,0,1],[1.0,0.5,0.5,1],[0.587,0.199,0.114,0],[1,1,0,0,0,0.2,1]];
bis_revive_ppBlur ppEffectAdjust [0];```
haha
I dont really understand how already setting an aperture is preventing u from setting a new aperture but okay ๐คจ
using setApertureNew I hope btw
maybe it doesn't, i dont know too much about these screen/lighting effects
Whatever you feel more comfortable with, aperture is just a set of numbers for received light
i am just hoping there's a number in the above ppEffectAdjust code i change to darken it
syntax is unclear so will need a bit of trial and error i guess
Hence, aperture is the easy way ๐
it will
like i am using it in a loop, and there is no variable name for the setaperture effect that i can see
have a global var you increase / decrease
yea
setApertureNew [-1];
};
if ((_value >= 0) && (_value < 50)) exitWith {
setApertureNew [3,3,3,1];
};
if ((_value >= 50) && (_value < 250)) exitWith {
setApertureNew [12,12,12,1];
};
if ((_value >= 250) && (_value < 500)) exitWith {
setApertureNew [15,15,15,1];
};
if ((_value >= 500) && (_value < 1000)) exitWith {```
basically just an alias function of the vn_fnc_tunnel_aperture function
why would overwriting it be a problem, record the values before you get incapacitated, apply your own, once changed, put it back
didnt even know about that command
so i have changed to
(player getVariable ['QS_client_inTunnel',FALSE]) &&
((lifeState player) isEqualTo 'INCAPACITATED')
) exitWith {
setApertureNew [75,75,75,1];
};
if (_value <= -1) exitWith {
setApertureNew [-1];
};
if ((_value >= 0) && (_value < 50)) exitWith {
setApertureNew [3,3,3,1];
};
if ((_value >= 50) && (_value < 250)) exitWith {
setApertureNew [12,12,12,1];```
I'm a bit confused about the "params" command in SQF scripting.
I'm trying to say that an array is a parameter and can only contain strings.
Would I go about implementing such a thing like this?
params [...
["_information", [null, null, null], [[str, str, str]]]
];
looks okay yes
trial and error is your best bet
I don't think null does exist?
I looked it up and changed it to nil within my script haha
not like this no
params [
[
"_information", // var name
[], // default value
[[]] // expected data
]
];
then you check if isEqualTypeAll @floral steeple ๐
I even more confused lol
you cannot check an array content with params like you want to ๐
params [
[
"_information", // var name
[], // default value
[[]] // expected data
]
];
if !(_information isEqualTypeAll "") exitWith { ["not all info was string"] call BIS_fnc_error };
so something like:
params [
["_id", "", [str]],
["_information", [], [[]]],
["_destination", [], [[]]],
["_type", "", [str]]
];
if !(_information isEqualTypeAll "") exitWith { ["Not all data in Information was a string"] call BIS_fnc_error };
if !(_destination isEqualTypeAll 0) exitWith { ["Not all data in Destination is a Number."] call BIS_fnc_error };
could work?
str is a command, not a data type
Yup ๐
ah okay thanks
also
I have one more question to see if something like this would work haha
[[blufor, false] call BIS_fnc_sideColor] call BIS_fnc_colorRGBtoHTML;
Nested calls are okay, yes
ah alright, just making sure
However, in this case you have an excess pair of square brackets. When BIS_fnc_sideColor returns, the expression looks like this:
[[r,g,b,a]] call BIS_fnc_colorRGBtoHTML;
```But `BIS_fnc_colorRGBtoHTML` expects this:
```sqf
[r,g,b,a] call BIS_fnc_colorRGBtoHTML;
ah
just for readability's sake, don't one-line that ^^
Personally, I hate introducing variables for one-time use 
Same. I come from C and C++ so I've just learned "Don't assign variables if they're not needed long-term."
well if there was an optimizer, it wouldn't really cost anything
code is meant to be read by hoomans
but doing that its +2 sqf instructions
Are there ways to create variables via the Description.ext file then?
โฆwat
because I'm going to be using the sideColor's HTML value HEAVILY
(I'm writing a dialogue system)
you can define values in Description.ext yes
see getMissionConfigValue iirc
my memory hasn't failed me! \o/ this time
lol
use a hashmap instead
I-
There are only four relevant sides, I'd just make four global variables in some init script and be done with it.
yeah I dunno where I'd put them though to be honest
besides I think it would be a little cooler to have custom colors for the enemies and the player's team and what-not
When you use a composite function in a one-liner, does the memory of the inner function get freed after the line has completed or does it wait for the sqf to finish?
Damn I didn't realize Arma had hash maps, and here I was using setvariable and get variable to do the same exact thing
define in some init file
rif_sideColorsHexHash = [west, east, resistance, civilian] createHashMapFromArray (["blufor", "opfor", "independent", "civilian"] apply {
private _key = _x;
["r", "g", "b", "a"] apply {profileNameSpace getVariable format ["map_%1_%2", _key, _x]} call BIS_fnc_colorRGBToHTML
});
// usage
private _westColor = rif_sideColorsHexHash get west;
a code blob is just a refcounted pointer
that's a bit too advanced for my tastes
I have absolutely no idea what that is, does, nor used for.
Is it possible for AI to perform task upon spawning, like garrisoning, patrolling and defending? Given that they were just spawned on a marker using a trigger
BIS_fnc_taskPatrol & BIS_fnc_taskDefend
Should I add them after the spawn lines in the script?
haven't tested it, but it's probably better if you run those functions after the units have spawned in
That is not possible as I will have no control over them or zeus (No zeusing, totally autonomous mission. Everything will be activated via trigger). Never mind, I think I found how to put it in use. Will post it here once I've done it
Anti-bouncing script for planes with bugged physics:
https://youtu.be/4QWO9lk8csw
https://youtu.be/IlkK6agy_Xw
_veh addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
if (canMove _unit) exitWith {};
// Plane is crashing
if (((getposATL _unit) #2) > 100 && {_unit getvariable ["OT_planehandler",-1] isEqualTo -1}) exitWith {
_planehandler = [{
_handle = _this select 1;
(_this select 0) params ["_unit"];
if (((getposATL _unit) #2) < 20 or {isTouchingGround _unit}) exitWith {
[_handle] call CBA_fnc_removePerFrameHandler;
};
_unit setvariable ["OT_speed", velocity _unit #2, false];
}, 2, [_unit]] call CBA_fnc_addPerFrameHandler;
_unit setvariable ["OT_planehandler",_planehandler,true];
};
if ((isTouchingGround _unit or ((getposATL _unit) #2) < 15) && {isNull _instigator} && {_selection == ""} && {_hitPoint == ""}) exitWith {
_unit removeAlleventhandlers "handledamage";
if (_unit getvariable ["OT_speed",0] < -50) then {
"LIB_SC50_Bomb" createVehicle [getpos _unit #0, getpos _unit #1, 0]; // Any object to explode
deletevehicle _unit;
private _objects = nearestTerrainObjects [getpos _unit,["TREE","SMALL TREE"],15,false,false];
{
_x setdamage 1;
} foreach _objects;
};
};
};
];
is there a way to get the names of all mission layers and their folder strucutre?
never mind, getMissionLayers does that
wierdly it didnt show up in my google and biki search
Well if it does not work, their is a mod called 'No more aircraft bouncing' ๐ฅด
"their is a mod called 'No more aircraft bouncing' "
It does nothing beyond setting z velocity to -1, decreasing plane's vertical speed
So I made this.
Maybe you can make it a mod also
does arma support structs? ๐
hey i made something similar! cool
wat
struct dog {int legs; int eyes; function bark();};
No
shame
SQF doesn't even support classes, why would it support structs?? ๐
idk, wierd magic
structs come before classes ๐
hm i guess i could build my own struct support
or i wont and just live with what i have ๐
Just use arrays + defines
That's what I used to do 
wanted to say "OOP", but SQF has SOME KIND of OOP ๐
hashmap, then you got your properties and fast access ๐
am I correct in understanding that when using params all variables are passed into the private variables as copy-by-value and not as a reference to the original variable?
As in, if I have an array and do
private _arr = ["value1", "value2"];
_arr params ["_item1", "_item2"];
_item2 = "new value";
(_arr select 1) == _item2 // this would be false?
actually, why am I not just testing this ingame.... nwm
^yet another example of rubber-duck debugging. Didn't realise how easy I could test it until I typed it out ๐
Is there any way to get the length of an sound file like .ogg dynamically so I know how long to "sleep" for to allow it to play to the end?
Or am I required to "hardcode" that information?
hardcode IIRC
alright cheers. Function with big switch-case, it must be then ๐
Arrays are passed by reference
depends on the use case, what are you doing? ๐
Hashmap
Sound module that will repeat a sound until conditions are fulfilled. So to know when to initiate the next play of the sound I need to know the sound length so I don't overlap.
yep indeed. you could also use some CfgSFX or IDR what
that is not a bad idea. Guess I could just key the classname of the sound. And define the variables for that sound in preinit
Ohhh. I did not realise CfgSFX existed. That seems to do the repeating for me. However I don't think I can dynamically set the delay between the repeat. In some cases I might want to repeat a sound as soon as it finishes, in others I want a delay between repeats of x seconds.
Although for atmospheric or machining sounds it seems very handy with CfgSFX.
If I change _item2 = "new value"; in my previous example, the original value in the array is not changed? I assume that is because I don't use set. But if they are passed by reference to params shouldn't the changes to the private variables reflect in the original array?
Or am I choking on the concepts here? ๐
Can you create a simple object using the vehicle's model instead of leaving no wreck on the crash site? It would be way more immersive like that.
And perhaps also a crater
is Bis_fnc_randomPos broken?
biki says you can input a center + radius, but that throws an error, internal to the function:
_pos = [[getPos player,500],["water"]] call BIS_fnc_randomPos;```
=>
```18:14:42 Error in expression <s, rectangular _this, -1]};
if (_this isEqualTypeArray [[], 0, 0, 0, false]) e>
18:14:42 Error position: <isEqualTypeArray [[], 0, 0, 0, false]) e>
18:14:42 Error isequaltypearray: Type Number, expected Array
18:14:42 File A3\functions_f\Misc\fn_getArea.sqf..., line 30
18:14:42 Error in expression <s, rectangular _this, -1]};
if (_this isEqualTypeArray [[], 0, 0, 0, false]) e>
18:14:42 Error position: <isEqualTypeArray [[], 0, 0, 0, false]) e>
18:14:42 Error Generic error in expression
18:14:42 File A3\functions_f\Misc\fn_getArea.sqf..., line 30
never mind, syntax error on my side.
one of the examples says _randomPosAroundPlayer = [[[position player, 50]],[]] call BIS_fnc_randomPos; Might need an extra array around them?
yeah that was it
๐
all assignment operations in sqf are copies, except for arrays/hashmaps, which creates a reference to that array
that applies to params, =, etc.