#arma3_scripting
1 messages · Page 178 of 1
agentsreturns a list of… Team Membersagent _teamMemberreturns the object the Team Member is
like… yeah 😄
a very primtiive form of hunting as a side quest for some players
thats incredibly weird
btw, I believe addAction won't work on agents
C in "Arma" stands for Consistency 🙃
even on the corpses?
yyyep
aaand that's a good one 🤣
{agent _x addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
_unit addAction ["Hehe", {systemChat "It's already dead"}];
}];} forEach agents;```seems to work as intended 
agent _x addAction ["added to alive agent", {systemChat "ohoho"}]; seems to work as well (at least on stationary agent) 
not for me....
huh, good to know! it was not tested in a long time, so maybe it actually works in A3
the distance check seems to be borked on defaults, though
ahh. so just crank it up i guess
both on alive and dead agent 🤔
seemingly can be side-stepped by the non-default condition of "_this distance _originalTarget < 5" (non-default, but very popular 🤣 )
What does it do? Shows within 50m regardless?
Hi guys, got question. I am annoyed that my tank divisions AI dismount upon getting detracked. is there a way of stopping it from happening? So the crew always stays in the tank/APC even if the tracks are gone.
tried
this setUnloadInCombat [false, false];
did not work
i love u
hold up
they still get out
KK_fnc_allowCrewInImmobile = {
_this allowCrewInImmobile true;
{
_x disableAI "FSM";
_x setBehaviour "CARELESS";
} forEach crew _this;
};
//example
car call KK_fnc_allowCrewInImmobile;
i put it in tank execute/ did I mess up? @granite sky
also get error invalid number in expression
noticed.
aint any, just trying to get them to stop decrewing/ ever. they go down with their ship
tried the
{
_this allowCrewInImmobile true;
{
_x disableAI "FSM";
_x setBehaviour "CARELESS";
} forEach crew _this;
};
notin
As soon track is gone/they bail out
allowCrewInImmobile works. We use it regularly.
So likely your code isn't being executed on the vehicle.
_vehicle allowCrewInImmobile true;
?
I can't tell you what the first part should be.
or shut i put it on false?
_vehicle/_this/this/whatever have no meaning without context.
There are a lot of different ways to run SQF code in Arma.
Is there a way to get the unit from a weapon object?
E.g. looking at a unit's gun and running cursorObject returns NOID: modelName.p3d. objectParent cursorObject doesn't return the unit like I thought it might
I doubt it. The weapon isn't really an object, just a model rendered as part of the unit.
kinda annoying behaviour from cursorObject.
Anyone remembers any limitations on allLODs and selectionNames, can I rely on them to working right away (Init or frame later)?\
I think I recall there being something about it but I'm not sure. I want to go through all LODs and check if certain selection is there. Not sure if model streaming can affect that.
isn't there a way to get the .p3d path of an object in game?
getModelInfo?
that was it, thanks
wow every thing is working so good, i wish i had something for you guys to fix,
ill have something soon i can feel it
lol
That's what I assumed
Guess I could get nearest unit object within some small radius if it has no type
idk about allLods but if you do createSimpleObject the model always gets loaded (except for visual lods I think)
I think allLods is the same
Thanks, I couldn't find issues through tests, lets see how it does on live
Turns out you can't even get the position of the weapon either, getPosASL returns [0, 0, 0]
How do getVariable and setVariable refer to objects passed as varspace? I thought it was a pointer. But I've seen code where a client is setting vars on vehicles that would be local to other clients.
setVariable only stores things local to the machine it was executed on, unless you give a target for where the variable should be set.
E.g. using true to set the variable on all machines
is it possible to find out what music/sound is played (ambience sound effect on a terrain) and stop it somehow?
idk but i found this: https://community.bistudio.com/wiki/addMusicEventHandler
anybody here by chance has something in hands which makes the mortar shells/artillery shells sound just like being placed by zeus?
my community just "raised" that concern to me and i dont want to dig through all that crap :3
does anyone know how I would go about using a trigger to tell an ai squad to get in a heli and then have the heli take off and move to a position?
I would use 2 triggers:
- to order AI squad to get in using https://community.bistudio.com/wiki/orderGetIn
- to order the heli take off and move to a position using https://community.bistudio.com/wiki/addWaypoint
and I just sync the triggers to each other in the order I want them to fire? and sync them to the squad/heli?
As you wish -- you can use global vars instead.
it's telling me it expects a bool. How do I assign the squad to the heli?
What does expect a bool?
the trigger
Well, then write the condition, upon fulfillment of which an order will be given for AI squad to get in the heli.
when I do I get an error
Then your condition is wrong, fix it.
This is not a condition, condition should return bool value, true or false.
then where do I put that?
Condition in "Condition" field, order in "On Activation" field: https://community.bistudio.com/wiki/Eden_Editor:_Trigger
so wait
I have an area set to activate when the players get into an area
it's condition is set to true and is synced to the trigger next to a heli. That trigger's condition is true and the activation has that order for them to get in
so what am I missing?
Correct code I guess.
is [_unitOne] allowGetIn true; not correct?
Yes, it's incorrect.
what's wrong with it?
_unitOne is undefined.
how do I define it?
Greetings,
How would I go about extracting several arrays from a preprocessed File?
_content preprocessFile "myFile.sqf";
Puts everything in the file into _content...
Now I just struggle with accessing parts of what´s in the file.
Currently I am doing this:
private _configFile = preprocessFile format ["arsenal\configs\arsenal_%1.sqf", _arsenal];
And the contents of the arsenal_%1.sqf are:
_weapons = [
//...
];
_backpacks = [
//...
];
_magazines = [
//...
];
//...
And I need to access these arrays / know what´s in them somehow.
If that's what in it then just compile and execute it.
Well, I guess you'd have a local var problem, but that's easily resolved if they're your files.
actually if they're not declared private then you can just pre-declare those vars:
private ["_weapons", "_backpacks", "_magazines"];
And then read the values after the call compile.
You don't need that:
_units = units mySquad;
{
_x assignAsCargo myHeli;
} forEach _units;
_units orderGetIn true;
in the activation field?
okay but what if in the function doing this:
private _configFile = preprocessFile format ["arsenal\configs\arsenal_%1.sqf", _arsenal];
I also want to do something like this:
private _allWeapons pushback //something from _configFile;
So:
private ["_weapons", "_backpacks", "_magazines"];
call compile preprocessFile format ["arsenal\configs\arsenal_%1.sqf", _arsenal];
_allWeapons append _weapons;
How´d I go about that?
No. Have you read the article about triggers?
yeah and it doesn't explain anything about the difference between the activation field and condition field
So this essentially hands the scope of ..\arsenal_%1.sqf to the calling file?
Meaning that as long as I know the names of the arrays I can take the Arrays I need ?
¯_(ツ)_/¯
then where do I put it?
if not in the activation field
since condition requires a true or false
It turns the string from preprocessFile into code and then calls it.
Into "On activation" field. Sorry, I thought you meant "Condition" field. It's time to go to bed...
so then if it's linked to the area trigger it should work?
ayyy so
private _weapons = [];
call compile preprocessFile format ["arsenal\configs\arsenal_%1.sqf", _arsenal];
//turns _weapons into:
_weapons = [
//contents of array in other file
];
Not sure, but check.
doesn't seem like it
Same as this:
private _weapons = [];
call {
_weapons = ["aaa"];
};
_weapons; // returns ["aaa"]
I´ve never messed with the compileor preprocessFile commands before, so please forgive me if i am a bit daft
ugh actually maybe I'm getting this backwards
Avoid doing this stuff intentionally most of the time :P
hmm no, does work.
Well I am making a script that "creates" whitelisted Arsenals from "config files" so specific players can have specific Arsenals. And so my Friends can use the script whenever and just change Arsenals...
I much prefer the CfgFunctions approach instead of _fnc_someStuff = call compile preprocessFile "file.sqf"
very nice, thx for the help, I shall implement it this way now
anyone know why this isn't working and the squad is ignoring waypoints?
hans disableAI "MOVE";
then there's an area trigger with enableAI "MOVE";
the squad lead's variable is hans
I followed a tutorial from 2021 and it worked there. Is that too old?
Uh, what are you expecting it to do?
_unit disableAI "MOVE" should prevent a unit from moving or turning.
The squad shouldn't be following waypoints if the leader can't move. Probably.
Yeah that’s what I thought
But it doesn’t work
I still don't know what you're expecting and how that compares to what you're seeing.
You may have some AI Mods then. Or some other Mods
Is anyone able to help me with this? i'm trying to save an object variable through the ALIVE namespace save and then load it in a new session to maintain loot. However this doesnt appear to work?
Saving code:
private _object = _this select 0;
if (isNil "_object") exitWith { systemChat "Error: Object not found!"; };
private _jna_dataList = _object getVariable ["jna_dataList", []];
["jna_dataList", _jna_dataList] call ALiVE_fnc_ProfileNameSpaceSave;
loading code:
private _object = _this select 0;
private _value = ["jna_dataList"] call ALiVE_fnc_ProfileNameSpaceLoad;
if (!isNil "_value") then {
_object setVariable ["jna_dataList", _value, true];
};
at the moment i am initiating them both by doing addActions in the object init
How are you sure it's not working?
if you haven't already, check bis_fnc_projectile
There aren't death planes
Pardon?
I mean, I know they aren't a base game thing
But I figured maybe I can set them to find the players grid position and just fly straight for it
that's what handles the zeus mortars, sound file paths will be in there
Oh you mean aircraft
Could try searching the discord / forums for kamikaze, there's been a handful of people who have asked about it
You could probably just use https://community.bistudio.com/wiki/setVelocityTransformation and make it fly into some unit / vehicle
I have no idea what any of the stuff in the description says lmfao
Hello, I have a question if anyone has any idea how to fix this. I've spotted a bug with BIS_fnc_unitCaptureFiring: if any plane or helicopter has two seats, the capture of the pilot's gun is correct but doesn't react at all. Only the copilot's gun seems to work.
For exemple the MI-48 Kajman.
This is my script : _V1movedata = ... ;
_V1pewdata = ... ;
_V1dothings = [v1, _V1movedata] spawn BIS_fnc_UnitPlay;[v1, _V1pewdata] spawn BIS_fnc_UnitPlayFiring;
Average vector related explanation
Something something voodoo magic
what's the main difference between BIS_fnc_unitCapture and BIS_fnc_unitCaptureSimple?
why use one over the other?
looks like simple version stores only 3 values when the other stores 5
its in the wiki but wiki isnt in very good order
Hence why I ask. Also why is even BIS_fnc_unitCaptureFire a separate function?
dunno
I may speculate, but Separating Movement and Firing, enables more flexible scripts.
And to not have insane amount of data also. Maybe they didn't want all of the data of a moving unit, that doesn't move just that it's fires
Idk the way I see it it's more harm than good. unitCapture doesn't include unitCaptureFiring, forcing me to stack functions.
Really annoying.
I wanna create an optional task to avoid killing civilians how can I do that?
I have never ever seen a unit moving while it has disableAI "MOVE" applied. Besides turning within small angle, which disableAI "MOVE" allows.
is it in an area? you want it attached to a trigger? or through out the whole mission?
AI overwrite mods like LAMBs or RNGai have separate behaviours, which ignore disableAI "move". Found out the hard way.
Thanks then, so I don't have to find out hard way too 😀
But this is weird, disableAI does what is says, it disables AI
I wanna attach it to a trigger so that when I mistakenly kill any civilian during my operation I will fail the optional task
How could AI with disabled movement move? It has movement disabled, literally. Only explanation I have is that those mods re-enable it
the popular AI mods don't overwrite base AI functions, they add another layer ontop of them. ``disableAI` turns off the vanilla layer, but mod behaviours like pushing towards player or erratic movement will persist.
unit AI isn't one system, it's multiple systems intertwined
Create task and if they still live at the end of mission, then set status of the task as completed
what about this one. I tried to use it but It missed something I guess
({side _x == civilian && !alive _x} count allUnits) > 0;
I created a task but I used in the trigger this script
try these, bare in mind i'm dogshit at coding:
inside every civilian's init, put in the following:
this addEventHandler ["Killed", {setVariable ["CivilianKilled", nil, true];}];
Inside mission's init.sqf:
missionNamespace setVariable ["CivilianKilled", "false"];
Inside trigger's condition:
getVariable ["CivilianKilled", "true"]
I thought allUnits returns only alive units
ok I will try this one now
If you want to check if any civilians are alive then I would do (count units civilian) > 0
like that?
Yeah, but this only makes sense of there was only one civilian, since this condition returns true as long as at least one is alive.
So might need to adjust 0 to something larger
And just for your information trigger area does not matter when you remove this from condition
yeah I know I just used it to try something in the beginning
But the task hasn't failed yet!
It didn't work
If there was at least one civilian alive when scenario started, then this trigger fired right at the start of scenario
Now I have more than 5 and when I start my mission, The trigger gets active before I even kill any civilian
(count units civilian) > 0 this condition would have to be used right before mission ends
Maybe if player is supposed to go somewhere to end mission you could use trigger, which would be set to be activated by player being present in the area and trigger condition would be this && (count units civilian) > 0
then this would fire when you enter the trigger area, while at least one civ is alive
but this is not going to fail the task
Trigger with condition (count units civilian) < 5 fires when there are less then 5 civilians alive, which you could use to fail the task
But this would be better to do with event handler like Texas was suggesting
And fail task by event handler when any of the civs die
thank you, bro 🥰
Finally I did it
It didn't work in the beginning for a glitch or something.
Idk but it works now thank you again
Hello,
I want to spawn an NPC at a certain position depending on the building type. So I want to use modelToWorld but I don't know how to get the position relative to the building where I want my NPC to be placed?
do you have any idea?
Thanks !
I success to have position with this and playing with _offset:
_offset = [2.35,5.5,-2.72];
_worldPos = cursorObject modelToWorld _offset;
npc setPos _worldPos;
I'm trying now to get the dir
Get dir from where?
https://community.bistudio.com/wiki/getDir
https://community.bistudio.com/wiki/getRelDir
https://community.bistudio.com/wiki/getDirVisual
Depends what dir do you need and you want to set new dir?
is there any way of just straight dumping the entire contents of a text file (or sqf file) into a string variable? What I have right now is:
example.sqf:
maybe with some linebreaks,
maybe with some "quotes" in the text that I'm gonna have to escape,
and so on and so forth";```
Ideally, what I'd like to have is
``example.txt``:
```a bunch of text,
maybe with some linebreaks,
maybe with some "quotes" in the text that I'm gonna have to escape,
and so on and so forth```
Specifically, it'd be of enormous help to not have to go through the text and escape every quote.
Just put it in a separate file and use #include "bigText.sqf" or something similar in your main file
There i add code for adding 1 inv item to ai clothes on initserver
Then i want to complete
Assigned Task for pickup it
Any guide?
I try it on trig cond but task wont complate
It have any prob?
[player, "ItemMap"] call BIS_fnc_hasItem;
What are the trigger settings?
None
Cond
[player, "ItemMap"] call BIS_fnc_hasItem;
On act task comp order that tested before
Check using debug console if your condition really works.
I read somewhere that BIS_fnc_hasItem is buggy.
There are simple alternatives too. "ItemMap" in items player if it's in inventory, or player getSlotItemName 608 == "ItemMap" if it's equipped.
Let's compare:
(player getSlotItemName 608 == "ItemMap") or { "ItemMap" in (items player) } // length is 77
[player, "ItemMap"] call BIS_fnc_hasItem // 41
Where is simple?
In this case it sounds like you know which one of the two you want.
Normally you'd just use the getSlotItemName one.
Map can appear anywhere when you pick it up.
So BIS_fnc_hasItem is a more universal solution. The only question is if it's really bugged or I'm wrong.
I've never heard of hasItem being buggy, but it is performance-intensive because of the depth of the search it performs. If you need to check very frequently (e.g. each frame) then you should try to find a narrower check you can use.
Sure, but triggers don't check each frame.
Looks like BIS_fnc_hasItem does a recursive string search on getItemLoadout, so it should be reliable, just slow.
In sp that cond worked good but not on mp
Good. Screenshot?
I will take it
- Make the trigger to be non server.
- Change condition to
!(thisTrigger getVariable ["mapIsTaken", false]) and { [player, "ItemMap"] call BIS_fnc_hasItem }
- Change "On activation" code to
thisTrigger setVariable ["mapIsTaken", true, isMultiplayer];
if (!isMultiplayer or { isServer }) then {
[...] call BIS_fnc_taskSetState;
} else {
[...] remoteExecCall ["BIS_fnc_taskSetState", 2];
};
So, I got your help a couple of days ago, and your solution worked fine for # firstText otherText, converting it to [h1]firstText[/h1] otherText. However, with multiple occurrences, it captures the first occurrence of # and the last occurrence of \n, so the output becomes
otherText
# secondText[/h1]
otherOtherText```instead of the expected ```[h1]firstText[/h1]
otherText
[h1]secondText[/h1]
otherOtherText```
I guess I'm looking for "match any character any number of times except for a line break". I've tried to use lookahead, but can still only get it to capture the last instance of the final delimiter (linebreak, in this case).
I guess the issue is that there are different linebreaks in your text: \n, \r\n, etc.
Try this regex: "# (.+)(\n|\r|\r\n)/g".
I've tried that exact solution, and it still matches on the last linebreak. I've tried converting the text to have identical linebreaks all over (_input = loadFile "input.txt" splitString toString [13,10] joinString endl;), but it still matches on the final occurrence.
It seems to be the expected behaviour, if we assume that Arma 3:s regex parses treats linebreaks as any other character, because regex101.com matches the first and last double asterisk, like so:
yup, it worked.
try with something that isn't an actual linebreak. Compare
and
if a3 doesn't treat linebreaks as actual linebreaks but just special characters, it seems to work as you'd expect. (which is still a bit iffy, but it did lead me to your solution that works for a bunch of other use cases, so you solved like 5 problems in one, thanks 👍 )
So, I've noticed Arma Man has air resistance when you fling him.
...Does anyone know how much?
where can I see what exactly single player save save (global variables, objects, date, time etc) ?
profile name space under documents using windows but most things will be encrypted
no idea might be in config but afaik its mostly mass that de acelerates people bullets simulate more air resistance
I wonder if his terminal velocity would tell me
config would tell you easier but there is also the nvidia phsyx docs https://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/classPxRigidBody.html
arma man is not a physX object
i couldve sworn units were phsyx objects as well as vehicles?
nay
@lime rapids what it saves, not where 🤓
Turn ArmaMan into a soft body
you can look in that file and see what it is saving
😦
weird after digging into it it has no air friction config paramater i wonder how that will work with setting mass to 0 or if its linked to how equipment adds mass to a unit to add stamina
Actually, decent thing to test. Arma man had a terminal velocity of 67 m/s (no freefall) when I tested, but I didn't test with different equipment loads
I don't think it matters, though
yeah seems setmass does not affect it
(Because arma man doesn't actually have that mass)
so does setmass just affect stamina for a unit then and nothing else if it isnt a phsyx object?
I think it does nothing for a unit?
In any case, some test code if you want to jump off of some things. I'm pretty sure this is the right concept, but my drag coefficient is wrong.
lastVelocity = 0;
onEachFrame{
private _dragCoef = 0.00429677;
private _velocity = velocity player;
private _speed = vectorMagnitude _velocity;
private _acceleration = (lastVelocity - _speed) / diag_deltaTime;
lastVelocity = _speed;
hintSilent str _acceleration;
private _resistanceVelocity = ( (_velocity vectorMultiply _velocity) vectorMultiply (-_dragCoef/2));
_velocity = _velocity vectorAdd (_resistanceVelocity vectorMultiply diag_deltaTime);
player setVelocity _velocity;
};
If your terminal velocity is correct, that'll mean the drag coef should be: g/v^2 = 0.00218467365 (assuming the game uses quadratic drag)
You're not accounting for gravitational acceleration
It happens regardless of me setting velocity or not - apparently gravity step is independent of setvelocity
this is me just trying to "counteract" it
You can use setVelocityTransformation instead
Oh no, I'm trying to counteract it and allow gravity
I'm flinging a man accurately
(with the potential for organic interruption)
iirc men do collide when they have velocity, even if you use setVelocityTransformation
I also mean like, him getting shot or slamming into a tree etc
I'm teaching AI to jump, you see
but like, stupidly
Worst case I just adapt my missile guidance script to harold (harold is my test dummy)
Does anyone have any idea how to detect the opening of a specific door or set of doors on a map object? I'm trying to create ready or not-like traps where the opening of a door acts as the trigger to an explosive, but I can't figure out how to detect when the door opens.
I don't think there are any events. You'd probably need to poll animationSourcePhase
Hey
I want to show a cinematic intro
That player are in first person
The eye close and open effect is what i need..
Any guid?
Do you mean black out/in
Some thing like fade out and in
Close eye and open
Like when an explode happend and you get dammage and close eye and after few sec open it
Slow and natural
Hey people and good morning, Im into developing a old idea
But small steps first I want to show the return value in a hint/systemchat so I can be sure whats going on (what my return value exactly is)
Thats what I have so far:
_position = nearestLocation [getPos player, "",20];
systemChat _position;
I expect to get the cords here
cutText may help
Let me search about it and am there in a while
I'm 99% sure you didn't even ran this code, since if it works perfectly, will return just an error
Ouch
So the first line doesent work as well, am I getting you right? (language barrier)
No. systemChat doesn't take a location
But isnt _position the way to execute the return value of "nearestLocation"? sry for basic questions
That's not the question/issue
systemChat just doesn't work like that and will return an error
Copy confirm
Ive also tried with "hint". It issued me in the same way haha
So how am I able to check whats my current return value?
Use systemChat str brabra
Can you explain me how it works?
So I would do systemChat str _position;
Yes
So what does str do? https://community.bistudio.com/wiki/str
Is that the correct wiki entry?
Yes
Thanks brother. Im into reading then
Bro I totally dont need this hahaha, love moments like this
What I want to return is the Numbers of players in a called area so I
can adjust the difficulty of spawning AI automaticly by detecting the
player count
Thats what Ive did now. But Im hanging on how to define the position
_Position = _this;
_Area = _Position nearEntities [player, 20];
systemChat str _position;
But I have the problem that _this isnt detected as the point where the script is getting executed from
In my case a simple object with addAction command:
_this addAction ["Verteidigen", "MissionsGenerator\TrenchComplex\Verteidigen.sqf"];
->
execVM "MissionsGenerator\PlayerScan.sqf";
->
_Position = _this;
_Area = _Position nearEntities [player, 20];
systemChat str _position;
The issue is in the last instance where no usable position for "nearEntities" is found
So how can I give him the correct input?
2 issues:
- according to the code posted, you're not passing a position to the execVM as an argument, so
_thiswill contain nothing. The game doesn't magically know what information you want to pass to be included in_this, you have to tell it. - your syntax for
nearEntitiesis wrong
Thats what Im finding out at the moment slowly
_Position = getPos player;
_PlayerScan = _Position nearEntities [player, 20];
systemChat str _PlayerScan;
Thats my current attempt, but the value of "_Position" are cords
https://community.bistudio.com/wiki/nearEntities
It looks like you're trying to use syntax 2. Look at the parameters for that.
Is there a reason to have two script files just to run some nearEntities
Right, so read that list of parameters and compare them to what you actually have in those positions
I want to have everything clean. Thats the file for the playercount.
On the actually defending (so spawning) file I want to set the difficulty with
the return of the playercount file
Im into it. Thats also my question. What is a "position" in the sight of the game? If cords arent it what else could be ment?
execVM creates a new separate scheduler thread. You won't get a useful return by doing that.
Is call better in my case?
Yes but for this tiny piece of code you might as well just write it in place
Copy confirm
Im into restructure.
Im placing down the PlayerScan in the actual defending script.
The addAction command is stored in the entity init like this:
_this addAction ["Verteidigen", "MissionsGenerator\TrenchComplex\Verteidigen.sqf"];
In that way I can still execute the command in a zeus mission live
The final defend script looks now like this:
//------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------PlayerCount------------------------------------EBER------//
//------------------------------------------------------------------------------------------------------------//
_Position = getPos player;
_PlayerScan = _Position nearEntities [player, 20];
systemChat str _PlayerScan;
Position is an array with three numbers, that represents X, Y, Z axis each
Now that you're defining the position with getPos instead of literally nothing, it should provide a valid position. That's not the syntax problem I'm talking about.
Look at ALL the parameters in syntax 2 for nearEntities.
So I need above see level, right?
First parameter (left argument) is a position or object. You are providing a position. ✅
Second parameter (right argument, first element) is a string or array of strings. You are providing the return from player - an object. ❌
Third parameter (right argument, second element) is a number. You are providing a number. ✅
getPos returns a 3D position and there are 3 coordinates in that array.
Oh your right... Just was blind
So Im failing in the atribute "type"
getPos also isn't really the correct command to use, because the position format it returns is AGLS, while nearEntities requires AGL. This difference won't cause a script error, but it could cause your vertical positioning to be wrong.
It is possible to get the position in the correct format, but you can skip that: nearEntities accepts an object for the position parameter, so just provide the player directly.
So my position value needs to be relative to the ground? So I need getPosATL?
Btw the return value of _PlayerScan is equal []
It needs to be relative to the ground, but AGL is not the same as ATL. Click on one of the position formats mentioned on the wiki page to see all the different formats.
And like I just said, you can simply use the player object directly, and not worry about getting the position yourself.
So I do it like
_PlayerScan = player nearEntities ["player", 20];
systemChat str _PlayerScan;
But my return stay []
Well, you're looking for objects of the type "player", but this isn't an object class that exists in the game
Damn... Bruh. I feel cheated. Ouch. haha how dumm I feel now. learning.exe -> saved process
Player units aren't a unique kind of object. Their object class, their type, is still "B_Soldier_F" or whatever.
So in my case
"BWA3_Rifleman_Tropen" they are all the same kind of unit. What they are need to be, right?
Now Ive got the return value "D" thats quite random, can you explain me why its not my player name or a number?
Its just "D" lol. Ill translate it now into a number with the count command
You could search for that class, but if there happened to be an AI unit nearby of the same class, or if you wanted to make a player use a different class, you'd have problems.
Watch this:
private _nearPlayers = allPlayers select { (alive _x) && { (_x distance player) < 20 } };```
Ok study time
Bro I need to fully understand "private" btw. Im still kinda unsure in usage
Ive found out today that == means is equal to
But what does && mean? Is there a diffrence to just &? Like force and force force?
So is it just a priority thing?
String representation of an object reference. Object references aren't human-readable, so when outputting them to a string, the game has to come up with something to show you. If the object doesn't have an Editor variable name, then it shows some auto-generated information, like its group ID and position within the group, if it's a unit. If it does have an Editor variable name, that variable name is shown.
Your player unit probably has the variable name D.
If you have a new question you should probably make a new message instead of editing the old one :U
&& is equivalent to and
About private:
https://community.bistudio.com/wiki/Variables#Scopes
Oh yeah your right! Its the Zeus connection!
Very well explained. Thank you alot. There was a real big question mark in my eyes haha
So its just another "syntax"
Copy
Btw, as you've just discovered, all the solutions we've discussed so far will also return the player who activated the action. If you do want that, then that's fine - but it is possible to filter them out if that's what you need.
Now we are at the point Im hanging on since Ive seen this
the first time. Why isnt 33 overwritten by 42 with the Global command?
I thought the global things are the most outer scopes and automaticly the "highest" so
they cant be overwritten by something lower or am I completly wrong with the
scope topic?
Global scope doesn't mean it can't be overwritten. It means it's available to all scripts - not limited to a particular script's scope.
My plan is to invent a self creating mission in someway.
So randomly generated procceses based on the player count -> difficulty
Being an Editor object's specified variable name does mean it can't be overwritten, as the page says, but that's not inherent to all global variables.
Okay its getting wild haha
That example you screenshotted is talking about the difference between global (scope) and global (networking).
A global scope variable is available to all scripts on the current machine. That example is talking about how to make it available to all scripts on every machine.
Thats the anwser haha
Its also what I will need in the future i gues
Btw Ive did something like that:
private _nearPlayers = str allPlayers select { (alive _x) && { (_x distance player) < 20 } };
_PlayerScan = player nearEntities [_nearPlayers, 20];
systemChat str _PlayerScan;
I tried to use str for the first time. Did Ive done it in the right way?
That's probably going to do str allPlayers first and then try to do the select on the resulting string. You might need some () to force the correct order of operations.
But also that is really not the way to make this code work
private _nearPlayers = str (allPlayers select { (alive _x) && { (_x distance player) < 20 } };);
No detection in the return value
Let's break down what you're doing:
- you get all the nearby living players
- you convert that array of objects to a string
- then you try to use that string (which does not contain an object type) as the type parameter for
nearEntities....to get all the nearby players
Yes
Well, doing that won't work, because that string is completely invalid for nearEntities. It is a literal text representation of an array of object references - but what you need is a string object type, or an array of string object types.
But more importantly, why?
The moment I went in silence I realized that I did the exact same shit before
allPlayers select ... gives you an array of nearby living players. Why are you trying to then run it through nearEntities?
Im tryna understand the correct usage of your command
So I can detect the amount of players nearby
Ive did it like this:
_PlayerScan = player nearEntities ["BWA3_Rifleman_Tropen", 20];
_PlayerCount = count _PlayerScan;
systemChat str _PlayerCount;
and got the result Ive wanted. The numbers I can use to create the if causes for the difficulty
nearEntities is used to get entities in a radius around the given object with the types and distance you provide
player nearEntities ["Man", 1000];
Will return an array of objects that are of type "Man" within 1000 meters of the player.
I know your ultimate objective, but you don't need nearEntities to do it
allPlayers select ... gives you an array of nearby living players. So what do you need to do, to find out how many living players are nearby?
just count that array
Ouuu
So your going in with allPlayers select fill filter here
//------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------PlayerCount------------------------------------EBER------//
//------------------------------------------------------------------------------------------------------------//
private _PlayerScan = allPlayers select { (alive _x) && { (_x distance player) < 20 } };
_PlayerCount = count _PlayerScan;
systemChat str _PlayerCount;
So now Im happy with the knowlegde and results.
Ive got private a bit closer again but its still not completly fine
Btw, is it actually important to only count nearby players? If you just need the number of players in the mission, this can be even simpler
Yes but No
Thats also a question Ive asked myself,
"Do I need this?" I decided for yes because its in all cases more dynamic
And also the learning is always important
I now need to go on and find out how removeAction works so the players
cant execute it 50 times because they think nothing happens
Btw, can you give me a tip how to set a "local variable"
to the object its executed? Because I gues its not the best way to always
strugle with _this
Because its wont work with the addAction thing:
_this addAction ["Verteidigen", "MissionsGenerator\TrenchComplex\Verteidigen.sqf","",1];
_this removeAction 1;
Well this is just "add the action to the object, then immediately remove the action with ID 1", which is wrong for 2 reasons:
- actions are indexed from 0, not 1
- removing the action immediately after adding it is probably not what you want
You're sort of on the right track with wanting to set a variable on the object. This is a good way to store action IDs. The command for this is setVariable.
HOWEVER
So I gave the priority "1" so its on first position, but the ID to remove it is "0"??
Priority and ID aren't the same thing
Ouch#
ID is a unique, sequentially-generated...ID...used to refer to the action later. Priority is just... priority. It's how much importance the game gives to the action when showing it in the menu. It's not unique and isn't used for anything else.
Action IDs are machine-specific and different (or nonexistent) on different machines, partly because the commands involved are all Local Effect: they only do stuff on the machine where they're executed.
So thats what I need in the object init:
_this setVariable ["TrenchComplexVerteidigungObjekt", "", true];````
No, because that just saves a variable with an empty string, which isn't helpful. You need to save the return from addAction (the ID).
But there's more, so just hold on a minute while I type
Cheers
You need to execute addAction on all machines, and removeAction on all machines.
The object init field is executed on all machines, including on new machines when they JIP. Helpful? Kind of...but it also means machines that join after the action is removed, will also add it again for themselves.
So instead, you'll want to use some check to make the code only execute on one machine (if isServer then probably) and use remoteExec to tell other machines to do stuff with safer JIP handling.
Done? No. We need to do stuff on the other machines using the returns from their local executions of addAction. But remoteExec doesn't support doing that directly.
So instead we enter the magical world of functions.
A function is a saved script, packaged into a single name. I'll post a link after this message. This lets us make a complete script and remoteExec that to be executed locally, not just a single command, so we can do more complex stuff, like working with the return from addAction.
Here's what we do:
- function 1 adds the action and stores the ID, locally on each machine
- function 2 retrieves the ID from the variable saved on the object, and removes that action, locally on each machine
JIP = Join in Progress, right?
I was doing this the other day so here's some useful code: #arma3_scripting message
Yes
Here's the info about functions: https://community.bistudio.com/wiki/Arma_3:_Functions_Library
You're making a mission, not a mod, so you need the information relevant to description.ext
I kinda know about functions
Its a bit rusty but Ive got a self writen explanation in my archiv lemme check
I explained it in the past with "Like a variable connected to a script"
Its also connected to the description.ext and I need files for it.
It look like:
Beispiel:
(muss in description.ext eingepflegt werden)
class CfgFunctions
{
class EBER //TAG (Vorname)
{
class Scripts //Category (1. Ordner des Pfades)
{
file = "Scripts\Ordner1\Ordner2"; //Atribut (bestimmt Pfad)
class szene1_Gruppe_I_4 {}; //Function (Dateiname des Skriptes) (ohne fn_) (ohne Dateityp)
};
};
class nächsteFunktion
{
class Scripts
{
file = "Scripts\Ordner1\Ordner2";
class szene1_Gruppe_O_6 {}; //Am Besten in camelCase oder snake_Case schreibweiße. Nicht in PascalCase
};
};
};
Its getting executed by something like:
call EBER_fnc_szene1_Gruppe_I_4
are we talking about the same?
What code editor are you using? Notepad++, Visual Studio Code, or...?
Notepad++
Ok, then nvm. Was going to suggest trying my Visual Studio Code extension that automates generating the Functions Library etc. but it's not available for Notepad++
Unfortunately I don't read German incredibly well, but that looks like CfgFunctions to me.
I did link the wiki page that also shows the structure.
You're going to need 2 functions as described in the message I linked a minute ago.
Instead:
call EBER_fnc_szene1_Gruppe_I_4
I use:
remoteExec EBER_fnc_szene1_Gruppe_I_4 [order?,0,true]
order: String - function or command name
"order" as in "instruction", "the thing to be remotely executed"
Copy - So the thin I need to create first
As I mentioned, this message contains almost the exact code you need to put in your 2 functions, and exactly how to remoteExec them. Just a couple of placeholder variable and function names and placeholder addAction content.
#arma3_scripting message
I need to go out now so good luck with this
Ill give it a try and let you know
Thanks for everything and for your great help. I enjoyed a lot
anyone know a lot about the arma commander mod ? need help
Sound part not work but other parts done.
Any guide?
call{[kod,
"D",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 2",
"_caller distance _target < 2",
{},
{hint "D";},
{
removeAllWeapons _caller;
removeAllItems _caller;
removeAllAssignedItems _caller;
removeVest _caller;
removeBackpack _caller;
_caller addWeapon "rhs_weap_akms";
_caller addPrimaryWeaponItem "rhs_30Rnd_762x39mm_bakelite";
_caller addVest "V_Chestrig_oli";
_caller addBackpack "CUP_B_AlicePack_OD";
for "_i" from 1 to 20 do {_caller addItemToVest "ACE_fieldDressing";};
for "_i" from 1 to 2 do {_caller addItemToVest "ACE_morphine";};
for "_i" from 1 to 4 do {_caller addItemToVest "30Rnd_762x39_Mag_F";};
for "_i" from 1 to 4 do {_caller addItemToBackpack "vn_m61_grenade_mag";};
_caller linkItem "ItemMap";
_caller linkItem "ItemCompass";
_caller linkItem "Itemwatch";
hint "L";
if isServer then {"gu" remoteExec ["playSound"]};
},
{hint "L";
if isServer then {"l" remoteExec ["playSound"]};
},
[],
1,
1000,
false,
false,
true
] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true];}
The client is not the server,
So you check the blocks play sound event.
You want to play the current sound for everyone or just for the caller?
If for everyone, just remove the isserver check .
Client
For client
But on mp ded server
Also what about play sound from objects? Like water or jungles
Hold action is executed locally on client so just
playSound "alarm"
Will play sound locally on client who use action.
You can use say3d
helicopter1 say3D "FortunateSon";
helicopter1 say3D ["FortunateSon", 500, 1, 0, 0, true];
[helicopter1, player] say3D "FortunateSon";
[helicopter1, player] say3D ["FortunateSon", 500, 1, 0, 0, true];
Work with dedic server mp too?
It will play local on the client,
Use remoteexec if you want to broadcast that to other clients.
Like what i send?
If yes it not work , sound not played
params remoteExec [order, targets, JIP]
order = function or command name, in this case say3D
How to remoteExec say3d
And make sure you sound is valid
Test with
player say3d "alarm"
So probably something like sqf "alarm" remoteExec [say3D, -2, false]; (2 in targets would mean "execute on server only", while -2 inverts the choice meaning "execute on every client but not the server" which is what we want here)
if isServer then {"l" remoteExec ["playSound"]};
Will it work when all guyz want hear it?
It is and defined with called class on desc
File
[player, ["alarm", 35, 1]] remoteExecCall ["say3D"];
So player who use action will be object that "say" your sound.
And no, you cannot use isServer check.
It will block because client is not server.
Just use remoteexec without check
Missing , after player
True, thanks.
Referring earlier,
Can you do classed by one letter?
Should it be tag_l,
More that can use even use
class cfgSounds {
class l {
...
Hello gents, I have question regarding time.
I am making mission that will be played on dedicated server and I want to track time after briefing (waiting on map), once we enter game.
I will need to refer to that time during mission, to check how much time is left till the end, or something specific to happen at specific time.
What would be the best thing to use as a got confused by time, uiTime, serverTime and diag_tickTime..
My target is playsound fnc
And when i need to just caller hear sound must use:
"l" remoteExec ["playSound"];
And when target is all players must use:
if isServer then {"l" remoteExec ["playSound"]};
Ya?
Noup.
For all
Remoteexec without check.
For client.
playSound "l"
Remoteexec Will raise your event for every client.
And without remoteexec it will play sound on client where it's executed because it's event that have local effect
Hmm
Must be this?
My target is playsound fnc
And when i need to just caller hear sound must use:
Playsound "l";
And when target is all players must use:
"l" remoteExec ["playSound"];
Ya?
Yes.
No.
Because hold action is local event.
And it's executed on client who uses it.
You should be fine with those
Ok , thank for guiding bros
Best regards
Right and correct
And for a pos sound like an generator
That need to play sound for every one i must use remoteexec?
To place code on init
i'm using the set hostage box in 3den and i have a trigger that has the condition ['ENH_isHostage', false]) but for some reason when the hostage is free the trigger wont activate? It does activate if the value is set to true. Anyone know why? thanks!
Can I use this in iniServer.sqf for that purpose?
[] spawn {if (isServer) then {START_TIME = diag_tickTime; while {true} do {ELAPSED_TIME = diag_tickTime - START_TIME;publicVariable "ELAPSED_TIME";sleep 1;};};};
time already tells you how many seconds its been since the mission started
Will it properly work on dedicated server?
isn't cba_missionTime usually better
Yeah, why wouldn't it
cant find any info on it, can you please point me with some link
a lot of info out there got me confused
It's a number
It's a thing from CBA, it's just a global variable with the time in seconds since mission start
If you have cba loaded you use that global variable
Something like this would do it?
[] spawn {if (isServer) then {mission_start_time = cba_missionTime; while {true} do {elapsed_time_from_mission_start = cba_missionTime - mission_start_time;publicVariable "elapsed_time_from_mission_start";sleep 5;};};};
uh
That elapsed time is just gonna be cba mission time
Because cba mission time is time since mission start
So I'm not sure what the point of that code would be
Ok let me clear it out. I have a fear that time will be counted while players are still on map (briefing) and not after I push it trough and that will break some of my stuff.
So I am trying to be sure, that time is going to be counted only and only when player is in game and he sees his gun in his hand.
Thank you a lot Jenna and Dart. You guys are great!
Just in your condition, say like maybe a trigger, do:
CBA_missionTime > 600;
That would activate after 10 minutes have passed since the mission started
That's all you need
Will this work and all players hear the alarm sound from speaker1 and 2 object?
CutText ["","blackin",2];
[Speaker1,Speaker2 ["Alarm",20,1]] remoteexeccall ["say3d"];
Sleep 2;
CutText ["","blackout",2];
Sleep 10;
[Speaker1,Speaker2 ["",20,1]] remoteexeccall ["say3d"];
Will be use in trigger on act with true cond.
You want cuttext for everyone?
if your trigger is only server [✔️ ] , then you need use remoteexec on cut text and say3D to broadcast to players
but if its global, you dont need use remoteexec, because you your trigger will activate on all clients
Its part of my intro
When players are move and enter trigger this code will run
Also before everything cinematic view will enable and players see blackin
Hear alarm and then blackout
Then cinematic view disable and they can keep move
disableUserInput true;
[0, 2, true, true] call BIS_fnc_cinemaBorder;
Sleep 1;
CutText ["","blackin",2];
[Speaker1,Speaker2 ["Alarm",20,1]] remoteexeccall ["say3d"];
Sleep 2;
CutText ["","blackout",2];
Sleep 1;
disableUserInput false;
[1, 2, true, true] call BIS_fnc_cinemaBorder;
Have it any problem?
You don't need remoteexec say3d,
Just
[speaker1, speaker2] say3D "Alarm"
Because it's local and if you remoteexec it, it will be multiple executed from client to clients, so change remoteexec part
Another on same topic. What would be a better solution for my initServer.sqf?
mission_start_time = cba_missionTime;
//Safe Time
sleep 600;
["Move out!"] remoteExec ["hint"];
//Mission Duration
sleep 3600;
"EveryoneLost" call BIS_fnc_endMissionServer;
or maybe
mission_start_time = cba_missionTime;
//Safe Time
waitUntil {CBA_missionTime > 600;};
["Move out!"] remoteExec ["hint"];
//Mission Duration
waitUntil {CBA_missionTime > 3600;};
"EveryoneLost" call BIS_fnc_endMissionServer;
Yeah
But you also don't need the mission_start_time
You don't use it there at all, and it would also always just be 0
Wich is better, sleep or waitUntil?
Undestood
It's going to essentially be the same
I know they are doing same thing, I am just asking for performance reasons etc.
It's going to essentially be the same
Thank you one more time 🙂
Memory is failing me here, If I want to trigger a waypoint when a specific unit is dead the trigger activation would be ```sqf
!alive UNITNAME
For example
#0 LOAD
#1 HOLD
#2 MOVE < Trigger Activation
#3 TRANSPORT UNLOAD
Also would It be smarter to also giving the unit a variable name and doing a move in cargo in its INIT? less chance of arma being glitchy with Units getting in vehicles?
Am I losing my mind? I could swear I have gotten this to work previously, and it is basically the exact code from the wiki (https://community.bistudio.com/wiki/getVariable), but, why does the following work:
hint _output;```
while the following doesn't
```_output = missionNamespace getVariable ("_input" + str 0);
hint _output;```
?
you mean "_input" + str 0 on the second one, I think.
That's a typo in my question, not in the script. "_input" + str 0 is what's not working.
Is your _input string?
If it's
private _newInput = _input + "0";
private _output = missionNamespace getVariable [_newInput,"defaultValue"];
hint _output;
missimissionNamespace?
Can we have some real code that actually declares _input0?
_input0 = "test", for sake of argument.
I have tried localNamespace and player, and neither of those work either.
I dunno, I never considered using getVariable on locals.
It doesn't make any sense to do so.
Maybe they don't exist in any referenceable namespace.
yeah, turning them into globals worked. Cheers! 👍
Right delving down a rabbit hole, checked above and cant seem to get it to work, im now trying the trigger with the following
Condition ```
!alive gospandicp_1 && gospandicp_2 && gospandicp_3 && gospandicp_4 && gospandicp_5 && gospandicp_6 && gospandicp_7 && gospandicp_8;
Activation
```sqf
axeman_1 sideRadio "Norseman 1, This is Axeman 1 Checkpoint is clear, move out when ready.";
norseman_1 sideRadio "Received, Norseman 1 & 2 are moving.";
axeman_1 sideRadio "Copy that, we will monitor your advance and join when close, Out.";
But its throwing an error
ahhh do I have to do each separately?
Yes, each alive check has to be done separately (though you could condense it with findIf).
You also have another problem:
https://community.bistudio.com/wiki/sideRadio
sideRadio is for sending audio messages by classname, not for sending freeform text messages. You're probably looking for sideChat.
([gospandicp_1, gospandicp_2, ...] findIf {alive _x}) < 0```
(`findIf` returns -1 if none of the elements in the array satisfy the condition, so if none of the specified units are alive, we get -1 and activate the trigger)
You are entirely correct sideChat is what Im looking for
hey rq was curious what does "simulationStep" do in cfgAmmo?
It'd specify the time between updates for that ammo. However, I don't know whether A3 uses the parameter.
yea was curious since the code i was looking at had it and on the cfgAmmo wiki it shows it exists but has no description other than that its a float
trying to teleport an enemy group to a location, trigger is BLUFOR present and code is ```sqf
{
gosptowndefence moveTo (getMarkerPos "GospandiTownWarning");
hint "Teleporting Enemy";
};
The hint is just for debugging purposes, Idealy Id like to set up a few empty markers and get it to randomise between them, say enemytown1 - enemytown 5 for example, but I cant even seem to get them to move as a group to the one marker with that code, anyone see something glaringly obvious?
moveTo is a low-level move command for units.
It doesn't teleport and it doesn't work on groups.
Hell, it doesn't usually work on units :P
If you want a group to move, then use move or waypoints. If you want to teleport them then do setPosATL on each unit.
Will give this a try in the morning!
If I'm spawning civilians through the Civilian Presence module, how could I check their side? This is what I've got so far to check if a player killed a civilian:
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer", "_instigator"];
if (isNull _instigator) then {
_instigator = UAVControl vehicle _killer select 0
};
if (isNull _instigator) then {
_instigator = _killer
};
if ((isPlayer _instigator) && (side group _killed == civilian)) then {
civDead = civDead + 1;
_instigator sideChat "No! I killed a civilian!";
};
}];```
Is there a way to check the agent's side?
_sideID = getNumber (configFile >> "CfgVehicles" >> typeOf _killed >> "side");
if (_sideID == 3) then {
civDead = civDead + 1;
};```
Well. I came up with this. Does this hit fps much in the missioneventhandler?
What you have will work, and isn't bad for performance.
Using side _killed will return the side of an object. However, if the object is dead, it will always return as a civillian.
You could use faction _killed which will return a string of the side as well.
https://community.bistudio.com/wiki/faction
Basically more of a "Pick your poison" in this case
I already tried using side _killed. I kept getting aError GIAS pre stack violation error though
faction seems less complex though. I'll try that
Those GIAS errors are typically when you mess up the syntax in a way that the interpreter can't fathom.
It won't be simply from writing side _killed, regardless of what _killed is.
what is the command to get a launchers attachments like primaryWeaponItems/secondaryWeaponItems ?
Launcher is secondary so secondaryWeaponItems
So anyone know how to make it so objects that are present in a scenario eventually despawn after a certain amount of time? Globally?
I went from student to teachers assistant today in a class. 😛
Does someone know why some objects are immune to "setObjectScale" when hostes on a dedicated server? I tried to set the scale in the attributes, everything working fine when locally hosted. But the second I put the mission on a dedicated server it breaks and goes back to normal scale. Same problem when executing it via a command in the object cmd. Can someone help?
swot 😄
setObjectScale takes local argument https://community.bistudio.com/wiki/setObjectScale
It's because objects in multiplayer need to be attached to an object prior to maintain scale
singleplayer and multiplayer have different rules on setObjectScale and how it behaves
object: Object - must be either an attached object or Simple Object - see Example 3
alternative as stated here is simple object

