#arma3_scripting
1 messages Β· Page 656 of 1
I assume you already know transportation. I don't know of more efficient methods, for example with EH, but you could run a while loop with a reasonable sleep time. In each loop, you can check whether all the units within a certain group are inside your helicopter. If they are, activate a waypoint otherwise keep waiting.
ooor use synchronised waypoints
Can you tell me in one sentence what synchronized waypoints offer over normal waypoints?
They wait for each other to complete before activating
two groups, two "MOVE" waypoints - if one group reaches their first waypoint, they will wait for the second group to reach its first waypoint as well before proceeding
@spark turret basically, good things, especially when wanting to synchronise getin/load/getout/unload waypoints
do they require anything special or is it just adding a "(this && Group1WPComplete)" condition into the waypoint?
no need for code, just sync them through Eden Editor
I know, we are not used to such simplicity π
Does it work as well for script created waypoints or is it some script magic that only allows for editor waypoitns bc it runs on missionstart?
I think you can synchronise script-created waypoints with a waypoint command yes
like, synchronizeWaypoint π
https://community.bistudio.com/wiki/synchronizeWaypoint
Thats very neat. Definetly will try that out for a synchronized ambush or similar
Guys, I am trying to do a motion scanner script that will show dots on the GPS when it detects agents (aliens) near the player, is there any way to detect if the GPS interface is visible for the player, this is the fnc so far:
vMotionScanner = {
params [
["_unit", objNull, [objNull]],
["_motionScannerDistance", 100, [100]], ["_detectEnemyAgents", true, [true]]
];
if (isDedicated OR !hasInterface) exitWith {};
vMotionScannerRunning = true;
private _nearObjects = [];
private _motionMarkersArray = [];
private _maxMotionMarkers = 10;
if (_detectAgentEnemies) then {
while { vMotionScannerRunning } do {
if ("ItemGPS" in (assignedItems player + items player)) then {
private _nearObjects = agents select {agent _x distance player < _motionScannerDistance};
_nearObjects = _nearObjects select {side _x isNotEqualTo side group player};
if (_nearObjects isNotEqualTo []) then {
[player,"minedetected"] call vPlaySound;
for "_i" from 1 to _maxMotionMarkers do {
{
if( !(player isEqualTo _x) && (vehicle _x isEqualTo _x) ) then {
if(abs speed _x >= 3) then { playerSide reveal _x; private _xName = name _x; private _marker = createMarkerLocal [_xName, position _x]; _marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "DOT"; _marker setMarkerColorLocal "ColorGUER"; _marker setMarkerSizeLocal [0.5, 0.5]; sleep 0.2; _marker setMarkerSizeLocal [1, 1]; sleep 0.2; _marker setMarkerSizeLocal [1.4, 1.4]; sleep 0.2; deleteMarkerLocal _marker; }; }; } forEach _nearObjects;
};
};
};
sleep 0.5;
};
};
};
just reviewing the A3 updates; surprised we are only now seeing bits like HashMap or even continue and break commands, for that matter.
I think continue and break were already in the dev builds before this
in the dev bits, yes, just now being pushed for general consumption.
I agree with that, then.
It was a bit surprising seeing them not for general consumption before.
Q: re: https://community.bistudio.com/wiki/attachTo
in particular followBoneRotation, meaning when the host object rotates, moves, etc? attached objects rotate/move with it seamlessly?
boy, wow, or addition of https://community.bohemia.net/wiki/isNotEqualTo who knew
no more !(... isEqualTo ...)
not only host object, but sub bones of the object.
Afaik it already rotated with object previously, but on humans for example only with the whole body, not the head specifically
@still forum huh that's interesting. so, if I understand correctly, let's say we have resources attached to a spill bund, for instance. when the bund rotates, moves, etc, the attached objects move with it?
ye
visibleGPS is true when the GPS mini screen is showing right?
That's what the description says right?
@cosmic lichen
Checks if the player has GPS receiver opened and visible
So by receiver opened and visible it means the GPS mini gui
Checks if the player has GPS receiver (minimap) opened and visible.
Better?
@cosmic lichen yes sir
Anyone who happen to know a ScriptingCommands that changes the units "init" box of for example all the "B_Pilot_F" on the map on a global scale ?
I don't get the https://community.bistudio.com/wiki/setVehicleInit to do it..
setVehicleInit is disabled in Arma 3, as described on the wiki page
use init.sqf (or initServer.sqf) combined with forEach, units west, and select {(typeOf _x) == "B_Pilot_F"}
roughly:
_targetUnits = (units west) select {(typeOf _x) == "B_Pilot_F"};
{
// whatever code you want to apply to the units, with _x referring to the unit in question
// don't forget remoteExec if this code may need to be applied to player/non-server units
} forEach _targetUnits;
units west β€οΈ
Wait is it out now?!
yes
π₯³
Now we wait for someone to report it being broken
works fine in SP at least π
it uses engine side (the allUnits command actually just grabbed all sides, and merged them into a single array) side.
probably issue if you spawn a opfor unit, and put it into a blufor group so it becomes technically blufor or such shenanigans
In that case I would expect it to consider the unit to be blufor, as is the case for side command
I didn't try it.
And if it would not work as you want to, it would be terribly annoying to fix
This works fine:
_u = createGroup west createUnit ["B_soldier_F", getPos player, [], 0, "NONE"];
_u setVehicleVarName "tempUnit";
systemChat str units west;
[_u] joinSilent createGroup east;
systemChat str units east;
Also works fine after setCaptive
after setCaptive is civilian or old side?
I'm sure there will be people who want either of these, and will consider the other to be a bug π
As far as I'm concerned, matching the result of a side command check is the most consistent functionality and it should stay that way
old side
captives are not technically civilians (depends on their group)
but this doesn't work (wish it did):
units sideEnemy
I think it always checks the group's side
what does sideEnemy return? it should just return EAST probably?
oh a seperate side
They are probably still in their group side tho?
yeah
but their side is ENEMY (their group's side could be something else like west)
uff.
Well I'm fine with that
Maybe its easy to fix. But I already closed everything so not gonna check
It's fine
you can always loop thru all units

btw sideLogic works tho
units sideLogic
is there not in [] ?
no
sad
also I think you meant notIn
or an exit boolean
right I'm not sure yet the efficacy of an breakWith or continueWith, but I'm sure it has its use cases
they're used for loops that need to return something
such as apply
select
waitUntil too maybe?
hmm okay so if I had a LINQ style, first, min, etc
I could breakWith from a select, then
I would appriciate selectFirst, some equivalent of findIf for select
I don't think it merits a new command
but if devs have free time, why not ^^
it doesn't
ACE people wanted notIn and findAny (_array findAny [1,2] returns index to first 1 or 2 in _array)
I would rather it was used for "cooler" things π
they dont
here: have one free time :p
so maybe a dumb question, some help with the usage would be grand. show the syntax how it is used. is breakWith for instance like exitWith?
it doesn't execute code like exitWith
so probably less "overhead"
ah ok...
_values = [1, 2, 3, 4];
for [{_i = 0}, {_i < count _values}, {_i = _i + 1}] do {
if ((_values select _i) > 2) then {
breakWith (_values select _i);
};
};
// 3
don't use that version of for 
it's slow
but... that for loop is bad, and why would anyone return a value from a counting for loop :U
Intention is apply/select/waitUntil n such
and it doesn't exit nearest scope like exitWith, it exits nearest loop
also that could be rewritten using findIf
right, but I'm not looking for findIf examples here
Well at least don't use that hideous for syntax 
also not sure about continueWith per se... this yields 4:
_values = [1, 2, 3, 4];
for [{_i = 0}, {_i < count _values}, {_i = _i + 1}] do {
if ((_values select _i) > 2) then {
// ^^^^^^^^^^^^^^^^^^^^^^^
continueWith (_values select _i);
};
};
whereas I think this yields nil:
_values = [1, 2, 3, 4];
for [{_i = 0}, {_i < count _values}, {_i = _i + 1}] do {
if ((_values select _i) < 2) then {
// ^^^^^^^^^^^^^^^^^^^^^^^
continueWith (_values select _i);
};
};
maybe there are clearer use cases
typo corrected
@little raptor I don't know what it "needs" to return; again these are academic, seeking illustrations of the commands
kicking the tires if you will
I told you
only stuff like select/count/findIf/apply need to return something
focused here on breakWith, continueWith
select {
//blabla
true //return
}
why wouldn't a for loop not be allowed to return something, or better said, break out of it when the loop shouldn't run anymore?
and yes; **With will return something which doesn't make sense in a for loop
as the documentation states, for instance, continueWith, breakWith, Skips current loop iteration and continues with the next one and returns given value, Skips all loop iterations and returns given value, respectively. so what. so what's a practical usage.
The loop itself can return something
I'm saying the code INSIDE it doesn't need to return something for the loop to work
But select/count/findIf/apply do
(the code they run as they loop needs to return bool)
well, sidebar, for starters, apply does not return a BOOL, per se. it can, but it is a transform more than anything else.
I'm saying its CODE
array apply code
right, and the thing returned by code can be literally anything.
well yeah
that just got lumped into the rest ( I meant select/count/findIf codes should return bool)
from a pragmatic perspective, would have to experiment to discover cases that really worked for breakWith continueWith I suppose
fair enough, yessir, code as predicate, in those cases
is there a way to force helicopter hover less than 50m above terrain ?
flyInHeight/ASL
I am using those, but heli stays at 50m above, it does not go lower
hover, not fly, right?
yes
I am already afraid to ask, but⦠mods?
give it a move order
I think the AI don't respect flyInHeight unless there's a move order
Like doMove
or waypoint
is there a getPos that return pos with Z set as 0 ?
(getpos _x select [0, 2]) + [0] ?
don't use getPos for that
but anyway I think this does:
private _pos = getPos _vehicle;
_pos set [2, 0];
_vehicle doMove _pos;
_unit getPos [0,0]
doMove destination must be AGL
@still forum it works
and is fast
not if the object is floating
yes if the object is floating
getPos [0,0] returns above ground level height
it's not getPos
if object is floating, its non-zero
it's an alternative broken syntax
https://community.bistudio.com/wiki/getPos
alt syntax 2
where z is land surface in format PositionAGL
ground level? I don't think so, according to the docs, origin getPos [distance, heading]
which is always 0
unless sea
not if floating/flying
ah ok I see
Try it if you don't believe me
I'm never wrong
getPos heli; // [10176.9,7043.75,105.743]
heli getPos [0,0]; // [10176.9,7043.75,0]
@still forum you lost this time ;3
"land surface in format AGL" either means. G == ground == land surface. So just z in PositionAGL.
Or that Z is always landSurface, in which case its nonsense to write that on wiki if the real answer is "where z is always 0"
Then wiki needs correction
no u :U
again
yeah wiki is wrong then.
in format PositionAGL AGL is above ground level for z.
But this thing returns THE ground level, not position above ground level
so I tried
private _vehicle = cursorObject; // B_Heli_Transport_03_F
private _pos = getPos _vehicle;
_pos set [2, 0];
_vehicle flyInHeight 10;
_vehicle doMove _pos;
heli don't go bellow 50
maybe set behaviour to safe ?
heli getPos [0,0] == (ASLToAGL getPosASL heli)
?
@winter rose Z appears to be terrain height (in AGL format)
no
Yeah then PositionAGL format is wrong
that won't return 0 for Z
We have invented a new position format π
Or rather some programmer on 1.55 did
here's code
res[2] = Landscape->SurfaceY(res[0], res[1]) - Landscape->SurfaceYAboveWater(res[0], res[1]); //AGL
Even says AGL as comment, but thats not AGL
getRelPos does the same
It's the ground level pos in ASL?
yeah
terrain surface, relative to sealevel if underwater. otherwise 0 except rounding errors
try 9, from my experience flyInHeight in range 10-50 always ends as 50m
but below 10m it's working fine
π
Its PositionAGL. But not height between ground and object (as any other command) but height between ground and other ground
flyInHeight has a limiter of some heights it doesn't let you do afaik. But for some reason when you go too low it lets it through again. There was a ticket about that last year, afaik KK looked at it and said no
yeah, as I said everything below 50m but more than 10m seems to default to 50m
but below 10 is fine.
holy Miller, I am scratching my head. it is working below 10
Here is real AGL code from ASLToAGL
// To make AGL subtract height above water surface
array[2] = pos.Y() - Landscape->SurfaceYAboveWater(pos.X(), pos.Z());
How you wanted to "fix" this? block below 50m or allow any value?
flyInHeight 0 is useful in waypointStatement on landed WP to ensure they don't fly away again.
I don't think I looked at it. I think KK did.
If it was me then I forgot
```cpp π
thats what I did :U

@little raptor Hey. You told me yesterday that it would be much easier to create an own weaponrandomiser script, did you by that mean one that would run in a mission or one .pbo wise (in my faction mod) cheers.
in your mod
So an sqf script that can be called in editor, placed in one units init box can also be called/used via CfgVehicles init eventhandler CBA of an units config?
not necessarily
depends how the script is written
fixed wiki
Thanks!
@hollow thistle That's even more wrong 
how it is wrong? I just tested it.
It's not getTerrainHeightASL
but over water 
It's terrainHeightAGL π€£
The previous description was correct
Just not well understood
yeah... kinda.
https://community.bistudio.com/wiki/drawIcon3D now lists offsetX and Y as something you can use to offset the text. Has anyone managed to get this to work?
changed it back just added one word so it's more obivous it's position of the ground
How is it possible to add a line of string ("Rifles") in the eventhandler of an units init config? ```sqfParameters:
Object - Unit
Category - String
Returns:
Nil
Examples:
(begin example)
[_this, "Rifles"] call cfp_fnc_randomizeWeapon;
(end)
How are they thinking? It's an template I'm gonna use..
what?
because they randomizing gear script that is working looks like this; ```sqf
Parameters:
Object - Unit
Returns:
Nil
Examples:
(begin example)
[_this] call cfp_fnc_randomizeUnit;
(end)
Well, I can't put this in an units eventhandler init ```sqf
[_this, "Rifles"] call cfp_fnc_randomizeWeapon;
Or can I?
Thanks for pointing me in the right direction.
Still something is off.
addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
remoteExec [
_targetUnits = (units west) select {(typeOf _x) == "B_Pilot_F"};
{
this addAction ["Open Garage",{
_pos = player getPos [25,getDir player];
BIS_fnc_garage_center = createVehicle [ "Land_HelipadEmpty_F", _pos, [], 0, "CAN_COLLIDE" ];
[ "Open", true ] call BIS_fnc_garage;
} forEach _targetUnits;
]
}
]
}
];
What am I lacking to make every AI helicopter pilot a garage spawning entity? (Which is accessible by an other player unit.)
In config you can only put strings in the init.
So it should be:
"[_this, 'Rifles'] call cfp_fnc_randomizeWeapon;"
(or you can call another function that does that)
this not defined
without the " right? so ```sqf
[_this, 'Rifles'] call cfp_fnc_randomizeWeapon;
Also this variant of getPos returns bad Z
see our discussion above
When you create a vehicle it should be placed on AGL position
Thanks for pointing that out. How do I define it? (/Find info on how to defining it?)
with the " "
also your remote Exec is wrong 
This small " might solve an issue I have had for days. I'm gonna dig in. Thank you so much. You're knowledge of all this is outstanding!
I'm gonna try if it works at first.
because it looks weird. Here it is from my perspective; ```sqf
init = "if (local (_this select 0)) then {_onSpawn = {_this = _this select 0;sleep 0.2; _backpack = gettext(configfile >> 'cfgvehicles' >> (typeof _this) >> 'backpack'); waituntil {sleep 0.2; backpack _this == _backpack};if !(_this getVariable ['ALiVE_OverrideLoadout',false]) then {_loadout = getArray(configFile >> 'CfgVehicles' >> (typeOf _this) >> 'ALiVE_orbatCreator_loadout'); _this setunitloadout _loadout;[_this] call CFP_main_fnc_randomizeUnit; "[_this, 'Rifles'] call CFP_main_fnc_randomizeWeapon;" [_this, 'USP_PATCH_IRN_ARMY_GROUND_FORCES'] call BIS_fnc_setUnitInsignia;reload _this};};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";
};
@fresh wyvern
https://community.bistudio.com/wiki/remoteExec
remote exec syntax is like this:
parameters remoteExec ["command", target, jip]
for target addAction [...], the command is addAction
parameters is
[target, [....]]
Use _x not this when inside a forEach, like I said in the original example
it's already in a string
can't you see it looks weird?
it stands out from the rest
it should've been GREEN like the rest
It's the extra " "
Simply put, remove " "
because it's already in a string
Did you try the last example?
Just as an FYI, Discord syntax colouring doesn't show up on mobile. So don't always rely on it to get the message across.
the " are already there
init = ".....";
@gilded rampart Be aware that it's v2.03 not 2.02
Yeah, just noticed that. Welp.
π
Yes. Cheers. But that makes me on step one again since I already have tested it and it reffered too an error in; ```sqf
if (count _array == 0) exitWith {};
(_array isEqualTo []) is faster
Yet, it's faster π
by 0.0001 ms which is due to measurement error π
Are you talking to me? @hallow mortar
Yes
(afaik it already uses count as a quick check)
Hold on. Launching Arma.
2 commands vs 1 command
Doesn't isEqualTo use count internally tho?
internally is not in sqf
engine internal is very different than SQF
You can retrieve errors from your rpt log without launching the game (though having the game open is useful for troubleshooting)
Why no one believes me π¦
Which is exactly why functionality makes less difference than number of commands.
A select loop is also creating a new array and pushBack'ing elements into it.
Now compare a select with a forEach that pushBacks into a new array and see the difference.
Same functionality but big difference
well for starter, you're a dog
rasis........ π
anyone know how setObjectScale is supposed to work in eden? the wiki says something about it being possible in eden editor but I'm not sure how I'm supposed to do it there
Eden has a debug console on top, in the top bar
Tools - Debug Console
((get3denSelected "Object") # 0) setObjectScale 0.1;```
Select a tank, and execute that in the debug console
But no in this case isEqualTo won't be checking count internally.
_array = [];
_array isEqualTo []
0.0016ms
_array = [];
count _array == 0
0.0023 ms
no measurement error
player
0.0014ms
player;player
0.0021ms
just the difference between number of commands and general SQF overhead
Here is the screenshot for full understanding. Cheers; https://ibb.co/f8yHpBm
_array is unkown
you have faster PC than I do.
But you can still see it. Its not measurement error
What are you proving here @little raptor I stated it's faster and it is. I didn't say its 5 times faster π
No hashmap support planned for publicVariables? https://community.bistudio.com/wiki/publicVariable
its supported
Also, personally, I think it's nicer to write and read
_array is undefined.
_array has to be defined within the same .sqf?
Much nicer
yes
Dedman's was much faster so I had to defend my honor that it's not THAT much faster 
added, F5 π


So dedmen, why are you programming on a potato?
yours was over 50% faster 
it served me well the past 8+ years since Arma 3 alpha
Hmm so it's the same potato I have. Bought 2013 for Arma 3 π
Man, 8 years already 
β¦10+ (but GPU)
Alright, I have to admit. I replace the GPU as well
GTX 275 started to be a bit slow yeah π
Same. But I still have my GTX 275 laying around here
I only have a potato 6yo laptop π¬
@still forum What is your CPU? There's no way in hell my laptop is faster than your PC
I watched your streams and it runs much better than mine 
Maybe you have an AV or something running
where is this discussion going ? π€£
FX-8350
it's good, he can see the perf issues more easily π
maybe also bad ram
That's really fast tho
Maybe Arma doesn't like it cuz it's AMD 
_array = [];
_array isEqualTo []
0.0005
_array = [];
count _array == 0
0.0005
you see, it's harder to measure these with fast cpu π¬
I get an error that says _targetUnits is not properly defined. What can I do to fix that?
_targetUnits = (units west) select {(typeOf _x) == "B_Pilot_F"};
addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
{
remoteExec [
_x addAction ["Open Garage",{
_pos = player getPos [25,getDir player];
BIS_fnc_garage_center = createVehicle [ "Land_HelipadEmpty_F", _pos, [], 0, "CAN_COLLIDE" ];
[ "Open", true ] call BIS_fnc_garage;
}
]
]
} forEach _targetUnits;
}
];
you're about two layers too deep
It's not "seen" by the EH
EH code executes "somewhere else"
don't do that event handler, put it in initPlayerLocal.sqf and don't remoteExec it if you want it to run every time someone joins and add the action for that player
Even if you made that variable global it would be invalidated by the time the EH code executes
so you should probably put it in the EH
That's technically accurate but still don't use the EH at all in this case
In all those layers of redundancy you would end up adding the action, for everyone, about a million times
lil side thing, but does the follow bone rotation bit apply to the new diorama base models?
That is something I am actively looking for which is basically the reason why I look for eventHandlers in the first place, to prevent triggering an action about a million times.
InitPlayerLocal will do it
yes, well, it didn't work. Hold on, I'm rewriting this
also your remoteExec was wrong but you don't need that either
it only executes when the player joins the server, and it only executes locally (which is what you should use for addAction)
Nice. Good to know. The same goes for init.sqf?
ok
{
_x addAction ["Open Garage",{
_pos = player getPos [25,getDir player];
BIS_fnc_garage_center = createVehicle [ "Land_HelipadEmpty_F", _pos, [], 0, "CAN_COLLIDE" ];
[ "Open", true ] call BIS_fnc_garage;
}]
} forEach _targetUnits;
this is all you need, put it in initPlayerLocal.sqf
and this one in the inti.sqf?
_targetUnits = (units west) select {(typeOf _x) == "B_Pilot_F"};
Hey its a good thing a dev is coding on a potato
They will notice the performances more

