#arma3_scripting
1 messages ยท Page 147 of 1
https://community.bistudio.com/wiki/Variables#Scopes
Variables starting with _ only exist within the current script scope. Variables without it are global variables that are available to any script on the current machine.
Local scope variables are usually preferable because you can have many with the same name at the same time, each specific to an instance of their particular script, without conflicts.
I see
So for instance if I were to execute my script twice, I wouldn't have to rename the 2nd cargo to Cargo2 for instance
Is there no way to script custom attribute in 3DEN without an addon?
Myb with this :https://community.bistudio.com/wiki/set3DENAttribute
Doesn't work with undefined custom attributes
You can't seem to set any attribute you want
Yea only way is to mod it then.
Sucks big time
What did you mean to build with that ?
I want to save a value associated with an object in mission.sqm
Its needed within 3DEN but it needs to be saved and loaded
I mean you could still make a mod with all the tools you need. Why is it a problem beaing a mod ?
I'm lazy
I need that for a tool that is fine being a single file script
Setting up a mod, having to run it each time you open that mission, etc. etc.
Don't want to deal with that
Myb with extension then ? have a extrnal tool
Extension is also a mod, you have to run it
Made it parse init field so I can get scale value and apply it within 3DEN to preview the scale
No mods life 
// Params: Entity
// Returns: Number / Nil
editor_getScaleFromInit = {
private _regex = _this get3DENAttribute "init" select 0 regexFind ["this\s+setObjectScale\s+([0-9.]+)"];
if(count _regex > 0 && {count(_regex select 0) > 1}) exitWith {
private _scale = parseNumber(_regex select 0 select 1 select 0);
if(_scale <= 0) then {_scale = 1;};
_scale;
};
};
```in case anybody will need it
Does anyone know if there is a script to add all the items in the game into an ammo cache/box etc. I know about virtual arsenals already but i actually want a box that just has all the items in the inventory, and yes i know this is a weird request.
you gotta at least have 3den enhanced lol
You'll need to iterate through configs and add*ItemGlobal
It adds isMultiplayer checks into init fields for scale ๐ก
yeah i know, but it at least gets you the preview for placement
sorry can u explain this a little bit better (im very dumb) do i just add a command like this into the initilization of the ammo crate?
you're probably at the level where we need to write it for you
yes probably
but if you want to try in the mean time, you use configClasses
and you are aware, that if you don't change the storage capacity of a crate, that no one will be able to put items back into it because all items in the game will overload it. meaning as people take stuff out that they dont want, you end up with a huge stack of objects on the ground
yeah i understand that but im in a singleplayer game rn
to make more sense to you im playin g antistasi and want to add ammo and backpacks etc to my loot
oh... ok
well thats easier since you really are just using the To Crate option after you add them
alright well give me a few min
thanks man
if(isServer) then {
{
if(getNumber(_x >> "ItemInfo" >> "type") > 0) then {
this addItemCargoGlobal [configName _x, 10];
} else {
this addWeaponCargoGlobal [configName _x, 10];
};
} forEach ("getNumber(_x >> 'scope') == 2" configClasses (configFile >> "CfgWeapons"));
};
Be careful what you wish for 
do i just add this to the initilization of the ammo cache or should i run it in the debug console
init
my code that is
I shouldve asked before but this will work with zeus correct?

using this it won't
the variable for the arsenal crate is boxX in antistasi
@meager granite have you moved over to enfusion at all yet?
Not really, I can't give up A3 with this many players
Wish I could copy-paste me like 3 times
you're not reaching end of life for it yet? or maintenance only era?
ok so i tried adding the code to the debug console, an empty crate, and the virual arsenal in antistasi and it didnt do anything, I do not know if I did something wrong or what, i replaced the code this with boxX aswell
Still so much to do...
this was code for editor
If it's community Antistasi or based on it then you can run this as server:
{
_x call A3A_fnc_unlockEquipment;
} forEach (allWeapons + allItems + allMagazines + allExplosives);
Preferably avoid doing this when you're trying to use the server. It will jam the network.
can i use "missionDifficulty = x" or can i only use "x = missionDifficulty"?
is there any way mission side to set difficulty then? i see the prologue is forced on regular but i wonder how to do the same myself
Yes and no.
Arma has separate server skill and mission skill values, which are combined to produce final skill values for AIs.
Missions can change mission skill values but not server skill.
is there a way to have an object init in 3den that activates after the init.sqf?
Although I might be answering the wrong question there.
yea nah i was more thinking about setting it forced to regular/veteran more so than changing AI skill values
It's plausible that description.ext would have stuff for that, but the only option documented is for the tactical ping.
if I use https://community.bistudio.com/wiki/getVariable do I get a reference to that variable or a copy of that variable?
A reference, if it's an array or hashmap.
Internally everything is a reference, but other types just make a copy when you assign them to a variable.
thanks @queen cargo , i'd have written it up but i don't really understand dialogs enough to explain it
no. you have to run another custom "init" (script) on top of it after
I'm a little late to the party @candid sun but why do you need some RscEmpty when you have all of these ctrlCreate classes?
@fallen locust so what?
@spiral trench because you still need a display/dialog for ctrlCreate
ctrlCreate is just for the control elements (createDialog/createDisplay still needed)
yeah i just want an empty dialog class that i can ctrlcreate shit in to, without having to define that empty class in description.ext
Yeah I get that but I suppose it depends on the use case, I would just define in description.ext then use createDisplay or use ctrlCreate on some display like 46 or whatever, if I really needed to
i'll have to do it that way i guess, just seems so counter-intuitive
They don't
They're still references. You just can't modify them by ref
Because there's no command for it
But arrays and hashmaps (and structured text) do have commands that modify by ref (pushBack, set, etc.)
Using a single element array to create a reference to an unreferable type... Delightfully devilish Seymour
I've finished making my vehicle spawner; the only issue is that my 'display' models aren't sitting on the table correctly. Is there a way to fix it?
Start sharing your code, without content hard say what do you need to change
SpawnTable attachTo [this, [0,0,0]];
detach SpawnTable;
SpawnTable setPosATL [(getPosATL this select 0) + 0, (getPosATL this select 1) + 0, (getPosATL TableHeight select 2) + 0];
this setPos [(getPos this select 0) + 0, (getPos this select 1) + 0, (getPos TableHeight select 2) + -1.625];
this setDir 135;
this setObjectScale 0.1;```
check out the https://community.bistudio.com/wiki/getPos wiki page where the exclamation is
Or change attach point.
Just testing
private _pos = getPosATL player vectorAdd [0,10,0];
private _tank = "O_T_MBT_02_cannon_ghex_F" createVehicle _pos;
private _spawnTable = "Land_CampingTable_F" createVehicle _pos;
_tank attachTo [_spawnTable, [0,0,0.65]];
_tank setVectorDirAndUp [[1,0,0], [0,0,1]];
_tank setObjectScale 0.1;
and with setVectorDirAndUp you can change direction of object
dont know what table and tank do you use.
Just testing vanilla.
to init of tank
private _tank = this;
private _pos = getPosATL _tank;
private _spawnTable = createVehicle "Land_CampingTable_F" _pos;
_tank attachTo [_spawnTable, [0,0,0.62]];
_tank setVectorDirAndUp [[1,0,0], [0,0,1]];
_tank setObjectScale 0.1;
detach _tank;
I have a mod installed which creates an object on player every once in a while, I want to check everytime this object is created so I can run another script, is it possible?
alias_snow = "Land_HelipadEmpty_F" createVehiclelocal [0,0,0];
thnx saved my day once again
Hey guys, i'm a bit confused, yet again ๐
TriggerTask3 == 1;
I get a "generic error" with this line of code, it doesn't seem to do anything bad as the trigger works just fine, but I still get the warning.
The error message is on the picture
Any ideas of what it could be ?
To explain the code itself, on the triggers there's a condition where it checks if "1", and the actions/things that trigger the triggers there's a "On activation triggertaskX =1"
What is the initial value of TriggerTask3?
are you trying to activate another trigger when first trigger gets activated ?
On the screen the mission just started
So no, nothing done during the mission yet
And it keeps switching between triggertask2 & Triggertask 3 every tick
On the error message
I am gonna assume becouse they are null you didnt assing them anywhere.
It's not complaining that TriggerTask3 is undefined?
Don't think so ?
You are trying to check if TriggerTask3 is equal to 0 but becouse you didnt assing them anywhere they are null so basicly you are doing this with a code:
null == 1
So I should put in the init lines that state
TriggerTaskX = 0 ?
If you never provide an initial value, the variable would be undefined (not null or nil or something like that), and that would result in an error.
Yes, do TriggerTask3 = 0 somewhere.
So isEqualRef is bugged?
_var1 = 2;
_var2 = _var1;
_var1 isEqualRef _var2;
-> false
Hello,
If I have a default value (number) x from cba setting, tag_myDefaultValue
_value = _myObject getVariable ["tag_myValue", tag_myDefaultValue];
So if value is not defined it will use default value.
so in check
if (_value > random 1) then {
// do stuff
}
works yes.
But if i want define if someone set _value to true or false it uses 1 or 0
Is only way to check
if (_value > random 1 || _value) then {
// do stuff
}
So it will check "number" or "boolean" .
It works fine with arrays:
_var1 = [1];
_var2 = _var1;
_var1 isEqualRef _var2;
Yes, that's the point.
Is it possible to enable gun light on a unit which is in animation loop?
true > random 1 should throw an error, so _value > random 1 || _value should fail.
I would do something like this:
if (_value isEqualType true) then {
if (_value) then { _value = 1; } else { _value = 0; };
};
if (_value > random 1) then { ... };
if you dont know which type a variable is you can use isEqualTo because it doesnt throw an error
Probably easier to read and think through if we do it the other way around:
if (_value isEqualType 0) then {
_value = _value > random 1;
};
if (_value) then {
//Do stuff ...
};
This!
Awesome, thanks
It returns true for me
Also I actually checked the memory and both point to the same data
Quick question. Let's say you wanted to restrict certain ace arsenal items to specific players. Basically a whitelist list of weapons specific to one player.
So one person has access to the ak while another one doesn't.
You can call ace arsenal local , so unit have "own" arsenal.
https://ace3.acemod.org/wiki/framework/arsenal-framework#11-adding-ace-arsenal-to-a-box
Does this go under the Adding ace arsenal to box or is it somewhere else in the ToC?
Ah wait no think I understand it
And don't hesitate to ask if you don't.
Here's are a lot of ppl who can help you out
will prob ask some stuff later on managed to find a forum thread that kinda helps just wondering about the local and how it works with each and every player.
forum discussion: https://forums.bohemia.net/forums/topic/233579-weapon-restrictions-for-specific-roles/
Hello, I would like to add weapon restrictions to specific classes. For example only ATs can carry launchers, only engineers can carry explosive charges and only medics can carry medkits. In my mission, players will be given a virtual arsenal at the start, but I dont want them to pick up anything...
i got given a script by a guy that does exactly this
hes let me give it out to other people if you want it
would be amazing if you could send that over
anyone arma 3 dev can help out with my fucked mission file
[21:24]
pleade just dm i am doijng old lakisde map i got everrything at this my idk whatwrong i need new insite
I have something like that, took some functions from the liberation scenario and the whitelist idea from the apex framework and made my own version
FoldTable, and the tank is supposed to be anything the script is attached to; in other words, if I copied and pasted the unit with the Init on it, and changed the vehicle type, it would still work. So although I calculated its position correctly for an Abrams, it's not working for other types.
Here's the view from 3den, to give an idea of how it looks in the editor first.
make your vehicle [v] simple object
How does that differ from attachTo?
What code do you use currenlty?
could you share your code and object type what your are using
SpawnTable attachTo [this, [0,0,0]];
detach SpawnTable;
SpawnTable setPosATL [(getPosATL this select 0) + 0, (getPosATL this select 1) + 0, (getPosATL TableHeight select 2) + 0];
this setPos [(getPos this select 0) + 0, (getPos this select 1) + 0, (getPos TableHeight select 2) + -1.625];
this setDir 135;
this setObjectScale 0.1;
Object type is any vehicle the script is attached to; it's meant to be copied and pasted into any vehicle. The script is intended to make a player-operated vehicle spawner, and these small vehicles on tables are meant to be spawn selectors.
I think the problem is setObjectScale itself, rather than a positioning problem. But I could be wrong.
if you attach to tank, taank is not attached, table is.
you need attach your tank to your object
'this' is the tank itself.
Hold on, I'll show you the rest:
_spawnDescription = getDescription this;
_spawnClassName = _spawnDescription select 0;
_displayName = format [getText (configFile >> "CfgVehicles" >> (typeOf this) >> "displayName") + " (" + (typeOf this) + ")"];
SpawnTable = createSimpleObject ["FoldTable", getPosATL this, false];
SpawnTable attachTo [this, [0,0,0]];
detach SpawnTable;
SpawnTable setPosATL [(getPosATL this select 0) + 0, (getPosATL this select 1) + 0, (getPosATL TableHeight select 2) + 0];
this setPos [(getPos this select 0) + 0, (getPos this select 1) + 0, (getPos TableHeight select 2) + -2.5];
this setDir 135;
this setObjectScale 0.1;
[this, ["Set vehicle spawner to spawn " + _displayName + ".",
{
params ["_target","_caller","_actionID","_target"];
VehicleType = _target;
DisplayName = format [getText (configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName") + " (" + (typeOf VehicleType) + ")"];
hint format[DisplayName + " selected."];
VehicleSpawner = 1;
},
_target,
10,
false,
false,
"",
"",
3]] remoteExec ["addAction"];
And this is in the init field of any vehicle you want to turn into a spawner without changes (except vertical position).
hmm.
Many things.
You do not need detach "table" from your object.
And if you are using init, you do not need remoteExec your addaction code because its executed for every client.
So you could do workaround.
Just do all on server with
if (isServer) then {
private _tank = this;
private _spawnDescription = getDescription _tank;
private _spawnClassName = _spawnDescription select 0;
private _displayName = format [getText (configFile >> "CfgVehicles" >> (typeOf _tank) >> "displayName") + " (" + (typeOf _tank) + ")"];
private _spawnTable = createVehicle FoldTable (getPosATL _tank);
_tank setDir 135;
_tank attachTo [_spawnTable, [0,0,0.5]]; //set this value to correct height
_tank setObjectScale 0.1;
[
_tank,
[
"Set vehicle spawner to spawn " + _displayName + ".",
{
params ["_target","_caller","_actionID","_target"];
private _type = typeOf _target;
private _display = format ["%1 %2",getText (configFile >> "CfgVehicles" >> _type >> "displayName",_type];
hint format[_display + " selected."];
VehicleSpawner = 1;
},
nil,
1.5,
true,
true,
"",
"true",
10,
false,
"",
""
]
] remoteExec ["addAction"];
};
And noot sure about your addaction parameters so just added "default" from wiki..
I like it. ๐ I'll take a look at it in a bit. But to answer your question on addAction, it creates an addAction on the vehicle that spawns the table and shrinks the vehicle, and when the addAction is selected, it forwards the vehicle's typeOf to a global variable, that is forwarded to the spawn controller.
So far, it currently works as intended. At this point, the only issue is placement of said vehicle in relation to the folding table.
And after some testing, I realized it may not be so simple; I tried turning on physics, and some clipped the ground itself to a partial extent, so I'm wondering if the model's hitbox changes from its actual visual location.
Anyone know how I'd do this?
I'm basically trying to get the ViewAngle between a player, and another player to determine if they are looking at the upper, or lower part of the body
lineIntersectsSurfaces is probably one way to check if one is looking upper or lower
Could something like that be used to determine position?
Yes, or intersected selection
why not look lower ๐ ๐ ?
you sir, have a missing " in your code. also not JIP compatible
Ahh... that explains why I was suggested to use remote. ๐
How can I use script to skip a waypoint? I have it working in the editor with a skip trigger but I actually want this to run in an .sqf
setCurrentWaypoint or something I don't recall exact name rn, but should be possible
deleteWaypoint [group, index] I found this. Is the group the object name in the editor? And what is index? The wiki just says 'number'.
deleteWaypoint [B Alpha 1-2, 0]; I used the group command to return the group in the editor. But when I run the sqf it says it's missing a ]
First WP you place is 1, second is 2 so fourth
The group's initial pos that is placed automatically is 0 IIRC
Also your second code is not referencing group
deleteWaypoint [group heli, 1]; So this reads as: delete waypoint 1 from the group that has heli in it?
Basically
It works! ty!
Hello
Top of the evening to ya
Please can anyone make a function Arma 3 weapon?
i don't know what you are asking
player addAction ["<t color='#FFFF00'>End Mission</t>", "call BIS_fnc_endMission;", nil, 7, false, true, "", ""]; I am getting an error with this about an expected string. It works kinda even with the error
Using quote within the quote is the error
I just removed that and got a new arror now about a string or an expected array
I think it has to do with the call part
What exactly is the error message
I dont really like the glitch effect since this is a vietnam mission
but if I have to use it oh well
You can always make your script
BIS_fnc_endMission uses END1 by default if you don't specify an ending
Probably it tries to look _this that addAction throws?
https://community.bistudio.com/wiki/BIS_fnc_endMission
What you actually need to do is pass a number for the fadetype parameter. Then it'll use a fade to black instead of the digital effect.
Oh wow I just found this: https://wiki.sogpf.com/index.php/VN_fnc_endMission
but how do I do the syntax correctly within an addaction. I think thats whats tripping me up. Maybe I need brackets?
Use different quote in quote, in fact you've already done in your code
Use Code instead of String for the action code, it'll save a lot of trouble
Or, don't use String to specify the code you want to execute in addAction
_obj addAction ["mytitle", { hint "button pressed!"; player setDamage 1; }];```
player addAction ["<t color='#FFFF00'>End Mission</t>", "["end1", true , 3, true, true, true] call VN_fnc_endMission;", nil, 7, false, true, "", ""];
Usually I call a sqf from the addaction but I thought maybe it would be easier to do it within.
It say error mission bracket
I should stick to what I know lol
Where you're specifying the code you want to run when the action is triggered, you're enclosing it in "", making it a String data type. This is valid, but it means when you use another " inside the string, the game sees that as the end of the string, which confuses it
Instead, enclose the code in {}, making it a Code data type. addAction also accepts this, and using " won't confuse it because that's no longer the delimiter character for the whole thing.
You can also use quotes inside Strings by using the other kind of quote, ', or doubling them for the inner string ("text text ""my string"" text"), but using a Code data type is much more convenient and is usually better if it's possible.
player addAction ["<t color='#FFFF00'>End Mission</t>", {"["end1", true , 3, true, true, true] call VN_fnc_endMission;"}, nil, 7, false, true, "", ""];
Ahhh okay. I might be understanding a little.
player addAction ["<t color='#FFFF00'>End Mission</t>", {["end1", true , 3, true, true, true] call VN_fnc_endMission;}, nil, 7, false, true, "", ""];```
How do you make yours have color?
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
Your has error parama type bool epected code.
this means its one of the trues right?
bool = true or false if i undersrtand
It's from your vn_fnc_endMission call
I think the last one true is the culprit. lemme check
Have another look at the vn_fnc_endMission documentation. The last parameter, if specified, needs to be Code; you've provided Bool.
It's an optional parameter so if you want to use the default, just don't specify it at all.
nice so i did catch that. but when i delete the last true I get an error that says missing ]
Did you also delete the comma after the previous parameter? You need to.
oh wait I can try ""?
no
Yeah that was the problem the comma
So how come I cant just use "" there? That works in addactions all the time to leave it blank
Data type matters. "" is a String. If the command or function expects a different data type, it will throw an error.
interesting. will arma 4 have the same code as arma 3 or will I have to learn anew?
Reforger and A4 use the new Enforce language, which is quite different.
Does anything translate or is it like learning a completely new language?
It is a completely new language
Oh wow this means proprietary from Bohemia?
SQF is also a proprietary BI language
Interesting. Venture a guess as to why change the language?
New game engine
So every game engine requires a new language?
It doesn't require a new language, but it will often result in one for technical reasons. Especially when the old language deserves to die
(when we talk about game engines changing languages, keep in mind not all engines actually have a separate userside scripting language. A3 is not written in SQF. If a game that doesn't have a separate language changes to an engine that's written in a new language, that's what you get. Reforger/A4 could have had SQF support instead of Enforce, but why recreate a bad language instead of making a new fast one that can do much more?)
If a parameter is marked as Optional, you can leave it out completely and the indicated default value will be used. You only need to provide a "placeholder" value if you want to use another parameter that comes after that in the array. In that case, you need to provide a value that is one of the expected data types and won't do anything unexpected - so usually the indicated default value.
Ahhh ok I was wondering that. I couldnt figure out how the code knew what to provide if I didn't put anything there.
Thanks Nikko for the tutoring lesson. Im headed to bed. cya!
(sqf isnt a bad language)
It's not bad in every way, just many of them
Squiff is perfect
You're gonna pronounce it Squiff now aren't ya
Neva!!!!11
It's so satisfying to say
anyone know why when i use setFlagTexture the flag reverts to the original texture after a period of time?
A Mod or something is overwriting
thanx thought it was strange
@warm hedge would you be interested at having a look at a script? it has no loops in it so i have no idea how this flag is changing. Its weird, if the flag pole has no texture when the server starts then i use setFlagTexture the flag will stay but then if i change this current flag with setFlagTexture it will revert back, if i do this process with a flagpole that has a texture set by the server on start it will always revert to that texture. So its making me think the server is doing something and not the script but i really have no idea.
do i have to like delete the pole and make a new one?
No idea
where are you calling the setFlagTexture command, dedi, client?
ok you need to call the command where the flag is local
so probably server..
but that should be the problem only if you are running dedi server?
If that's the case indeed setFlagTexture is GE
its called in init.sqf
well maybe ```
if(isServer) then
{
flag setFlagTexture "texnamehere";
};
im so confused, i use execvm in init to call the script that has setFlagTexture, sorry im so bad at this ๐ฅ
i have to ask if you have dedi running + client. ? or is it all in editor?
so at the moment ive made a init.sqm im the mission file while im messing with scripts, then i chuck it all up on a dedi and everything has been fine untill this flag thing. i never noticed it on the dedi only now when starting a mp mission from eden then having another client join
local client
so where is the flag created? server or client?
i dont know? how can i tell?
is the flag placed in the editor?
yea
roger
Depends what build you are on.
On dev/profiling that returns true.
There is some code in stable build that copies in some cases even though it doesn't make sense, that's a bug.
@proven charm so its kind of working, but now clients who join that use the script cant change the texture, sorry im so confusing with my explanations
all changes to the texture must be made on server side
sweet as thanks for your help ๐
yw
I fixed that in december 2020, but forgot to enable it in stable builds
claaaic dedmen W
_objects = player nearEntities [["Flag_FD_Green_F", "Flag_FD_Orange_F"], 30];
sleep 15;
if (_objects) then {
sleep 5;
hint "Player reached the flags";
} ;
i want to check if player has reached any of the given classname flags within 30 distance, how do i fix nearEntities? i tried also working with nearobjects/ nearestobjects no luck so far
should be if (count _objects > 0) then
isnotequalto [] is faster
how do i write it?
didnt work
if (_object isNotEqualTo []) then
[] spawn { _objects = player nearEntities [["Flag_FD_Green_F", "Flag_FD_Orange_F"], 30];
sleep 15;
if (_object isNotEqualTo []) then {
sleep 5;
hint "Player reached the flags";
}; } ;
its now looking like this, getting error just before _object isNotEqualTo []
_objects
ops my bad
doesnt seem to work with nearEntities . try ```sqf
_objects = nearestObjects [player, ["Flag_FD_Green_F", "Flag_FD_Orange_F"], 30];
appreciated so much๐
np
Hi I'm trying to get this script working when you click on someone in zeus and put this is the execute area but it doesn't seem to be working. It should be displaying what ever word i want above their head. Would appreciate some help with this i can't figure it out.
[_this, "text here", 30] remoteExec ["3DText",0];
inb4 ChatGPT
Maybe a stupid question, but would this work in a trigger condition ?
I'm trying to make an objective with an optional task, basically there's a FOB with a comms tower that the players would have to destroy, but there's also another location near it. The idea is that if they destroy the fuel tank (optional OBJ), the FOB sends a QRF to the location that the players could evade to then strike a weakened FOB.
This works, but now i'm trying to make the trigger that makes the main objective "Succeeded" and the optional "Canceled" if the players decide to fudge subtility and just strike the FOB with the comms tower without doing the diversion.
alive AJFuelTank;```
Where do I place it in this code ?
!alive a && alive b
If I delete a trigger or a spawn point on the server with deleteVehicle, will it cease to exist on clients as well? Thanks
if the trigger is server only, it will be deleted for everyone, otherwise no
Hello! I'm working on a artillery menu with map and such, but the text in the markers in the GUI map don't show up. Anyone knows why?
Which map control do you use?
CT_MAP_MAIN
iirc there's 2, one with type 100 and other 101, and you should use the 101 one
iirc it's called CT_MAIN_MAP
A custom one or do you inherit from the CtrlMapMain (iirc)?
I have a defines.hpp and I got all the necessary items to make the map works here https://community.bistudio.com/wiki/CT_MAP_MAIN
yes
Hard to say what's wrong exactly because I'm reading it on mobile, but try inheriting from the vanilla one
I guess you might've missed a color
oh well, let me check those hundred lines
Or just inherit 
you say from the defines.hpp?
No inherit from the game main map
in this case class RscMapControl : CtrlMapMain ?
And declare it first but yeah (also make sure it exists, I just wrote the name from memory)
Are you making a mission or mod?
let me check cfg viewer first
Then you should import it:
import CtrlMainMap;
In addons you declare them (you also need to list the correct requiredAddons):
class CtrlMainMap;
aaa, I was reading about the import command, a practical example, nice
is this the correct one from the cfg? configfile >> "ctrlMapMain"
idk it could be. check if its type is 101
yes it is, but still don't quite understand the import command. Should I put it on description.ext?
this looks awesome, if you could share it later so maybe i could use it in the future, after your permission, whenever you want
Of course, let me fix this first.
I'm having an issue getting a helicopter to land on a dedicated server (works in editor just fine.)
- Helicopter has a hold waypoint.
- Players enter trigger zone that removes the hold waypoint.
- Helicopter flies to invisible helipad but wont land.
Oddly enough if I removed the hold waypoint it has no problem working on the server. Something about the hold waypoint breaks it.
inb4 locality problem when trying to delete the hold WP 
Well I'm not so sure it's a locality issue, because the waypoint is removed for all clients via a remoteExec:
deleteWaypoint [group heli, 1];
And indeed the heli is able to fly away and hover above the landing zone. But it just wont land.
@little raptor got it working without having to inherit, it was the multiple sizeEx with wrong format
someone has a workaround for player action ["Gear", _myVehicle]; not opening the inventory if the player is inside the vehicle (it opens when you disembark - surprise)?
by any chance does anybody know the name of animation where person is kneeling handcuffed behind back ?
Try "Acts_ExecutionVictim_Loop"
That is it thanks.
guys, does someone knows a script to put a server FPS measurer? to show on the players map or something like that
hey guys I want to achieve that I'm able to prevent people to use for example the nightvision via displayeventhandler.
That already worked pretty easily via using actionKeys check. But now the problem is when people add key combination like shift+N or even B+N it doesent work anymore due to bit flags probably being added to the dik value. And the number which then is inside the actionKeys are rising up higher than 7 digits and since numbers in sqf are floats it becomes not precise anymore.
so my solution was to use actionKeyEx (includes key combination) and since displayeventhandler only triggers for one key maybe the best would be to use a array which contains all the keys which are getting pressed and added via KeyDown and then getting deleted via KeyUp , what do you think , maybe any better solutions ?
You could use a UserAction EH to detect the vision switch event rather than the controls, then use player action ["nvGogglesOff",player] to immediately switch back.
Or, you could use a keyDown EH and check whether the NVG inputAction is currently active, rather than looking for the specific buttons.
I forgot that addUserActionEventHandler existed , thank you I will give it a shot , looks promising !
for inputAction thats what I tried as well, the only issue is that it bocks other key inputs as well if the one key is getting pressed, for example Shift+N for Night Vision and then you stop running if inputAction is higher than 0.
Then you could make another check only if the key for nightvision is getting pressed and then you are back to check which key combination is getting pressed
i have a vehicle in the mission with variable name "OBJECTIVE_VEHICLE_1" that MUST exist always meaning if it gets destroyed or deleted it should respawn at the last known position with the same variable how i do this?
[[], {
if (hasinterface) then {
if(isNil "FPSDiagActive") then
{
FPSDiagActive = true;
while {true} do
{
player setVariable ["PlayerFPS", floor diag_fps, true];
sleep 1;
};
};
};
}] remoteExec ["spawn", [0, -2] select isDedicated, true];
showFrames = true;
addMissionEventHandler ["Draw3D", {
{
_distance = (ATLToASL (positionCameraToWorld [0,0,0])) distance _x;
if (_distance < 1200) then {
_playerFPS = _x getVariable ["PlayerFPS",50];
if (_playerFPS <20) then
{
if(showFrames) then {
drawIcon3D
[
"",
[1,0,0,0.7],
ASLToAGL getPosASL _x,
1,
2,
0,
format["%1 FPS: %2", name _x, str _playerFPS],
0,
0.05,
"PuristaMedium",
"center"
];
};
}
else
{
if(showFrames) then {
drawIcon3D
[
"",
[1,1,1,0.5],
ASLToAGL getPosASL _x,
1,
2,
0,
format["%1 FPS: %2", name _x, str _playerFPS],
0,
0.03,
"PuristaMedium",
"center"
];
};
};
};
} forEach allPlayers;
}];```
I run this code (Local Execution) that helps me view the FPS of all players in the server (Only for me).
If you have a lot of players on the server and only you want to scan the fps of the players then you should change player setVariable ["PlayerFPS", floor diag_fps, true]; to player setVariable ["PlayerFPS", floor diag_fps,remoteExecutedOwner]; This way it only sends the PlayerFps variable to the guy who actually wants to see it
With true it will just sends it to everyone every 1 second
for example with each of these 80 people sending it to 80 other people that would be 6.400 vars getting send over the network every second
Ah yes, true
Hey all. What's the easiest way to make a mod that references a normally hidden object (ie. scope = 0) and make it visible in 3den (ie. scope = 2)? There's a mod that does something similar, but it's so poorly written I want to start over.
I think I can figure out how to change the scope and stuff myself; I more need help with making a mod override that's simple.
Can I please get some help remoteExec'ing this:
player addAction ["<t color='#FFFF00'>End Mission</t>", {["end1", true , true, true, true] call VN_fnc_endMission;}, nil, 7, false, true, "", ""];
This is what I got so far but it says invalid number in expresssion:
player addAction ["<t color='#FFFF00'>End Mission</t>", {["end1", true , true, true, true] remoteExec ["call VN_fnc_endMission", 0];}, [], 8, false, true, "", ""];๏ปฟ
Hmmm. I still get the same error that way.
You'd need to remoteExec the addAction.
Post exact error
Thats the goaal
these are hard as hell to write. Give me a few minutes.
On Activation: Invalid Number in Expression
Exact means lieteral, word to word character to character, no skip or add or summarize
Are you sure you have no invisible illegal character there?
actually the easiest bad way is just:
[{player addAction ["<t color='#FFFF00'>End Mission</t>", {["end1", true , true, true, true] call VN_fnc_endMission;}, nil, 7, false, true, "", ""]}] remoteExec ["call", 0];
wait never mind, not sure what this function does.
This works in the editor just fine
It shouldn't be used in the editor.
Im going to try on dedicated server now.
I guess not? How do you tell?
Why is this bad?
For some reason I assumed you were trying to add an action everywhere from server script.
It's an addaction for every client
And I actually have no idea what you were trying to do or what that function does, so ignore everything I said.
Check it in some text editor and check. Like notepad++. Probably I might guessed wrong anyways, I recall it would return an error not that one
Oh nice I have notepadd++. Any idea how to check the code for errors in it?
The mirrored P icon
You'll see some strange characters, but make sure there is no "super strange" ones
what's the best way to get full orientation (vdirup) player is aiming? not v familiar with camera commands and cant seem to get it to work
There's getCameraViewDirection but I don't know of any way to get the up direction.
private _startPos = positionCameraToWorld [0,0,0];
private _endPos = positionCameraToWorld [0,0,2];
private _vdirandup = [_startpos, _endpos] call BIS_fnc_findLookAt;```
is currently what im doing but seems to give some sort of offset... usecase is for firing projectiles from player's eyes
i was aiming straight up on the far left one
never mind
jenna doesnt remove her deprecated code i was updating deprecated code its all her fault blame her
I guess I'll ask here, but:
What's a good way to remove the vests from TFA - namely just removing them from the arsenal without whitelisting all the other contents?
Can I create a config patch to change their scope?
Is there some way to get all markers only from a specific channel? I.e. can I somehow fetch markers only from Side Channel?
Thank you, POLPOX.
you can use AGLtoASL positionCameraToWorld [0,1,0] and subtract it from AGLtoASL positionCameraToWorld [0,0,0] to get the up
do you really need a vectorUp for spawning the projectile, though?
just _vectorDir = (AGLToASL positionCameraToWorld [0, 0, 1]) vectorDiff (AGLToASL positionCameraToWorld [0,0,0]); for unit-length direction vector
fixed: added AGLToASL
or even https://community.bistudio.com/wiki/screenToWorldDirection in the next patch
That's different
It should be ASL
directions don't care about ASL/AGL/ATL/whatever, though. And vectorDiff would give you a direction As long as both points are in the same format.
and
usecase is for firing projectiles from player's eyes
sounds like the most fitting usecase forscreenToWorldDirection
point taken, my error is: AGL doesn't have a flat base plane, so Z offset would be different in the starting and ending points. (AGLToASL positionCameraToWorld [0, 0, 1]) vectorDiff (AGLToASL positionCameraToWorld [0,0,0]) should be used. The original code has the same bug, though ๐
at least if BIS_fnc_findLookAt doesn't take care of that internally
hi,
is there a trigger condition that detects once the leaflet has been opened by the player?
["init", [this, "YourImage.jpg", "text"]] call BIS_fnc_initLeaflet
so in the leaflet's init:
intel1 addEventHandler ["objectInspected", {
params ["_object", "_texture", "_text", "_sound", "_textureRatio"];
_object setVariable ["leafletRead", true, true];
in trigger condition:
intel1 getVariable ["leafletRead", false]
Check BIKI more carefully

if (isServer) then {
intel1 addEventHandler ["objectInspected", {
params ["_object", "_texture", "_text", "_sound", "_textureRatio"];
missionNamespace setVariable ["leafletRead", true, true];
}];
};
[missionNamespace, "objectInspected", {
params ["_object", "_texture", "_text", "_sound", "_textureRatio"];
if (_object == intel1) then {
missionNamespace setVariable ["leafletRead", true, true];
hint "New location has been located";
};
}] call BIS_fnc_addScriptedEventHandler;
trigger condition:
missionNamespace getVariable ["leafletRead", false]
if you want to check that the leaflet is not read yet use !
!(missionNamespace getVariable ["leafletRead", false])
Ok but I want to check whether it has been read
ok
Then it shows a marker on map in the trigger activation
so whats the problem?
It didn't work
what didnt work?
Hey Folks, stupid question:
How can I find out if a Class that is given to a function is a disposable Launcher (so only one time)? Is there a way to find that via config or something? I looked into the NLAW config and didn't find a value that caught my attention.
There is no system for disposable launchers in the vanilla game. Mod implementations are all scripted, usually with EHs. GM disposables have a config flag for it but that's a courtesy, not something that's actually required, and other mods use different flags or none at all.
The EHs required for disposability will be visible in the launcher's config, under its EHs subclass, but you can't really read that in a reliable way through scripting.
The trigger didn't fire when I opened the leaflet
did you see the hint "New location has been located"; ?
RHS and CBA (used by CUP) have different disposable launcher systems. Not sure whether GM uses one of those.
RHS: getNumber (_config >> "rhs_disposable") == 1
CBA: getArray (_config >> "magazines") # 0 == "CBA_fakeLauncherMagazine"
probably not given that one has "rhs" in it and GM doesn't require CBA :P
I thought we handled GM disposables but I guess not.
CBA also has CBA_fnc_firedDisposable, which can be used by any weapon from its EHs without any particular config requirements. That's what ACE uses for its modified vanilla NLAW.
CBA actually has three versions of each launcher. A launcher+fake missile one that should be in the arsenal, a real launcher + missile pair that it turns into when equipped, and an empty tube.
IIRC other modsets stick with the two. CBA's system is so you don't need to put a missile in the launcher.
RHS will create a missile for an empty launcher when humans use it, but this doesn't work for AI.
Oh, CSLA and SOGPF (and Spearhead? I can't remember if any of their launchers are disposable) will have their own systems too. They're probably functionally similar to one of the other major systems since there's only so many ways to do it, but the problem is that the config flags (if used) and function names will be different again, so in order to detect them you have to basically build a specific check for every version of every system
the EH goes in the condition line of a trigger, right?
i set another hint to show in the activation, and that one didn't fire
the whole BIS_fnc_addScriptedEventHandler thing goes to init.sqf or something like that, not to trigger
yeah spearhead has panzerfausts- based on the RHS system with some differences
sorta wished by this point there'd be native support for disposable weapons especially when there's been examples in... every game on the engine so far
@analog mulch I ran this on console and it worked good ```sqf
[intel1, "#(argb,8,8,3)color(1,0,1,1)", "This is some Magic Pink"] call BIS_fnc_initInspectable;
[missionNamespace, "objectInspected", {
params ["_object", "_texture", "_text", "_sound", "_textureRatio"];
if (_object == intel1) then {
missionNamespace setVariable ["leafletRead", true, true];
hint "New location has been located";
};
}] call BIS_fnc_addScriptedEventHandler;
i just used it in a Game Logic module and worked
so is that what they are there for, Game Logics that is?
basically use them for as an init?
never used them my self 
ty @proven charm
Can someone help. How can I check if uniforms in container can be weared by player? Maybe need some manipulations with isUniformAllowed command?
private _Uniform = ("getText (_x >> 'simulation') in ['Weapon'] && getNumber (_x >> 'ItemInfo' >> 'type') in [801] && getNumber (_x >> 'type') in [131072]" configClasses (configFile >> "cfgWeapons")) apply {configName _x};
private _Uniforminbox = (itemCargo _container) arrayIntersect (_Uniform);
private _canUseUniform = ....
Assuming that the player is local: _canUseUniform = _uniformInBox select { player isUniformAllowed _x };
You really shouldn't scan the whole config here though. Just run the check on the items that are in the crate.
@granite sky Thanks.
Would the Eden editor display return anything when using
findDisplay _someIDD;
``` while testing the mission from there? Or does that IDD only exist while the actual editor is active?
Same question with the ZEUS IDD, will it return anything when the mission normally runs or does it only return something while you are using the zeus interface itself?
_westOrEast = simulationEnabled triggerComms;
if (_westOrEast = false) then {
onOff setPos [7706.14,9696.31,0];
}
else {
onOff setPos [7702.57,9682.04,0];
};
Having a hard time understanding why it's giving me this as an error despite me having a closing parenthesis thing
(= should be ==)
Ah
I think _var == false does work these days but you should really do !_var instead.
Sounds good, I'll change that, thanks for the help
right, boolean support for == added in A3 2.00
Is there difference use
private _westOrEast = simulationEnabled triggerComms;
private _pos = [[7706.14,9696.31,0],[7702.57,9682.04,0]] select _westOrEast;
onOff setPos _pos;
You can select with true false,
False 0 and true 1
So it select 1st if false and second if true.
I didn't test if there is difference in performance (time)
The bulk of the cost there is usually the setPos, so probably not much.
If your Z values are accurate then you can use setPosATL instead and then it's much faster.
Not the sort of code where performance matters though.
Does anyone know how to force the AI to raise or lower the landing gear in an aircraft, I've looked online but found no results
https://community.bistudio.com/wiki/Arma_3:_Actions#LandGear
Note the note about needing a loop to override the AI's instincts.
I did try using nameOfPlane action ["LandGearUp", nameOfPlane]; but the gear was still down, am i suppose to loop it?
Is the dedicated version of the "call" command "RemoteExecCall" ? I tried to check on the wiki but didn't really understand if it is.
I noticed on our dedicated server that this script from Advanced Rappelling didn't work
[Helo1,30,GetPosASL LZA_RappelPos] call AR_Rappel_All_Cargo
@hallow mortar sorry i dont understand
That's the documentation for the LandGearUp action, which I linked to before.
It says you have to loop it to get it to apply to AI.
I've done some experiment recently and it is simply bugged and unreliable
Ok ill try that
Hey folks,
I am again, down in Configs and I realise that I know not enough to fight my way through that.
I have a function that gets a classname of an item and now I want to read a value from this. For this I need to know if the item is in CfgWeapons or CfgMagazines.
to go for the correct item info patch I use here:
sqf _mass = getNumber (configFile >> "CfgWeapons" >> classname >> "ItemInfo" >> "mass");
How would I know if to search in CfgMagazines or in CfgWeapons?
How could I do this?
Hi all, pretty simple problem here. I am trying to make targets pop back up on a command using scripts. I can't seem to get my syntax right, I have all the target names stored in an array and I am trying to loop through the array with a for statement and setting the targets animation. But I am getting this error, I cant figure it out from reading the docs. Any help?
` targetList =["t", "t_1", "t_3", "t_4", "t_5", "t_6"];
"i" = 0;
for "i" in targetList do {
select targetList["i"] animate["terc", 0];
};`
What exactly is the context there? What classname can be?
targetList =[t, t_1, t_3, t_4, t_5, t_6];
for "_i" from 0 to count targetList do {
(targetList select _i) animate["terc", 0];
};```
More better way:
```sqf
{
_x animate["terc", 0];
} forEach [t, t_1, t_3, t_4, t_5, t_6]```
Thank you polpox, why is the second way better in this case?
Just less lines?
Less lines, less things to execute
Cheers
@warm hedge
Classname could be a Weapon, or a Magazine, for example:
"ACE_M26_Clacker"
"ACE_VMM3"
"DemoCharge_Remote_Mag"
So you put these classes by hand? Not fetched by some command?
Put in by Hand.
It is an Equipment Array for a loadout in a Role System I am writing.
Then isClass maybe the way
Ah, okay, wonderful. I think this should work. Didn't know about that command and was obviously not searching the right buzzwords in the wiki.
It worked, thank you.
Hey I saw this message from about a year ago, but do you still have that low gravity mission handy.
I have been looking everywhere for a script that can help my unit with a moon op!
hey how would we find out of the player is in water
also how do we get uavs to automaticly follow something from the start
because follow waypoints dont work\
Quick question: I am trying to remove a specific magazine from a vehicles inventory. But apparently
_myVehicleReference removeMagazine _magazineToBeRemoved;
does not work. I browsed the wiki for quite some time now and I didnt find any alternatives. Is there a workaround?
Clarify. You want to remove from inventory where infantry can access, not from vehicle magazine where they consume upon fire their cannon?
Yes. The inventory a player can access and place magazines inside.
I was thinking to create an array, save the current inventory of magazines, remove all magazines, substract the array element and then add all magazines from the array. But this seemed a little too complicated for such an (in theory) easy task
Unfortunately, that's the way. No idea why
if (ARMA) then {?!};
Pretty much
Hi im trying to make it so the vehicle i have attched not be attached to anything anymore but unsure how to do that. cant find anything on the attachedto docmentation aswell
[vec1 ,null] call BIS_fnc_attachToRelative
Thank you
Hello there - I am wondering if it is possible to add the alchemist magic to a player (from the saharan CDLC) via script e.g. if a player interacts with an object
You might wanna ask on their discord or in #western_sahara
^^
Zeus IDD is only valid while interface is open, 3Den IDD is valid both with the interface and the mission preview.
If needed an alternative to check for actual 3den interface or 3den mission only, use
is3den; //Interface
is3denPreview; //Mission
is3DENMultiplayer; //Mpmission
Hello. The command "inRangeOfArtillery" is acting weird. Calling it directly through a script always return false, but calling the <<same>> code from the debug, returns true lol. Any ideas?
You should share your current code,
Without that hard to say why it acts like you say.
From where do you call it?
Does it return via debug when you execute server , local and remoteexec false too?
I'm testing this on SP\hosted
/*
[arty1, "32Rnd_155mm_Mo_shells", 3, getMarkerPos "targetPos_refer"] spawn PIG_fnc_fireArty;
*/
params["_arty", "_ammo", "_rounds", "_targetPos"];
_isInRange = _targetPos inRangeOfArtillery [[_arty], _ammo];
if !(_isInRange) exitWith {hint "The target is out of artillery range"; PIG_fire_button = 0};
this is a piece of it, in the original version of things, another scripts calls it, and it works normally, but if I try to call this function directly with the arguments above, always returns false
If I try to realocate this piece of the code to the other script that actually calls it, also returns false
If I run the inRangeOfArtillery command directly from debug with the same arguments, returns true (as it should).
And what is the code of the script that calls this fnc ?
/*
Author: PiG13BR
fn_checkParams.sqf
Description:
Checks if the player selected the items from the list boxes
Checks if the player selected a target position
Check if the artillery is busy
Parameter(s):
-
Return:
-
*/
// Check if the artillery is selected
private _indexArty = lbCurSel 2100;
if (_indexArty == -1) exitWith {hint "Select the artillery piece"; PIG_fire_button = 0;};
// Get the selected artillery object
private _arty = uiNamespace getVariable "artySelected";
// Check if the ammunition is selected
private _indexAmmo = lbCurSel 2101;
if (_indexAmmo == -1) exitWith {hint "Select the ammo type"; PIG_fire_button = 0;};
// Get the selected artillery ammo
_ammo = lbData [2101,_indexAmmo];
// Check how many rounds
private _indexRound = lbCurSel 2102;
if (_indexRound == -1) exitWith {hint "Select how many rounds"; PIG_fire_button = 0;};
// Get the selected rounds
_rounds = lbValue [2102,_indexRound];
// Check if the player clicked on the map
if (isNil "PIG_artyPos") exitWith {hint "Select a position in the map"; PIG_fire_button = 0;};
// Check if the selected artillery is busy
if (!unitReady _arty) exitWith {hint "The artillery is busy right now"; PIG_fire_button = 0;};
if (PIG_fire_button == 1) then {
[(_arty) select 0, _ammo, _rounds, PIG_artyPos] spawn PIG_fnc_fireArty; // Checks if the artillery is in range and fires it
// Don't close the dialog and run the script again
[] spawn PIG_fnc_fetchArtyInfo;
[] spawn PIG_fnc_checkDialog;
// Remove map single click EH
["arty_event", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
// Delete the placeholder target marker
deleteMarkerLocal "marker_arty";
// Delete pos variable
PIG_artyPos = nil;
};
if I put the code below in that script above, it returns false. But the same code called from it, returns true
_isInRange = _targetPos inRangeOfArtillery [[_arty], _ammo];
if !(_isInRange) exitWith {hint "The target is out of artillery range"; PIG_fire_button = 0};
Try debug the _targetPos see what it returns ?
it returns the position [number,number,number]
calling it from the menu, works normally, but calling directly doesn't
No yea but i think it might depend on what kind of position ASL,AGL ATL ect and it might report its close becouse its one of those.
also, I'm testing this on dedi server, the artillery seems not to fire using doArtilleryFire. I used this code before on dedi and it should work normally
That the thing, It works normally when I call it from another script: the position, the object, and the ammo are not the problem
artifire is local, check that the ownership of the arty piece is not remote
now it's working... omg
but my problem now is the arty that doesn't fire
doArtilleryFire is local,
So if you call your event on client and your unit is not local, it doenst fire.
hmmm, I checked using debug "local arty1" it returns false
what shoud I do?
remoteExec your artillery event
private _unit = arty1;
private _pos = getMarkerPos "artyPos";
if (!local _unit) then {
[_unit,[_pos, "8Rnd_82mm_Mo_shells", 3]] remoteExec ["doArtilleryFire",_unit];
} else {
_unit doArtilleryFire [_pos, "8Rnd_82mm_Mo_shells", 3];
};
ohh okay
although, you already have a function prepared
you might aswell remote exec the function
Yeah true
Also check this:
Where ever you are getthing the position of the marker:
PIG_artyPos
Try adding this:
getMarkerPos ["markerTwo", true];```
this true at the end will give you the AGL position.
Now i dont know if inRangeOfArtillery is checking distance 3D or distance 2D.
No the same.
execute there where your aritllery is local
its a cleaner more organized way
Yeah i'm doing this
and, for the remote targetting, shoud I just put clientOwner?
3d agl
Yea but in this video you are getting 2d pos [x,y,0] with AGL you get [x,y,z].
ohhh right
I would say that you should get the specific owner of the arty, OR you can just globally remoteexec but thats the "easy" way out haha
I Assume the arty is created on server right?
If so using ID 2 is enough, if the arty is supposed to be local to a player get its owner but you require to query the server for that
Well, the arty is already spawned in the editor itself
yeah, 2 is enough then
I get the position from mapclick event, then I use this to spawn the marker and get the coords for the arty
Just get the pos of that marker and include the Z value and see if that is the case myb.
I can confirm that the "inRangeOfArtillery" is working normally, but it acts weird when it's called in the same script, even if the arguments are the same
got it
still doing that lol
I noticed that got the object inside an array, let me see if this is the problem
yup, fixed it
so, using "unitReady", it's the same thing: I need to check if the unit is local, right?
when you want dynamic airport like in https://community.bistudio.com/wiki/Arma_3:_Dynamic_Airport_Configuration do you have to create new config/mod class?
yes, airport, run ways and whateve the term is used for the rally points of the ai taxi are defined in mod
then it should be dropable in editor?
it's an ancient command that doesn't even has a locality marker, you can test but its most likely local like the doSomething family, as its intended to be used in tandem with those
according to documentation yes, but if a map doesnt have a proper airport definition it wont work. Something like that happens in Tanoa I believe
i never used the "prop" itself
humm well i got the new airport dropped in, in editor but i guess it doesnt render the runway? its just for AI?
correct, the doc mentions its just for ai and auto pilot logic
Placing the airport in 3DEN allows to see its shape in the map view (2D map), as well it is rotation. However, in 3D it is basically invisible.
ok
is there an alternative?
Looking for a way to make it so that when I spot any unit within a group a trigger fires
I've already got a basic setup down using
cursorObject == spot4;
But I really do not wanna write out
cursorObject == spot401 || cursorObject == spot402 || cursorObject == spot403
and so on.
Is there a way to target any units within the group in one go?
@hallow mortar I tried looping the AI to have the LandGearUp with this
[] spawn {
while {true} do {
{F15EX_1_Pilot enableAI _x;} forEach ["ANIM","MOVE","FSM","TARGET","AUTOTARGET"];
F15EX_1 action ["LandGearUp", F15EX_1];
sleep 5;
{F15EX_1_Pilot enableAI _x;} forEach ["ANIM","MOVE","FSM","TARGET","AUTOTARGET"];
F15EX_1 action ["LandGearUp", F15EX_1];
};
};
But all I see happened was the gear animation plays half way then it's lowered again
Why are you looping enableAI?
The documentation I linked before says you should use a per-frame loop (e.g. eachFrame mission event handler). Alternatively, as POLPOX mentioned, the command may just not work properly.
It's a unitCapture but the aircraft itself is bouncing on unitPlay so I attached a game logic to the aircraft and replayed it and solved the problem
cursorObject don't really mean spot
but you could do cusorObject in units groupToSpot
Yeah it's more look at those objects tbh
I'll try that though, thanks!
I am using a combination of the keyframe modules along with the camera module to create a moving camera sequence, I want to enter and exit the camera view's by script.
This is the current script I got.
camera1 cameraEffect ["internal", "back"];```
Pretty basic, everything goes smooth for like 2 seconds and the camera runs on the track and then it kicks me out of the camera view.
The way I fixed this is by using the ``switchCamera`` function,
```[timeline_1] call BIS_fnc_timeline_play;
camera1 switchCamera "internal";```
but the problem I am running into that with is that it does not take any of the effects applied inside the module into account, running both switchCamera and CameraEffect results in the same thing of CameraEffect kicking me out but switchCamera works fine.
**TLDR; CameraEffect kicks me out when used to enter a module made camera, switchCamera works fine but does not apply any effects onto the Camera (i.e: Cinematic Borders)**
@hallow mortar I got it working now
how do you spawn the smoke from a destroyed vehicle? cant seem to find another smoke pillar like it
thank you
anyone got any pointers?
how would I go about scripting a map onto a whiteboard
im just looking to put the map for the terrain im playing on onto a whiteboard
@cedar cape Look at setObjectTexture on the wiki
Alright
With the whiteboard donโt you use the texture path in the attributes
Sure, you can use that. If you're using that then just get the image of the map and put its path there
Any help on this particular error I'm getting?
Module is attached to unit in Zeus, unit is given Fire Mission waypoint, and as soon as it fires, this happens.
_projectile is an object there
hmm how'd I convert that to string?
typeOf
just str(_projectile)?
oh ok
How do you get notepad ++ to have the colors for different code like it does here on discord?
Download the synatx highliter here:
https://forums.bohemia.net/forums/topic/138891-arma-3-notepad-syntax-highlighting/?page=10
Updated for 2.10 Hotfix 1: https://drive.google.com/file/d/1-hnVUZx98BHKD8La5RePfoT47eHG0vfD/view?usp=sharing 06. September 2022 ChangeLog: - added: getTIParameters and setTIParameter scripting commands
Scroll down where you see highlight for 2.16
Oh wow this is a project that someone is keeping up with. Amazing
Is there a quick (one-line) method I could use to set the side of an arbitrary unit to that which matches the numerical value stored in a variable _AmmoSide (1 is west, 0 is east, and so on)?
Current code is below, but it's a modification of some code I found elsewhere and it doesn't seem to work. All spawned entities currently are their default config-set value of side = 1;.
I'm guessing the error is that I'm not using the "west", "east", "UNKNOWN", etc, but writing those if statements/switch statements would probably be much more taxing on performance.
[_ICMVehicle] joinSilent createGroup _AmmoSide;
With this myb you can get side ID and based on the ID you can get the side.
https://community.bistudio.com/wiki/BIS_fnc_sideID
hmm, sideID returns numbers, which are what I'm already starting with. Looks like BIS_fnc_sideType returns the EAST/words which is waht I'm looking for, will try that.
Is there a way to execute code when a player deploys an UAV from their backpack?
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#WeaponAssembled
player addEventHandler
[
"WeaponAssembled",
{
params ["_unit", "_staticWeapon"];
if(unitIsUAV _staticWeapon) then
{
systemChat "Drone assembled";
};
}
];
awesome, thanks! Two questions about this:
- Will the event handler code be executed on the server or locally for the player who assembled the drone?
- Will the drone be local to the server?
- Player obviously
- Drone locallity is all over the place, not sure.
gotcha, thx
typeOf _projectile, but you also have _ammo in event handler which is exactly the same thing
Hmm must have swapped those thx
I am looking for suggestions as to how to force the AI driver to drive from the vehicles current position to a waypoint. Right now, about half the time or less, the driver either does not move or gets stuck at an intersection going through a town or city. I have tried with combateMode "SAFE" or "AWARE".
Theres a command called something like forcefollowroads you can try
I need to enemy tank stay on roads. So I put this forceFollowRoad ture; script on it. However, this causes problem on AI behavior. Tanks are wont moving. Plus, they just wiggling and spinning around. How can I fix this?
how do you make smoke effect similar to when buildings get destroyed? I need that for large area (50x50 atleast)
https://community.bistudio.com/wiki/Particles_Tutorial
Spreading particle spawning across an area is done with the position randomisation in setParticleRandom (or by making several sources I guess)
thx for the link. i was hoping for preexisting function because i havent done much particles my self
When you use setParticleClass as part of creating the source, you can choose preset types that already exist in the config. I think building destruction dust might be one of them, so you might have a good starting point available
ooh nice
Also, one of these creates dust similar to that caused by building destruction. I don't remember which of them it is, but it's pretty easy to test.
_emitter2 setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal",16,12,13,0],"","Billboard",1,15,[0,0,0],[0,0,0.01],0,1.276,1,0.03,[0.8,5,9,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12],[[0.2,0.2,0.2,0.2],[0.2,0.2,0.2,0.16],[0.2,0.2,0.2,0.12],[0.2,0.2,0.2,0.1],[0.2,0.2,0.2,0.8],[0.2,0.2,0.2,0.6],[0.2,0.2,0.2,0.3],[0.2,0.2,0.2,0.01]],[1000],0.1,0.02,"","","",0,false,0,[[0,0,0,0]]];
_emitter2 setParticleRandom [5,[10,10,1],[0.4,0.4,0.1],30,0.3,[0,0,0,0],0,0,1,0];
_emitter2 setParticleCircle [10,[0,0,0]];
_emitter2 setParticleFire [0,0,0];
_emitter2 setDropInterval 0.09;
_emitter3 setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal.p3d",16,12,13,0],"","Billboard",1,2,[0,0,0],[0,0,0.2],0,0.05,0.05,0.05,[3,4,5],[[0.5,0.4,0.3,0.06],[0.5,0.4,0.3,0.11],[0.5,0.4,0.3,0.06],[0.5,0.4,0.3,0.05],[0.5,0.4,0.3,0.015],[0.6,0.5,0.4,0]],[1000],0.1,0.05,"","","",0,false,0,[[0,0,0,0]]];
_emitter3 setParticleRandom [1,[2,2,0.2],[3,3,0.15],20,0.2,[0,0,0,0],0,0,0,0];
_emitter3 setParticleCircle [1,[1,1,0]];
_emitter3 setDropInterval 0.001;```
thx!
both seem to create dust. man all those numbers 
The particle system has a lot of complex attributes. It's surprisingly flexible, but a bit inaccessible as a result. That's how it is ๐คท
The tutorial should have links to things like the particles array page that explain what each number means.
yep the wiki is pretty good, still lot of numbers ๐
You can try the Emitter 3Ditor mod to get a more visual way of experimenting with it. It'll let you export the parameters to an SQF-ready format. (It's still complex and sometimes unstable, but at least you can see what you're doing.)
hmm does it support rectangle areas or ellipses? All i found was setParticleCircle
setParticleRandom also contains area randomisation. It's probably ellipse (well, 3D ellipse/spheroid) but I don't know for 100% sure.
ok thx
Thanks you for that feedback. I will try setting the drivers's combat behavior to "CARELESS" and skipping forceFollowRoads and report back.
I use such code for group:
{
deleteWaypoint _x;
} forEachReversed (waypoints _group);
_group setBehaviourStrong "CARELESS";
Such code for waypoints:
_waypoint setWaypointBehaviour "SAFE";
I also have a monitor script that periodically runs such code:
_groupLeader = leader _group;
_groupLeaderVehicle = objectParent _groupLeader;
{
if (((abs (speed _x)) >= 5) or { (behaviour (effectiveCommander _x)) == "COMBAT" }) then {
continue;
};
if (_x == _groupLeaderVehicle) then {
_waypoint = [_group, currentWaypoint _group];
_waypointPosition = waypointPosition _waypoint;
if ((_x distance2D _waypointPosition) > ((waypointCompletionRadius _waypoint) max 10)) then {
_x doMove _waypointPosition;
};
} else {
if ((_x distance _groupLeaderVehicle) > 50) then {
_x doFollow _groupLeader;
};
};
} forEach _vehicles;
In general it works, but not ideally -- sometimes either leader's vehicle, or the others, or all of them get stuck.
Thank you - I will give this a try
Do You have some example?
I mean if you have some house "explosion" effect what you do wanna use.
You can get all particles that are used on explosion from config and you could use those.
_object = curatorSelected select 0 select 0;
_pos01 = getPosATL _object;
_source01 = "#particlesource" createVehicleLocal _pos01;
_source01 setParticleClass "HousePartDust";
_source01 attachTo [_object, [0,0,0]];
from
class Land_u_Shop_01_V1_F: Land_i_Shop_01_V1_F
{ ..
class HitPoints
{
class Hitzone_1_hitpoint
{
armor = 0.6;
material = -1;
name = "Dam_1";
visual = "DamT_1";
passThrough = 0.4;
radius = 0.4;
convexComponent = "Dam_1";
explosionShielding = 20;
minimalHit = 0.02;
class DestructionEffects
{
class Dust
{
simulation = "particles";
type = "HousePartDust";
position = "Dam_1_effects";
intensity = 1;
interval = 1;
lifeTime = 0.01;
};
.....
interesting ๐
seems there is alot of funny stuff what you could use
yeah the _emitter2 that Nikko posted looks promising
there are even "evil eyes" particles, its one of those that start with "alk", its pretty goofy haha
Quick question why do i have to remoteExec these commands to show on hosted MP ?
I put them in init of a AI. When i just use switchMove they dont show but when i RE they show ?
[this,"Acts_ExecutionVictim_Loop"] remoteExec ["switchMove",2];
[this,"Acts_ExecutionVictim_Loop"] remoteExec ["playMoveNow",2];
due to the locality of the unit
if the unit is not local, it doesnt matter if the execution is global
using 2 suggest you are using a dedi or someone is hosting, so the unit is most likely local to those instance and you are trying to execute the code remotely
remoteExec the whole code you are doing and let the server/host handle the rest
So this is fine what i am doing just RE on Server ?
otherwise you end up flooding the server with RE requests
yes
Local Argument commands can sometimes not make sense, most of them predate the times of remoteExecute. Some other are like that by design.
Specifically speaking anything before 1.58 I think? I dont remember when was that introduced.
ok Big thanks.
hosted multiplayer you should set to zero to run globally remoteExec
[0, -2] select isDedicated using this idea will always make it run globally correctly in hosted MP or dedicated
but yeah hosted multiplayer is 2 2 is the server
this is an optimisation though, to avoid dedicated servers running code they don't need to
Yea i put 2 its going on Dedicated just i was testing on hosted.
That's just optimization tip (see example 6: https://community.bistudio.com/wiki/remoteExec ). remoteExec ["...", 0] will work correctly on both hosted and dedicated servers.
^
Yea but isnt 0 sending message to everyone to clients and the server as well while the 2 is just the server.
yeah and -2 is to everyone but the server
Wouldnt that mean that command would run that many times how many players are on the server ?
depends what context you are using it
There is an argument to be made here imo though, it really depends on how often you need to remote execute.
You are more prone to have a worse performance by spamming RE and creating artificial latency of execution + scheduler on your side than letting the server handle it completely.
I guess it varies according to how often its planned to be executed and the complexity of whats being executed.
Yes I've read the doc aswell
i am using it in a init of a unit to play the animation when scenario starts.
yea but when i dont RE then it dosent play.
including the server
init runs it on everyone
the reason of why its not working its likely due to you units not being fully initialized or unavailable to animate on startup
that was what i initaly asked i was under impression if i use just switchmove and Playmovenow with out RE that will play but it dosent it only plays when i RE.
I would recommend using a delay, spawn the statement and put a sleep or use waitUntil, However finding a better trigger case may be better
spawn the code in the init and give it a half second sleep
for example RespawnEH
yup
I would not recommend using a "bare" init field for this as every machine runs their own local copy when they start the mission - including when they join mid-mission. A client joining in progress will send a new instruction to the server/other clients, causing the animation to reset, or start again if it's stopped
Hmm.
PlayMoveNow in examples in spawn, so it needs a scheduled event?
To be safer, wrap the code in if isServer then {}; to ensure it's handled only on the server
I'll leave you guys to it there is plenty of people who can help here atm
Those examples are spawned because they use sleep
Like this ?:
[this] spawn {
params ["_obj"];
if!(isServer) exitwith{};
sleep 0.3;
_obj switchMove "Acts_ExecutionVictim_Loop";
_obj playMoveNow "Acts_ExecutionVictim_Loop";
};```
ye
I'd usually put the isServer check outside the spawn, so the clients aren't spawning an unnecessary thread
you would want the server check flipped and I would recommend isDedicated
and putting it outside of the spawn is a good shout
That server check is perfectly fine, it doesn't need to be flipped
I love the fresh smell of optimisation in the morning
that would only switchMove on the server
Yes, that's the intention
right, but then nobody is going to see it?
switchMove is a Local Argument / Global Effect command
Ok and last question when i have code that adds ace interaction would i need to remoteExec the code that is inside the interaction if i want for everybody to see it ?
private _hostageAction = ["LEG_ReleaseHostage","Prepare Hostage","",{
params ["_target"];
[5, [_target], {
params ["_args"];
private _obj = _args#0;
[_obj,""] remoteExec ["switchMove",[0,-2] select isDedicated];
[_obj, true] call ACE_captives_fnc_setSurrendered;
[_obj, true, objnull] call ACE_captives_fnc_setHandcuffed;
[_obj,0,["ACE_MainActions","LEG_ReleaseHostage"]] call ace_interact_menu_fnc_removeActionFromObject;
}, {hint "Failure!"}, "Preparing Hostage."] call ace_common_fnc_progressBar;
},{true},{},[], [0,0,0], 100] call ace_interact_menu_fnc_createAction;
[this, 0, ["ACE_MainActions"], _hostageAction] call ace_interact_menu_fnc_addActionToObject;
if its intended to be there from the very beggining I would suggest doing a function and use initLocal
I'm also not sure why isDedicated would be preferred here. The locality check to avoid duplicate executions still matters in non-dedicated multiplayer.
I misunderstood the intention
I thought we were making them complete an action once you loaded
I just need it to be used once i dont need to call this multiple times.
what you have will work then
are ace actions propagated by default?
question, does anyone know whats the issue with this? I am trying to spawn a missile and make it hit the target. target is a helo, and missile should spawn behind it at an angle
_position = AGLtoASL (mfammotarget1 getRelPos [2000, 170]) vectorAdd [0,0,-10];
[[_position], "ammo_Missile_AA_R77", mfammotarget1, 900, false, [0,0,0.25]] spawn BIS_fnc_exp_camp_guidedProjectile;
mfammotarget1 is the helo
I get fn_guideprojectile invalid position, not a 3d vector
you wrap it in another array
Try what Lou said you put the position in array.
private _position = AGLtoASL (mfammotarget1 getRelPos [2000, 170]) vectorAdd [0,0,-10];
[_position, "ammo_Missile_AA_R77", mfammotarget1, 900, false, [0,0,0.25]] spawn BIS_fnc_exp_camp_guidedProjectile;```
How can I lower engine and rotor RPMs of a helicopter on the ground? I tried some of the command here: https://community.bistudio.com/wiki/Category:Command_Group:_RTD
Nothing works properly.
It is AFM only command
RTD commands require the helo to use AFM. I don't think helos use AFM unless a player with AFM is the current pilot.
Then what do you do actually
This gives an ; error: heli setThrottleRTD [0.5, -1];
And this does nothing: heli setEngineRpmRTD [500, -1];
And this one just almost turns the engine off, though idle is ~4000RPM:
heli setWantedRPMRTD [3900, 10, 0];
setThrottleRTD has a game version indicator for Take On Helicopters but not Arma 3. It may not exist in this game.
Indeed it is not
hey just asking why wont this work?
["6", [formatText ["%1", image "images\buried_treasure_map.paa"], "Find the buried treasure", ""]] call BIS_fnc_taskSetDescription;
``` I just get an error from inside the `BIS_fnc_taskSetDescription` function
Likely because formatText returns Structured Text not String
ah, so, convert it to string via str()?
Just format.
oh, got it, more simple than i thought lol
much appreciated
i could just be stupid but it didnt seem to work, i dont get the error anymore though which is good!
Incorrect path to the image?
dont think so, i triple checked
hint it.
will do
interesting, hint didnt show anything. like not even an empty box or a sound. just did nothing
hint as in example: https://community.bistudio.com/wiki/image
ok i get an image now, but its tiny
Try to replace image command by string: https://community.bistudio.com/wiki/Structured_Text#Image
By the way, you can use size attribute to zoom your image.
got it, gimme a sec
ok i have this:
hint parseText "<img image='image\buried_treasure_map.paa'/>";
but im getting an error again
What's the error?
same one as earlier
Could you provide it's text from RPT file? https://community.bistudio.com/wiki/Crash_Files
I also see this warning:
17:41:54 Warning Message: Picture image\buried_treasure_map.paa not found
thats strange because im 100% sure thats the correct directory
in my mission root folder, there is a folder called images. and inside that is buried_treasure_map.paa
images
This is the last error:
17:41:54 Error in expression <};
private ["_text"];
{
_text = _txt param [_forEachIndex,"",["",[]]];
if (t>
17:41:54 Error position: <param [_forEachIndex,"",["",[]]];
if (t>
17:41:54 Error Type Text, expected Array,String
17:41:54 File /temp/bin/A3/Functions_F/Tasks/fn_setTask.sqf..., line 210
As mentioned, you pass text, but must string.
dude my brain is fucking stupid sometimes
if this works now im going to cry ๐ญ
ok no, still the same issue
Try
["6", [format ["%1", image "images\buried_treasure_map.paa"], "Find the buried treasure", ""]] call BIS_fnc_taskSetDescription;
or
["6", ["<img image='images\buried_treasure_map.paa'/>", "Find the buried treasure", ""]] call BIS_fnc_taskSetDescription;
top one didnt work, let me try the bottom one
hi guys, does anyone know if its possible to run keyframe camera via trigger somehow?
aha, bottom one seems to be working (mostly) just gotta figure out how to scale it down a little now lol
does that go inside the <img> or in its own <>?
Inside.
kk lemme try it
cant seem to figure this out as well (sorry im being so dumb)
["6", ["<img image='images\buried_treasure_map.paa' size='0.2'/>", "Find the buried treasure", ""]] call BIS_fnc_taskSetDescription;
is this the right place?
Yep.
didnt seem to do anything then
i could just manually decrease the size of the image lol, atleast i know how to do that
right now its 1024x1024
Yes, seems you can't use fractional numbers to zoom out images, but you can use integers (e.g. 2).
i did try 2 before hand and again didnt seem to do anything. ive just manually decrease the image resolution lol ill see if this works
good enough
thanks for all the help, im so sorry that i suck at coding ๐ญ
You're welcome!
I've got a question about function library attributes https://community.bistudio.com/wiki/Arma_3:_Functions_Library#Attributes
Is my understanding correct that if I run a function with preInit then the mission objects will not exist yet during the execution?
Thing is, I want to edit terrain objects en masse and I've read that for this purpose it's better to use preInit. However I want to effect to be limited only to the area of certain triggers. But triggers don't exist during preInit ๐ฆ What can I do?
You could run the code in preinit but instead of using trigger just use position and nearestTerrainObjects with a range. https://community.bistudio.com/wiki/nearestTerrainObjects
but that would just give me a circle, no?
I first get terrain objects and then check if they're in the trigger like so:
_area = triggerArea _trigger;
_sizeX = _area select 0;
_sizeY = _area select 1;
_maxSize = _sizeX max _sizeY;
_trees = nearestTerrainObjects [_trigger, ["TREE"], _maxSize, false];
//........
if not (_object inArea _trigger) exitWith {false} else {/* Do stuff */}
(it's a bit more complex actually, I have a few "Include" triggers of different shapes and a few "Exclude" triggers for areas that I don't want affected)
I guess technically inArea function allows me to pass trigger dimensions instead of the trigger itself. But where do I cache those between saving the mission in Eden and preInit?
I am confused you just need nearestTerrainObjects and it will give you all objects of type that you are searching for. Everything else you dont need.
And also you cant pass the _trigger as a paramater where the position is.
nearestTerrainObjects does lookup inside a circle of radius R.
What I need is to filter out only the objects inside a trigger. A trigger does not have to be a circle - it could be a square, rectangle, elipse etc.
You can filter what objects you are searching with this ["TREE", "ROCK", "what ever"]
I'm already filtering by object type, what I need to filter for is wether or not the object is inside a trigger
i mean this command will give you all of the objects that are in range its basicly the same as in side the trigger.
it is not, "distance to object < radius" is not the same as inside trigger. Not all triggers are circles with a radius
for example, let's say I need to remove trees ONLY within this rectangular trigger
I can not just use Radius because a rectangle does not have a radius x)
So what I'm doing is I'm using nearestTerrainObjects to get all objects in the circle that encapsulates the trigger.
And then I filter out all objects based on whether or not they're inside the rectangle.
I think you could also use marker area. And if you dont want to show them to players just make them invisible.
do they exist in preInit?
IDK myb.
aight I'll check, might just work, thx!
otherwise might have to resort to postInit ๐ฆ
Why do you think need you to use preInit? It doesn't make much difference in your circumstance. The mission doesn't load until all inits are done either way.
Also, use the inAreaArray command to filter the object list, it's much faster than checking inArea for each object individually.
I don't remember exactly where I read this but it had something to do with server flooding the network with commands if not done in preInit.
In my case I need to replace hundreds of trees with models of destroyed trees, and from what I understood if I do this at runtime it might be unreliable due to sheer amount of traffic
Also inAreaArray will come in handy, thanks!
_area = triggerArea _trigger;
_radius = if (_area select 3) then { // isRectangle
sqrt ((_area select 0) ^ 2 + (_area select 1) ^ 2)
} else { selectMax (_area select [0, 2]) };
_trees = (nearestTerrainObjects [_trigger, ["TREE"], _radius, false]) inAreaArray _trigger;
You're sending a shitload of network traffic either way, don't think it really matters when you do it.
If you wanted to avoid that, run the script on every client and use hideObject (local version) and local simple objects or createVehicleLocal
So long as your code doesn't include randomness, the results will be the same on every client with 0 network traffic.
smooth, thanks!
I'm already doing the local hideObject but the second part uses a lot of random for selecting classnames and positions of simpleObjects so I figured I'd have to flood the network ๐ Unless I want to use the seeded RNG but tbh I can't be bothered, just hoping it will work ๐
You could decide where to put the objects on the server, put the creation data (class, pos, direction) into a single big array and remoteExec (with a JIP argument) a single function every client which uses that data to create the objects
Or use a random method which isn't truly random
we're optimizing the network with this one ๐ฅ ๐ฅ
It will be more reliable
that would require ensuring the sequence of RNGs is the same on every client, could be done with the "random" synthax that accepts seed. But imo that's less convenient
So the first method is probably your best bet, transferring a single array as part of a remote function call is better than potentially thousands of individual network messages
Im doing exactly this already on one of my projects, seed your random
and you will get the same results for everyone in the session
each session the seed token changes and results in different rolls
For example, your seed could just be the _forEachIndex of the object creation loop.
yeah that could work
I think that would be more bug prone though, and I'm already getting a bit burned out with my current mission ๐ I'll probably go with a single array remotexec
why would it be bug prone?
A seed always warranties the same sequence in each session
the seed itself can always be the same number and will yield different sequences each session, what you gain with it is that you obtain the same sequence in X iteration in a random generation
unless im missing some context, this is a map cleaner right?
Yep, just make sure you always interate over the objects in the same order (and nearestTerrainObjects and inAreaArray are both already deterministic so you don't need to worry.), then use _forEachIndex as the random seed and it'll be the same on each client
Just don't modify the triggers during the mission and it'll stay deterministic
But for peace of mind the array remoteExec method isn't bad, so do whatever
well in a sense, it's a "no mans land" generator ๐
Maybe it's not as bug prone, but I'm just not feeling like making TOO drastic changes to my code at this point.
Debugging sqf is pain and if I mess up during the rng coding and will have to debug this code again I might just abandon the mission, I know myself.
remoteExec approach seems more straightforward so I'll preserve my mental resources ๐
not saying RNG approach is bad or anything, it's just me
well, if you are willing to take time from the mission startup do the array stuff then. Just be aware that desync can linger for up to 10 minutes after the code finishes spamming network
A single array transfer won't spam the network, that's the point of that
that's a good point about desync - I haven't worked yet with high netword demand scripts. Didn't know desync could last that long. Let's see how it turns out.
definitely hope so
this the end result btw, used to be forest
Fuck them trees
Arma has too little frontline battles and trench warfare for a war simulation game, Ima fix that
(hopefully)
a single big variable data type is no better that multiple smaller messages. Data transfer is not really a3 forte haha. Same with publicVariable iirc.
hopefully youll get a good result in the end
It is better though, with many commands sent over the network there's a chance you get desync in the form of missing objects, and also these objects will have updates sent over the network for the duration of the mission if they are created correctly.
A big array might desync the server whilst it is being sent, but it won't straight up miss parts of the array and also the local objects are better for performance long term.
now that I think about it, technically my whole generation of no mans land is one huge loop. I guess what I could do is add a RandomNumbersRequested = 0 variable and use it as seed for the RNG. I would increment this variable each time a new random number is requested. This way I'd get the same sequence of seeds for every client
seems like nearestTerrainObjects are ordered by proximity, so the order of elements should be identical among everyone
Yeah I've done that before
hmm did something change with LAN testing for multiplayer?
Arma wiki says:
Select the mods that the host will use (if any)
Launch the game using the Play/Play with Mods button
Select the mods that clients will use
Launch the game again using the Play/Play with Mods button
But when I click Play with Mods for the second time the first instance gets closed
yep that worked ๐คฆโโ๏ธ I've got to sleep more.
Thanks!
is there a command that outputs a unit vector tangent to an interpolated value from bezierInterpolation?
Anyone know why the diag_captureFrame set of commands dont work? I've tried it on profiling and dev and they just give an error saying theyre missing a semi-colon
how can i get which "add to inventory" functions can be applied to class?
Wiki helps here as always
https://community.bistudio.com/wiki/Category:Command_Group:_Unit_Inventory
No i mean, i need in script determine which commands can work fine with that classname
Guess you want that 
not exactly but thanks
You need to use the actual profiling exes. The default ones don't have profiling, even on the performance/profiling branch.
nope, you'll need some math there
Ah alright, thankyou
Does anyone know what archive this series of scripts live in? https://community.bistudio.com/wiki/Category:Command_Group:_Ropes_and_Sling_Loading
I've tried searching all over, but can't seem to find anything.
What do you mean?
Like, for example, BIS_fnc_weaponsEntityType (https://community.bistudio.com/wiki/BIS_fnc_weaponsEntityType) can be found inside Functions_F.pbo. I'm trying to figure out where the slingloading and rope functions are. The reason is because I want to create an alternate rope, and I wanted to study the fuctions to see if whether it can be done without serious changes.
Commands and functions are different
Commands are built into the game engine; their "contents" is internal to the game and you can't read it.
Ahh, okay. The reason I'm asking is because I saw this (https://community.bistudio.com/wiki/Arma_3:_Ropes) page, and was trying to figure out how to apply changes to those attributes without rewriting all the backend code.
I saw the "Class Rope" and all those attributes, and was hoping I could define a rope before using a command with it.
You can but it requires a config mod, because those are CfgVehicles and CfgNonAIVehicles config classes.
Yep, which was the plan. However, I also don't want to overwrite the existing rope because that would break the functionality for everything else. I'm not sure how to use, for example, "createRope", but using the specialty rope I was making specifically with that command, and not the standard rope.
Use the rope type parameter for ropeCreate
https://community.bistudio.com/wiki/ropeCreate Do you mean the "slingload0" and "RopeEnd" in the examples provided?
"RopeEnd" is one of things you'd need to change because that refers to the class of the rope end segment to be used. "slingload0" is a memory point on the source vehicle that they're using as the attachment point for the rope - you probably want to change that but it's not related to the rope type.
The rope type parameter is the 8th parameter in the main syntax [6th in alt syntax]. You can quickly find it in the list of parameters because it has the "since 2.06" indicator next to it. It doesn't appear in any of the examples, but it's really not hard to use - it's just a string that goes in the 8th [6th] position in the parameters array.
AHA! Okay! Got it! ๐ THANK YOU!
Going to give it a test. ๐
@hallow mortar Yep! That did the trick, thanks! ๐
Hi guys, so usually to make an animation "set" to synch I use a game logic, like for the animation "abuse".... so, at first they start synched BUT then they un-synch... why that?
I attach units to game logic using this : this attachTo [logic1, [0,0,0]];
question, I noticed that not super long ago some more Data Terminals were added to the game. Does anyone know if there is a script to move its "progress bar"?
It's an animation, so you can use animate or animateSource to adjust it, as well as to open or close the terminal. You can look in the object's config to find the names of its animation sources.
Note that for that object the animation state ranges are 0-100, not 0-1 as is common.
Thanks I will check!
Quick question is there a way to switch show/hide state from Show hide module via script ?
Heya just wanted to give a little update on what I ended up doing.
I found a way to spawn the objects without affecting network at all. I've ran my algorithm on the server and saved all the generated objects data into clipboard, then pasted it into a new SQF file which basically only contains this fat array. Since SQF files are part of the mission every client has the same version of this array and is able to generate identical set of objects.
I've tried the RNG approach yesterday and sadly was not able to make all clients generate identical objects, even though in code it seems like the seeds should be local and identical ๐ฆ
let me get home and i can check with you, ensure your seed is the same across clients
I've already got it working in a different way as I described above, but thank you!
yeah saw that. Nice
The Show/Hide module, like all modules, uses scripts to do its work. You can find these scripts in the Functions Viewer; the Show/Hide module uses BIS_fnc_moduleShowHide (in the ObjectModifiers category when using ADT).
Spoiler: it's just hideObjectGlobal and enableSimulationGlobal
just curious on how you were doing it. I've dont think ive ever encountered issues with seeded randomization not returning consistent results across clients
I have that version of the script in git, I can DM it to you if you want
How do I do a simple addition to a variable again...?
I used something along the lines of _variable setVariable ((namespace getVariable _variable) + 3)
sure
maybe i can give feedback for future reference
Anyone know what I did wrong or how to explain this
this is what i used
Stretcher_1 attachTo [UH60Med_1, [0, 1.5, -1.8]];
Stretcher_2 attachTo [UH60Med_1, [0, 2.5, -1.8]];
Stretcher_2 setDir 90;
Stretcher_2 setDir 90;
most likely you didnt do anything wrong and its a limitation of the model itself. the interior is not rendered as the exterior in most vehicles
Ok thank you
thats just the way arma works unfortunately
you're the first thing that's rendered, then its the interior of any vehicles, then everything else (afaik)
Yeah @deft zealot do vehicle player action ["gear",vehicle player] - it's a little weird but it works...
It just seems weird to consider when in all other (I think) situations you would think <unit> action ["gear",<target>] which works, but only when you get out of the vehicle you are in. In this case though we do <vehicle> action ["gear",<target>] as though the vehicle is a unit capable of opening its own inventory but heh
https://community.bistudio.com/wiki/enableChannel im trying to get this working, i just have no idea where to put it
Where you need to put it depends on when and for who you want it to take effect.
For all players, from mission start? Init.sqf, although there's also a description.ext config property you can use for that. At a certain time, for specific players? A trigger and remoteExec could be what you need, or maybe an event handler. There are many possible answers.
ill put it in init
Yeah, I get what you're saying and it's just a little unexpected to most people I guess
https://community.bistudio.com/wiki/weaponsTurret
theres a funcGetTurretsWeapons created by someone on this page, how do i get it working? where i do paste the func code, and so on?
Define in somewhere, then use it somewhere
but how do i define it somewhere?
init.sqf or Debug Console or some SQF script or... anywhere
There are two main ways to define a function:
- Save the function to a variable, using the
varname = { function code here };structure. This must be done in a place that runs before you want to use the function, and it must be done on all machines that will need to execute it, either by the code running on all machines or by one machine saving it and then usingpublicVariable.init.sqfwould be a common place to do this, but keep in mind the Initialisation Order (https://community.bistudio.com/wiki/Initialisation_Order) to make sure you don't try to use it too early. - Register the function in the Functions Library (https://community.bistudio.com/wiki/Arma_3:_Functions_Library). This means the function will definitely be available when you need it on all machines. In this case, the function lives in its own sqf file in the mission folder, and the game detects and prepares it for use based on the CfgFunctions definition.
Anyone here familiar with the Spectator? I want to hide AI units from the list on the left.
I can already hide them from 3D view with BIS_EGSpectator_showAiGroups = false;
But BIS_EGSpectator_allowAiSwitch = false; doesn't seem to hide them from the tree view.
https://community.bistudio.com/wiki/BIS_fnc_EGSpectator
allowAI parameter in the initialiser function
@hallow mortar Yeah, its a bit messy. The trick seems to be to not set the variables in mission namespace but in players namespace.
The init function then moves them to missionnamespace.
The documentation is a bit misleading here
Shocking
im adding a magazine and a weapon to a vehicle, however once it adds them, it has to reload the weapon, is there any way to load it immediatley or just shorten the time it takes for it to reload the magazine?
The classic way is to add the magazine first
Is there a way to convert map grids => 2d coordinates and vise-versa?
Do you mean 000-000 format vs position?
ye
Ooh I didnt know these functions existed! Thanks ๐ ๐๐ป
Hi. Can someone check, what is wrong with that code? Trying to check if player rifle have underbarrel GL, then find magazine for it in box. Something goes wrong (with _HE_compat_mags)
_unitRifle = primaryWeapon player;
_muzzles = getArray (configFile >> "CfgWeapons" >> _unitRifle >> "muzzles") - ["this", "safe"];
_gls = _muzzles select { getText (configFile >> "CfgWeapons" >> _unitRifle >> _x >> "cursorAim") == "gl" };
_gls_str = _gls select 0;
_compat_mags = compatibleMagazines [_unitRifle, _gls_str];
_HE_compat_mags = _compat_mags select {getNumber (configfile >> "CfgAmmo" >> _x >> "indirectHit") > 0};
_GLinbox = (magazineCargo cont1) arrayIntersect (_HE_compat_mags);
_GL = if ((count _GLinbox) > 0) then { selectrandom _GLinbox } else { "" };
Magazine classnames are from CfgMagazines, not CfgAmmo. So you have to do a double lookup.
After the muzzle lookup you should bail out if _gls is an empty array, but I assume you're testing with a unit with a GL at the moment.
Tell me please
if you add more than one โ_pos1โ to it, then systemChat โtestโ; duplicates
Tell me how to do it right
The task is: If the player enters a given radius, then execute the code, and not like mine, it is executed several times
{
private _player = _x;
private _pos1 = [
[[13848.4,18603.3,0],100],
[[13848.4,18603.3,0],100]
];
{
_x params ["_coordinate", "_radius"];
_pos = (getPos _player distance2D _coordinate < _radius);
if (_pos) then
{
systemChat "test";
etc...
};
} forEach _pos1;
} forEach allPlayers;
Well, if you put a break; after the systemChat then it'll only trigger once per player, regardless of how many regions that player is within.
Any ideas about this error I'm throwing? Previously, I had a string with the default value class name in there which worked fine. I've also attempted using str(_AmmoTypeMissile) but that caused the ammo to delete immediately upon firing. Attempted to debug using a hint str(_AmmoTypeMissile) but that did nothing.
Module config and function script attached.
_AmmoTypeMissile is not defined there
It is defined in the module with its default value, and in my get-line, I also set the default value as a backup.
do I need to pass it as a param?
It clearly is not. The Fired EH does not recognize it
Here is the module as placed in 3DEN, showing the default values set for the Missile and Shell types in their combo boxes.
Still. It is not defined within the EH
So does that need I need to pass it as a param? If so, do I just tack , "_AmmoTypeMissile and , "_AmmoTypeShell" to the end of the eventhandler-specific params in the params line?
addEventHandler does not support external arguments to pass
You can somehow setVariable getVariable
That doesn't seem to explain it. The stretchers should still be in front of the heli and be drawn
What if you don't attach them? (for testing purposes)
That won't alter the render queue
Anyone know how to work with a config entry type variable within the console or between string conversions?
Don't convert it to a string except for logging.
I need to be able to paste it into a editbox, which forces it as a string
Then you have to use the SQF syntax form, configFile >> "CfgVehicles" etc.
Is there any way to convert that from a string back into text that sqf will recognize?
maybe. I haven't examined the output syntax.
Alright, I'll look into, thanks for the suggestion
call compile seems like it can do it
Oh, you mean SQF text -> code, yeah.
@spiral trench thanks
I'm interested in finding out if anyone has developed a mod or script that automates the process of managing class names from mods in Arma 3, specifically for use with ACE Arsenal.
Let's say that i have the mods installed, is there maybe a way to run a .py file or even an .sqf file that would look inside these files and scan for classnames that i can put into the limited arsenal?
Maybe even a script that skips that whole process and just finds everything like the little "^" arrow icon next to the searchbar in eden where you can filter by mod.
Wouldn't be suprised if someone has already made such a thing since it's a struggle to make limited arsenals with big gear/weapon mods. Any help would be appreciated.
Your request is too vague. Everything can be pulled from config to only return needed classes by any conditions you can come up with, the rest is up to you to figure out what you need exactly.
That's not what i asked/requested. I asked if somebody already made a script/mod that does this. I know how to make it, i'm just asking if somebody has already done this.
It would be a waste of time if i spent time on this, cause it's something that 50% of the "bigger" units already have.
No, this is normal. In first-person, the model of the vehicle you're in is rendered in front of everything else (except your own body). It's always been an annoyance when attaching stuff to vehicles.
How do I make an Antistasi-like text bar on the top that displays certain text values like variables?
I want it to work on each client on a dedicated server
init.sqf:
waitUntil {!isNull findDisplay 46};
private _bar = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
_bar ctrlSetPosition [SafeZoneXAbs, SafeZoneY, SafeZoneWAbs, ctrlFontHeight _bar];
_bar ctrlCommit 0;
_bar ctrlSetBackgroundColor [0,0,0,0.1];
_bar ctrlSetStructuredText parseText "<t align='center'>My cool bar with some text</t>";
uiNamespace setVariable ["myCoolBar", _bar];
Get it with uiNamespace getVariable "myCoolBar" to change it later
Hey folks, again a question to which the answer is maybe hidden in the config but I can't for the love of god find it.
There is a function: inRangeOfArtillery but I would like to get the max range of the Artillery (If I am lucky even in meters?).
Is there a way to get it? Or can I somehow calculate it?
I think it checks if shell will physically reach the position
I'm sure there is a formula to get max range of a shell somewhere here
But you could also just brute force it and cache the result
it happens for ViV objects as well
if thats something that is fixable i can ticket it ๐คท
Yeah, I see. I was looking for that formula but couldn't find it. There must be some way to get it, because Artillery Computers throw a Max Range at you.
Okay, I will search a bit more, maybe I get lucky. Thanks man
is there a way to make a players weapon into a static? or some way to integrate the idea of the dead man drill for 240 gunners? mostly just looking for a cleaner way than dzn tripods to have mg tripods that also allow the unit to use the weapon without the silly looking tripod on all the time
Arma does not calculate air resistance for shells, so I think you can use a projectile parabola formula r=(vยฒsin(2theta))/g where r is horizontal flat range, v is muzzle velocity, theta is angle to the horizon and g is gravity.
You can get muzzle velocity onfrom the weapon and ammo config, and the the longest range parabola will be 45 degrees to the horizon.
Oh that is neat. Thank you very much.
huh? Only bullets and missiles then?
Yes
Yeah it gets ignored for some things
https://community.bistudio.com/wiki/CfgAmmo_Config_Reference#airFriction
Muzzle velocity is obtained from the magazine config
iirc it's called initSpeed
iirc artilelry has some meme way of redefining muzzle velocity for different charges 
Ah yeah I think it used the muzzle config
it's just a multiplier ie. artilleryCharge of 0.5 is 50% of initspeed
im not sure why airfriction is disabled for it as I think AI are capable of accounting for it when aiming but shrug
In a vacuum, it's a single formula to determine correct firing angle. With air resistance you have to simulate a path to find the correct solution
true
i mean, then you add an artillery piece that shoots, say, 25 km. And then you add an air height/density gradient
and then you add another half dozen or so effects into that
Because it's simpler, and there's no closed form solution for quadratic drag motion
So you either use numerical approximation or an approximate equation (which are typically valid for very specific ranges of parameters)
to clarify - airfriction works for shotShell it's the artilleryLock parameter that disables airfriction
or forward observers ๐คฃ
Hey man, thanks so much for the formular.
I am making progress but I can't quite get the exact value of the MK 6 Mortar with the formular compared to Arma Wiki.
With all the values gathered, the formula should look like this:
Is that right? Or is Gravity in Arma somehow different?
sin(90) 
oh, wait, that's 1
RIP my trig knowledge
yeah, 200*200*1/9.81 seems to match what i've found in some random video 
That's right. The answer also matches the table on the wiki, max range of 4070m
Ah okay, thanks for the help guys.
can anyone tell me why my code isn't preserving the vertical axis offset?
this setPos [getPos ball select 0, getPos ball select 1, getPos ball select 2];
[this, ball] call BIS_fnc_attachToRelative;
First of all, rather than selecting each axis of the position individually, just use the whole position in one, e.g. this setPos getPos ball;
Selecting each axis is unnecessary and means you're using six commands, 3 variable retrievals and an array creation when 1 command and 1 variable retrieval will do.
thx i was having trouble with syntax when i tried that
Secondly, don't actually use setPos and getPos. They're slow and they do NOT use the same position format as each other. Use set/getPosASL or set/getPosATL. They're faster, and each pair uses the same position format as each other.
would that matter if they were on the same x and y position? they should have the same surface height no?