Hi, I have a question about Arma 3 and their running system. I was trying to make a Realistic Stamina script with the hopes of 4 levels of speed from Sprint, jog, light jog, walk.
I was hoping that the script would trigger the player speeds based on their fatigue.
For whatever reason, the running is only 2 levels (sprint and jog. I've tried everything but can't get it to work.
Is it possible with Arma scripts or am I wasting my time. I am very new to scripting, but I wanted to learn and give it my best shot.
Thanks for the insight, so basically to fix it I just need to attach them to eachother and then it should work right?
not to eachother
place a "holder" object it can be anything, just needs to be showing it's model, simulated and preferably somewhere nearby the objects you are attaching to it
then attach all the ones you want to upscale to this object using this init code within the object you want upscaled
[this,holder] call BIS_fnc_attachToRelative;
this setObjectScale 5;
example ^
You could try it with a animation check and due to in which category they are set the speed to what you want. Take a look at my mod to get a better Idea on how I managed to get somthing simular to that working. https://github.com/MissHeda/Adjustable-Walk-Speed-Rework
yea I framed my sentence a bit bad but thanks for clearing that up. 
Thank you, I'll try that.
feature request:
https://community.bistudio.com/wiki/insideBuilding
Can this be expanded so it can accept a position as a parameter?
You'd have to do that on the feedback tracker
https://feedback.bistudio.com/project/view/1/
2 part question, I thought there was an event handler for when an attachment on a gun changed like optic/muzzle device etc but I cant seem to find it
and part 2, would said event handler fire off when in arsenal? mainly in single player where time is paused (from wat I know)
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#SlotItemChanged (the added in 2.18 part)?
The vanilla arsenal does change the player's items live, so it should work.
Assuming that it ever does :P
any way to which specific weapon does? else I could:
- on arsenal open save current gun and attachments to list
- when this pops off, compare to saved variable
- profit? 🙂
idk why I missed the 2.18 addition to the slottedItemChange eh, I guess I was reading to fast
It didn't get added to the wiki... so maybe I should do that, but Dedmen also graced us with a weapon muzzle config event for SlotItemChanged
Also, yes, it fires in arsenal
Damn ghost events
Wat else is hidden 
Wouldn't you like to know 👀
Only other ones that I am aware of for muzzle events are the MagazineUnloaded and WeaponChanged (both of which I may use for the TCP shotgun)
I was thinking of trying to do my own version of RHS' bipod slot grip class changing using SlotItemChanged at some point for the VK78
These are trying times amongst ghost wikis
Cant figure out why this isnt working, Trigger Activation is None - Present
Condition !alive gosptown_1 && !alive gosptown_2 && !alive gosptown_3 && !alive gosptown_4 && !alive gosptown_5 && !alive gosptown_6 && !alive gosptown_7 && !alive gosptown_8 && !alive gosptown_9 && !alive gosptown_10 && !alive gosptown_11 && !alive gosptown_12;
Activation
null=[]spawn {
"miltown" setMarkerColor "ColorBLUFOR";
"GospandiTownWarning" setMarkerType "Flag_USA";
axeman_1 sideChat "CLEAR! CEASE FIRING";
sleep 2;
norseman_1 sideChat "Odin this is Norseman 1, Gospandi is cleared";
sleep 2;
officer1 sideChat "Copy that Norseman, Axeman 1 this is Odin Actual, Charlie Mike.";
sleep 3;
axeman_1 sideChat "Copy that Odin Actual, Continuing Mission, Out.";
obj3 setTaskState "Succeeded";
["TaskSucceeded", ["", "Windfall Stage 2 : Assist in the capture of Gospandi"]] call BIS_fnc_showNotification;
obj4 setTaskState "Assigned";
player setCurrentTask Obj4;
["TaskAssigned", ["", "Windfall Stage 3 : Clear Weapons Cache"]] call BIS_fnc_showNotification;
};
It is Identical to a trigger that I had set up with a different type of Unit with different names but for whatever reason this one isnt firing once all units are dead
You can execute that condition in the debug console to check its current status at any time. Try doing that to figure out if the condition is working as expected.
Good shout
Why not just simplify the condition to:
{ alive _x } count [gosptown_1, gosptown_2, ...] == 0;
See alt syntax on count
https://community.bistudio.com/wiki/count
findIf is slightly faster for this because it doesn't always have to iterate over the entire array (#arma3_scripting message)
Ah yeah forgot that findIf exits once true
does anyone know what terminal velocity is in arma?
Do you mean 9.8 or?
For humans, 67 m/s
Hi, just a question, did anything change in the scripting framework? because I'm getting now an error
private _invDisplay = findDisplay 602;
_invDisplay displayAddEventHandler ["MouseButtonClick", ...
_invDisplay displayAddEventHandler ["MouseButtonClic>
15:05:28 Error position: <displayAddEventHandler ["MouseButtonClic>
15:05:28 Error Foreign error: Unknown enum value: "MouseButtonClick"
I'm pretty sure it worked fine in the past
There's no such event handler for displays
It only works on some controls
See the wiki
I see now, thank you
is there a method to use halt or terminate without assigning a script handle in an execvm statement inside of executed file / code?
i suppose im asking if one can assign a script handle post execution of script\
terminate _thisScript;
ah thanks shouldve remembered to check magic variables
I've been struggling to create a script which will make a enemy AI plane "drop" the infantry as paratroopers... aaaand its chaos
anyone who can help me? or even better, suggest how I, as simple as possible, can make AI planes drop paratroopers
easiest way i usually do it is moveout with a foreach and just use units to get all units in a squad then put it in a waypoint activation field or trigger for when the air vehicle is in range
Call{[kod,
"D", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 2",
"_caller distance _target < 2",
{},
{},
{},
"Sound" remoteExec ["playSound"];,
[],
1,
1000,
false,
false,
true
] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true];}
When a player use this holdaction on server ,all players will hear Sound?
No, because you have a syntax error on the code you're trying to run
Also that call is doing nothing for you
Just do:
[
kod, "D",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 2",
"_caller distance _target < 2",
{},
{},
{},
{ "Sound" remoteExec ["playSound"]; },
[],
1,
1000,
false,
false,
true
] remoteExec ["BIS_fnc_holdActionAdd", [0, -2] select isDedicated, true];
does anyone have any idea on how to make a script to change pylons of helicopter using add action
i am trying to have set presets E.G. Escort - (just rocket pods), AT - (hellfires) recon - (hellfires+rocket pods)
I have seen that the setpylon command is there but im using RHS helicopters so I dont know how that would work, any help would be appreciated.
Because some unpleasant person is DDoSing the BI servers
Well......it is. It's been ongoing for the last few days.
okay since now i can
i can't access the wiki for scripting
i think this is the only place i can ask this
i wanna check real player side even while the player is dead
like something other then side
If you want to get the side of a dead unit, the best way is to check the side of its group. The dead unit itself changes to Civilian, but the group's side doesn't change.
so i have entitiykilled event on and i have checker for side players
and as you said it shows civilan cause the enitity is already dead....
what i have something like if!(side _killer == side _killed)
Like I said, check the side of the group.
if (side group _killer != side group _killed)```
that returns the side of the group and not the side of the unit
Okay i see
does that effects if all the group members are dead ? will it change the side ?
that only works on unit's death and some time after that, afeter a certain time dead units get ungrouped and all you can do is check faction (or config)
This is apparently in an entityKilled EH so I would expect it to work fine
You can't really trust config sides because a unit can be created on, or switched to, any side, regardless of its config
yep
on death is ok, later, not guaranteed
Thank you for answer
I use call cause am using code in trigger on act , still need to change ?
That code is already being executed, if it wasn't, then adding a call wouldn't change anything
there was a way to see script commands in the game, does anyone know how ?
@tulip ridge very funny biki is down, I know without checking
You can also read the command name in the link.
Wayback machine also exists, this isn't difficult.
https://web.archive.org/web/20241012231315/https://community.bistudio.com/wiki/supportInfo
There, saved you the 10 seconds.
@tulip ridge the whole evening I am backing up this 😆
BI decide to kill arma to make room for this creature called reforg but without me
Dam i don't have anything to fix,,,, You guys fixed me up so good,,, Everything works perfect
i soon will have something to fix i can feel it lol
@tulip ridge and how u use this command, I am too dumb to understand? ok I used it, now I need 90000+ days to sort out the mega array it spat
lol
How would a get a flat area thats also near a road?
I believe there's a command called isFlatEmpty but apparently the biki fell over. Also nearRoads.
^
you can check if nearRoads empty or not (as it returns an array), and then run a isFlatEmpty on that position
might also want to use isOnRoad if you dont want postions on the road itself
Hi ! I have a weird problem where this script works in solo and hosted Multiplayer, but not on dedicated.
When on dedicated it creates a generic Error expression while it works perfectly in solo and Hosted.
AR_isPhase1 is stored inside the description.ext and is set to true.
There is the error :
Error in expression <ssionConfigValue ["AR_isPhase1",false]) != "true"))then{
_array = ["ar_p2_head>
Error position: <!= "true"))then{
_array = ["ar_p2_head>
Error Generic error in expression
there is the code it is executed on the init of an object:
if(isServer)then{
private _array = [];
if(((getMissionConfigValue ["AR_isPhase1",false]) != "true"))then{
_array = ["ar_p2_headgear_v1","ar_p2_headgear_v2"];
}else{
_array = ["ar_p1_headgear_v1","ar_p1_headgear_v2"];
};
private _Dir = vectorDir this;
private _Up = vectorUp this;
private _pos = getPosATL this;
deleteVehicle this;
private _helmet = (selectRandom _array) createVehicle _pos;
_helmet setPosATL _pos;
_helmet setVectorDirAndUp [_Dir,_Up];
};
You're trying to use == to compare a boolean (true/false) to a string ("true"). == cannot compare different types.
If the config value "AR_isPhase1" actually contains a string, then the default value you're using with getMissionConfigValue is wrong - should be "false" instead, I guess.
If the config value actually contains a bool, then you can't compare it to "true" - and you don't need to, because == returns a bool, and you aready have a bool, so just use the returned config value directly.
Well, getMissionConfigValue returns a String, My value is bool no doubt but it returns it inside a string.
It's like it encapsulate the value inside a string. So I have to test it with a string.
Then you need to fix the default value to also be a string, otherwise there will be an error if the default value ends up being used
dumb question, probably asked a million times already. Is the bistudio wiki down?
yes
btw, config doesn't actually support bools, which is why it's being interpreted as a string.
The usual convention is to use numbers instead in this case, 0 for false and 1 for true. This will allow you to do this neat trick:
_array = [["ar_p2_headgear_v1","ar_p2_headgear_v2"], ["ar_p1_headgear_v1","ar_p1_headgear_v2"]] select (getMissionConfigValue ["AR_isPhase1",false]);```
You can use the internet archive with the link of your page if you want
I just needa know the params for addAction- I think there was one for JIP?
description.ext doesn't support bools ?
Arma 3 config in general does not support bools
oh ok. I'll try with 0 and 1 then. I'll get back to you with the result. Thanks for the help
https://web.archive.org/web/20240910072119/https://community.bistudio.com/wiki/addAction
There is not. addAction is a local effect command with no networking, so it has no need for a JIP parameter.
So I don't have the generic expression Error anymore but I have a new error :
Cannot create non-ai vehicle ar_p2_headgear_v2
Code :
if(isServer)then{
private _helmetArray = [];
_helmetArray = (([["ar_p1_headgear_v1","ar_p1_headgear_v2"],["ar_p2_headgear_v1","ar_p2_headgear_v2"]]) select (getMissionConfigValue ["AR_isPhase1",1]));
private _Dir = vectorDir this;
private _Up = vectorUp this;
private _pos = getPosATL this;
deleteVehicle this;
private _helmet = (selectRandom _helmetArray) createVehicle _pos;
_helmet setPosATL _pos;
_helmet setVectorDirAndUp [_Dir,_Up];
};
I still have this weird behavior where on solo and Hosted it works but not on dedicated.
Are the helmet classes you're using the classnames for the equippable inventory items, or for static props/placeable containers?
If it's for the actual inventory item then you can't createVehicle it because helmets are weapons (non-unique proxy things, essentially stored as strings) not real objects.
You could create a groundWeaponHolder_Scripted and store a helmet inside it (for an item you can pick up) or use createSimpleObject with the helmet's p3d path instead (for a non-interactive model)
You can simplify your helmet array selection code btw, you don't need all those () or to predefine the variable. This is all you need:
private _helmetArray = [["ar_p1_headgear_v1","ar_p1_headgear_v2"],["ar_p2_headgear_v1","ar_p2_headgear_v2"]] select (getMissionConfigValue ["AR_isPhase1",1]);```
(Actually you probably don't even need that last set of () )
I'm not the one who coded them, so I don't really know. The guy who did told me he took the class of a helmet that is already in game and replaced it with those in the array.
But why does it work in Solo and Hosted but not on dedicated if it's the first option it shouldn't work at all no ?
Does it actually work or does it just not show the error?
yeah work perfectly in solo and hosted, I even check the RPT for any error, there is none.
That is interesting
But we should still determine whether these helmet classes are actually valid for createVehicle, because it absolutely could cause odd behaviour if they're not
head to the Config Viewer from the Tools menu and see if those classnames appear in CfgVehicles. I suggest using Leopard20's Advanced Developer Tools to get the better config viewer, if you don't already.
yep they are registered inside CfgVehicles
configFile >> "CfgVehicles" >> "ar_p2_headgear_v1"
btw, I think your helmet arrays are backwards. It won't cause an error, but logically, in the current configuration you'll get Phase 1 helmets if isPhase1 is set to 0 (false, i.e. not Phase 1).
that's probably my fault for writing it that way in the example
yeah its backward anyway it's phase 1 or phase 2, so I put 0 for Phase 1 and 1 for Phase 2
You might want to adjust the config value name to reflect that then, because currently it implies the opposite
Anyway, about this error, I don't know. I don't see anything in this code that's DS-specific, and if that really is a valid vehicle class then it shouldn't cause any problems.
When I use the createVehicle command with the Console inside a dedicated Server it work without a problem, so yeah this is some really weird behavior.
Thanks for you help, and i'll change my code to be more in accordance with what you said ^^
Anyone can guide about changing between phases in mission (intro,mission,outro)?
By intro you mean an animation (cutscene) played after starting the mission or the briefing part before mission start?
is there a command to test performance impact when running code in ms?
The debug console has a speedometer icon that measures code performance
ah ok
But don't use it with a code that spawns/execVMs stuff
which I believe is basically a UI way of accessing diag_codePerformance https://web.archive.org/web/20241009031032/https://community.bistudio.com/wiki/diag_codePerformance
Yes
thanks
Is the entire wiki archived under web.archive or is there a backup mirror/local git version of the commands 😄 ?
web . archive is wayback machine which isnt even setup by bi or a community member lol it just grabbed all biki webpages and so we can use it whilst biki down due to reasons
I know, just asking if someone at some point decided to archive the commands and here we are now solely relying on it 😄
nah lol just a random internet sweep
ngl a downloadable version of the entire biki would be useful as hell for times like this or slow internet regardless of how much space it would fill up
or a paperback 
Just put it in a git repo - clearly git never has had a problem 
The current one is a little old but BI does maintain a downloadable version of the wiki
my life is complete i can now reference the biki even when offline
i've found the cause of this problem ! I'm a really dumb guy.
I've been using an unpublished version of our mod. that is not on the Server I used for testing. So it doesn't work because it the headgear doesn't exist. All of this for something this dumb.
Either way thank you for your help, you helped Optimize my script !
anyone know why the "selectWeapon" works for me on virtual map but not altis
its the only variabel i can find in if it works or not
There is another variable :P
?
selectWeapon works fine on Altis.
im just saying in my mod, that uses it, it only works on virtual map
anyone got the 3 ammo eventhandlers on hand, cant look on the wiki for obv reasons
they were listed at the bottom of the EH page
Search doesn't work but there's a link to the EH page from the intro to scripting.
_vehicleClass = "B_MRAP_01_hmg_F";
_position = player getRelPos [30, 0];
_group = createGroup [west, true];
_vehicle1 = createVehicle [_vehicleClass, [0,0,0], [], 0, "CAN_COLLIDE"];
_group createVehicleCrew _vehicle1;
_group addVehicle _vehicle1;
_vehicle1 setPos _position;
_vehicle2 = createVehicle [_vehicleClass, [0,0,0], [], 0, "CAN_COLLIDE"];
_group createVehicleCrew _vehicle2;
_group addVehicle _vehicle2;
_formationPos = formationPosition effectiveCommander _vehicle2;
_vehicle2 setPos _formationPos;
When this script is executed, _vehicle2 will move on top of _vehicle1.
When _vehicleClass is changed to “B_MBT_01_cannon_F”, _vehicle2 moves to the same location as the formation position.
I think it's a issue that the result changes between an wheeled vehicle and a tank, Is there any way to move _vehicle2 to the formation position?
https://pastebin.com/axbsHh8e
Can someone check out that code?
It's saying init: invalid number in expression after pasting the init variable in game logic
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
init fields don't support comments 
o=[this,1000] execVM "Amb_battle.sqf";
Did I paste in correct field?
this -> is the part that doesn't compute 
yeah not sure where you got that from. It doesn't look like any part of SQF.
But is the code in the right field?
yes, just don't paste non-sqf stuff there 
just 0=[this,1000] execVM "Amb_battle.sqf";
Well, it might not be in the right field but it's a code field :P
Idk it's not my code
Lol
only this [this,1000] execVM "Amb_battle.sqf"
This is correct?
Why not this?
this is the correct syntax but what u have in "Amb_battle.sqf" idk
0= part is unnecessary but syntactycally sound and doesn't break anything 
I'll test it now
Gentleman I am having a pretty hard time to fix an issue. I've got two scripts - the first one fires the second one which monitors spawned squads for particular parameters. It should run every 60 seconds with sleep, but i get the "suspended not allowed in this context" error. I've tried it also with waitUntil, but sadly with no luck.
if (_debugEnabled) then {
systemChat "[DEBUG] Squad has surrendered.";
};
break; // Stop monitoring after surrender
};
_surrenderChance = _surrenderChance + 5;
} else {
if (_debugEnabled) then {
systemChat "[DEBUG] Squad is above threshold. No surrender check.";
};
};
if (_currentSquadSize == 0) exitWith {
systemChat "[DEBUG] Squad monitoring terminated: no survivors.";
false
};
sleep 60; // Replace waitUntil with sleep to avoid suspended error
};
Here is a little code snippet if someone would mind care to take a look.
Any advice is greatly appreciated
Both waitUntil and sleep use suspension so swapping them will make no difference
the issue is that you're in an Unscheduled context (code executed now this frame, everything else waits for it) and suspending is not allowed because it would freeze the game
You need to use spawn to create a Scheduled thread
Well, that explains a few things.
I wonder if it worked in any older version of A3.
I have a quick question, it seems that limitSpeed doesn't work. I propably don't know how to use it but it doesn't seems that complex.
I have a vanilla quad and I put this inside :
this limitSpeed 25;
But my quad goes past that speed.
ffur2007slx2_5
(A3 1.24)To clarify, limitSpeed only do effect on non-player controlled AI units, it has continuous effect and AI won’t break through the speed limitation until one is contacted, engaged or regrouped.
It does work very well on AI vehicles, IME. I use it for convoy spacing.
It's in the Wiki Page ? I didn't see it my bad.
So there is no way to limit the speed of the vehicle that is controlled by a player ?
Ooooohhh I see, Thank you very much for your help !
group speed "LIMITED" / "FULL" not working?
Player waypoints are purely advisory, aren't they?
setCruiseControl is at least supposed to work.
ya probably doesnt work with player but AI waypoints, atleast i thought they did 🙂
yeah but the meaning of LIMITED is sometimes not very useful.
If you have a single vehicle and you want it not to bomb around at full speed, then sure.
Can someone remind me, which namespace is for a server [mission duration only, that will not send players data, but store variables for scripts on server + only an admin / mission script would be able to overwrite them, via setVariable]?
Because website is down, when I am available [these ddos kids... We NEED a mod to ban them automatically when they try to join any server, no matter which game. Also a police to arrest them... :D].
localNamespace probably fine too.
Note that missionNamespace doesn't broadcast automatically either. Difference is that you can broadcast to it from clients.
i mean, if something/somebody can push a variable onto a server it's probably capable of pushing a code to run on the server as well 
Well, there is CfgRemoteExec.
but yeah, not much point locking down one without the other.
Thanks.
missionNamespace is what I need.
I though it was automatically sending data to players, but looks like it requires publicVariable command to do it, so it's fine.
- it can save [Serialisation]
It's not working for me
Can you test the code?
I did this and nothing happened
@south swan @split ruin
@frank plinth I just pointed the right syntax, I have no idea what is in the sqf you run bro or if you fill the right type parameters in the array
https://pastebin.com/axbsHh8e
Someone test this pls.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
What am i doing wrong with the syntax here gentleman, as it keeps saying that i am missing a semicolon here? [] spawn { private _squadUnits = _this select 0; [_squadUnits] call Nat_SimpleSurrender_fnc_squadSurrenderLogic; } spawn { private _squadUnits = _x; [_squadUnits] call Nat_SimpleSurrender_fnc_squadSurrenderLogic; }; }; } forEach _currentSquads;
There is so much wrong here that i cant event start to explain you just need to do this:
{
[_x] call Nat_SimpleSurrender_fnc_squadSurrenderLogic;
} forEach _currentSquads;
Thank you good sir.
If you needed the spawn for some reason then:
{
_x spawn {
[_this] call Nat_SimpleSurrender_fnc_squadSurrenderLogic;
};
} forEach _currentSquads;
If you don't need the spawn then don't :P
well i understood it in that way that i need to spawn this function to use properly "sleep"
as else i get the suspended not allowed error
cant he just do this then ?
{
[_x] spawn Nat_SimpleSurrender_fnc_squadSurrenderLogic;
} forEach _currentSquads;
Yeah, fair enough.
but i am pretty bad in programming, sqf particular, so sorry in advance
still learning the ropes
It depends where you're running the code from.
So i have two scripts and a simple eden module.
The one scripts monitors all opfor squads currently spawned in game, and updates every 5 mins
Then passes those squads to another script, which monitors every squad on particular parameters as squad size, leader courage etc.
How are you executing the first script?
Because that one should really be running as scheduled code.
private _opforSquads = [];
{
private _grp = group _x;
if (side _grp == east && {!(_grp in _opforSquads)}) then {
_opforSquads pushBack _grp;
};
} forEach allUnits;
_opforSquads
};
if (isNil "monitoredSquads") then { monitoredSquads = []; };
while {true} do {
private _currentSquads = [] call _getOpforSquads;
systemChat format ["[DEBUG] Found %1 OPFOR squads.", count _currentSquads];
{
if (!(_x in monitoredSquads)) then {
private _squadUnits = units _x;
systemChat format ["[DEBUG] Monitoring new squad: %1", _squadUnits];
monitoredSquads pushBack _x;
[] spawn {
private _squad = _this select 0;
systemChat format ["[DEBUG] Starting surrender logic for squad: %1", _squad];
[_squad] call Nat_SimpleSurrender_fnc_squadSurrenderLogic;
} _squadUnits;
};
} forEach _currentSquads;
waitUntil {sleep 300; false};
};
This is my whole first script. It's currently bugged. And yes i know its a mess.
This is the one that should monitor all east opfor squads and pass it to the second script, which monitors the parameters.
Yes, but how are you executing that script?
handwaving emoji
init.sqf? Init field of some object on map? Init field of the entire mission? Some event handler?
trigger?
CfgFunctions entry with onInit or whatever the correct flag is?
oh yeah cfgFunctions in the config.cpp of the module
So it executes it when the module is placed
class Nat_SimpleSurrender {
class Functions {
file = "NatSimpleSurrender\functions";
class monitorOpforSquads {};
class squadSurrenderLogic {};
};
};
};
Or i am still wrong here?
There's no preInit or postInit in there.
So I guess it's a module hook. I don't know shit about modules so I'm outta here :P
I mean the script is executed 100% upon module placement. When the module is not present the script won't run.
The problem with the first script is i am getting an error that a semicolon is missing at line 25, so it's some kind of syntax error i guess. But i cant figure what.
for Extended_FiredBIS_Eventhandlers I sometimes see stuff like onRespawn="true"; is there a list of what else besides onRespawn can exist?
[] spawn {
...
} _squadUnits;```is not a thing
Yeah it's a lot easier for everyone if you just paste the script you're actually using rather than trying to abstract it :P
The spawn there is wrong too. Not passing anything in.
i mean, you can't paste it if it's abstracted into 5 different places already 🤣
There's some information here https://github.com/CBATeam/CBA_A3/wiki/Extended Eventhandlers
This is the whole first script which triggers upon module placement and SHOULD trigger the second script which is fnc_squadSurrenderLogic
triggers upon module placement
how?
The problem is what artemoz said. #arma3_scripting message
The spawn that would call squadSurrenderLogic has a problem with its structure as described, so it's causing an error and bailing out instead of executing fully.
plus the issue John mentioned where it doesn't have any arguments passed into it, so all those variables used in it are undefined
Not really sure what it should be because I don't know what _squadUnits is for there.
It sounds like the function should just be called once per squad?
i mean, by cursory glance at BIS_fnc_moduleInit module functions are supposed to handle a bunch of modes, most of which do get its function call-ed from within the EH code or something
Reference some of the vanilla modules, like BIS_fnc_moduleGrenade or BIS_fnc_moduleTracers probably
also hey, nice typo 🤣 in moduleInit sqf //--- Set default variables _logic setvariable ["bis_fnc_initModules_priroty",abs _functionPriority];
Is that one of those typos where it's spelt the same way everywhere
although it seems to be called by the same "bis_fnc_initModules_priroty" name elsewhere (i.e. in initModules)
How many days has the wiki been down ?
Only a couple.
Apparently BI finally shored up the Reforger backend servers, so now the DoSers are hitting all the other services.
less than one full day continuously, i suppose? And what feels like a week or two of periodically 
Well, it was never exactly a 99.9% uptime service :P
Hi, I have a question about optimizing the network on my server. Do remoteExec calls from one player to another first go through the server or is the request sent directly between players ?
Okay, i have little problem :/
Server can't keep up, too many incoming network messages. Remaining in queue: 150147
Do you have any optimization tips ?
Don't send a bucketload of shit from the client? :P
Okay, I'll stop asking the player every 1ms if they're okay, especially when there are 100 players on the server 
What does "okay" mean in context?
Often with published variables you want to only publish changes, so constructs like this are legitimate:
if (player getVariable "myVar" != _newVal) then { player setVariable ["myVar", _newVal, true] };
If it wasn't a published variable then you'd just set the thing regardless.
That was a joke. I was asking because I'm trying to help a friend optimize his server, as he runs into this problem when he reaches around 100 players.
I know that excessive use of publicVariable and remoteExec is probably the cause, but he also has a heavy modpack and even a small loop could be the reason for this issue :/
Yeah, it's difficult to tell in that case. Could be any mod doing one dumb thing.
Yes :/
Some mods are known-garbage, so you could try pasting the list into #server_admins and see what people think.
Ok, thanks i look that
diag_activeSQFscripts is probably the only useful thing you can do with script, but depending on how code is executing it may not show up.
Spawn, yes. eachFrame EH, nope. CBA stuff, nope.
Yes, I also checked with ScriptProfiler but I'm looking for which function is making numerous network requests, not just RAM & CPU performance :/
there's no bis_fnc_projectile @tranquil nymph ?
ArmaScriptProfiler does actually record network activity to some degree, when it's working.
Like we could tell that ACRE was sending 16MB of data to each new client :P
Oh, I didn't know that, In which tab can I see the network usage ?
Dunno, it's been a while. The trace file I have doesn't even open in the current version.
Ah, you might need -profilerEnableNetwork in the command line.
Ok thanks I'll check it out
I'm trying to run this code in a script "marker setmarkerpos getpos runner;" marker and runner are both set in the editor however it says that marker is an undefined variable
try "marker" setMarkerPos (getPos runner)
markers must be in quotes (unless it's a string variable)
Worked perfectly, thank you so much.
this is my RPT file after you guys helped me get all my stuff correct
Strange issue here, players on my server are able to retexture their clothing to predefined textures, however, a small number of players don't ever see themselves in the new texture.
Other players can see them retextured, I've used the same script for 10 years but this problem has only recently appeared.
I texture with the following basic code (added the 4 local lines recently attempting to fix, but doesn't)
player setObjectTextureGlobal [1,_texture];
player setObjectTextureGlobal [2,_texture];
player setObjectTextureGlobal [3,_texture];
(backpackContainer player) setObjectTextureGlobal [0,_texture];
_texture spawn {
sleep 0.5;
player setObjectTexture [0, _this];
player setObjectTexture [1, _this];
player setObjectTexture [2, _this];
player setObjectTexture [3, _this];
};```
Worth mentioning, their backpack retextures just fine to the new texture and this issue occurs in all uniforms
Reminds me of an issue we had with some GM vehicles. It's probably a Arma bug but we never had a reliable replication.
I have noticed in rare occasions, if you setObjectTexture outside of the range of textures it supports, it can cause a similar issue. Might not be what you're looking for, however worth trying
Ex.
getObjectTextures player; // ["",""]
player setObjectTexture [0,_texture];
player setObjectTexture [1,_texture];
player setObjectTexture [2,_texture];// This can rarely reset the 0 index texture for some reason?
The GM vehicle case I saw was setting a lot of textures on the vehicle. Maybe it was off by a couple.
@gentle zenith Try checking count getObjectTextures player first and ensuring you don't go past the total.
I'm getting 1-3 for various uniforms.
Confirmed only happens on profiling, I'll direct it there, however this might be why some people have the issue on his server while some dont.
Thanks all, I'm trying this out and will let you know if it helps
https://pastebin.com/axbsHh8e
can someone test out this script that plays ambient noises?
It's not working for me
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
How about to just say what is not really working, or error, or how do you call it
Instead of posting this everywhere
I ran the script directly and it worked. I'm not sure what the instructions mean because a trigger doesn't have an init box.
There i mean how i can pas main mission to intro , players play intro part then after it the main mission load
How did you do it?
Sorry
How about to tell us more info more than a sorry
I followed the instructions and nothing happened. Think the instructions are incorrect
How did you run it directly?
Singleplayer or multiplayer?
How can I run that script directly?
@granite sky did that and it worked
Mp
So this should work as far as I can see, but for whatever reason my screen fades out but not back in, any ideas?
if (isServer) then {
[0,"BLACK",5,0] call BIS_fnc_fadeEffect;
obj1 setTaskState "Succeeded";
["TaskSucceeded", ["Preparation", "Move to Checkpoint Delta"]] call BIS_fnc_showNotification;
obj2 setTaskState "Assigned";
["TaskAssigned", ["Checkpoint Delta", "Man the Checkpoint"]] call BIS_fnc_showNotification;
checkpointtriggeractivated = true;
[parseText "<t font='PuristaBold' size='1.6'>1 hour later...</t>", true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles;
[1,"BLACK",5,0] call BIS_fnc_fadeEffect;
};
Im also trying to get a show/hide module to work with the checkpointtriggeractivated = true; but that doesnt seem to fire, its set to false in the Init, the module works when not associated to the variable but wont with the trigger
so i got this code from gunther
this addMPEventHandler ["MPHit", { params ["_unit", "_causedBy", "_damage", "_instigator"];
if !(_instigator in allplayers) exitWith {false};
private _hitCount = (_unit getVariable ["you_hitCount", 0])+1;
_unit setVariable ["you_hitCount", _hitCount];
if (_hitCount >1) then {
_unit removeMPEventHandler ["MPHit", _thisEventHandler];
_unit spawn {
private _emitter = "#particlesource" createVehicle position _this;
_emitter setParticleClass "MediumDestructionFire";
sleep ((round random 3) +3);
"HelicopterExploSmall" createVehicle position _this;
{
deleteVehicle _x;
} forEach [_emitter, _this];
}
}
}];
and wanted to use it within zeus. Having converted simpler scripts, I thought it would be as easy as this:
_this [addMPEventHandler ["MPHit", { params ["_unit", "_causedBy", "_damage", "_instigator"];
if !(_instigator in allplayers) exitWith {false};
private _hitCount = (_unit getVariable ["you_hitCount", 0])+1;
_unit setVariable ["you_hitCount", _hitCount];
if (_hitCount >1) then {
_unit removeMPEventHandler ["MPHit", _thisEventHandler];
_unit spawn {
private _emitter = "#particlesource" createVehicle position _this;
_emitter setParticleClass "MediumDestructionFire";
sleep ((round random 3) +3);
"HelicopterExploSmall" createVehicle position _this;
{
deleteVehicle _x;
} forEach [_emitter, _this];
}
}
}]];
yet it doesnt work, anybody know why and how it would work?
Plonked down a basic logic object, gave it a variable name. Put that in line 13. Ran it in the debug console as scheduled code.
Im super confused, BIS_fnc_returnConfigEntry returns the correct value when the attribute exists, but if default value is used it returns an "array" yet I cant assign said array to anything because it says it doesnt exist?
if I directly systemchat the function it shows the array
but I cant select values of it or assign it to a variable???
Show how you're calling it.
private _vehBase = [configFile >> "CfgVehicles" >> (typeOf _veh) >> "liftVehicleBase",""] call BIS_fnc_returnConfigEntry;
systemchat str [configFile >> "CfgVehicles" >> (typeOf _veh) >> "liftVehicleBase",""] call BIS_fnc_returnConfigEntry; this works though
Uh, returnConfigEntry takes three parameters?
how would i remoteExec a script please ?
erm....what do you need to know? i have a script: timer.sqf and if i execute it in the debug console it works, but only there. what does execute global exactly do?
only execute global makes it work. id need to execute it globally to have it working correctly
do you execute it multiple times or should it be one time?
only one time, but in dedicated server environment
[["my", "arguments"], "timer.sqf"] remoteExec ["execVM"];
```should do 😉
what is my for ^^ ?!
those are arguments
if your timer.sqf takes any arguments it would be like that if not you dont need them.
ok thx !
Here is a simple example:
//timer.sqf
params ["_arg1","_arg2"];
systemChat format ["%1, %2", _arg1,_arg2];
//somewhere else.
["This is my arg 1","This is arg 2"] execVM "timer.sqf";
if you want to remoteExec to each client it would be like this:
Good check to have
[["This is my arg 1", "This is arg 2"], "timer.sqf"] remoteExec ["execVM",[0,-2] select isDedicated];
Also i would recommend you to look at few of these links to help you understand locality.
https://community.bistudio.com/wiki/Arma_3:_Remote_Execution
https://community.bistudio.com/wiki/remoteExec
https://community.bistudio.com/wiki/Multiplayer_Scripting
https://www.youtube.com/watch?v=-hz0SoS95VY&t=477s
Do you mean from ACE?
Look at a chair and hold windows key
Prefix your custom properties
Also you can use configOf to shorten that config lookup
planned on it once I got it working
Why
It's easier to just do it as you're writing
¯_(ツ)_/¯
oh its already in ACE?
Yeah
Has been a thing for years
Do I still need to put the script in the mission file as said in the instructions?
Not if you paste it into the debug console, no...
But for practical use, that would be a reasonable approach.
The object you pass in is only used as a position.
So i only need to put it in mission file and don't have to set up any triggers?
If you don't execute it then it won't do anything.
So just gotta copy paste it in the debug console?
really just like that?
Yeah
Hey , any guid about new hint methods?
Like when you complate task hint pushed left from right side and after show message pushed back to right
What "new hint"?
Hints with that method i say
Like animated hint
Or flash
What I mean is we're not aware of such new feature. Images or videos might help to recognize
I don't think they mean that there is such a feature, I think they mean that they want to make such a feature.
And to that I say "maybe choose something simpler for your first scripting project"
Hey guys, I'm having a problem with unit/group sides that someone might be able to help me with. I've made a script to spawn ambient patrols and vehicles which works well. A friend wants to use it to spawn bluefor and opfor units in the same squad in a survival scenario, however the units end up shooting each other even though they are in the same group. How can I work around this issue?
Its a bug with createUnit of wrong side. To fix this just readd the same units to the group again.
_unit = _group createUnit ...;
[_unit] joinSilent _group;
Can someone show me a working Description.ext or a Init.sqf that has the prompts for a working spawn and mission?
With working spawn I mean, there is no "respawn disabled".
Thanks in advance, your are great
This is what I use (description.ext): ```
respawn = 3;
respawnDelay = 10;
respawnTemplates[] = {"MenuPosition","Counter"};
respawnOnStart = 0;
@grizzled cliff so you finally experienced how my informatics lessons were for the last 4 years ^^
hey guys, just a quick question, im wondering if its possible to remove existing markers on the map for say houses. (I dont think so but worth an ask).
Apparently you can make them invisible with https://community.bistudio.com/wiki/createLocation
Oh, that's the names though, not houses.
dam yeah. A friend was looking to delete a town with hide map objects and remove it from the map too.
One way could be to simply start the mission and play some intro scene (either playable or not), then black out the screen, silence the music, and move players to another position, then do your briefing with voice lines or plain text on the screen, or even show something on the map. You can use commands like: say, playSound, cutText, forceMap. But all these things are not particularly easy, since you have to synchronize everything and deal with late joining players.
Generally, you need to learn how to do cutscenes (work with camera and animations), work with map and markers, play sounds and show texts, teleport players around or switch playable units and synchronize everything, so that it does not break in a network game. But it depends on what you want to achieve.
For inspiration:
https://youtu.be/5mgM4Qxkh_w?si=ov4ZLJALX9fsA-dR
https://community.bistudio.com/wiki/Category:Function_Group:_Map_and_Markers
https://community.bistudio.com/wiki/Category:Command_Group:_Map
https://community.bistudio.com/wiki/Category:Function_Group:_Briefing
createVehicle a smokegrenade ammo
No, you carry the magazine in your inventory, which creates the ammo class
For vanilla classes, the classes are usually the same iirc
They're different classes
What you carry in your inventory is a part of CfgMagazines. What you throw is CfgAmmo, which you can use createVehicle to do anything
Of course not. Follow the syntax
type there is a string
ok, thanks! And I don't need anymore info ín the file?
is there a reason a hint or systemChat in a switch case wouldn't show up in a singleplayer session? trying to test with error messages isn't working properly the one time i try it 
i am dumb and it is case sensitive, nevermind
What is case sensitive?
case strings
rather, strings used as cases for a switch
i'm trying to reply in agreement but my messages are getting automodded
I know what you're trying to say 🤣
im crying
fing- word was censored
mhh ... maybe i should visit the university from time to time then ... however, that entire talk should be held at #offtopic_arma
@tranquil nymph sadly that function is not existing ...
or do i have to place down the zeus module for that (which would then come to the question what magic that is)
Do i can use keyframe animation to make a suicide attack?
Will triggers work as normally?
Like this and obj name in this list then set dammage vehicle?
I need it to capture intro
A car move and hit gate then explode
i dont think so
could someone sanity check me? this is coming back as undefined no matter how i try it, and i've done every method i can think of.
_Sound = createSoundSource [(player getVariable colSoundPack), position player, [], 0];
it's intended to allow the player to do an action that sets the variable colSoundPack in the player's namespace, then feed that variable into the createSoundSource.
getVariable takes "string" for the variable name
so i need it in quotes?
i swear, i need to stop spending more than 4 hours looking at code processors
that fixed it uwu
lol
Hi guys!
I am editing KP_Lib to suite my own preferences and I'm having issue getting the systemChat player death messages to globally execute on all machines. It works just fine when I run it in client-side-multiplayer. However, when i ran it on the dedicated server, it near always failed to send any messages except twice. I will have to post the code in a screenshot, as I don't have Nitro and the code block is too long, my apologies.
Are you implying I need to just put [_msg] remoteExec ["systemChat"]; instead of [_msg] remoteExec ["systemChat", 0, true];?
" Pilot Huey Moving To Extraction ExLZ " remoteExec ["systemChat"];
oh you want the server to exec it
Could also use event handler 'killed' for a bit of cleanliness: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#InventoryOpened
yes EH would be better
I do want to get into event handlers, but am a bit ignorant with them.