#arma3_scripting
1 messages · Page 662 of 1
where on the wiki?
https://community.bistudio.com/wiki/BIS_fnc_randomPos
blacklist parameter
okay, so it is supposed to be an array
do I need to create an array variable first or can I just list the triggers?
//PLAYER SPAWN RANDOMIZATION
_randomPlayerSpawn = [nil, []] call BIS_fnc_randomPos;
_playerSpawnX = _randomPlayerSpawn select 0;
_playerSpawnY = _randomPlayerSpawn select 1;
player setPos [_playerSpawnX, _playerSpawnY];
Random pos should exclude any water by default if you give no blacklist
According to biki
oh
great
@spark turret i figured it out, but it doesnt seem to be excluding water by default lol
"blacklist (Optional): Array - blacklisted areas. If not given, water is blacklisted. Areas could"
Alternative:
_randomPosMapNoWater = [nil, ["water"]] call BIS_fnc_randomPos;
Then its either broken or your code is
ok one sec
@spark turret it works when you put "water" in the blacklist
i was just leaving it blank
Bis_fnc_earthquake needs to be remotly executed dosnt it
just reminding my question in case someone knows the answer, thank you
no
@winter rose any way to get it to work
not with this!
what do you want to do?
I want to detect when a player is in any building on the map
the airpot was just for theory
actualy let rephrase that i want to if the player isnt in a building
!_inside 😁
???
_veh = "B_CTRG_Heli_Transport_01_tropic_F"createVehicle (player modelToWorld [8,0,0]);
_veh setUnloadInCombat [true, false];
_veh addMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Red", [-1]];
_veh addWeaponTurret ["LMG_Minigun_Transport", [-1]];
_veh addMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Red", [0]];
_veh addWeaponTurret ["LMG_Minigun_Transport2", [0]];
_veh addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_unit fire "LMG_Minigun_Transport2";
}];
Anyone who knows a clever way to limit the co-pilot from emptying his 2000 rounds after the first initial shot?
@winter rose got a link to that or.... you know an explanation please google turns up nutin for !_inside
I meant, if you can check if a unit is inside and you want to know if the unit is not inside, invert the result with !
https://www.reddit.com/r/armadev/comments/4zht63/make_sure_a_unit_is_inside/
this link explains some stuff on how to know if someone is in a building; use that
wait isKindof "house" is a thing that works
can i get some attention as well? 🥺
no 👀
…j/k, but IDK TFAR. what did google say?
haven't found anything usefull on google, that's why i'm asking
tfar is a task force arrowhead radio by the way
yes, I know that (or Task Force Arma Radio as well) but I don't know how to use it I'm afraid
it's interesting that it's one of the most popular mods for arma but nearly everyone doesn't know anything about it 😄 everyone just tells me "yeah you know i just downloaded it and i use it as it is" 😅
i know that what i'm looking for really exists but still haven't found it 😃
@winter rose just received a message on another forum, do you think, this will work?
tfar_core\functions\fnc_vehicleLR.sqf
Why would anyone do like it says in the wiki example 2? --> SQF [player, "AmovPsitMstpSlowWrflDnon"] remoteExec ["switchMove", 0]; switchMove is already global.
its arg local. So remoteExec would make sense if you want to execute it on a remote object
that code isn't doing that though
@wind hedge Did you read the description at the top of the page?
@winter rose so it doesn't let me put it in the init field, i assume i'm on the right way but how to use that script? tfar_core\functions\fnc_vehicleLR.sqf
maybe... isn't it supposed to be in some sort of combination with execvm ?
Yes, and that is why I came to the conclusion that the wiki could be wrong... a more fitting solution would be SQF [_unit, "AmovPsitMstpSlowWrflDnon"] remoteExec ["switchMove", _unit]; so that the Args are also executed where the unit is local.
ohhh you meant " When the argument is remote, the animation change on the executing PC is only temporary."...
But still... isn't the 0 value used in the wiki example 2 just make the animation play twice for every player or at least make the network transfer duplicate data?
init.sqf and initServer.sqf run at exactly the same time, correct?
_buildingLocation = [_x] call BIS_fnc_buildingPositions;
_buildingLocation = selectRandom _buildingLocation;
How do i check if _buildingLocation is not null.
isEqualTo [] @heady quiver
Q: concerning up vectors, [0, 0, 1] is true vertical, correct?
Ah, which is alluded to by the docs, https://community.bistudio.com/wiki/setVectorUp
Sorry to ask, but would anyone know why when I put this
this addaction ["<t color='#FF0000'>test</t>", {[Player] execVM "scripts\myscript.sqf"}, nil, 10, false, true, "", "", 5];
into an object's init, It works.
But if I use this in initplayerlocal.sqf:
object1 addaction ["<t color='#FF0000'>test</t>", {[Player] execVM "scripts\myscript.sqf"}, nil, 10, false, true, "", "", 5];```
It wouldn't work ? assuming I have add object's variable as object1
Whats the error
oh no error. just nothing happens when I run on dedicated server
eden works just fine though
weirdly enough
Lou, you know what would be the best way to chance something?
Have you tried logging that it gets added? Put a diag_log into the action
good point. let me give it a try
In this case the animation on the executing machine is immediate while on remote machines it will be transitional
that's why it has to be executed for everyone
private _houses = nearestObjects [player, ["house"], 500];
Is there a way to do this for mil objects only?
it says that init.sqf runs first, but do they still start at roughly the same time?
like, within a couple seconds of each other?
- Make sure your initPlayerLocal.sqf is executing (which should work if you haven't misspelled). A simple
systemChatat the top is enough - Make sure the variables exist:
systemChat str object1; - Make sure your code doesn't throw error before that line (put a
systemChat "ok";before that addAction)
Since it is scheduled, it depends how much unscheduled code needs to run between that and initPlayerLocal
Expressions of Eden Editor scenario attributes are called
Persistent functions are called
Modules are initialised
depends how much time it takes for those
but they probably run almost exactly at the same time
Leopard you know anything about nearestObjects with milli objects like towers?
Hello my Arma Peeps does anyone know of a vehicle garage Script that is not VVS?
what about it?
Well im trying to spawn certain items ONLY in mill objects.
they're not any different than ordinary houses in terms of config 🤷
damn
your best bet is looking at their editor subcategory
_buildingLocation = [_x] call BIS_fnc_buildingPositions;
_buildingLocation = selectRandom _buildingLocation;
How would i get the name of a house so i can make a list of the buildings i want in (inArray) check
actually
I'm seeing some interesting stuff
vehicleClass = "Structures_Military";
editorSubcategory = "EdSubcat_Military";
so you can use either of those (or both)
config
private _houses = nearestObjects [player, ["Structures_Military"], 500];
you mean this?
oh.
nearestObjects [player, ["House"], 500] select {getText (configOf _x >> "vehicleClass") == "Structures_Military" || getText (configOf _x >> "editorSubcategory") == "EdSubcat_Military"}
makes no sense
i dont know whats going on
you probably made a mistake somewhere
i cant seem to call any function any more
did you put a while without sleep?!
nop
im so confused rn
did it work?
Nop
The first function
lootCrates works but everything after that doesnt work even if i call it first.
Mmmm seems something wrong with the function itsself.
probably a missing }
or you put the whole thing in {}
Seems its your code
private _millObjects nearestObjects [player, ["House"], 500] select {getText (configOf _x >> "vehicleClass") == "Structures_Military" || getText (configOf _x >> "editorSubcategory") == "EdSubcat_Military"}`
🤔
don't blame my code
you forgot =
private _millObjects =
hey, Im trying to use animation Viewer and use an Static Dead pose animation for a mission on an AI, How exactly would i do this?
if this doesnt belong in this channel, Let me know
Tiny bit confused over how the onKeyDown and onKeyUp event handlers work, the args they are passed. Take _ctrl for instance...
key down true meaning the key is down; versus key up true meaning the key was lifted?
which if accurate, seems a bit counter intuitive, but whatever, it is what it is...
When you press, down, when you stop to press, up
yes I understand that eventing... my confusion is _ctrl is true in both instances... semantically true, that is?
Also ctrl, alt, shift returns corresponded state regardless which key you're pressing
le sigh... also not my question
I am focused strictly on the modifers, specifically _ctrl for sake of this question
i.e. would like to achieve a modifier+mousewheel gesture
so my question is, being true in both instances is a case of the down/up being semantically true?
Apologies, I don't really get the part of semantically true. Both down and up return true when is/are pressed, false is/are not, regardless the event is down or up
ok, well, empirically, would not agree with that as an assumption. logically, I might expect true is down false is up, but that does not seem to be the case.
another question, onMouseButtonClick, _button is left, middle, right, are, 0, 1, 2?
hmm is middle mouse button supported as a mouse click?
seems like middle mouse button click is not supported at the moment... can anyone confirm?
Why can't I doArtilleryFire the AAF MRLS with "rockets_230mm_GAT"? It keeps throwing a 'weapon doesn't exist in CfgWeapons' error :c
It seems that it can't determine if anywhere is in range, despite the weapon having rather extreme reach
probably a gap. I seem to recall it was some time ago when the ship gun for the liberty, etc, could not operate correctly with the arti computer either. shells would splash in the ocean, never go anywhere.
Left, right, middle is 0, 1, 2
so _button == 2 would be a middle mouse button click
hmm well I tried that, actually I put a general systemChat in for any button click, middle mouse button click was not seen by the event handler
I know it works for mouseDown/Up
for middle mouse button?
yes
hmm ok, maybe we "emulate it" that way...
Regarding your question about the _ctrl/_shift/_alt IIRC they are only the state of those keys at that specific point in time.
So if you press Ctrl-L you have _key = DIK_L & _ctrl = true, but if you then let go of Ctrl, then let go of L then the key up for L won't have _ctrl as true
is it possible to get (aand set) the current OpticsMode of a weapon
The one that modders set here https://community.bistudio.com/wiki/Arma_3:_Weapon_Config_Guidelines#Optics
@verbal saddle well, again, "at the moment of key up" the indication I am receiving is _ctrl is true, i.e. was "up" at that instant
True in that instant would mean it's pressed IIRC.
_ctrl is a true/false for if the ctrl key is pressed in that instant.
So a true for _ctrl in a keyUp event handler would mean that the ctrl key was being pressed when the key was released.
no, that's what I'm saying... I got the event, in particular onKeyUp, _ctrl is still true, which I take to mean, true, key was "up"
I think we kinda sorta said the same thing there, just wanted to clarify
_wep1 = _WeaponArray deleteAt ((count _WeaponArray) - 1);
_wep2 = _WeaponArray deleteAt ((count _WeaponArray) - 1);
_wep3 = _WeaponArray deleteAt ((count _WeaponArray) - 1);
_magList1 = [_wep1] call BIS_fnc_compatibleMagazines;
_magList2 = [_wep2] call BIS_fnc_compatibleMagazines;
_magList3 = [_wep3] call BIS_fnc_compatibleMagazines;
something like that?
hold on...
you could do selectRandom on _magList1, _magList2, and _magList3
to get a single string
I don't see _Magazine used? What about it doesn't work?
_Magazines = [_randomitem] call BIS_fnc_compatibleMagazines;
_MagazineString = selectRandom _Magazines;
I don't have the game open right now, sorry if my suggestions aren't correct.
are you using addMagazineCargoGlobal to add the mag?
haha, shucks!
no prob
@verbal saddle to clarify, middle mouse button events are not registered by arma whatsoever. for neither button click, nor down nor up events.
perhaps there is a special configuration properly I need to provide in order to allow middle mouse button events, down, up, click, etc. scroll wheel is just fine, just not the click.
Is it possible to use drawIcon on custom dialogs?
@dreamy kestrel
Are you placing the eventhandler on a control or a display?
Because I think this is the problem your talking about,
https://forums.bohemia.net/forums/topic/160653-middle-mouse-button-ui-event/?do=findComment&comment=3120375
TLDR: MMB only returns if the event handler is added to Display 46
no
and why anyway?
you can create a picture ctrl
and use it as an icon
I want to make a radar with has to display mutliple icons. I didn't want to use the drawIcon3D
You can only use drawIcon on map ctrls
drawIcon3D it is then
if you absolutely want it to be 2D you can use a ctrl
I barely got my head around the basics of dialogs
Ok, so maybe I should be using control as I want player to be able to move even with the display on. How would I go around using control to draw icons on my radar?
want to make an object play music i have this ```sqf
if (isServer) then
{
while {alive Radio} do
{
playSound3D ["sounds\Dirge.wav", Radio];
sleep 263;
};
};```
its not throwing any errors but it isnt playing the custom .wav file i have
If mean like a hud use RscTitles
music must be defined in CfgMusic
^
done that
why do you always ping the wrong people?! 
{
sounds[] = {};
class music1
{
name = "music1";
sound[] = {"sounds\Dirge.wav", 300, 1};
titles[] = {0,""};
};
};```
so use music1 now
not its path
also there are event handlers for music
no need to sleep for some time to repeat the music
these event handlers tell you when the music is done
are you sure your path is correct? seems like you should remove the leading \
good morning guys, just a question, i have been trying to make this work but it seem to me i need some assistance. im building my own base on Malden complete with gates and everything. how do you script it so that if you are within a certain distance from the gate it opens?
Someone should make a script so you cant get armed
the path seems wrong as it does not contain the mission folder
taro_tactical_aids\data\sounds\mortar_start_3.ogg
is it needed for music?
yes sir
wat?
Thank you sir. appreciate your time.
dont bother. it won't even work 
yeah i messed tht up the important part is animate ["door_1_rot", 1];// 0= close 1=opens
Thank you kindly
just slap it on a trigger
I told you
it won't work
and the problem isn't simply a "0= close 1=opens"
code?
but regardless, here's probably the best way:
_rand = [];
_rand resize 3;
_rand = _rand apply {selectRandom _someArray};
then do something like _weaponsArray deleteAt floor random count _weaponsArray instead of selectRandom
add ceil random 3 instead of just 3 constant in your for loop then

does BIS_fnc_compatibleMagazines work with custom weapons too or?
that function just looks up magazines array in the weapons config iirc, so it depends on that
double check in functions viewer
@verbal saddle ah, good to know, was not aware of that. thanks!
I've been working on an "advanced Helo transportation" script for awhile, should I try to turn it into a mod or is there something people already like using?
Is there a way to prevent player from joining the server with the nickname like 'administrator' or 'moderator' or something like that ?
how can i make this also for the rest of a tank: this setObjectTexture [0,"#(argb,8,8,3)color(0.1,0.1,0.1,0.1)"];
Get the name of the player and use https://community.bistudio.com/wiki/serverCommand
to kick them
@cosmic lichen in where? initPlayerlocal ? or init.sqf?
thx.
change the texture index
it's more typically used with getObjectTextures in a loop
also don't use init fields in MP 
and you code @maiden warren ?
Is that your script?
What's inside the functions
nvm
oh, ANZUS.
So far I see it, just execute that script for every player, so each player has its own box
Hey guys so i get a script that spawns loot in civ and mill buildings but what would the best way to trigger the 'spawnLoot' function so it doesnt duplicate.
but its based on where the player is (spawns loot 300 meters arround player)
Can i show you the code i have in a PM ?
you can remoteExec it on the server
without looking at the script it's hard to tell what you should do
Cant show code here too big what was the link again where i can post it.
What this does is spawn a crate in a random location inside a building.
for all buildings 500m from the player.
the script is client side
yes
you don't need remote exec then
But 2 things
wait. It's client side but creates the crate globally
I want to trigger the script at a certain point / time ? and i dont want duplicates.
so 5 players would spawn 5 crates in a house?
Yea so if player A goes to a city loot will spawn (that also is visible for player B) but i dont want to spawn more if there is already crates spawned.
So what i think i need to do is check if
_lootContainers = [
'Land_PaperBox_01_small_closed_brown_F',
'Land_MetalCase_01_small_F',
'Land_PlasticCase_01_small_olive_F'
];
Any of these are close to 500 if so then dont spawn more.
Unless there is a better way.
Also the reason why i want it 500 meter is because if i spawn the crates on server launch that would mean thousands of crates already in game and i think that will cause big FPS problems.
it's simple
grab one player
grab players within its 500 m radius
call the script once for them (preferably calculate the center position)
do this for every remaining player
the script needs to be modified and called on the server

it's not as complicated as you think
it doesn't have to be slow either
all you need:
- an array to track the positions where you spawned the loots (
_gridPos) - calculate the players' positions, divide their x and y by 500m, round them (2D positions). this is a grid position (
_gridPos) which you use as the center for loot crate spawns (after it's multiplied by 500) (_worldPos) - if the position already exists in the array, it already has loots
- otherwise, create the loot at that position and pushBack the position (
_gridPos) to that array
you can even use hashmaps for improved search speed 
(sidenote: server side script)
the whole script is a loop (such as while {true})
you can put it in initServer.sqf
the only part of it that needs to change is this:
nearestObjects [player, ["house"], 500];
instead of player you should use the grid position
also radius shouldn't be 500
or the grid sides has to be 1000m
grid side = search diameter
tbh i have no idea how grids work x)
draw one on the paper
you'll see 😛
i mean i know what a grid is but no idea how all this would work
again draw it on the paper
and pay attention to this
divide their x and y by 500m, round them (2D positions).
if you understand how round works, you'll get it


he has grids and spawns AI and when he is out of it it despawns.
its 20 sec
x)
only the beginning
_pos = getPosWorld _unit;
_pos resize 2;
_gridPos = _pos apply {round (_x/500)};
that's literally it 🤷
the actual pos is:
_worldPos = _gridPos vectorMultiply 500;
🤔
This is some magic shit for me
So...
How would something like that work with the nearestObjects then
📝
you don't have to understand it to use it 🤷
like I said, just draw it on a piece of paper
assume each grid side is 500 m
let's say a player is at [2458, 3612]
when I do that, I get:
_gridPos = [5, 7];
_worldPos = [2500, 3500]
worldPos will only change once you move half side length (250 m) away from that worldpos (in either direction)
which is why I said this:
#arma3_scripting message
so lets say i got 1000
_pos = getPosWorld _unit;
_pos resize 2;
_gridPos = _pos apply {round (_x/1000)};
_worldPos = _gridPos vectorMultiply 1000;
this becomes 1000 yea
😒

when you put 1000 what do you expect?! of course yes
x)
No. Yes. But if you want it instant you want it instant
Nothing in SQF can run at exactly the same time. There can only ever be one script executing at a time
_pos = getPosWorld _unit;
_pos resize 2;
_gridPos = _pos apply {round (_x/1000)};
_worldPos = _gridPos vectorMultiply 1000;
//
//private _newPos = setPosASL _worldPos;
//
private _houses = nearestObjects [player, ["house"], 500];
how would this workout in initServer cuz 'player' would not be possible and _unit wouldnt work
i said use the worldPos instead of player
ah
_unit = _x
private _headlessClients = entities "HeadlessClient_F";
private _humanPlayers = allPlayers - _headlessClients;
{
// Code in here x_
} forEach allPlayers;
_usedLootPos = createHashmap;
while {true} do {
sleep 5;
{
_unit = _x;
_pos = getPosWorld _unit;
_pos resize 2; //make 2D
_gridPos = _pos apply {round (_x/1000)}; //convert to grid pos
if !(_usedLootPos getOrDefault [_gridPos, false]) then { //doesn't exist in hashmap
_usedLootPos set [_gridPos, true]; //add to hashmap
_worldPos = _gridPos vectorMultiply 1000;
//spawn loot at _worldPos
};
} forEach allPlayers;
};
this is the hashmap version of what I said
all you need is put it in a while loop
WITH sleep
Mmm
also _usedLootPos = createHashmap should be outside the loop
(otherwise it keeps getting reset)
I guess it's fine
Problem is
but I only took a brief look
undefined var _buildingLocation
use _x buildingPos -1
just use what I said
instead of that function
you have to change it to:
_buildingLocation = _x buildingPos -1;
if !(_buildingLocation isEqualTo []) then {
_buildingLocation = selectRandom _buildingLocation;
...
}
gets all positions, iirc
https://community.bistudio.com/wiki/buildingPos
Since Arma 3 v.155.133934 if index -1 is supplied, the command will return array with all available positions.
ah oke
so i got it working now without a sleep (got it while looped)
Where should i sleep it?

only 5 seconds?
cool cool
One more thing i got a function in the initServer now thats called finishedSearching but this code can't find it for some reason:
it's remote execting for others
they don't have it
How could i make it possibile?
define it for everyone
How do I reference a trigger from script running inside the trigger?
_mapStructures = Map_Center nearObjects ["Building",(worldName call BIS_fnc_mapSize)];
{
_bldCenter = boundingCenter _x;
_realBldCenter = _x modelToWorld [(_bldCenter select 0),(_bldCenter select 1),(_bldCenter select 2)];
_mapBldTrig = createTrigger ["EmptyDetector",_realBldCenter];
_mapBldTrig setTriggerArea [1000,1000,0,false,1000];
_mapBldTrig setTriggerActivation ["ANYPLAYER","PRESENT",true];
_mapBldTrig setTriggerTimeout [0,0,0,true];
_mapBldTrigName = format ["MapBldTrig%1",_realBldCenter];
missionNamespace setVariable [str _mapBldTrigName,_mapBldTrig];
_mapBldTrigAct = format ["
Null = [%1] execVM 'Map_Ai_Spawning.sqf';
Null = [] spawn {
sleep 7200;
👉 ?WHAT GOES HERE? setVariable ["delay",true];
};
👉 ?WHAT GOES HERE? setVariable ["delay",false];
",str _mapBldTrigName];
_mapBldTrigDeact = format ["",str _mapBldTrigName];
_mapBldTrig setTriggerStatements ["this && (thisTrigger getVariable ["delay",true])",_mapBldTrigAct,_mapBldTrigDeact];
} forEach _mapStructures;
Thanks!
Check the pinned post please
thisTrigger is the magic variable to get the trigger itself in a trigger, though
yes, but it doesn't seem to work outside of the setTriggerStatements. Then found statement about it not working in the scripting commands wiki
Not sure how do you do that
k
did a bunch searching but have only found one example, which is what I've copied here.
script running inside the trigger?
Rephrase it: How do you run it?
?
execVM or call or whatever, do you use any of them?
Null = [] spawn {
Then put thisTrigger in the argument so you can use the trigger as a variable
this is completely wrong:
_mapBldTrigAct = format ["
Null = [%1] execVM 'Map_Ai_Spawning.sqf';
Null = [] spawn {
sleep 7200;
:point_right: ?WHAT GOES HERE? setVariable ["delay",true];
};
:point_right: ?WHAT GOES HERE? setVariable ["delay",false];
",str _mapBldTrigName];

I didn't even read the code ¯_(ツ)_/¯
normally I wouldn't read it either (not without syntax highlighting)
but this was so obvious 
okay, could you elaborate on what I'm doing wrong?
_mapBldTrigName = format ["MapBldTrig%1",_realBldCenter];
is one
the second is #arma3_scripting message
and the quotes (the syntax highlighting already tells you what's wrong)
and I'm not sure what you're trying to do
okay, yeah, forgot to change the quotes for being inside the statement. What am I doing wrong with "_mapBldTrigName = format ["MapBldTrig%1",_realBldCenter];"?
does it sound like a name?!
_realBldCenter = _x modelToWorld [(_bldCenter select 0),(_bldCenter select 1),(_bldCenter select 2)];
that is wrong too
why didn't you just use _realBldCenter = _x modelToWorld _bldCenter?
I was trying to get the center of the building (x,y, and Z), does modelToWorld do that automaticaly?
center is simply getPosWorld (ASL)
[_bldCenter select 0,_bldCenter select 1,_bldCenter select 2] is literally the same with _bldCenter
as for the name, I was trying to use it's position to create a unique name, so each trigger is identifiable?
it would give something like:
MapBldTrig[3212.3213,9878,65.464]
"center is simply getPosWorld (ASL)" doesn't that return the "center" in x & y, but not z? I was trying to get height center as well with bounding center.
I was trying to use it's position to create a unique name
you don't need a name
"this && (thisTrigger getVariable ["delay",true])
never works
how would I reference the trigger's position for the script it runs? "Null = [%1] execVM 'Map_Ai_Spawning.sqf';"
%1 is something only for format
that script is using the trigger as a location to setPos created unit
and your solution was to create thousands of triggers?!
do you even know how badly it affects the performance?
when I run "Null = [%1] execVM 'Map_Ai_Spawning.sqf';" without the %1, the script doesn't know where to place the unit.
the list of buildings is actually a list of only specific buildings, just didn't post that part here.
why do you even use triggers?
but yes, I have multiple triggers on the map
as you can tell by my scripting, I don't know how to do it differently, I'm trying to learn tho?
so if I understand correctly, you want to spawn AI near some positions?
when the player gets close to those positions
I have triggers that are placed on buildings at the begining of mission, when player enters area, ai units spawn and loot is created in the buildings. I'm trying to figure out how to "cooldown" the triggers for a time, so player doesn't keep activating the trigger for a period of time.
this is the script that runs at begining of mission.
cool down is implemented like this:
something setVariable ["cooldowntime", time + _cooldownTime];
if (time > something getVariable ["cooldowntime", 0])
okay, so how do I get the trigger to recognize "itself" as the "something" in the script it's running?
thisTrigger
Null = [] spawn {
sleep 7200;
👉 ?WHAT GOES HERE? setVariable ['delay',true];
};
👉 ?WHAT GOES HERE? setVariable ['delay',false];
you don't need that anymore
so use what you've shown in the conditions?
_trigger setTriggerStatements ["this && {time > thisTrigger getVariable ['coolDownTime',0]}","thisTrigger setVariable ['coolDownTime',time + 7200];",""];
it probably won't check the condition every time (afaik only checks the moment you step onto the trigger)
so that is not a good idea anyway
(I mean triggers)
okay, thank you very much, I'll test this out, and review my mangled code for better improvements! Again, thanks! 😀
btw, how do you post your code in that "square background" here?
see the pinned messages
k
ah, okay! not trying to spam the thread with gibberish.
and thanks for the getPosWorld reference. Just looked it up, and it's what I was trying to do.
np. just note that it's in ASL format
which may not be compatible with what you did before
@wispy lynx if you're not familiar with position formats read this:
https://community.bistudio.com/wiki/Position
thanks, I'll read that.
is it possible to change weapon textures using setObjectTexture, i've tried to no avail, but apparently it works on backpacks
no
sorry i should have also added, is there ANY way to change a weapon texture
yes, a mod - with the weapon author's permission
Hi, how do i spawn 1 NPC instead of a group (BIS_fnc_spawnGroup) ?
createGroup + createUnit
[box, true] call ace_arsenal_fnc_initBox;
["ace_arsenal_displayClosed", {
["rearm", "SUCCEEDED"] call BIS_fnc_taskSetState;
}] call CBA_fnc_addEventHandler;
what i have doing wrong? i cant figure it out how CBA_fnc_addEventHandler is not calling
"ace_arsenal_displayClosed" is not an event handler
but i get it here? so i am wrong about it? https://ace3mod.com/wiki/framework/arsenal-framework.html#6-eventhandlers
i was going search wrong thing for whole night seen to be cant solve
hey, I've borrowed the script from this page, but it's telling me that I'm not authorized even though I added myself to the IDs txt file. anyone able to help me out?
allowedIDs.txt```
//Fill the ARRAY with allowed UIDs - steam IDs
//Look something like "76566179256348507"
["76561198113700383", "76561198255862719"];
(Me and a friend, team-leader and zeus respectively)
ok, i will keep searching
[QGVAR(displayClosed), []] call CBA_fnc_localEvent;
ok, let me try
you're not supposed to try it
what I meant is that you're probably right
try adding the IDs as numbers (without "")
still no luck, guess i will continue use my old trigger for stand close
Didn't work
//Look something like "76566179256348507"
[76561198113700383, 76561198255862719];
still kicks me out of the mission when I try to pick my zeus char
does that help
yes
it does need the ""
did you place the file correctly?
allowedIDs.txt << this file gets placed in the folder where your servers Arma3.exe is
Directory: C:\Users\maxma\Documents\Arma 3 - Other Profiles\[WO1]%20Max\mpmissions\Campaign-Training.hebontes
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/12/2021 10:34 AM 133 allowedIDs.txt
-a---- 3/12/2021 9:48 AM 271 Description.ext
-a---- 3/12/2021 9:48 AM 299 initPlayerLocal.sqf
-a---- 3/12/2021 9:48 AM 196 initPlayerServer.sqf
-a---- 3/12/2021 9:48 AM 67 initServer.sqf
-a---- 3/12/2021 10:29 AM 18913 mission.sqm
doing that results in the game telling me that the script is missing
try running the game as admin
altho what you did should work too
allowed = call compile preprocessFileLineNumbers "allowedIDs.txt";
are you sure your uids are correct?
considering I copy/pasted it from my steam account page url, 99%
try this in the game (MP game):
getPlayerUID player
steamcommunity.com/profiles/76561198255862719/
becomes 76561198255862719?
has crashed the game.
DXGI error, interestingly.
what?!
where did you try that?
the debug console?
why would it crash your game then?
did you launch an MP scenario?
go to eden, create an MP game, then try it
I locally executed it, I'm the only person in the Lan game
i know why, i need close the eden editor then save init.sqf, problem solved XDDD
Yes, from 3den, this is a MP scenario I'm running
all I want is a live fire training ground that I can zeus in arma, is that so much to ask?
I mean to get the player UID 🙄
Is there any SQF command to get current server player capacity while being in game?
capacity?
now this will work, finally solved it```sqf
[box, true] call ace_arsenal_fnc_initBox;
ARSENAL_DISPLAY_ID = ["ace_arsenal_displayClosed", {
["rearm", "SUCCEEDED"] call BIS_fnc_taskSetState;
["ace_arsenal_displayClosed", ARSENAL_DISPLAY_ID] call CBA_fnc_removeEventHandler;
}] call CBA_fnc_addEventHandler;
you mean how many empty slots the server has?
I think he means slots in total
I mean how many players are on server right now and maximum amount of players
something like (16/32) etc
how many players on right now
count players
maximum amount, no SQF command
@slow urchin change initPlayerServer to this:
_player = _this select 0;
_uid = getPlayerUID _player;
diag_log str allowed;
diag_log str _player;
diag_log str (_player getVariable [ "reserved", false ]);
if ( _player getVariable [ "reserved", false ] && { !( _uid in allowed ) } ) then {
[ [], "fnc_reservedSlot", _player ] call BIS_fnc_MP;
};
check the rpt on the server, see what it gives you
yeah, it was quite obvious, didn't thought about that 😅
count players will count headless clients too?
headless clients are players too
is there a players command?! 
BIS_fnc_listPlayers
oh, wonderful, it actually works
now, is there a way to make it so players spawn where I place them instead of respawning when the mission starts?
it's kind of annoying
i think it is some kind of wrapper around playableUnits
what? what works? I didn't even change anything
change the mission respawn parameters
whatever you changed in initPlayerServer fixed the issue.
I didn't change anything
I only added some diag_logs
for logging
which you should remove
well, it doesn't kick me out of the locked slots anymore
you probably didn't copy the script correctly then
How do i make a spanwedGroup walk slow instead of running
it has nothing to do with what I did
you hadn't copied the script correctly
so it wasn't working before
_player = _this select 0;
_uid = getPlayerUID _player;
if ( _player getVariable [ "reserved", false ] && { !( _uid in allowed ) } ) then {
[ [], "fnc_reservedSlot", _player ] call BIS_fnc_MP;
};
that's the content of initPlayerServer.sqf.bak
and that's what I told you to put there
#arma3_scripting message
what's the difference?!
nothing
@slow urchin if you don't believe me, use this:
_player = _this select 0;
_uid = getPlayerUID _player;
if ( _player getVariable [ "reserved", false ] && { !( _uid in allowed ) } ) then {
[ [], "fnc_reservedSlot", _player ] call BIS_fnc_MP;
};
I still cant get this to work any ideas ive tried every permutation of inticating the source file, its not throwing any errors its just not playing
if (isServer) then
{
while {true} do
{
playSound3D ["Music1", Radio]; //i've tried "sounds\filename.wav" // "missionfolder\sounds\filename.wav" // yes i have a description.ext with a cfg sounds containig the relevent information
};
};```
description.ext
```sqf
class CfgSounds
{
sounds[] = {};
class music1
{
name = "music1";
sound[] = {"sounds\Dirge .wav", 300, 1};
titles[] = {0,""};
};
};```
space in filename ("sounds\Dirge .wav")
I found the change
I accidentally duplicated the array in the IDs, so it was defined twice, and that worked for some reason?
Did you close the mission when you edited the IDs? I bet you didn't
you did it now and it worked
I accidentally duplicated the array in the IDs
that's fine
duplicating won't have any effect (except for making the code run slower)
Hey guys does anyone know how i can make the AI go into a patrol stance.
patrol stance
?
// Spawn groupm
random_group_spawn = [_patrolStartPos, east, _list, [], [], [0.3, 0.5]] call BIS_fnc_spawnGroup;
random_group_spawn setBehaviour "AWARE";
random_group_spawn setCombatMode "WHITE";
random_group_spawn move (getPos _house);
Where they walk slow with the weapons down
towards X location.
speed mode has to be LIMITED
behavior safe
ty
ok is is confused now sqf if (isServer) then { Radio #say3D ["music1",100]; };
error type : script expect array, object
is radio defined?
what?!
yes radio is defined
there is no type script
what is the full error?
also cfgMusic doesn't work with say3D
for that you need cfgSounds
its CFG sounds
class CfgSounds
{
sounds[] = {};
class music1
{
name = "music1";
sound[] = {"sounds\Dirge.wav", 300, 1};
titles[] = {0,""};
};
};```
[_grp, 2] setWaypointLoiterRadius 200;
that's not what's causing the error
Does this expect the spawned group or the marker 🤔 ?
error say3D: type script, expected array, object
have you placed something like this in your codes?
radio = [] spawn ...
```or
```sqf
radio = [] execVM ...
```?
where exactly? Radio is a radio i have placed in the editor Called aptly enough Radio
the script causing the error is being run from my init on mission start
anywhere
type script means a script handle:
typeName ([] spawn {})
so you're doing something like what I said somewhere
and this is the line in my init sqf radio = execVM "Radio.sqf"
the only despite it being a different case
[] = execVM will not work
why do you think you have to put anything before execVM?
execVM "Radio.sqf"
a simple 0 = will work too
0 = execVM "Radio.sqf"
eh either way it works now finally
ok question its probably stupid but if i use the 'BIS_fnc_ambientAnimCombat' in a units init field will it be ok for multiplayer
or does it need to be run for each client ?
anyone
anytwo
haha @winter rose but seriously
animations are global, but don't use init fields in MP if you don't know what you are doing!
wasnt planing to use the init fields just wanted to know if they were global thanks
But what if there is a sleep command? Don’t you mean they start at separate times?
Thats why i need multi thread access, so i can run multiple scripts parallel and cause runtime issues instead of improving my scripts performance 👀
Arma 3 + multithreading = Arma 4 😋 oh the perf gain
"C_van_02_transport_f" createVehicle position player
For some reason, starting today, this creates a boxy, low mip version of this vehicle. Only this vehicle. Placing the same vehicle in the editor the model is fine. Any ideas?
tbh this doesn't really sound like a script issue, more of a "verify your game files" issue
I second this opinion - game data or computer performance @hot kernel
@hallow mortar , @winter rose
Game files validated with no issue. Since I was in STEAM I launched the game using the launcher instead of the shortcut I usually use. It's fixed. Profile settings desynched or something, I dunno. Not a script issue for sure.
Thanks!
does anyone knows if there is a way to check when in task force radio some one changes the frequency? so far I had no luck and I am avoiding doing a check each frame.
ping dedmen, he wrote TFAR
or ask on the TFAR discord
are there specific things i should know about data littering?
like, can i cause a RAM overflow by looping a script which creates a new variable which is created but never deleted?
or anything else i can do to improve performance and not spam obsolete data
none of they do what I need
Wiki's Mission/Code Optimisation pages?
https://community.bistudio.com/wiki/Variables
Check out the sections on 'Deletion' and 'Variables lifespan'
thanks guys
_i = 0;
while {true} do {
_i = _i + 1;
missionnameSpace setVariable ["varname" + str _i,"uwu",true];
};
i dont dare to test it out 😄
haha, I'll try it.
dont think scheduled allows while afaik
there's a max loop limit in unscheduled environments, I think
scheduled and 'while' are fine
iteration or time taken?
i think i once heard a 3ms think but idk
might have been unrelated
hello, how could i do: if something is not in your inventory, then ...
you can get specific items with special commands or just pull their whole inventory and search that.
yeah, i want to check if a player has an specific item
like something in his backpack?
yep
could i say
_mags = magazines player;
if !("item" is in _mags) exitWith { ...
yeah that works, assuming you have the items classname and compare it to the class of the entrys in the _mags array
10k loops max
good to know
Tested it, when spawned into scheduled environment, not much of a notable impact. When called, it does indeed stop at 10,000
would schedule it
then we obviously need to make the size of the var far bigger
save the whole logfile or something lol
yeah, let it run to 1 million
two whiles can do
What are you trying to achieve? 
That's a great question
fried eggs on kevins computer
arma bitcoin mining I guess
or a housefire 🤷♂️
no issues here.
_i = 0;
_fn = {
missionNamespace setVariable ["varname" + str _i, "uwu"];
_i = _i + 1;
call _fn
};
call _fn
It probably crashes because the call stack grows so huge 
Is recursion supported?
Yes
Can anyone clarify, attachTo recently received a followBoneRotation parameter, default is not indicated, but I assume, and "build mode" repositioning of objects would seem to indicate, default is true. Thanks...
https://community.bistudio.com/wiki/attachTo
Default is false
It won't follow the bone
Right, but what is "follow the bone".
I'm a dummy concerning the question. The attached objects would just "stay there" ?
E.g. if you attach it to the head, it won't rotate when the head turns (but it still changes its position and goes where the head goes)
hmm okay. or "crates" attached to a spill bund, for instance.
What's a spill bund?!
ContainmentArea_02_sand_F or ContainmentArea_01_sand_F
right thank you @winter rose
When things are attached without bone following, they're only attached to the "root" of an object, its "main body"
Bone following lets you attach things directly to an animated sub-part of the object
hmm so the assumption is false. the default seems to behave like it was true, however.
Not entirely true
They can still follow its position
Oh, that's right
hmm I see.
so we're probably okay as long as we're attaching objects to the parent object
Hey, I'm fairly new at scripting things because I mainly just use Zeus and improvise things on the fly, but I think that this will execute setTarget.sqf globally, right?
' mazeLaptop addAction ["Set targets", {execVM "setTarget.sqf"}]; '
ah the code block isnt working
Anyone able to give me an example script on changing the ammo of a gun? Like a turret firing autocannon rounds.
Hi guys how can i change the map icon for the task:
[west, ["task2"], ["Good luck finding this cookie", "Find Cookie", "cookiemarker2"], _housePosition, 1, 3, true] call BIS_fnc_taskCreate;
with task types
see https://community.bistudio.com/wiki/Arma_3:_Task_Framework
hey, I need some help I have 0 know how on how scripts work, basically I want a squad of AI troops to do endless push ups
I have this script I found
if ( isServer ) then{ [this, "AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMove", this, true];this addEventHandler ["AnimDone",{ params ["_unit", "_anim"];if ( _anim == "AmovPercMstpSnonWnonDnon_exercisePushup" ) then{ [_unit, " AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMove", _unit, true]; };}];};
which makes them do push ups, but not endlessly
you have one extra space in your animation name and when checking for the animation name maybe compare the lower case version:
if ( isServer ) then{
[this, "AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMove", this, true];
this addEventHandler ["AnimDone",{
params ["_unit", "_anim"];
if ( toLower _anim == toLower "amovpercmstpsnonwnondnon_exercisepushup" ) then{
[_unit, "AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMove", _unit, true];
};
}];
};
ah thank you!
Guys, loiter with a radius means that the AI will 'LOITER' in that area right?
// Spawn commander
_commanderPos = [_housePosition, 15, 20, 0, 0, 20, 0] call BIS_fnc_findSafePos;
randomCommanderSpawn = [_commanderPos, east, ['CUP_O_TK_INS_Commander'], [], [], [0.6, 0.9]] call BIS_fnc_spawnGroup;
// Waypoints
_wpCommander = randomCommanderSpawn addWaypoint [_housePosition, 0];
_wpCommander setWaypointType "LOITER";
[randomCommanderSpawn, 2] setWaypointLoiterType "CIRCLE";
[randomCommanderSpawn, 2] setWaypointLoiterRadius 50;
randomCommanderSpawn setSpeedMode "LIMITED";
randomCommanderSpawn setBehaviour "SAFE";
This commander goes to the position and just stands there.
is there anyway to stop them moving? they are slowly advancing forth
Anyone knows how these 3d markers (arrows pointing downwards) are called?
Loiter is mostly for aircraft I believe.
oh
Then no wonder it didnt work
x)
You know how to let hem like roam arround a certain pos ?
I know Seek and destroy sorta does it, but they will be in combat mode. I swear there was a BIS_Function some were that does it...
I could be wrong about SnD though, might be worth a try.
https://community.bistudio.com/wiki/BIS_fnc_taskPatrol
or "DISMISS" waypoint type
hm maybe resetting their pos each time:
if ( isServer ) then{
[this, "AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMove", this, true];
this setVariable ["TAG_originalPosition", getPos this];
this addEventHandler ["AnimDone",{
params ["_unit", "_anim"];
if ( toLower _anim == toLower "amovpercmstpsnonwnondnon_exercisepushup" ) then{
[_unit, "AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMove", _unit, true];
_unit setPos (_unit getVariable ["TAG_originalPosition", getPos _unit]);
};
}];
};
see above
What are the steps needed to have a document (ace intel folder) be picked up by a player, which triggers a set task state, which completes the task and runs some code (make ind and west friendly to each other?)
I have all the parts, I'm having trouble connecting it all together
Intel folder > sync to set task > sync to task > sync to a game logic?
thanks I'll try this later
Anyone still awake to help me 😄 ?
I wanna use this:
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
}];
To check if this vehicle is destroyed
_objective = createVehicle ['O_Truck_02_Ammo_F', _markerPosition, [], 0, "CAN_COLLIDE"];
🤔
Why not add a regular Killed EH to the vehicle when you create it?
How would i do that?
[_objective,["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
// code to execute when thing is killed
}]] remoteExec ["addEventHandler",0,_objective];```
is it Killed or EntityKilled
I said what I meant
ah so whats the difference between Killed and KilledEntity ?
EnityKilled*
AY is works tho.
EntityKilled is a Mission Event Handler, as you might guess from the command addMissionEventHandler. It's added to the entire mission and fires whenever any entity is killed.
Killed is a specific event handler and only triggers when the specific objects you add it to are killed.
full client.sqf https://pastebin.com/XuFz4DGR
if ( GVAR(CMarkerTagChannelVisibility) == MTAG_ALWAYS_ON ||
( !GVAR(CMarkerTagNameVisibilityTemporaryOn) && GVAR(CMarkerTagChannelVisibility) == MTAG_ON ) ||
( GVAR(CMarkerTagNameVisibilityTemporaryOn) && GVAR(CMarkerTagChannelVisibility) == MTAG_OFF )
) then
{
if (d_restr_enable_freeze) then {
if (_mar select 12 == 1) then {
_text = (GVAR(CMarkerChannelToChar) select MAR_CHAN(_mar)) + " " + _text;
} else
{
_text = ((_mar select 11) select 0) + " " + _text;
};
} else {
_text = (GVAR(CMarkerChannelToChar) select MAR_CHAN(_mar)) + " " + _text;
};
};
This error spamming .rpt
over 9000 times of this:
22:24:42 Error position: <select 12 == 1) then {
_text = (amm_CMar>
22:24:42 Error Zero divisor
22:24:42 File xx\addons\d_map_adv_markers\client.sqf..., line 135
22:24:42 Error in expression <(d_restr_enable_freeze) then {
if (_mar select 12 == 1) then {
_text = (amm_CMar>
@hallow mortar
// Objective Event Handler (check if alive)
[_objective,["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"];
[_taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;
}]] remoteExec ["addEventHandler",0,_objective];
How can i make _taskName accessible?
Its a empty string now cuz its not in the EH
When you set up the task to begin with, you gave it a string name. Use that string, not _taskName
_taskName = format['task_%1', round(random 9999)];
Hello, i dont understand my error, it's possible to help me ?
_varName = ;
_array pushBack [_varName,];
} forEach ("true" configClasses (miss>
0:57:33 Error position: <];
} forEach ("true" configClasses (miss>
0:57:33 Error Missing [
0:57:33 File \AFL_Client\AFL_Base\AFL_Session\fn_updatePartial.sqf [SOCK_fnc_updatePartial]..., line 79```
This feels like a kind of horrible way of doing it. What if you get the same random number twice in a row?
Yea i know..
But thats the problem atm
x)
i was still looking for a better way.
I don't really have time to redesign this for you. But for the moment, the stopgap fix is to make _taskName a global variable (with a unique name) so that it's accessible by the EH. Any variable starting with _ is a local variable only accessible in the current scope.
It's hard to troubleshoot this because it's part of a larger framework of interconnected files and mission elements. The error seems to indicate a problem with the config retrieval part, but without knowing what the script is actually looking for or what is in missionConfigFile >> "Licenses" it's impossible to say what the problem really is.
You're probably best off trying to get in contact with the original author.
Nikko you know anything about limiting a forEach loop to 5 times?
if (_forEachIndex bigger than 4) then {break;} ?
ty
What are the steps needed to have a document (ace intel folder) be picked up by a player, which triggers a set task state, which completes the task and runs some code (make ind and west friendly to each other?)
I have all the parts, I'm having trouble connecting it all together
Intel folder > sync to set task > sync to task > sync to a game logic?
Need a script to turn an RHS MI-8s MGs into M134s from RHS blackhawks
Rlly simple
Just don't know the Cfgs
Preferably the MI-8 with 4 MGs
MI-8 SA or SH model, whatever it's called again
There's a tutorial on yt, I'll try and find the link
Thank you, I've been looking but everyone names it something differently
LOL that first frame of the video
private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag", ["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_AKM_F", "30Rnd_762x39_Mag_F"], [" arifle_AKS_F", "30Rnd_545x39_Mag_F"], ["arifle_AKS_F", "30Rnd_545x39_Mag_F"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["sgun_HunterShotgun_01_F", "2Rnd_12Gauge_Slug"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["srifle_EBR_F", "20Rnd_762x51_Mag"], ["arifle_Mk20_F", "30Rnd_556x45_Stanag"], ["arifle_Mk20_F", "30Rnd_556x45_Stanag"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["arifle_MXM_Black_F", "30Rnd_65x39_caseless_black_mag"], ["hgun_P07_blk_F", "16Rnd_9x21_Mag"], ["hgun_P07_blk_F", "16Rnd_9x21_Mag"], ["hgun_P07_blk_F", "16Rnd_9x21_Mag"], ["hgun_PDW2000_F", "30Rnd_9x21_Mag"], ["hgun_PDW2000_F", "30Rnd_9x21_Mag"], ["hgun_Pistol_01_F", "10Rnd_9x21_Mag"], ["hgun_Pistol_01_F", "10Rnd_9x21_Mag"], ["hgun_Pistol_01_F", "10Rnd_9x21_Mag"], ["SMG_05_F", "30Rnd_9x21_Mag_SMG_02"], ["SMG_05_F", "30Rnd_9x21_Mag_SMG_02"], ["hgun_Rook40_F", "16Rnd_9x21_Mag"], ["hgun_Rook40_F", "16Rnd_9x21_Mag"], ["hgun_Rook40_F", "16Rnd_9x21_Mag"], ["arifle_SDAR_F", "20Rnd_556x45_UW_mag"], ["arifle_SDAR_F", "20Rnd_556x45_UW_mag"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"], ["arifle_SPAR_03_blk_F", "20Rnd_762x51_Mag"], ["SMG_02_F", "30Rnd_9x21_Mag_SMG_02"], ["SMG_02_F", "30Rnd_9x21_Mag_SMG_02"], ["arifle_TRG21_F", "30Rnd_556x45_Stanag"], ["arifle_TRG21_F", "30Rnd_556x45_Stanag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"]];
private _itemArray = ["30Rnd_45ACP_Mag_SMG_01", "30Rnd_45ACP_Mag_SMG_01", "6Rnd_45ACP_Cylinder", "6Rnd_45ACP_Cylinder", "6Rnd_45ACP_Cylinder", "9Rnd_45ACP_Mag", "9Rnd_45ACP_Mag", "9Rnd_45ACP_Mag", "2Rnd_12Gauge_Slug", "30Rnd_545x39_Mag_F", "30Rnd_545x39_Mag_F", "20Rnd_556x45_UW_mag", "20Rnd_556x45_UW_mag", "30Rnd_556x45_Stanag", "30Rnd_556x45_Stanag", "30Rnd_556x45_Stanag", "30Rnd_556x45_Stanag", "30Rnd_556x45_Stanag", "30Rnd_556x45_Stanag", "50Rnd_570x28_SMG_03", "50Rnd_570x28_SMG_03", "30Rnd_65x39_caseless_black_mag", "30Rnd_65x39_caseless_black_mag", "30Rnd_65x39_caseless_green", "20Rnd_762x51_Mag", "20Rnd_762x51_Mag", "20Rnd_762x51_Mag", "30Rnd_762x39_Mag_F", "30Rnd_762x39_AK12_Mag_F", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "30Rnd_9x21_Mag", "30Rnd_9x21_Mag", "30Rnd_9x21_Mag_SMG_02", "30Rnd_9x21_Mag_SMG_02", "30Rnd_9x21_Mag_SMG_02", "30Rnd_9x21_Mag_SMG_02", "optic_Aco", "optic_ACO_grn", "optic_Arco_blk_F", "Binocular", "Binocular", "Binocular", "FirstAidKit", "FirstAidKit", "FirstAidKit", "FirstAidKit", "FirstAidKit", "FirstAidKit", "FirstAidKit", "optic_Hamr", "optic_MRCO", "optic_Holosight_blk_F", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "SmokeShell", "SmokeShell", "SmokeShell", "SmokeShell", "muzzle_snds_H", "muzzle_snds_L", "muzzle_snds_M", "muzzle_snds_B", "muzzle_snds_acp", "B_CivilianBackpack_01_Everyday_Black_F", "B_CivilianBackpack_01_Everyday_Black_F", "B_CivilianBackpack_01_Everyday_Black_F", "B_CivilianBackpack_01_Everyday_Black_F", "V_PlateCarrier1_blk", "V_PlateCarrier1_blk", "V_PlateCarrier1_blk", "V_PlateCarrierSpec_blk", "B_ViperHarness_blk_f", "B_ViperHarness_blk_f", "U_B_FullGhillie_ard", "U_B_FullGhillie_sard"];
I get an error somewhere in there
missing ]
it says line 21
but it also says private _itemArray = ["30Rnd_45ACP_Ma...
oh
thanks
i was just confused because it seemed like it was telling me 2 different places
You better to break line for every each elements not to do such a simple issue
yeah
_a = [
[0,1],
[2,3],
[4,5,
[6,7]
];
Spot the issue! 😉
yeah
according to arma 3, arifle_AKS_F does not exist
its giving me an error message at the start of the game, and the boxes that are supposed to contain them just contain this weird blank space thingy
well, I would say this: " arifle_AKS_F" doesnt exist as well...
oh shit
¯_(ツ)_/¯
ohhh
i didnt see it because the way i had it in my code, the " was on the end of a line and the arifle_aks_f was on the next line
is it possible to setPos without it affecting vertical?
out of bounds selection
change the z yourself
you need a "take" event handler, which checks if the picked up item matches the document type
if it does, use BIS_fnc_taskSetState to complete the task and add the rest of the code below it
player nearEntities [["CAManBase", "Dog_Base_F", "Goat_Base_F", "Sheep_random_F", "LandVehicle", "Helicopter", "Boat_F"], 120] select {((getPosWorld vehicle _x) select 2 < 50) && (abs speed _x < 50)}; ``` gives me an "type any, expected number error"
nothing in here gives you that error
what did you just change?
one of those variables was giving the error
You are right, Just fixed it, thanks!
[] spawn { _closestTarget = objNull;
[player] call vZombieSense; _closestTarget};
``` the result of this spawn is always objNull even then the fnc vZombieSense gives a clear unit.
How can I make use that the spawn gets the result of the fnc being called in the middle, because currently it seems not to wait for the end result
spawn doesn't return anything (it returns script handle to the spawn)
the question is, why do you even use spawn?
Well I tried to explain it without posting the whole nine yards but here:
The spawn is because I need to have sleeps in there
vZombieSense = {
params ["_zombie"];
if (isNil "sunLight") then {
[] spawn vZombieSunLight;
};
private _nearTargets = [];
private _selectedTargets = [];
private _closestTarget = objNull;
_zCheckRangeMult = vZombieRangeMult;
_zCheckRange = ((60 + sunLight) min 120) * _zCheckRangeMult;
_nearTargets = _zombie nearEntities [["CAManBase", "Dog_Base_F", "Goat_Base_F", "Sheep_random_F", "LandVehicle", "Helicopter", "Boat_F"], _zCheckRange] select {((getPosWorld vehicle _x) select 2 < 50) && (abs speed _x < 50) && (_x != _zombie)};
if (_nearTargets isNotEqualTo []) then {
{
_nT = _x;
if ((isNil {_x getVariable "vIsZombie"}) && {!((crew _nT) findif {alive _x && !(isObjectHidden _x)} isEqualTo -1)}) then {
if ([_zombie, _x, -3] call BIS_fnc_isInFrontOf) then {
_visibility = ( [[objNull, "IFIRE"] checkVisibility [eyePos _zombie, getposASL _x],2] select (_x isFlashlightOn (currentWeapon _x) || isLightOn _x) ) * _zCheckRangeMult;
if (_visibility > 0) then {
_chance = (_visibility + abs(velocity _x # 0) + abs(velocity _x # 1) + (((eyepos _x) # 2) - ((getposASL _x) # 2)) + (((100 - (_zombie distance _x)) max 0)*0.1)) * ((sunLight*0.01) max 0.1);
if (random _chance > 1) then {
0 = _selectedTargets pushBack _x;
};
};
};
};
} count _nearTargets;
};
if (_selectedTargets isNotEqualTo []) then {
private _sortedTargets = [];
_sortedTargets = [_selectedTargets,[],{_x distance _zombie},"ASCEND"] call BIS_fnc_sortBy;
_closestTarget = _sortedTargets select 0;
};
_closestTarget
};
if you need return from something, it makes no sense to spawn it
even if it has sleep in it
nooo, wait
vZombieSense returns the _closestTarget just fine... it is AGENT XXX
then I need to bring that result to the vZombieBrain spawn
again, you don't need spawn
vZombieBrain = {
params ["_zombie"];
if (isNil "sunLight") then {
[] spawn vZombieSunLight;
};
while {alive _zombie} do {
if (diag_fps > 15) then {
if (vZombieBrainActive) then {
_closestTarget = objNull;
[_zombie] call vZombieSense;
systemChat format ["Closest Target %1", _closestTarget];
if !(isNull _closestTarget) then {
if !(simulationEnabled _zombie) then {[_zombie] call vZombieEnableMovement;};
if !(isPlayer _closestTarget) then {_nTarget reveal [_zombie, 2];};
That is the first half of the spawn
see where I call vZombieSense;
the systemchat debug in the vZombieBrain Spawn returns objNull
it should return the result of the vZombieSense fnc which was AGENT XXX
I hope you get my question now... The spawn that is the "brain" of my zombie units that loops inside that while {alive _zombie}
requires the result of the vZombieSense fnc
@wind hedge
currently it seems not to wait for the end result
if you want to wait for something, you have to call it
I am calling it!
hello Q: working with CBA to create and manage namespaces, which are LOCATION in SQF terms.
can I treat them as objNull types, i.e. params [["_target", objNull. [objNull]]]?
or allow for different _target types? something like params [["_target", objNull. [locationNull, objNull]]]
then the problem is here:
if (_selectedTargets isNotEqualTo []) then {
private _sortedTargets = [];
_sortedTargets = [_selectedTargets,[],{_x distance _zombie},"ASCEND"] call BIS_fnc_sortBy;
_closestTarget = _sortedTargets select 0;
};
you never select a closest target
Yes, the select 0 is the closest target
if it uses setVariable, it makes no difference whether it's an OBJECT or LOCATION
both support setVariable with the same features
which may never get selected if _selectedTargets iEqualTo []
@little raptor yes, of course. notwithstanding the argument constraint.
this one is fine:
params [["_target", objNull, [locationNull, objNull]]]
the argument can now be either a location or an object
great perfect. thanks for the clarification. 👍
Is there a script command that which Server's OS is running, Linux or Windows?
no
@quasi rover but you can check commands that are not available on Linux
if it doesn't exist -> Linux server
I think rotorLib commands were not available on Linux
@quasi rover try this:
_isLinux = supportInfo "i:getRotorBrakeRTD" isEqualTo [];
_isWindows = !_isLinux;
Hello everyone. Curious if anyone has fixed Jezzurro's "Warlords Redux" ammo reload issues. Before I dive in and look for the issue, I figured I'd ask because it's likely someone has already fixed it. Thanks for any tips! (plz @ me for attention)
noone is allowed to fix someone else's mod without their permission
It's a mission not a mod
That's news to me, where does it say we can't fix mission bugs?
ask in #ip_rights_violations
Jezuro is a BIS employee and stopped working on the mission.
thanks Leopard20, I checked it.
does it work?
@little raptor https://i.ibb.co/mBYD3ZZ/zombie-Brains.jpg
The image shows both the FNC and the Spawn results as systemchats
yeap, on linux server, the return value, _isLinux is `false'.
The FNC is working great and the zombies get my player as the closestTarget...
but the spawn that calls the FNC doesn't get the FNC return for some reason
so it doesn't work?
are you still using this?
#arma3_scripting message
it doesn't work? anyway the return value of _isLinux is false on Linux server.
it should be true
I search the #ip_rights_violations channel and the warlords topic was brought up...the answer was that it's not an IP Violation but rather an "OTHER" category. I then searched #other_ip_topics and references to Warlords edits were approved.
ok then. but still it's not related to this channel
I need to know if anyone has scripted a fix for Warlords Redux
Jezuro left it broke, nothing rearms
Discussion about anything related to Script creation and usage within game ... IF (script == true) THEN {chat here};
that's the channel description.
it's only for people who have problems with their scripts
It's superior to Warlords in many ways but the ammo thing is game breaking, hence why I'm asking here
I expressed myself wrong, the spawn never returns anything, it is the FNC which returns the "closestTarget", but then inside the SPAWN when it calls the FNC it doesn't get the results but now I think I know why... I should have done: _closestTarget = objNull;
_closestTarget = [_zombie] call vZombieSense;
I am such an idiot!
this was the final fix: _closestTarget = [_zombie] call vZombieSense;
ask in #general_chat_arma
😅
alright, I'll poke else where....I'll dig around the mission and if I find the rearm code I'll post it here
Thanks
if ((_asset getVariable "BIS_WL_nextRearm") <= WL_SYNCED_TIME) then {
_curWeapon = currentWeapon _asset;
{
private _turret = _x;
private _mags = (_asset getVariable "BIS_WL_defaultMagazines") # _forEachIndex;
{
_asset removeMagazineTurret [_x, _turret];
_asset addMagazineTurret [_x, _turret];
} forEach _mags;
} forEach allTurrets _asset;
_asset selectWeapon _curWeapon;
_asset setVariable ["BIS_WL_nextRearm", WL_SYNCED_TIME + WL_MAINTENANCE_COOLDOWN_REARM];
playSound3D ["A3\Sounds_F\sfx\UI\vehicles\Vehicle_Rearm.wss", _asset, FALSE, getPosASL _asset, 2, 1, 75];
[toUpper localize "STR_A3_WL_popup_asset_rearmed"] spawn BIS_fnc_WL2_smoothText;
} else {
playSound "AddItemFailed";
};
The issue has to be in there somewhere....players reported missing ammo/smoke/etc but no rearm after the timer hit 0
Anyone have an idea?
is there any way to return Engilsh, non-localized string from getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName")?
good morning all i am from Germany whe hav a Altis Life Server 4.4r3 and whe have Problem with he weapons equipment
this is no longer active after the game update (2.02) our main admin is no longer so active because of real life but we have access rights to the main server (sorry for my bad english)
You can get the raw text
but I don't know if you can localize it to a specific language
https://community.bistudio.com/wiki/getTextRaw
it will return something like $STR_?
yes
I don't think there's any direct “STR_brabra to specific language”, although some stupid and indirect workaround could achieve that IMO
maybe dedmen could answer if it is even possible to add something like localize ["STR_blabla", "English"] into the next a3 patch 🙏
currently discussing in #arma3_feedback_tracker
thank you for raising this request 😅
i got a bunch of local variables in my function, which i want to initialize as privates through my params command, but i dont want them to be accessible by the caller, (they re pure helper vars). can i do that by giving an empty array as expected datatypes <=> no input allowed?
private variables are not accessible to the caller
_a = 1;
call {
private _a = 2;
};
_a //returns 1
no i meant, i want to initialize them in the same params command as my input variables, without having them accessible
params["input1",input2,local1,local2]
and lock local1 and local2 from outside
params [
["_crate",objNull,[objNull]], //input 1
["_clone",objNull,[objNull]], //input 2
["myLocalVariable",objNull,[]] //shouldnt be overwritten by a third, unwanted input given, just be initialized as null.
];
then just initialize it as null 🤷
private _myLocalVariable = objNull;
is there any way to enable the squad AI radio messages in multiplayer
but im lazy and dont want to do it for every var 😢
@spark turret you can also "skip" parameters:
params ["_var1", "", "_var3"];
then do this:
[objNull, 1, 2, 3, ...] params ["_var1", "_var2", "_var3", ...];
it's slower than private _myLocalVariable = objNull; 🤷
yeah thats fine, i dont have any functions running on a loop where it would matter
@spark turret also you can just skip putting private behind every variable if you just define an array of privates:
private ["_var1", "_var2", "_var3"];
yeah that is good too
(still not sure what you want to do) 
exactly what you wrote on the last line
initialize as bunch of privates as null or nil, i just thought the shortest way is to put it in params
what do you mean enable?
they already talk in MP!
yeah but i mean like the readable verison that happens in multiplayer
man 200 meters left
It's already enabled by default 🤷
Or do you mean you want to reenable it? (like when it's disabled by a mod, mission, etc.)
no in MP the ai will say the radio protocol but it will not display a text version in botom left like sp this isnt a problem for Us forces cause the speak english but trying to understand what spetznass foces say in mp is harld less you speak russian
they dont for me mabey its a playable units thing idk
but my 4 man fire team all playable, will say their lines but dont show a text response at all, makes it hard to understand the callouts when their in freaking russian
only a map and drongo simple factions
and i checked the callouts work in sp
i will get the text version of what was said in bottom left
it could be a bug
I know there were some changes to the group chat messages in v2.02
Maybe that's responsible
could be
cause it be nice to know if my russian buddy is telling me "man 200 meters left" or "TANK 200 meters left"
the subtitles rely on the radio item
so if you dont have itemradio or some mod is messing with it, it could be causing the issue
they have a radio they are literaly straight from the editor
apparently it works fine in SP
but not in MP
so it could be a different issue
Yeah I was thinking maybe something like tfar which turns the radio into another item might do it but I can't remember if it has a dummy itemradio like acre
hmmmm okkkkkay its working now in mp same mods loaded
strange wasnt working last night
oh well thanks for the help
The golden rule is: as soon as you ask for help, the problem vanishes
Hey, I need help. My bank account shows a negative number 😄
is there a fast and easy way to define a bunch of respawn inventories availalbe to the player?
ideally i would like to collect all loadouts of the playable units and make them availalbe to the player on respawn.
Either use the script provided on the Arma 3: Respawn page
or use 3den Enhanced and export the loadout of the selected unit
sorry, i dont see the function, can you point me to it?
ah thats what i wanted thanks revo
That one @little raptor
You can only export one at a time. Maybe I change that at some point.
❤️
wish the vanilla flash lights were a bit more powerful NVG's are ok but a good night mission with just flash lights and moonlight are fun
want the contact DLC lighting in base arma 3
contact DLC lighting is nothing special
you just play the mission when the moon is the brightest
try utils 3
in debug console
, nah pretty sure ive messed around in the editor with contact only the nights are significantly brighter compared to a3, especialy on nights that arnt full moon. base unless its full moon you dont see jack, contact you can still see ok even at half moon
okay so i have CfgRespawnInventories defined with 4 classes, respawnTemplates is set to MenuInventory and now i have to make all defined loadouts available to side west ?
in the initServer or where do i do that?
yeah that worke
Apologies if in the wrong channel, but could someone kindly explain how to do what is in the following forum post link : https://native-network.net/forum/thread/11738-loading-screen-script/ ```c++
class RscStandardDisplay;
class RscDisplayStart: RscStandardDisplay
{
class controls
{
class LoadingStart: RscControlsGroup
{
class controls
{
class Logo: RscPictureKeepAspect
{
text="\mv_data\ui\logo.paa";
onLoad="";
};
};
};
};
};
It is as simple as creating a config.cpp file with that code inside (creating a random logo.paa picture) then converting it with the addon builder, Adding it to a folder like @Mod then running it on my client?
is there a way to make a script not select the same value in an array when using selectRandom
Remove value from array
how do i do that
_randomItem = _myArray deleteAt (floor (random (count _myArray)))?
Need a script to change RHS MI-8AMT's Machine-guns to GAU-8s (vanilla or rhs any is fine)
soo would this work ```sqf
if (isServer) then
{
_allpositions = nearestBuilding _gGroup buildingPos -1;
_randomItem = _allpositions deleteAt (floor (random (count _allpositions)));
_gGroup = [getPos aPosition, east, 5] call BIS_fnc_spawnGroup;
{_x setPos (selectRandom _allpositions); disableAI "MOVE"; _ramdomItem} forEach units _gGroup;
};```
You can use array shuffle and pick elements in their new order
{_x setPos (selectRandom _allpositions); disableAI "MOVE"; } forEach units _gGroup;
Should be
{_x setPos _ramdomItem; disableAI "MOVE";} forEach units _gGroup;
ah cool so it pulls the position from the array and then removes it from the array so the next time it runs through for each that position wont be there anymore
yeah i dont want to spawn 2 units on the same position
One more thing to worry about is what happens if there are more units in the group than positions in the building
Hi guys, if i put this: playSound "cp_mission_accomplished_1"; in the initServer.sqf does that mean it will play for everyone?
hmm getting an error ```sqf
if (isServer) then
{
_allpositions = nearestBuilding _gGroup buildingPos -1;
_gGroup = [getPos aPosition, independent, 5] call BIS_fnc_spawnGroup;
{
_randomPos = _allpositions deleteAt (floor (random (count _allpositions)));
_x setPos _randomPos; disableAI #"MOVE";
}; forEach units _gGroup;
};```
missing ;
whats #