Any variable name that starts with a _ is a local variable, which means it only exists in the current scope (script or "level" of code)
also takes longer to fix it
Its an incentive to get it right the first time 
Anyone happen to have the mempoint for the new diorama model for it's rotation on hand?
So I have litteraly sit for an hour to try defining _array. (line 45)
Could someone check this small script and see what's wrong with it. Much appreciated; https://sqfbin.com/anifofigekefivesujim
how are you calling the script? (exact code)
[_this, 'Rifles'] call CFP_main_fnc_randomizeWeapon;
where?
In an units init eventhandler (CfgVehicles.hpp)
show the full init
init = "if (local (_this select 0)) then {_onSpawn = {_this = _this select 0;sleep 0.2; _backpack = gettext(configfile >> 'cfgvehicles' >> (typeof _this) >> 'backpack'); waituntil {sleep 0.2; backpack _this == _backpack};if !(_this getVariable ['ALiVE_OverrideLoadout',false]) then {_loadout = getArray(configFile >> 'CfgVehicles' >> (typeOf _this) >> 'ALiVE_orbatCreator_loadout'); _this setunitloadout _loadout;[_this] call CFP_main_fnc_randomizeUnit; [_this, 'Rifles'] call CFP_main_fnc_randomizeWeapon; [_this, 'USP_PATCH_IRN_ARMY_GROUND_FORCES'] call BIS_fnc_setUnitInsignia;reload _this};};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";
Does the unit actually have a config entry called RiflesList in its config?
No...
well then
randomGearProbability = 80;
headgearList[] = {"SP_M1Helmet_Iran",0.25,"SP_M1Helmet_Tan",0.45,"SP_M1Helmet_GrayDim",0.20,"SP_M1Helmet_Green",0.15,"iri_headgear_desert_camo_helmet", 0.30};
vestList[] = {"V_TacVest_khk",0.3,"CFP_Tactical1_ACRDesert",0.2,"CFP_Tactical1_3ColorDesert",0.15,"SP_Tactical1_Tan",0.15};
facewearList[] = {"CUP_Beard_Black",0.25,"CUP_FR_NeckScarf2",0.35,"CUP_FR_NeckScarf5",0.35,"CUP_G_White_Scarf_Shades",0.2,"CFP_Scarfbeardshades_tan",0.2,"CFP_Scarfbeardshades_green",0.2,"USP_ADVANCER_GU_SF2",0.15,"TRYK_SBeard_TK6",0.25,"TRYK_SBeard_BW6",0.3,"TRYK_SBeard_BW",0.25,"TRYK_SBeard_BW",0.3,"CFP_Scarfeard_white",0.25,"CFP_Scarfeard_white",0.25,"CFP_Neck_Plain2",0.25,"CFP_Neck_Plain3",0.25,"CFP_Neck_Plain4",0.25,"CFP_Neck_Plain1",0.25,"CUP_G_Scarf_Face_Tan",0.2,"CUP_G_Scarf_Face_Red",0.2,"CUP_G_Scarf_Face_White",0.2,"CUP_G_TK_RoundGlasses_gold",0.15,"CUP_G_TK_RoundGlasses_blk",0.15,"CUP_G_TK_RoundGlasses",0.05,"SP_Kneepads_Tan2",0.25};
uniformList[] = {"iri_u_desert_camo_1_uniform",0.6,"iri_u_desert_camo_2_uniform",0.4};
randomWeaponProbability = 80;
rifleList[] =
{"CUP_arifle_M16A1",0.35,"CUP_arifle_G3A3_ris",0.4,"CUP_arifle_FNFAL5060",0.35};
the randomgear work.
but not the weapons.
[_this, 'Rifles'] call CFP_main_fnc_randomizeWeapon;
so that has to be Rifle, I see.
private _category = format["%1List",_cat];
this line (42) uses the category you specify to generate a config reference. exactly as you specify it.
I still don't get the "units" part of this line to work..
_targetUnits = (units west) select {(typeOf _x) == "B_Pilot_F"};
why?
Are you on v2.02?
Also it might be case sensitive so watch out for that
Did it come out today?
it's not
configs are not case-sensitive
CFP_main_fnc_randomizeWeapon might be
we don't know whats in there
no, cuz I read the function before
it can't hurt to get the case right just in...case :U
yes. update time!
It should've already asked you to update if you were online in Steam π€·
Ok, might explain. Have had the game on for some hours now. I'll try restart.
It didn't
maybe you launched the game before the update π€·
gues so. It was 2.00.17 something.π
So now the primary weapon choice spawns but whenever it wants to select a random weapon the units spawn without the weapon.
remove the old weapon first
I told you this too
Only the one defined here spawns; ```sqf
weapons[] = {"CUP_arifle_G3A3_modern_ris_black"};
respawnWeapons[] = {"CUP_arifle_G3A3_modern_ris_black"};
I must have misunderstand, sorry.
remove the old weapon from the riflelist[] or from the code above?
I'm not hanging on.
This should be applied in CfgVehicles or the script.sqf?
It's a scripting command
isn't it applied here in a faulty way? ```sqf
// Check to see if we randomize Weapon
private _weaponProbability = getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "randomWeaponProbability");
if (random 100 < _weaponProbability) then {
removeAllWeapons _unit;
{
private _cat = format ["%1List",_x];
if (count (getArray(configFile >> "CfgVehicles" >> typeOf _unit >> _cat))>0) then {
[_unit, _x] call FUNC(randomizeWeapon);
};
} foreach WEAPON_CATEGORIES;
};
};
The removeAllWeapons thing I think we talked about.
Is there a newer version of arma 3 than 2.02.147284?
why don't you ask the person who actually designed the scripts?
I don't know how.
Honestly I just want to create my own randomizing weapon script and I am trying.
Sorry If I sound annoying.
Updated the game. This still doesn't trigger. On the bright side, I do not get the "units" error anymore.
_targetUnits = (units west) select {(typeOf _x) == "B_Pilot_F"};
{
_x addAction ["Open Garage",{
_pos = player getPos [25,getDir player];
BIS_fnc_garage_center = createVehicle [ "Land_HelipadEmpty_F", _pos, [], 0, "CAN_COLLIDE" ];
[ "Open", true ] call BIS_fnc_garage;
}]
} forEach _targetUnits;
it removes all weapons
then reads the config and replaces them
So why isn't it doing that?
what?
Probably because you didn't define all of them in the config
I only see rifleList
Removing the weapons and replacing them as defined in the config; ```sqf
randomWeaponProbability = 80;
rifleList[] =
{"CUP_arifle_M16A1",0.35,"CUP_arifle_G3A3_ris",0.4,"CUP_arifle_FNFAL5060",0.35};
this is definitely in initPlayerLocal.sqf?
if so, make sure all braces are closed, maybe try putting a ; after the last ]
can't think of anything else
@tough abyss also it is case sensitive like @hallow mortar and Dedmen said 
my bad
it should be rifle
not Rifle
Thank you all. Hope it works this time.

I am cursed! The units still spawn with either the G3A3 or empty handed. I'm going nuts. I'm gonna try doing some stuff. Also noticed when spawning an AT-men who shares the same init makes him spawn with the RPG and all WHEN the G3A3 spawns but when it spawns emptyhanded the RPG is also removed. So I guess the whole inventory is removed.
@tough abyss are you doing this now?
[_this, 'rifle'] call CFP_main_fnc_randomizeWeapon;
Also did you change the code?
Yes.
Did you change the function?
Or is it still the same?
I am referring to CFP functions
Did you change this function?
CFP_main_fnc_randomizeWeapon
It says this; ```sqf
Function: CFP_fnc_randomizeWeapon)
Let me explain.
The working randomising gear script works and it says this;
Function: CFP_fnc_randomizeUnit)
but it is called, like this; (and yes I did not change any script functions)
[_this] call CFP_main_fnc_randomizeUnit;
"unit addBinocularItem item" Adds weapon item, including magazine, directly to the binocular weapon. This is used for infantry weapons.: Does that means we can add regular weapons to the binocular slot?
No
all weapons have their own slots
So by "weapon item" it means "binoculars"
yeah
Cool
I think the phrasing is probably just a careless copy from the addWeaponItem page
Mention it in #community_wiki
Would have been cool to dual wield rifles with "B" π¦
Well now that attachTo follows the bone you can easily script it
Before people would have to use loops
Well yeah... even thou I hate attachTo in Multiplayer... but it works great for SP
You can always create a "mirror" of the weapon for the launcher slot.
I think I saw a mod on SW before that did this
Would it be too hard to unlock (on the engine) the launcher slot just to any launcher sized weapon?
Yeah
because it's controlled by the engine
it's not just hard
it's impossible
unless you're a dev
you can already put launchers in the launcher slot
But if a Rifle is the same size and even lighter than the launcher, why can't I put a rifle there? Realistically speaking...
Since Arma seeks realism
I can carry a rifle and a heavy launcher but not a rifle and a rifle... makes no sence
π¦
The devs that implemented the weapons system decided that
so now it is controlled by the weapon slot parameter in the config
You mean the previous "not as cool as the current ones" devs?
But in all honesty, there is no reason not to improve upon some of the previous decisions, unless it is too hard to fix thou
it can't be done now
since the animation system uses a special bone for the launcher, which is not compatible with the rifles
you can also make a rifle that goes into the launcher slot (with all its limitations) nothing stopping you from doing that
Yeah but I meant without mods!
Why would anyone carry two rifles
Now that was the technical explanation that sums it all
Arma still has some realism targets
A sniper rifle and a close quarters SMG
π€ breaching shotgun
SMG as secondary weapon
Breaching shotgun as secondary weapon
already exists in mods
But no need for that in vanilla
Second rifle also exist as mod π€·ββοΈ
mod get outdated and stop working on new servers
Even TFAR stable still works, and hasn't been updated for years...
We can spend the time making a feature that makes no sense for the base game, and that people who want to have it can already have via mods.
Or we can spend the time implementing new things that is useful for us and others and that mods couldn't do yet.
Bad mods/scripts are also bad when they're new
Pretty simple decision on that.
Are there any templates for weapon randomisation scripts? All I find on the googly woogly are scripts for missions and way more advanced than I need.
What do you need?
Just a simple scipt that randomises and choses a weapon from a list. And call this script via unit init eventhandler, not in mission. π
I'm a newbie in this guys, be nice π¦
Just get an array with items, get a random one from it and replace the current weapon
When, where and how you call it doesn't matter. Could even be called when placing an unit in 3den when you want
I couldn't agree more... but sadly there seems that there is so little features/content remaining that mods haven't tried to add/fix... hell there is even an amazing melee mod that truly turns Arma 3 into a decent melee game, and then we have female units mods that fix the lack of them in vanilla... and we have hundreds of amazing maps etc... so what else remains?
For me sometimes it is better if the devs make the coolest mods official and optimised so anyone can enjoy them...
Well obviously mods don't try to add features that aren't possible for mods to add
@Bohemianet = Developers/Progammers of Arma?
yes
wow cool. What was your jurisdiction/responsibility?
Was? juristriction?
Like what part of the game was more "your" part.
about 85% of the "Engine" changelogs since 1.98 update
Cool! Thank you for your work.
You wasn't one of those devs that got arrested taking those pics?
no no
Dedmen was hired recently
"so what else remains?"
object scaling, hashmaps, workshop compositions, 64bit linux server, linux server at all, engine features to allow community to make their own firing drills, better performance, inter-mod magazine compatability, new detailed missile simulation, tank vehicle interiors, advanced damage model for tanks, general new customization abilities via new script commands or config entries to open more things to modding, The 3DEN editor, Zeus, new aircraft HUD system, ...
Mods don't do that stuff, because they LITERALLY can't, and you also won't see mods attempting it because they will always fail and thus you never hear about them as they also never get released.
You really want us to spend the time copying things that are already there, instead of doing all of the above?
Go back to Arma 3 version 1.0 and have fun then. Without mods of course, because many mods won't work and wouldn't exist today without the new features we added.
prob one of the features I have seen a lot of people want is the CPU compatibility and 1-core issues.
However, y'all work is really appreciated bringing this wonderful game in it's state.
including the people in this helpful community.
The game supports multi threading
But sadly not done properly
so the AI couldn't be multi threaded?
It's single threaded afaik
What parts of AI are expensive enough to make it worth
path gen
pathfinding? multithreaded.
Finding which enemies they could possibly engage? multithreaded.
Deciding if they should start their vehicle engine, before driving off to next waypoint? singlethreaded. Because pushing that to seperate thread would take more time than just doing it now.
My two major concerns were path gen and visibility checks (which can be very expensive)
If you say they're multi threaded, then I don't think there's much more that can be done
AI deciding things between them? singlethreaded.
Because you can either just go over them all and let each of them talk.
Or you can have them shout over each other not able to understand anything and constantly having to repeat eachother until finally everyone understood what the others tried to say.
pathgen is multitheaded and async (runs over multiple frames).
Visibility checks, not sure which there are.
Most of the things that make sense or are possible to multithread already are.
There are still a few on my list that I'll try out someday, but they all are rather minor
@still forum I guess a multithreaded scheduler can't be done right?
scripts no
more like two or more schedulers
Technically possible. But you need to remove one big script performance improvement to make it possible in general.
And then you add checks so that no two scripts can be modifying the same object/property/state/environment/whatever and these checks will be so expensive that all scripts will be ALOT slower.
Making everything slower so that you can say "but its multithreaded now" is a bit nonsense
I have also heared there were folks from the Alive mod who were hired after their mod got so much fame.
Is this true? or just a reddit hoax.
Don't know. But I know others that were hired because their work was good (like Kydoimos and I guess Dedmen too?)
But anyway, not #arma3_scripting
don't know about anyone from ALiVE mod
Cheers guys. And yes wrong channel, sorry.
So I'm just gonna try use the script that already succesfully works randomising gear/facewear/helmet/vest/uniform. This script also offers weapon randomisation but this, cursed part does not work and either units spawn with their official main G3A3 or empty handed with an empty inventory. Here it is; https://sqfbin.com/ucajewanomujidoquvef. @somber skiff I saw you contributing this script in github so you might have an idea? Cheers!
try this:
init = "if (local (_this select 0)) then {_onSpawn = {_this = _this select 0;sleep 0.2; _backpack = gettext(configfile >> 'cfgvehicles' >> (typeof _this) >> 'backpack'); waituntil {sleep 0.2; backpack _this == _backpack};if !(_this getVariable ['ALiVE_OverrideLoadout',false]) then {_loadout = getArray(configFile >> 'CfgVehicles' >> (typeOf _this) >> 'ALiVE_orbatCreator_loadout'); _this setunitloadout _loadout; _this removeWeaponGlobal primaryWeapon _this; [_this, 'rifle'] call CFP_main_fnc_randomizeWeapon; [_this, 'USP_PATCH_IRN_ARMY_GROUND_FORCES'] call BIS_fnc_setUnitInsignia;reload _this};};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";
north_targets = [targ_n_1, targ_n_2, targ_n_3, targ_n_4, targ_n_5, targ_n_6, targ_n_7, targ_n_8, targ_n_9, targ_n_10, targ_n_11];
while {true} do
{
(gunner light_north) dowatch (selectrandom north_targets);
sleep (random [5, 10, 15]);
};
I've got a searchlight light_north I'd like to pan around between some targets targ_n_1 etc.
The code above runs without errors but the light doesn't move.
Interestingly, when I define the array north_targets from the debug console and then run (gunner light_north) dowatch (selectrandom north_targets); from the debug console it works just fine.
if I use compile/compileFinal preprocessFileLineNumbers, should I now rewrite to compileScript ?
note that searchlights need a weapon to work
I think a simple "FakeWeapon" will do the trick
People have asked about it before
You can search in this channel to find it
I think NikkoJT asked it iirc
Never mind, turns out I was just being impatient and it starts working after like 30s or so.
Right now it doesn't do much
But in the next build it will have more bytecode optimizations
So it is a good idea to do that now for forward compatibility
ok
It's weird, but it works.
Could you rewrite that init please using this function, since it already is being used and works for the gear part (https://sqfbin.com/cexojohemejonodamagi) ```sqf
[_this] call CFP_main_fnc_randomizeUnit;
no
I removed that function
because it was removing all weapons for you
I see.
If you want that function just make your own function
Copy paste the code
just remove the weapon part
replace it with what I wrote
Yes. I just did copy the init but now every unit spawns empty handed.
I just replaced the init part of my unit with yours in my CfgVehicles. That's what you meant right?
that's not what I meant
But, I don't get it since that line of code is from the eventhandler init of my unit.
sqf?
Okay. Pasting the script. Sorry for taking your time.
the gear one that I was using but not working weapon randomiser part; https://sqfbin.com/cexojohemejonodamagi
the weapon randomiser only script; https://sqfbin.com/alakalamozayakapoxay and one of my unit cfg; https://sqfbin.com/ajijotogexicavaqoyey
@still forum I'm right about this?
#arma3_scripting message

I wanted to reply you but then didn't
I feel like many people think compileScript will magically cause optimizations.
While it will only, if you also use bytecode
atleast only that is currently planned. While I can do more in theory
@quartz pebble βοΈ
if I also use bytecode - could you elaborate? how do I use it?
Open source ArmaScriptCompiler on github.
You need to compile your sqf files to sqfc files, and pack both together in your mission/mod pbo
@tough abyss ok I realized what the problem was
I am really happy to hear that. This wasn't just a problem for me but a curse.
your random weapons must be in [weapon, mag] pairs
like so
rifleList[] = {
{"CUP_arifle_M16A1", "some_mag"}, 0.35
};
Okay. Are we now talking about https://sqfbin.com/cexojohemejonodamagi or ; https://sqfbin.com/alakalamozayakapoxay
I'm talking about the config
Yes I know.
But, should I use the gear randomising script with the weaponrandomiser or the weaponrandomiser only script.
π
neither
init = "if (local (_this select 0)) then {_onSpawn = {_this = _this select 0;sleep 0.2; _backpack = gettext(configfile >> 'cfgvehicles' >> (typeof _this) >> 'backpack'); waituntil {sleep 0.2; backpack _this == _backpack};if !(_this getVariable ['ALiVE_OverrideLoadout',false]) then {_loadout = getArray(configFile >> 'CfgVehicles' >> (typeOf _this) >> 'ALiVE_orbatCreator_loadout'); _this setunitloadout _loadout; _this removeWeaponGlobal primaryWeapon _this; [_this] call CFP_fnc_randomizeUnit; [_this, 'USP_PATCH_IRN_ARMY_GROUND_FORCES'] call BIS_fnc_setUnitInsignia;reload _this};};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";
also correct your rifleList
like this:
#arma3_scripting message
The function still removes all weapons
If you want some of them back, you'll have to add them
for grenades, it's in {"grenade", count} pairs
for weapons (rifle, handgun, launcher) it's in {"weapon", "mag"} pairs
for explosives, it's just the list of explosives to add {"explosive1", "explosive2", etc.}
Thank you. ```sqf
randomWeaponProbability = 100;
rifleList[] = {
{"arifle_Katiba_GL_ARCO_pointer_F", "30Rnd_65x39_caseless_green"}, 0.35,
"arifle_Mk20_GL_F", "30Rnd_556x45_Stanag"} 0.40,
"arifle_MXC_F", "30Rnd_65x39_caseless_mag"} 0,35
};
So, about those searchlights. This works just fine
north_targets = [targ_n_1, targ_n_2, targ_n_3, targ_n_4, targ_n_5, targ_n_6, targ_n_7, targ_n_8, targ_n_9, targ_n_10, targ_n_11];
sleep 5;
while {true} do
{
(gunner light_north) dowatch (selectrandom north_targets);
sleep (random [5, 10, 15]);
};
But this doesn't.
south_targets = [targ_s_1, targ_s_2, targ_s_3, targ_s_4, targ_s_5, targ_s_6, targ_s_7, targ_s_8, targ_s_9, targ_s_10];
sleep 5;
while {true} do
{
(gunner light_south) dowatch (selectrandom south_targets);
sleep (random [5, 10, 15]);
};
The only change I made was swapping targ_n_ to targ_s_ and light_north to light_south. I'm really confused as to why one works just fine when the other doesn't work at all.
are both added successively?
Both are run from the debug menu with execVM.
like this:
...
while {true} do {...};
...
while {true} do {...};
?
Yes, both while {} do {} loops are correct
No, they're run from separate scripts.
then why do you say yes 
Because I thought you meant is each loop done correctly not are the done correctly and in the same place
also missing many ,
called or spawned?
execVM from the debug menu for both.
rifleList[] = {
{"arifle_Katiba_GL_ARCO_pointer_F", "30Rnd_65x39_caseless_green"}, 0.35,{"arifle_Mk20_GL_F", "30Rnd_556x45_Stanag"}, 0.40,
{"arifle_MXC_F", "30Rnd_65x39_caseless_mag"}, 0.35
};
yeah better now
it should work
I don't see anything wrong
maybe you have a typo
in the names
verify what the code is executing using systemChat
for example:
south_targets = [targ_s_1, targ_s_2, targ_s_3, targ_s_4, targ_s_5, targ_s_6, targ_s_7, targ_s_8, targ_s_9, targ_s_10];
systemChat str south_targets ;
sleep 5;
while {true} do
{
_target = selectrandom south_targets;
systemChat str [light_south, _target ];
(gunner light_south) dowatch (_target );
sleep (random [5, 10, 15]);
};
I've put a chat in for start and for each run of the loop. Will see what happens
I'm getting the system chat's but still no movement.
Huh, the light won't even move with
(gunner light_south) dowatch (targ_s_1);
do they have a gunner?
and a weapon?
@tough abyss oh I read it wrong again
(gunner light_south) setdamage 1;
Kills the guy in it, so yes.
Not sure about a weapon, how would I check?
weapons light_south
["SEARCHLIGHT"] is what retruns
randomWeaponProbability = 100;
rifleList[] = {
{"arifle_Katiba_GL_ARCO_pointer_F", "30Rnd_65x39_caseless_green", 8}}, 0.35,{"arifle_Mk20_GL_F", "30Rnd_556x45_Stanag", 8}}, 0.40,
{"arifle_MXC_F", "30Rnd_65x39_caseless_mag", 8}}, 0.35
};
wrong again
or remove the extra double bracket by 8?
just look at what I wrote
that's what you should put for each weapon
Roger that.
example
rifleList[] = {
{"arifle_Katiba_GL_ARCO_pointer_F", {"30Rnd_65x39_caseless_green", 2} }, 0.35
};
Thank you so much man.
@tough abyss this is only for weapons tho
the rest of what I said (grenades, explosives) was correct
rifleList[] = {
{"arifle_Katiba_GL_ARCO_pointer_F", {"30Rnd_65x39_caseless_green", 8} }, 0.35, {"arifle_Mk20_GL_F", {"30Rnd_556x45_Stanag", 8} }, 0.40,
{"arifle_MXC_F", {"30Rnd_65x39_caseless_mag", 8} }, 0.35
};
yeah
but targ_s_1 exists? what is it exactly? can it be targeted?
Should I swap them for riflemen or something?
do you have CBA?
Yes
use "CBA_B_InvisibleTarget"
Ok, thanks, where is that found in the editor?
I think under VR
NATO > Targets
Ah, thanks. Will AI fire on that though?
Ok, was worried other nearby AI would spray it down.
THANK YOU so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so MUCH. @little raptor
np
I had been stuck in this for so long. You're a life saver! Gonna get a nighty smoke and some sleep. English isn't my native language so there has been some misunderstanding here and there but still you managed to help me with one of the biggest confusing problems I have had. You should def be a mod, you are very helpful and active not only to me but everyone. Cya around buddy!
I'm a veteran tho π
But a very active one, I have not seen another vet active and helpful as much as you.
Now I feel bad 
Why π¦
For spending so much time in social media 
I probably killed a solid 5 hours today 
What do they say
what you give
comes around
I have seen the rest of the vets online from when I wake up until now they just active somewhere else on their PC.
Thanks, with those invisible targets both lights work perfectly. I'll keep a note of that for future.
What is the script to kick a player when they join a server with a certain mod? ( In this case personal arsenal)
How do I iterate through a group of objects made on 3den Editor in a script?
allMissionObjects
_allMObjects = allMissionObjects "All";
to iterate:
{
} forEach allMissionObjects "All";
script? uses verifysignatures v2, sign you addons and done
Sorry I mean if I had a group called "My Objects" for example
group?
or composition?
dunno
there's this
but it doesn't do what you want
Can I spawn a BIS function rather than call it?
a function is just a code
so yes
but spawned code don't return what you'd get with call
they return a handle to the spawned "thread"
How to increase marker size with 5 sec period?
if (isServer) then {
sleep 5;
respawn_east setMarkerSize = getMarkerSize respawn_east + [100,0];
};```
with a loop:
if (isServer) then {
while {true} do {
respawn_east setMarkerSize (getMarkerSize respawn_east + [100,0]);
sleep 5;
}
}
those are rookie numbers
@balmy creek no crossposting please - keep it to one channel
@quasi sedge also you might need a condition to end it
otherwise it keeps getting bigger forever
for example this makes it bigger 5 times
for "_i" from 1 to 5 do {
sleep 5;
respawn_east setMarkerSize (getMarkerSize respawn_east + [100,0]);
};
@quasi sedge @little raptor shouldnt you use vectorAdd?
.."respawn_east" setMarkerSize...
yes

@quasi sedge use this:
for "_i" from 1 to 5 do {
sleep 5;
_newSize = getMarkerSize "respawn_east" vectorAdd [100,0];
_newSize resize 2;
"respawn_east" setMarkerSize _newSize;
};
What the heck is this for?
RscDisplayLocWeaponInfo
This is what it looks like: https://i.ibb.co/DCnfNFt/Arma3-x64-2021-02-24-10-03-07-570.jpg
Can I use this for anything?
/*
Author: Karel Moricky
Description:
Checks length of weapon info texts.
Parameter(s):
NONE
Returns:
BOOL
*/
@little raptor i re-thinked, what if server change scenario to mine, but with already big ammount of players? Marker won't increase to needed size. This simple-stupid method will work as intended?
if (isServer) then {
while {true} do {
sleep 10;
if ((count allPlayers) => 8 && (count allPlayers) <= 15) then
"respawn_east" setMarkerSize [1400, 1406];
if ((count allPlayers) => 15 && (count allPlayers) <= 25) then
"respawn_east" setMarkerSize [1600, 1406];
if ((count allPlayers) => 25 && (count allPlayers) <= 35) then
"respawn_east" setMarkerSize [1800, 1406];
if ((count allPlayers) => 35 && (count allPlayers) <= 45) then
"respawn_east" setMarkerSize [2000, 1406];
if ((count allPlayers) => 45 && (count allPlayers) <= 55) then
"respawn_east" setMarkerSize [2200, 1406];
if ((count allPlayers) => 55 && (count allPlayers) <= 65) then
"respawn_east" setMarkerSize [2400, 1406];
if ((count allPlayers) <= 65) then
"respawn_east" setMarkerSize [2600, 1406];
};
};```
this one
also replace all thens with exitWith (not in the mood to do it myself)
if (isServer) then {
while {true} do {
sleep 10;
call {
if ((count allPlayers) => 8 && (count allPlayers) <= 15) then
{"respawn_east" setMarkerSize [1400, 1406]};
if ((count allPlayers) => 15 && (count allPlayers) <= 25) then
{"respawn_east" setMarkerSize [1600, 1406]};
if ((count allPlayers) => 25 && (count allPlayers) <= 35) then
{"respawn_east" setMarkerSize [1800, 1406]};
if ((count allPlayers) => 35 && (count allPlayers) <= 45) then
{"respawn_east" setMarkerSize [2000, 1406]};
if ((count allPlayers) => 45 && (count allPlayers) <= 55) then
{"respawn_east" setMarkerSize [2200, 1406]};
if ((count allPlayers) => 55 && (count allPlayers) <= 65) then
{"respawn_east" setMarkerSize [2400, 1406]};
"respawn_east" setMarkerSize [2600, 1406];
};
};
also remove the first conditions
they're already covered by the next ones
example:
if ((count allPlayers) => 15 && (count allPlayers) <= 25) then
{"respawn_east" setMarkerSize [1600, 1406]};
should become
if (count allPlayers <= 25) exitWith
{"respawn_east" setMarkerSize [1600, 1406]};
@quasi sedge also store allPlayers in a variable first
don't use allPlayers directly (could be costly)
example
_allPlayers = allPlayers
then use that instead
if (isServer) then {
while {true} do {
sleep 10;
_allPlayers = allPlayers;
call {
if ((count _allPlayers) => 8 && (count _allPlayers) <= 15) exitWith
{"respawn_east" setMarkerSize [1400, 1406]};
if (count _allPlayers) <= 25) exitWith
{"respawn_east" setMarkerSize [1600, 1406]};
if (count _allPlayers) <= 35) exitWith
{"respawn_east" setMarkerSize [1800, 1406]};
if (count _allPlayers) <= 45) exitWith
{"respawn_east" setMarkerSize [2000, 1406]};
if (count _allPlayers) <= 55) exitWith
{"respawn_east" setMarkerSize [2200, 1406]};
if (count _allPlayers) <= 65) exitWith
{"respawn_east" setMarkerSize [2400, 1406]};
};
};
That's right?
Evening - has anyone got a reliable way to check if a location is inside a rock?
if (
lineIntersectsSurfaces [AGLtoASL _testPos,AGLToASL _testPos vectorAdd [0,0,5],objNull,objNull,false,1,"GEOM","NONE"] isNotEqualTo [] &&
nearestTerrainObjects [_testPos,[],5,false] isEqualTo [] &&
{!(surfaceIsWater _testPos) &&
{terrainIntersect [_testPos,(_testPos vectorDiff [0,0,-3])]}}}
) then {
_position = _testPos;
};
This is what I'm currently doing to fulfil a spawn position - but I still get inside rocks on some positions
Maybe sufficient to just check that you are not inside rock bounding box
That's how find nearest free position works
Or whatever that script command there is called.
NearestEmtpyPosition or smth
private _testPos = _startPos getPos [random _maxRadius,random 360] findEmptyPosition [0,_maxRadius,_className];
My bad, that was the first line which I missed in the copy
that the command you were thinking?
Ye probably
It checks the AI path map, which should filter out objects that block positions
Unless, it's a boulder/rock that was placed upside down
With those things all together, it became rare, but still possible especially in some really tall rocks
I'll keep messing with it, see if I can get anything better with it, its far better then the first iteration
Looking at BIS_fnc_findSafePos they use isFlatEmpty which could be useful
private _testPos = _startPos getPos [random _maxRadius,random 360] findEmptyPosition [0,_maxRadius,_className];
if (
lineIntersectsSurfaces [AGLtoASL _testPos,AGLToASL _testPos vectorAdd [0,0,5],objNull,objNull,false,1,"GEOM","NONE"] isNotEqualTo [] &&
{nearestTerrainObjects [_testPos,[],5,false] isEqualTo [] &&
{_testPos isFlatEmpty [-1,-1,-1,0,0,false,objNull] isNotEqualTo []}}
) then {
_position = _testPos;
};
This seems to provide decent results, rarely in a rock
Also uses the lovely new isNotEqualTo to compare arrays π
yeah I think
But missing some parantheses
Actually, this might be more useful, but I cannot find the script/function associated with it. This is an admin player ban menu apparently:
RscDisplayMPPlayers
So magazinesTurret no longer accepts [0,0] turret path as right argument
There should've been a check if first array value is array before expecting second one to be boolean
RIP missions using _vehicle magazinesTurret [0,0] to get commander turret mags
So here's something odd. The building "Land_i_Addon_02_b_white_F" returns false with BIS_fnc_isBuildingEnterable
It has a door and you can certainly enter it.
Is this because there are no BIS_fnc_buildingPositions ??
I vote to change BIS_fnc_isBuildingEnterable to BIS_fnc_buildingHasPositions
Has anyone tested or know if it is possible to have a mission file read an SQF files from a web server address? I am hoping to have a location where Mission makers can compile a virtual arsenal and export it to an SQF import on a FTP upload and it will be there on next mission load "Training Ground" without having to repackage the entire PBO. For Example
Add this to a scroll wheel option to an object. (Can provide the SQF if necessary)
This addaction ["Get RTO Kit", "http://www.example.com/armory/RTO.sqf"];```
Never
Never as in never been tested or never should do it?
There's no possibility
Gotcha... Ok thanks. I was reading the htmlLoad as well and it says you can reference sqf files but i didnt understand how that works either so Thanks for the feedback
Only way is through extensions (like a database)
Although technically it should be possible to access files or an API as well
Yeah normally would not be a big deal but we have a few units with 30+ loadouts. Just wanted to avoid having to re-update the PBO every time they want to make a change.
Anyway Ill stop wasting my time if its not possible
Could upload to userdata folder on server and read that (from server)
Although DB is probably a lot easier
Not familiar enough with those so will read up on that before making a fool of myself asking simple quesions here.
FYI: if you even do ctrlText for htmlLoaded control, will return nothing so can't use
From what I've been able to use it seems setObjectScale is more of a cinematic creator tool rather than something that can be used for gameplay. Doesn't seem to work in MP
darn thats a shame
Me again sorry. I am trying to be super clever here with a training op that i need to conduct. I will be hosting some training on how to use the TFAR radios. I have a script on an officer where players go up to and take their kit. Within this kit there is a certain type of radio for the first part of the training course. I wish to have an addaction on a laptop (by me) that changes the radio that everyone has to another type of personal radio. I was thinking of using the same script but a copy with the different radio in it, but i think this is long winded. Is there a way i can execute a script and make every player logged on have their radio replaced with what i choose?
can you make FT ticket for it?
We'll fix it if its actually a bug oof
will do
Yes it works globally in MP. But you need to execute it local to your object
I specifically added MP support for it. It works
Meh! And I was just doing a rearm script using this exact command π¦
Is the action only visible for you?
yes
You will want to use remoteExec then and either use -2 if it is a dedicated server or 0 if not.
This will run the parameter code on all machines. From there, you can use the addItem and removeItem commands.
so if i change the execVM in this below script to remoteexec, it should work?
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
private _equipment = "";
if ("Squad Leader" in roleDescription player) then {
_equipment = "SquadLeader";
};
if ("Team Leader" in roleDescription player) then {
_equipment = "TeamLeader";
};
if ("Combat Medic" in roleDescription player) then {
_equipment = "Medic";
};
if ("AT Specialist (Javelin)" in roleDescription player) then {
_equipment = "RiflemanAT";
};
if ("Heavy MachineGunner" in roleDescription player) then {
_equipment = "AutoRifleman";
};
if ("Rifleman" in roleDescription player) then {
_equipment = "BasicRifleman";
};
if ("Commander" in roleDescription player) then {
_equipment = "Commander";
};
if ("Sniper" in roleDescription player) then {
_equipment = "sniper";
};
if ("Marksman" in roleDescription player) then {
_equipment = "Marksman";
};
if ("Grenadier" in roleDescription player) then {
_equipment = "Grenadier";
};
armaofficer addAction ["Rearm", {
params ["", "_caller", "", "_type"];
_caller execVM format ["loadouts\%1.sqf", _type];
}, _equipment];
or should i create a new script where it removes the radio and then replaces it using
[] remoteExec ["someScriptCommand", targets, JIP];
No
using this ?
{player setAmmo [primaryWeapon player, 1];} remoteExec ["bis_fnc_call", 0];
No
but additem
also I don't think you can pass player as a parameter for remoteExec
player means nothing on another machine
you can
that was from the arma wiki
oh?
player is a script command that returns an object
you can pass an object to another machine same as any other object
also here you aren't passing player as parameter at all.
It's a code
The above is sending a piece of code
The other machine executes the code
@still forum I had a question about intercept
After I create a client::invoker_lock, can I create multiple threads and call multiple functions without a mutex and stuff? (the functions do read only things, like line intersects)
no
you cannot do any script interaction in more than one thread
on windows
on linux you can, currently.
So it's an engine limitation?
yeah
why not on windows? could it happen at some point?
because windows has performance optimizations that are currently not enabled on linux
no I won't disable them and make all SQF scripts slower.
@little raptor @still forum listening to you reveals reveals on how little I know. And gives me a good feeling being lazy as there are more competent people out there getting the stuff done.
Me? I know nothing compared to Ded 
but you spill most of your knowledge while I keep most to myself
Your GF?
I'm single
Lucky you
I wanted to represent Dedmen hoarding knowledge but okay π
Lucky Lou π
Multiplayer > Host server > 3D Editor > Play
if (isServer) then {
while {true} do {
sleep 10;
//_allPlayers = allPlayers;
_allPlayers = 36;
call {
if ((count _allPlayers) <= 7) exitWith
{};
if ((count _allPlayers) <= 8) exitWith
{"respawn_east" setMarkerSize [1500, 1406]};
if ((count _allPlayers) <= 25) exitWith
{"respawn_east" setMarkerSize [1700, 1406]};
if ((count _allPlayers) <= 35) exitWith
{"respawn_east" setMarkerSize [1900, 1406]};
if ((count _allPlayers) <= 45) exitWith
{"respawn_east" setMarkerSize [2100, 1406]};
if ((count _allPlayers) <= 55) exitWith
{"respawn_east" setMarkerSize [2300, 1406]};
if ((count _allPlayers) <= 65) exitWith
{"respawn_east" setMarkerSize [2500, 1406]};
};
};
i set _allPlayers = 36;, but it won't change marker size according to if ((count _allPlayers) <= 35) exitWith {"respawn_east" setMarkerSize [1900, 1406]};
Because it sets it to <= 45?
_allPlayers should be an array
you can't count scalars
Yeah also that π
roga
if you use count on a number it should actually count the number out, e.g.
_var = 4;
count _var;
// returns [0,1,2,3,4];
not because it would be useful but because it would be funny
no
what you mean is iota
https://en.cppreference.com/w/cpp/algorithm/iota
I thought about adding that, but didn't see the sense
but maybe it makes sense to generate arrays. Give a generator function and number of elements, and generator function will be called N times to spit out new elements
or range(start, end)
just like
{code} makeArray numberOfElements
so
{_forEachIndex} makeArray 4
[0,1,2,3]
not because it would be useful but because it would be funny
it wasn't a serious suggestion for implementation
you can kinda already do it with set and apply.
But that way you are creating two big arrays where one is useless and just a dummy
makeArray would be neat for procedurally generating references to sequentially named variables (e.g. the auto-numbering system used by editor markers)
generateArray maybe makes more sense with what it actually does
if you feed it a string it should generate entries using the editor autonumbering system e.g.
{"variable"} createArray 3```
returns
```sqf
["variable_0","variable_1","variable_2"]```
Question is, will it have _createArrayIndex?
read
struggling to see why easily generating an array to match editor list generation is not a valid potential use case of this command
_forEachIndex in createArray π₯
It is a use case
but limiting the usability of the command for your very specific usecase is nonsense
Just use format with index
I did not intend to limit it but to have it automatically recognise when you feed it only a string (an otherwise non-functional argument) as a shortcut. In addition to its other functions
But that does limit it
you prevent people from generating a list of strings, of the same string
what if someone wants to do that?
That limitation is absolute nonsense considering you could just write the variable numbering yourself by just using format
Now genuinely curious why anyone would ever want to do this
What he means (I assume) is to parse the generated script instructions of the code to make sure it only has a single push instruction for a single string.
yes
Lots of extra work for literally no purpose. You can just use format
Its just a bullshit idea.
Thanks.
But he came up with the initial idea. Thanks for that β€οΈ
It seemed like it would be a fairly common use case because of how many existing systems in Arma generate sequences like that, so it made sense to me to build in a shortcut (there are plenty of existing commands that have special results depending on input type)
maybe it would be more effort than it's worth, but you don't have to be nasty about it
@still forum https://imgur.com/a/fyYL49j i think "oversize" on save files is geting out of hand (wasnt me i found it on a facebook group )
im wrong or that tryed to save a 2.74TB file lol
Its still nonsense because you can also do it without limiting the usability of the command. Its still extremely simple
No thats something different
footprint is virtual memory.
oh ok 
when I use the scaling command the object or person will increase in size then revert immediately
@still forum https://feedback.bistudio.com/T156981
why set? there is resize
still same result
you are using it on an object thats not supported
Does setObjectScale send any network messages or scale gets updated eventually along with other stuff?
eventually
Good to know
I see the bug in magazinesTurret, thats definitely not intended as it breaks backwards compat.
Some mistake in arg checking, will fix
Thanks, we already updated mission to use new syntax for nested turret paths but plenty of other missions will remain broken until command is hotfixed.
We'll try not to do a hotfix if its not really urgent.
Although this can be a simple non-version number changing hotfix but... oof
What's the big deal with hotfixes? 
(I mean why are you against it)
Wouldn't it be better to just fix broken stuff right away?
I guess it's expensive π
expensive, very time intensive. And I hate seeing hotfixes and am proud that we didn't need any since I joined :U
we may have needed some, but none we released* π
@still forum Any chance to see a scripting command to return unit's ragdoll state (at least return, let alone set), if I nag you enough?
I think I've been asking for it since like 2013 or something, can't even recall anymore but always had a need for it
Also, any chance for you to dive into ragdoll network sync if I create repros? I had a body dragging feature done for years but can't release it because ragdolls mess up if you change their locality in multiplayer
Mess up by appearing at [0,0,0] for some players and not for others
Pretty sure I can repro it, just want my efforts to be looked at
yes
ehhhhhhhhh.... Don't want to
Pretty sure there has been plenty of such tickets over time, should I just create another one?
Yes thats interesting, but I don't know how repro
if there already is one for exactly what you want, no
I'll try to make a repro for it, it happens pretty often in certain environment
Alright, I'll have a search, thanks.
I had tons of objects at 0,0,0 last weekend, but atleast they weren't ragdolling. I thought ACE is causing it
Ragdolls at [0,0,0] been an issue since alpha days, I even had few of my tickets for it fixed, but it keeps coming back in different ways, locality change in this case.
Some mods also create helper objects (sign_blabla_f) at [0,0,0] π€·
yes
I know we have some places in code that check for 0,0,0 because its usually an error.
but obviously missing some
Ace 2 dumping ground was horrifying
Any clue why this doesn't work?
#define GAME_VER __GAME_VER_MAJ__##__GAME_VER_MIN__
#if GAME_VER >= 200
//blabla
#endif
is game_ver_maj 2?
or 02?
nvm
it's because game_ver_min is 3
instead of 03
is that a bug?
@still forum there is any chance that VectorMultply/vectoradd/vectordiff if you give an array bigger than 3 parameters it works?
currently is like:
[1,2,3,4,5] vectormultiply 2
return : [2,4,6]
it can be done with apply... but im just curius 
no, its a scalar, not a string
could be done pretty easily yes. FT ticket
Hey, I am currently trying to create a sound source on a car that can be turned on and off again. This is my script:
[
policecar,
"Activate Siren",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa",
"_this distance _target < 2",
"_caller distance _target < 2",
{},
{},
{
siren_on = true;
PublicVariable "siren_on";
hint "Siren is now active.";
while {siren_on} do {
playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", policecar, false, getPosASL policecar, 1, 1, 200];
sleep 5;
};
},
{},
[],
1,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, policecar];
But I seem to have two issues:
- the interaction menu freezes. Once the holdAction is executed you can no longer scroll to interact with things. Pressing the mousewheel for to first action works though.
- the sound is placed on the positon of car at the beginning of the loop. I'd like it to follow the cars position
Any idea what causes this/how to make it work?
Can you make it work with any number of elements?
I made a feature request for 2D version of the commands.
What KK implemented would always add a 3rd element even when you add 2D vectors (e.g [0,0] vectorAdd [1,2] gives [1,2,0])
which is redundant most of the time for me (he suggested using resize to make it 2D
)
but making it work with any number of elements is pretty cool
like this:
[0,0] vectorAdd [1,2] //[1,2]
[0,0] vectorAdd [1,2,3] //[1,2,3]
etc.
yes
hey is it possible to disable the auto halo animation above 100ft? i guess its the "halofreefall_non" animation. tried it with evh and switchMove back but didn't work
is there a command for checking if ai can move to a position before ordering them to?
by can move i mean that they can actually get to that positions i dont mean the function canmove.
maybe calculatePath then
(and canMove π)
does canmove have that ability to also return false if they are healthy but cant actually get to that position?
no, canMove is only for the current mobility state π
ok
also does the scale thing work in MP?
effects are global, so I would say yes
that's pretty pog
Broad question: I can get PlaySound3D to work on my local host if I pass it with remoteExec
Why doesnβt it work on dedicated?
I think dedmen said no
not yet at least
Iβve tried 3 approaches, and none work in dedi, but 2 out of 3 work on local host
what is your line of code?
sRandomSong remoteExec ["hint", 0]; ```
I have it encased in a while loop
And a bit of logic to choose a random song
The song plays in local, and the hint, which I added for testing, gives me the path of the song
see example 3
https://community.bistudio.com/wiki/playSound3D#Example_3
use getMissionPath
playSound3D has a global effect, don't need to remoteExec on every machine.
So hereβs the full code
hey i tried obejctScale with global simple object and rescaling was only local not global
@crude needle @winter rose
Same result when I do:
sRandomSong remoteExec ["hint", 0]; ```
Hint works, no music
]*



