#arma3_scripting
1 messages Β· Page 219 of 1
*fires them railguns at @daring moss* Γ_Γ
Pew pew
hey! im an absolute beginner to scripting and am wondering if anybody knows how to get a template of text to remain on an ace notepad style item when it is spawned
create dummy items with unique "classnames", since you cant save data to items (if we talk about inventory items).
then write the script & create GUI to connect items and text
Alot to learn for a newby.
- Need to learn how to make your own mod & config to be able to create the items needed for it (notepad items with unique classnames).
- Need to learn scripting itself
- And also need to learn how to make the UI's (finicky/janky).
Depending on how fast you can learn and how good you can read, it will take you hundreds of hours.
in my use case, im intending for it to be used in correlation with a passport mod.
!code
Please use !sqf from now on (!enforcescript soonβ’)
im having issues with setVariable getVariable, i know setVariable Fires but the getVariable is unset, ive tested and im 100% sure that the code would work if the IF statement comes back true
im testing in SP only atm, any tips
myaction = ['Hook Up','Hook Up','',{
_unit setVariable ['ffr_static_line_hooked', true, true]; hint "Hooked up";
},{true;}] call ace_interact_menu_fnc_createAction;
[_unit, 1, ["ACE_SelfActions"], myaction] call ace_interact_menu_fnc_addActionToObject;
if (_unit getVariable ["ffr_static_line_hooked", false]) then {
hint "Deploying chute";
_unit action ["OpenParachute", _unit];
};
appolagies
And for the code you need use params,
See https://ace3.acemod.org/wiki/framework/interactionmenu-framework#31-fnc_createaction
You can use in action _statementent
params ["_target", "_player", "_params"];
diag_log format ["_statement [%1, %2, %3]", _target, _player, _params];
ah legend
Hey there, I wonder why the first time a player joins the server, the unit it controls is created by the server (ID: 2) but when it dies and respawns, the unit that it controls is created by the client (ID: clientOwner). Why is it like that??
"Why" doesn't feel like a useful question with A3. It's weird and you deal with it.
Shit, gotta get used to that mindset
Maybe because client didn't load yet, so server creates his unit for him? And later he creates units himself, since his unit would be local anyway
If you're ever dealing with AI it's more like "Why god whyyyyy"
Yes thatβs reasonable
I am just serversiding everything now, and I just wonder why certain things are like they are, well, Arma claims to be client-focused
are you checking this at init, or are you waiting for transfer to occur first? you should wait a few frames and see if its still the case
netIds are persistent, aren't they? They don't change with object locality.
If that's in relation to the previous stuff and not an unrelated question, I think they were talking about the owner's machine ID, not the object netID
They specifically said which machine created the object. Ownership does indeed change later, but that's not the point they were making.
Is there a command that can open a utility drones box? Just like when it drops the leaflets
Yeah I check it on the debug console, after having taken over the player unit and having full control of it
Just double checking tho youre looking at the actual owner or the netid? Cuz Its normal behaviour if its the net id youre looking at
NetId yeah
Which is made of creator and id
Exactly so as others have said the player unit is first made on the server and then ownership is transfered, netid itself doesnt change between transfers
the game uses the netid as a small string of data to identify objects - which is likely how theyre referenced internally when for example you feed an object into a network message
If it would change the reference would keep getting invalidated and youd end up with a right mess
hello,
I want to catch the info when there is no player still connected on a dedicated server (persistent=off)
I used different EH (HandleDisconnect/PlayerDisconnected) to have the input, I even make a test with a while true loop.
but I can't detect in every case!
when the player disconnect normally (proper logoff), everything works fine, but,
if he loose his connection, like when it's logged:
"15:48:04 Player toto is losing connection"
no event are send (and it's logic) to the server.
so how did you detect when the last player leave the game in a way that it support brutal disconnection ?
thanks
https://community.bistudio.com/wiki/allPlayers is one option. idk however when that gets updated
that what I'll check in the while loop, but bc the server is stopping this code is never executed (even with a sleep 0.1)
I use
count (allPlayers select {!(_x isKindOf "HeadlessClient_F")}) to count the players
but this code seems to be never reached (diag_log) when a user lose his connection.
it's almost work when he logoff properly
I said 'almost' bc in shutdown, timing is critical and even a sleep 0.1 could make the code not executed
ok have you tried ```sqf
addMissionEventHandler ["PlayerDisconnected",
{
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
if(_name == "SERVER") then // Called after all players ends game
{
};
}];
yes, but event are send by the client π
and if the client crash no events are sent
the typical rpt for a brutal disconnect look like:
15:47:01 "Civilian vehicle CUP_C_Volha_Blue_TKCIV incident 20 at 1987.42" 15:48:04 Player toto is losing connection 15:48:09 NetServer: cannot find channel #1084154869, users.card=0 15:48:09 Message not sent - error 0, message ID = ffffffff, to 1084154869 (hipley) 15:48:09 Player toto disconnected. 15:48:09 All users disconnected, waiting for users.
I want to catch this moment on server side
wiki says https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#PlayerDisconnected is server so idk then
in this case there is a while loop to count player and two EH (xxDisconect)
is executed on server, but the evnt come from the client
sadly !
oh
even LLM seems not to have any good info !
On SQF? Indeed they don't
yeah don't try πΉ they're not "well trained"
when you search for a very specific info, and you know pretty well your subject, you realize the LLM bullshit !
gpt can provide sqf code, and know a little about arma's internal, not so bad
The only times llms are useful for sqf is when youre too dumb to do complex math or vector calc π speaking from experience at least its good (sometimes) for churning that out π€·
I agree, I also use them for string tables
anyway, I leave this bottle to the sea, if someone know how to execute code on server (not persistent), when the last user disconnect in a reliable manner, please drop me a message!
I havent read your initial thing but - you wanna do stuff after the server becomes empty post-being filled by players previously?
Why not just check allUsers?
already proposed, in short bc it's come too late, and EH are send by the client
Hm... how late is too late?
I'll already try the "while loop" and the xxDisconect eventhandler
HandleDisconnect should still trigger on connection loss, at least it did for ExileMod.
don't think persistence param only would cause that change?
yeah but i think the timing is the issue here, or at least it not happening at the actual connectin loss - disconnect timeout can take up to a minute (depending on server settings i think)
something like:
while {true} do { sleep 0.1; _current_uid = count (allPlayers select {!(_x isKindOf "HeadlessClient_F")}); if (_current_uid == 0 ) exitWith { diag_log "--- Mission End ---";
don't work whena player lost his connection, it work (and the EH too), when the player logoff properly
the typical rpt for a brutal disconnect look like:
15:47:01 "Civilian vehicle CUP_C_Volha_Blue_TKCIV incident 20 at 1987.42" 15:48:04 Player toto is losing connection 15:48:09 NetServer: cannot find channel #1084154869, users.card=0 15:48:09 Message not sent - error 0, message ID = ffffffff, to 1084154869 (hipley) 15:48:09 Player toto disconnected. 15:48:09 All users disconnected, waiting for users.
I want to catch this moment on server side
the EH and the while loop have the same diag_log
and you see, nothing happen
i mean handledisconnect will eventually trigger; it might not be immediate but does it really matter that the server do stuff precisely at the moment of the last disconnect?
nope, I really studied this point, the EH is executed on server only, BUT send by the client
oh
that all my distress π
Yes it definitely is, checked it myself but I was just curious about why its like that
the log I paste come from real working server with diag_log in these EH
@tender inlet dedi or hosted by you?
dedi
It waffles so hard the minute you ask it do anything not basic usually
i mean i can think of at least one jank as hell solution to this but it's neither good practice nor is it very performance friendly
(have a callback heartbeat that the server does every few seconds that demands a response from the client which validates its presence)
this is a code line from Liberation, and it works just fine:
addMissionEventHandler ["HandleDisconnect", {
if !(allPlayers isEqualTo []) exitWith {false};
params ["_unit"];
deleteVehicle _unit;
["Last player disconnected. Saving mission data.", "SAVE"] call KPLIB_fnc_log;
[] call KPLIB_fnc_doSave;
}];
well according to him handleDisconnect doesnt trigger if the disconnect is actual connection loss or a crash (the event is sent by client on graceful disconnect)
not when the player lost his connection, I'm the LRX dev, I know this code very,very well, I totally rewrite it π
hmm
interesting
yeah very interesting, i just realized i have to rethink how im gonna fix my function to recover players' loadout and position when they disconnect due to a crash lmao
since im also using handledisconnect for that
yes, the only way is to not trust EH, use a while loop (and count player) BUT you must have the server persistent
why would the event to handle a disconnect even be reliant on the disconnecting client sending it 
bc in the shutdown time, all scripts are stopped, and you don't have time to do much
just use the persistence parameter, problem solved π€·ββοΈ
that how it works ....
in a CTI (ie Liberation) that make the enemy continue to attack
make a freeze manager for the AI
tbf imo you shouldnt be relying on scheduled scripts for crucial systems like that but that's beside the point i guess
yeah idk π€· again maybe a connection heartbeat, i guess sending 4 bytes of data over network at frequent intervals isn't the end of the world
that why I'm looking for an even server side to do the saving job
but it seems there no such handler
anyway thanks for the help π«‘
Nah I'm pretty sure it's supposed to work. If it doesn't then it's a bug.
We did have some complaints about the server not detecting HC crashes, but I couldn't replicate that.
I readit in some pages from the old forum, and real test tend to confirm.
the EH is declared and executed on the server only, but the event itself come from the client, at least for PlayerDisconnected and HandleDisconnect
I put a diag_log in each, and nothing pop when a user lost his co, works otherwise
I like to use it when I can't come up with a good function name myself π€£
Just tested, both handlers fired here. Used process suspend to simulate client death.
maybe a false positive, I have similar case when I test it.
you must have something like in the server log
15:48:04 Player toto is losing connection 15:48:09 NetServer: cannot find channel #1084154869, users.card=0 15:48:09 Message not sent - error 0, message ID = ffffffff, to 1084154869 (toto) 15:48:09 Player toto disconnected. 15:48:09 All users disconnected, waiting for users.
it seems that after the log of "Player toto is losing connection", the engine is suspended
only when it happen EH won't fire
my EH look like
addMissionEventHandler ['HandleDisconnect', { params ["_unit", "_id", "_uid", "_name"]; diag_log format ["--- player %1 (%2) disconnected...", _name, _uid]; if (_name select [0,3] in ["HC1","HC2","HC3"]) exitWith {
Is this a linux server? Because that looks like a mixed RPT/console log.
Normally "player XXX is losing connection" is console.log but the netserver/message lines are RPT.
yes linux dedi
hmm, maybe another Linux-specific bug then.
we poor linuxian, have only server.log π
you have stdout and stderr :P
hehe, oldies goldies
I don't have any windows server, if some one can test, but it need a dedi and a real client failure
it's annoying when he's the last user, bc I can't start the save script at time
if he loose his co during the session, it's not a trouble, the game save him by itself, but when he's the last...
no EH code execution, scripts force close, even a while loop with a sleep 0.1 is too much
Suspended client does generate all those messages. The difference here is that it also fires the event handlers.
idk, I think in the actual workflow, the disconnect event is sent by the client (even in windows)
hah, I unsuspended it and the client doesn't know that it's disconnected.
Surprised it works at all.
in such case, the client should display a red warning text "no message from server " and a countdown
Yeah, that's what it did.
if you have the right log in server.rpt, it (somehow) send the EH
did you reach the
15:48:09 Player toto disconnected.
message ?
yeah, console log was:
17:39:57 Player DevJohn2 is losing connection
17:40:02 Player DevJohn2 disconnected.
and the EH fire ?
Everything else is RPT log, and starts at 17:40:02
strange, in my setup (linux dedi) when a client lost his connection there is no log in the server log,
the EH is the same for all players, only won't fire in this case
the EH have a diag_log at first line
what EH did you use ? HandleDisconnect ?
Both but I did actually screw up and only logged HandleDisconnect not PlayerDisconnected. Rechecking.
take care with PlayerDisconnected, it's a mess (look on wiki)
we were already using it. Just wasn't logged.
HandleDisconnect shouldbe the right one, make it satrt wit a diag_log, likle:
addMissionEventHandler ['HandleDisconnect', { params ["_unit", "_id", "_uid", "_name"]; diag_log format ["--- player %1 (%2) disconnected...", _name, _uid]; ....
if it's work is a linux server issue
yeah it's fine:
2026/01/07, 18:22:46 NetServer: cannot find channel #417616, users.card=0
2026/01/07, 18:22:46 Message not sent - error 0, message ID = ffffffff, to 417616 (DevJohn2)
2026/01/07, 18:22:46 2026-01-07 18:22:46:254 | Antistasi | Trace | File: HR_GRG_fnc_removeUser | Removing user: 4
2026/01/07, 18:22:46 2026-01-07 18:22:46:254 | Antistasi | Info | File: fn_initServer.sqf | Client ID 4 disconnected (PlayerDisconnected)
2026/01/07, 18:22:46 2026-01-07 18:22:46:254 | Antistasi | Info | File: A3A_fnc_onHeadlessClientDisconnect | Client ID 4 disconnected (HandleDisconnect)
damn!
text "2026-01-07 18:22:46:254 | Antistasi | Trace | File: HR_GRG_fnc_removeUser", come from code executed in HandleDisconnect ?
nah, that one's a PlayerDisconnected. Separate code.
ok, I can re test this one, server is not persistent ?
persistent=1 if that's what you mean.
and DevJohn2 was the last player ?
First and last, yeah.
ok, so is persistent, ie: it continue to run whenever there is player or not
yes, when it's brutal
would be degenerate behaviour but within the range for Arma :P
Were you running persistent 0 or 1?
0 cause I run CTI, and if I leave it persistent the fight continue
and I want to save the game state on last player, and I also want it work when the player lost brutally his co, I'm obstinate π
I'll recheck with 0, might be interesting.
thanks for your time buddy!
on my side, I'll re test both EH with minimal code, more diag log, and restart le linux dedi
Ok, with 0, playerDisconnected fired but handleDisconnect didn't.
I choose the wrong ones ?!
that's a very good news to me !
I'll update the code to use playerDisconnected instead
thank you very much
I have to go, I'll update the server code, and I'll come back to report ! π
Do you guys know what relative paths are supported by fileExists and loadFile or where I could find a list?
Ah I am guessing by this comment on loadFile that it's strictly mission path unless file patching is enabled:
Notice that you will have to activate file patching via -filePatching. Otherwise execVM and loadFile will not load any files outside your mission folder (like the global scripts).
with filepatching you can load files from arma installation folder
"strictly mission path" isn't really accurate though. You should be able to access anything that's in Arma's virtual file system, like the contents of any PBOs loaded.
You can #include files from outside of misssion folder, but I dunno if you need filePatching for that
He's alive!
And the "crews" are replaced by the true unit, join the player group
So, I'm very stupid. I was curious if it was possible to add an action in the scroll wheel of every player for a mission in a dedicated server, IE putting something in the player's init field that adds an action they can use at any time.
The specific thing that I wanted to do was to have an option that disables their damage for a set period of time before enabling it again, a temporary invincibility that also removes the actions after it ends. Is there a good place to start in terms of commands to look into or something else?
addAction
To be exact, the condition can have a variable to limit people to use it. Such like, theAbilityIsUsed variable being true forbids player to use it again
I'm sharing the code with you, if you want to use it in your missions or to try it out
https://github.com/Nixx57/Arma3-random-script-libs/blob/main/scripts/fn_enhancedGarage.sqf
It works like the classic Virtual Garage, which I believe allows you to define a limited list of vehicles.
usage example: this addaction ["Virtual Garage", {[("MARKERNAME"), _this select 1] call "scripts/fn_enhancedGarage.sqf";}];
I haven't tested it in multiplayer, but I think it should work.
call <string> doesn't work. Gotta use call compileScript..
I am looking for something to detect when inventories are invalid somehow.
I have an external tool which parses and modifies mission.sqm files directly, the main modification is the injection of inventories/cargos definitions.
My issue is that I don't manage the size of inventory items/available room into backpack and so on. So imagine the tool injects 25x mags in a vest. In-game, you open the inventory and the vest is full.... but 25x mags are available.
My question is how to detect such issues. It can be some scripts to run on mission to validate them before playing them.
Any idea folks?
Never looked into this, but in theory. In config each cargo should have defined it's capacity and each item it's size
also maybe using https://community.bistudio.com/wiki/loadUniform etc to check if > 1
IDK if it can return > 1, but worth a shot
Thanks, it can help and spot the loadouts with issues π
also backpackSpaceFor
load{Backpack|vest|uniform} are what I am looking for I guess.
maxLoad
all these combined!
Is there any command for item size?
I don't understand the question?
Ya, because I just can spot a unit with an offending backpack/vest/uniform, then, I don't need to dig into each item etc.... because in the end I will need a human to analyse the issue, and decide to remove/relocate some item.s
It cannot be automated.
How do I make players immune to specific/scripted explosions but vulnerable to other explosions? Like I want the players to be immune to scripted artillery landing next to them but still vulnerable to other grenades etc. Turning off damage might work but what if on the rare chances that both explodes at the same time during this invulnerability?
You could probably use https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
I was thinking about that as well, but unsure what the source or projectile values would be
source: Object - the source unit that caused the damage
projectile: String - classname of the projectile that caused inflicted the damage
Yea the projecticle for an artillery could be many 
should probably do a quick lookup - will try thanks tho
You want a player to be immune to all artillery?
no just the ones i fire with scripts
which could be therotically any
think of it like a cod cinematic style artillery barrage
Why wouldn't you know what you're spawning?
probably because it can be used by other players as well including those with/without any special artillery mods
If source the projectile object, then you could setVariable on it and then check and see if it has the variable you set on it.
use configAmmo for that
hey guys, I'm having an issue where remoteExecCall works on a local server (and on remote clients) but not on a dedicated server with no logs to trace what might be happening. The call originates from code executed on the server so it shouldnt be a CfgRemoteExec problem. any ideas on what might be happening?
Params? please copy/paste the exact script here...
its a little large, would it be alright to psot the gitlab repo?
sure, share a link to the exact line
the function get called from initServer.sqf, is it possible because the mission is loaded prior to the player joining PB_STAGING_VEC is possibly null on the client?
looks like a JIP issue
really you think so? the calls on the JIP queue I thought that would fix it
unless im misunderstanding how the queue works
The order of persistent remote execution for JIP players is not guaranteed, i.e. the order in which multiple calls are added is not necessarily the order they will be executed for joining player.
Do you count only on the order to get the var content populated?
I do, that would probably explain it
ya, you need something more transactional...
based on waitUntil { !isNil "myVar" };
so you ensure that the client knows your var before using it
and put some logs for testing purpose.
actually now that you mention that, it is wrapped in a waitUntilAndExecute (CBA function) my condition might be busted
because its trying to compare nil to 0, the var isnt initted on the client until the action is transmitted
can't help.
yeah thats on me I'll test it, thanks for your help though man
hope you find your way π
My trick, when I don't know the status of my VAR, and we have so many at some point, is waitUntil { sleep 1; systemChat 'myVar is nil'; !isNil "myVar" }; right before using it.
I am currently doing it to understand the diff between my local tests and the mission on my dedicated π
honestly thats a shout, I'm learning the hard way why thats necessary lmao. I wish I could use the native functions but scheduled code has caused me alot of headaches so I'm trying to stay out of it as much as possible lol
The order for JIP invocations is as the queue is. But obviously any use of remoteExec with non-commands might be executed out-of-order by the scheduler.
I am creating a scenario where explosives detectors are used to find items.
Is there a way to place "dummy" explosives that do not go off? Ideally invisible as well.
Hmm, enableSimulatio false on the explosive maybe?
I am an idoit
Training mine set to invisible.
How does one disable to "red triangle" detection ?
That's controlled by the difficulty settings
Does https://community.bistudio.com/wiki/disableMapIndicators reliably override client difficulty settings when executed on init?
It shouldn't matter when you use it. After you run the command, they'll all stop rendering.
Keep in mind that command is for the map markers, not the 3D markers
Most difficulty options can't be changed through scripting, and only Tactical Ping can be changed through description.ext
It doesn't seem to set invisible markers of mines that I myself have detected. Which seems realistic.
So...anyone know why Arma 3 has a function for translating numbers into roman numerals?
Yes, to translate numbers
Better question of... why not?
is it possible to get some sort of type of objects that dont have typeof string? i was thinking of maybe using the .p3d name but that needs to be parsed from string
P3d is probably the best way.
ok is the object id always same length? like 385642: limestone_01_02_lc_f.p3d i mean that number
so i can just use select
I don't think so
hmm
Does targetsQuery work reliably for players?
I wanna capture some data one of which being which enemies players saw etc...
But running checkvisibility against each player against each enemy is expensive
well the examples which i just noticed use player so i'll assume yes π
dunno but theres also https://community.bistudio.com/wiki/knowsAbout
How can I make an object invisible (like an invisible wall) that ai and the player cannot go through
Why not trim ("385642: limestone_01_02_lc_f.p3d" splitString ".:" param [1,""]) // "limestone_01_02_lc_f"
there is an invisible wall object
i thought find with select would be faster but idk. thx for the code, will try it
it seems my code is little bit faster
friendly reminder to occassionaly back up your profile .vars file
mine got wiped after testing some random mods 
(not even sure how that happens but oh well)
could someone explain why the commented out line of code within NewDog returns objNull for the Vehicle?
DogClass = compileFinal createHashMapObject [[
// Properties
["#type", "Dog"],
["owner", objNull],
["legs", 4],
["health", 100],
["vehicleClass", "Alsatian_Sandblack_F"],
["vehicle", objNull],
// Constructor
["#create", {
params [["_owner", objNull], ["_vehicle", objNull]];
hint format ["Owner: %1, Vehicle: %2", _owner, _vehicle];
if ([_owner, _vehicle] findIf { isNull _x } != -1) exitWith {};
_self set ["owner", _owner];
_self set ["vehicle", _vehicle];
}]
]];
NewDog = createHashMapObject [
[["#base", DogClass]],
// [player, createVehicle [(DogClass get "vehicleClass"), [0,0,0], [], 0, "NONE"]]
[player, createVehicle ["Alsatian_Sandblack_F", [0,0,0], [], 0, "NONE"]]
];
You are not setting the vehicle class in the constructor maybe?
Not sure if that is required. Haven't used these yet
I figured it out, it was still using a non-existing class due to the hashMapObject being in-memory. It was still using Base_Dog_F instead of an actual Arma 3 dog class.
15 setFog 0.5;
Is the time delay in seconds or minutes
It says seconds on the wiki but for some reason its taking much longer than a few seconds for it to change
Seconds
can you change side of units during runtime?
i.e when I spawn a group thats config'd as blufor, can i turn them into opfor and how would i do that?
you create a new group with createGroup using a different side as a param, then you use join or joinSilent with your units to move them to that group, thus changing their side.
i had an issue where i was getting object not found
doing that
well post what you had
kk 1 moment
// Infantry - try group configs first, fallback to East_Units
case (_groupType isEqualTo "infantry"): {
// Try group configs if available and valid
if (_groupCfg isEqualType [] && {count _groupCfg > 0}) then {
private _selectedCfg = selectRandom _groupCfg;
if (isClass _selectedCfg) then {
_realGroup = [_position, _side, _selectedCfg] call BIS_fnc_spawnGroup;
};
};
// Fallback to East_Units if no group spawned
if (isNull _realGroup || {count units _realGroup == 0}) then {
if (!isNull _realGroup) then { deleteGroup _realGroup; };
_realGroup = createGroup [_side, true];
private _tempGroup = createGroup [_side, true];
private _spawnCount = if (_unitCount > 0) then { _unitCount } else { 6 };
for "_i" from 1 to _spawnCount do {
private _unitType = selectRandom East_Units;
private _spawnPos = [_position, 5, 20, 1, 0, 0.5, 0] call BIS_fnc_findSafePos;
_tempGroup createUnit [_unitType, _spawnPos, [], 0, "NONE"];
};
{ [_x] joinSilent _realGroup; } forEach units _tempGroup;
deleteGroup _tempGroup;
};
};```
and this is what i had for
// Vehicle groups
case (_groupType in ["motorized", "mechanized", "armor"]): {
_realGroup = createGroup [_side, true];
for "_i" from 1 to _unitCount do {
private _vehicleType = "";
// Select appropriate vehicle type
switch (_groupType) do {
case "motorized": { _vehicleType = selectRandom East_Ground_Vehicles_Light; };
case "mechanized": { _vehicleType = selectRandom East_Ground_Vehicles_Light; };
case "armor": { _vehicleType = selectRandom East_Ground_Vehicles_Heavy; };
default { _vehicleType = selectRandom East_Ground_Vehicles_Light; };
};
// Find safe position for vehicle with larger radius and vehicle-appropriate spacing
private _minDist = 10 + (20 * _i);
private _spawnPos = [_position, _minDist, 150, 10, 0, 0.2, 0] call BIS_fnc_findSafePos;
// Fallback if BIS_fnc_findSafePos returns the center position (failure)
if (_spawnPos distance2D _position > 200) then {
_spawnPos = _position getPos [_minDist, random 360];
_spawnPos set [2, 0];
};
// Create vehicle and crew
private _veh = [_spawnPos, random 360, _vehicleType, _side] call BIS_fnc_spawnVehicle;
private _vehicle = _veh select 0;
private _crew = _veh select 1;
private _vehGroup = _veh select 2;
// Ensure vehicle is grounded properly
_vehicle setPos [getPos _vehicle select 0, getPos _vehicle select 1, 0];
_vehicle setVectorUp [0,0,1];
// Transfer crew to our group and delete empty group
{
[_x] joinSilent _realGroup;
} forEach units _vehGroup;
deleteGroup _vehGroup;
};
};```
vics
:P
have you done any debug logging yet?
4 wut
ohh yeah i have i misread your sentence
ill retried doing the joinSilent etc and see if i can recreate it again tb
and do you have the full error message? is it a script error message? or one of those pop up boxes for config errors?
no its an engine error for object not found (type 112 message) but i will try to replicate it rq
Object not found messages are not necessarily a problem.
hm cant they cause performance issues?
Only the devs know.
Note that when you remove all of a group's units with join commands, it's supposed to delete the group anyway.
even if it's not flagged to delete when empty.
So it's possible that your deleteGroup is just referencing a group that's already deleted.
Likely harmless but the sort of thing that the engine might bitch about.
i tried doing it, i was doing it a long time ago but doesnt work for me
idk why
bleh just people will have to pick real opfor factions
It works. What doesn't work is creating the units within a group of a different side.
If you do that they all shoot each other.
yeah i have another problem where it does work but since its a new group it disconnected from my virtualization system as my virtualization system tracks the groups via ids and a new group just cooks it

maybe some dumb question but ... can I spawn (BIS_fnc_spawnVehicle) enemy UAVs as vehicles? I mean with AI already in them?
yea you just need to crew it with CreateVehicleCrew:
https://community.bistudio.com/wiki/createVehicleCrew
Hi folks, I'm looking for two very specific things and unable to find them as of yet. For context, this is for a sci-fi unit and I'm trying to turn our "ship" (currently just a composition we hide at the corner of a map) into an actual, physical object. All of the building is fine, but I run into two problems.
-
Free-fall animation + sound
Obviously, at a certain height you go into the freefall animation and it actually generates a sound from your character. How can I disable this? -
High-altitude wind sound
There is an ambient wind sound when you're at high altitude. I'd be having to place the ship somewhere between 3-5km into the air, and in current testing the wind sound is super irritating and can make briefings and even general chatter difficult to follow. Is there a way I can disable this specific sound, or perhaps a script I can put on a trigger at the spawn location to disable ambient noise, then attach another at the exit point of the ship to re-enable it?
@marble plume just drop this in initPlayerLocal.sqf
sleep 0.1;
enableEnvironment [true, true, 0.5];
last number is the wind sounds force in high altitude like mountains
1 = max, 0 = no sound
does anyone knows how to integrate AWS weapons system to a helicopter?
is it possible from mission config?
https://docs.google.com/document/d/1Jb8sj8uX4f-vQSKJlr55ckJq6AQ6ZM3LZLe9w4ACM40/edit?tab=t.0
FIR Air Weapon System(AWS) Integration manual for addon maker by Firewill New Version : 2019OCTV2 Table of contents 1. Basic Integration 2. I-TGT Integration 3. ECM Integration 4. AMS-Lite Integration 5. Example config Basic Integration after AWS 1.98 βJoint Assaultβ update, many thing...
Can someone provide a ready-made or corrected description.ext for a campaign?
Because for some reason, in this description.ext, the paths to the images do not work correctly.
description.ext:
`class Campaign
{
// Campaign parameters
name = "Dark night"; // For older Arma versions
briefingName = "Dark night"; // For Arma 3 UI
firstBattle = Missions;
enableHub = 1;
overviewPicture = "YearSP\imj\Night.jpg";
overviewText = "Crash site";
cutscene = "";
class MissionDefault
{
lives = -1;
lost = "";
end1 = "";
};
class Missions
{
name = "The survivor in the middle of the forest";
firstMission = M1O;
end1 = "";
lost = "";
class M1O: MissionDefault
{
loadScreen = "YearSP\imj\M1.jpg";
overviewPicture = "YearSP\imj\M1.jpg";
template = M1O.Altis;
end1 = M2Op;
lost = M1O;
};
class M2Op: MissionDefault
{
loadScreen = "YearSP\imj\M2.jpg";
overviewPicture = "YearSP\imj\M2.jpg";
template = M2Op.Altis;
end1 = M3O;
lost = M2Op;
};
class M3O: MissionDefault
{
loadScreen = "YearSP\imj\M3.jpg";
overviewPicture = "YearSP\imj\M3.jpg";
template = M3O.Altis;
end1 = "";
lost = M3O;
};
};
};`
Folder paths:
@YearSP\Addons\YearSP.pbo ==> campaign, imj, config.cpp\campaign == >Missions, description.ext
if need i can send config.cpp
Thanks!
you dont have folder at @YearSP\Addons ?
!sqf
```sqf
// your code here
hint "good!";
```
β turns into β
// your code here
hint "good!";
i could be wrong but i use @AddonName\addons\folderName
so then i can just do \folderName\image.jpg
The folder is located at ...Addons\YearSP...
ok try with \ "\YearSP\imj\M3.jpg"
shouldn't it be the following, according to https://community.bistudio.com/wiki/Description.ext#CfgSounds ?
overviewPicture = "@YearSP\imj\M3.jpg";
What exactly do you mean by CfgSounds? It shouldn't be there, because this is a general description for all missions, responsible for displaying pictures and text. @YearSP is the root folder, which contains the Addons folder, which then contains the YearSP folder with imj, campaign, and config.cpp inside. Or maybe I just misunderstood you.
You mean do like this: @YearSP \ Addons \ YearSP \ imj \ M3.jpg?
did you set the addon prefix correctly?
in debug console type addonFiles "YearSP\"
wiki says it takes array
addonFiles ["YearSP\", ".jpg"] then
yeah I forgot the syntax
how dare you
Debug console: yearsp\imj\m1.jpg","yearsp\campaign\missions\m2op.altis\m2.jpg","yearsp\campaign\missions\m3o.altis\m2.jpg","yearsp\campaign\missions\m1o.altis\m1.jpg","yearsp\imj\m2.jpg","yearsp\campaign\missions\m3o.altis\m3.jpg","yearsp\imj\night.jpg","yearsp\imj\m3.jpg"]
Is it correct use lowercase yearsp\imj\m3.jpg?
will this work on a trigger? the ship will be a composition that I give out to my other Zeuses, so it needs to be as drag-and-drop as possible
case is irrelevant
it doesn't work
try it with @ too like Lou said
if it still doesn't work, try using paa instead of jpg
@YearSP \ Addons \ YearSP \ imj \ M3.jpg? or just @YearSP \ imj \ M3.jpg?
the latter
and are the images inside the .pbo?
yes
@YearSP
βββ Addons
βββ YearSP.pbo
βββ config.cpp
βββ imj
β βββ Night.jpg
β βββ M1.jpg
β βββ M2.jpg
β βββ M3.jpg
βββ campaign
βββ description.ext
βββ Missions
βββ M1O.Altis
βββ M2Op.Altis
βββ M3O.Altis
Just
There might be an error because my M1-M3 images are 1280 x 800, while 'Night' is the only campaign image that is 1920 x 1080 which I see? Maybe better 1024x1024
the sizes have to be power of two
How do I set up Apex style subtitles for AI?
They don't have to play audio, I just want the text
It's probably this https://community.bistudio.com/wiki/BIS_fnc_EXP_camp_playSubtitles
doesn't work
@marble plume no need for this, it will be executed for every player and they will not hear wind hauling on the mountains altitude, Zeuses included
What does the "Sleep 7" do in the 2nd example?
Having it stay in there triggers an error
Also, this is in a Multiplayer session, will this display for everyone? Or just people near the trigger?
https://community.bistudio.com/wiki/sleep
sleep is a command used to make a delay before any further code is executed.
If this code is in a trigger, that's why. Trigger code fields are Unscheduled and cannot suspend. sleep suspends the code thread, so it must be run in a Scheduled context. You could use spawn to create one if needed.
Right
This is a UI function so it's likely to be Local Effect: it will only display subtitles on machines that actually execute the code.
Which machines execute the code depends on how your trigger is set up.
If it's set to Server Only, then naturally only the server will execute the code.
Otherwise, any machine where the trigger conditions are satisfied will execute the code. Triggers exist simultaneously on all machines, and each machine's local copy of the trigger will evaluate and execute independently. So, which machines will have their copy of the trigger activate, depends on what the condition is.
anyone knows how to integrate FIRs AWS with Mi-48? I want to use the Russian weapons for this beast π
isnt that config question?
this is my question actually ... any way to integrate AWS with vanilla without modding config?
I kinda solved the issue with GOM Loadout script ... but player will be in total chaos about pylons positions
does anyone have better pylon loadout script with better visualisation by chance ?
@split ruin can you just put more planes in and edit the pylon loadouts in the editor
No because FIR AWS apparently isn't integrated with the Mi-48.
i see
Mission had a weather script in it 
In another language I'd go ( if CLASSNAME in ARRAY_OF_CLASSES then DO X). How is this done in a3 SQF?
if (X IN Y) then { doThing };```
Or can you actually just do `in`?
I'm trying to ask the engine if a damage source is in my list of explosives.
This would be correct.
if (_x in _y) then {/*code*/};
Keep in mind that in is case-sensitive when comparing strings
Cool. Easy way to check for allowed demo charges on this script.
Is there any get3DENConnections equivalent that is useable in-game (in Preview I mean, not in Eden workspace)? In this context, it has to be reliable unlike synchronizedObjects which cannot be used on some certain simulations/non-AI vehicles
Aren't these connections just for the editor and don't exist past mission start?
I think I remember wanting this too
Nope. That's the question
If there never is a way to find sync states in game, what's even the point of this system?
From what I can see it seems they ever wanted us to expand connections system (Cfg3DEN >> Connections), but we have zero commands to check the status of the connections, if I miss something obvious?
But Sa-Matra saying no seems to be the most reliable answer ever, thanks
I'm not sure myself to be honest, I just recall wondering the same question
This must be the biggest bummer in Eden
https://community.bistudio.com/wiki/Eden_Editor:_Custom_Connections
Regards to this, I think I might take a look at this, I somehow mised this
Good luck getting this to work. It never really did for me.
There are also issues with grouping units via scripting.
Hello guys. I am just trying out arma3 scripts and I was wondering if there is any way I can move a tanks turrent by giving it some location? Like for example a direction in NE and an elevation angle for the turret. I have manged to move the turret using doWatch and doTarget commands but that way the soldier inside the tank is looking at a position in the map (which is what I don't want)
You could technically use logic object, since it's invisible
But I dunno If it's possible to turn turret any other way
lockCameraTo
wouldn't that just move the camera POV?
It literally does rotate the given turret
mhm so that means I am pretty much stuck with doWatch command
oh really? let me try that!
Not sure if I should be asking this here, but how do I make like premade loadouts for the faction I'm making to pick randomly when spawning in a unit
You can copy loadouts in arsenal by pressing Ctrl+C
Alrighty, then what
Execute the code?
what folder, where, how do you turn on the code, what code do you write, what script
Easiest is to save it inside of mission folder and call by execVM, but that's not recommended for performance
is there a way to prevent this from happening when creation composition on uneven terrain?
If you mean the building clipping ground, sometimes that's enough.
But for complex geometries like this container building probably not, also need to increase the Z axis a bit.
_buidling setVectorUp (surfacenormal (getPosATL _buidling ));
i mean the chair.. and the guy
disable simulation of the chair, attach guy to chair
disable damage of the chair?
tried attaching chair to house
it shouldn't be able to fall down
worst case make a new chair and remove the destruction type, maybe that still triggers or so
https://community.bistudio.com/wiki/CfgVehicles_Config_Reference#destrType
well ill keep testing , hopefully its something in my code that i can fix. thx
If building and chair were both higher than terrain. Would it still result in chair ending up flipped?
nope
i think the attachTo works, i just had typo in my testing code earlier. need to do more tests
vanilla composition feature?
i use the old compo scripts π¬
so i wouldn't know
hi guys, does anyone have some good practices for synchronizing score across clients on a linux dedi? I'm using the built in scoring system and I havent been able to find much good documentation on how it works on the back end
Well, addScore and addScoreSide are Server Only, Global Argument, Global Effect commands. So you must execute them on the server, and the server will automatically handle synchronisation.
There is no difference in script commands between Linux and Windows servers.
interesting thats not what I'm seeing on my end, on a locally hosted server the score is synched as advertised but when testing on the linux dedi the clients dont appear to get that message as the score remains 0
is there a way to draw lines on map using sqf? I tried drawLine but can't get it working
drawLine is one way, but it's a per-frame command, not a persistent line. It must be used in a per-frame event handler, like the Draw control EH on the map control shown in the example on the wiki.
For a set-and-done persistent line, you can use the polyline marker shape (setMarkerShape, setMarkerPolyline)
thank you that's exactly what I was looking for!
hey guys just a question. for some reason the marker doesn't show up in first persom when you look into the direction but is there when you open the map.
[
player,
"boardHeliTask",
[
"Get everyone inside the infiltration helicopter.",
"Board the Helicopter",
"getin"
],
infilHeli,
"ASSIGNED",
1,
true
] call BIS_fnc_taskCreate;
!sqf
```sqf
// your code here
hint "good!";
```
β turns into β
// your code here
hint "good!";
change your difficult options
i thought that too at the start but they're already on recruit and i set everything to show
it has something to do with distance. when the player spots the object the marker does appear and does stay but i want it to apper even before
i figured it out I had to replace infilheli with [infilHeli, true], which bypasses the discovery check
then there's an error in your script. they should never become upside down like that
yeah, otherwise it's based on target knowledge.
what would a good script be to tell a vehicle to stay on position after it lands with unitcapture?
I've tried this but it doesn't work. hydra 1 is the pilot of a helicopter in this case
hydra1 setBehaviour "CARELESS";
hydra1 disableAI "MOVE";
If you want to force it to be still, you can just remove its fuel.
great solution thanks
A slightly less brutal approach for helis is to give them a land command before running the unit capture or setVelocityTransformation. Seems to stop them wobbling around after the forcing is removed, I guess because it makes them cut the collective earlier.
You need the land command for helis with landing gear anyway.
hell yeah Arma 3 Woohoo π
i started training my friend to build missions in Arma 3 it may take like 3 years π
the terrain causes them to flip over. but im trying to fix this with attachto. im using the object mapper script , if you meant that
the terrain causes them to flip over
why would it? iirc chairs don't have physics
idk theres table and laptop too which fly around sometimes
check its simulation in config. if it says "somethingX" it's physx otherwise it has no physics and shouldn't move
you can by attaching chair to the building object
that im doing π
and it still flips ?
it seems to work but i havent done enough tests yet
everything seems to work now. except when i tested first time no furniture was created . i have no idea how that happened
Hi all - I'm trying to make AI land vehicles reverse - possible or no?
hi, maybe try https://community.bistudio.com/wiki/limitSpeed with a negative value, I am not sure though
There is sendSimpleCommand but it has several limitations
Put a wreck model in front of them, they will drive into it, then reverse back a few feet and then repeat that until you get bored looking at them π
Haha, I've managed a janky solution with this:
group myTank addWaypoint [(getPos myTank) vectorAdd ((vectorDir myTank) vectorMultiply 50), 0];
sleep 5;
myTankG forceWeaponFire ["cannon_120mm", "close"];
sleep 5;
private _startPos = getPos myTank;
private _revDir = vectorDir myTank vectorMultiply -5; // backward
// keep moving until ~50m backward
while { (_startPos distance getPos myTank) < 50 } do {
myTank setVelocity _revDir;
sleep 0.05;
};
myTank setVelocity [0,0,0]; // stop
Trying to set up a demonstration of a tank engaging a target and "jockeying" back into cover. However this method does not provide a smooth / natural looking reverse and the tracks / road wheels do not animate with this method of reversing.
From what I can understand here, sendSimpleCommand replicates those commands that a human player (commanding a vehicle) would send to an AI driver?
Maybe, but you'll have to try if you can get it working for your use case.
Ack - many thanks. I'll try again tomorrow when I'm back at my computer.
You may also be able to use https://community.bistudio.com/wiki/BIS_fnc_unitCaptureFiring (and BIS_fnc_unitPlayFiring) instead.
well, there's also setVelocity.
But sendSimpleCommand is the only way to make the AI do it.
Oh, that's what he used in the first place. Surprised setVelocity doesn't make the wheels animate tbh.
Thats because ai is constantly pushing the brakes, use the disableBrakes command
https://community.bistudio.com/wiki/disableBrakes
never saw this command lmao
Main use is for towing, but yeah, might help here.
Thanks guys - will test all permutations. Simple command might be preferred as I want a natural looking move as much as possible (acceleration/deceleration etc).
Is it possible for a script error to cause a server to not fully start?
The server just hangs at loading core configs
That is a thing that was sometimes done in Arma 2 times by scripters who didn't know how to read variables by name.
They knew how to read variables in normal script, so they just went to assemble script and compile and call it.
A bad hack solving a problem in a bad way, no-one should be doing this anymore.
Plus your example will also fail if the players name has a space inside it, or any other non allowed character.
Depends on what you mean.
In general, no.
For rendering text into UI, yes.
I just happened to have done a full export of all unicode characters Arma's font supports. Might be useful to some
this could do well on the wiki, but⦠where?
Scheduled throws an error when reading a variable that is nil. You have no variable here.
The error message is coming from the get variable instruction. There isn't one anywhere else.
in A3 when a script is done it implicitly ends with nil
After every statement (ends with ;) there should be a nil left behind.
Except when you have a variable assignment.
which is how the script knows when to end.
Uh no, the script knows when to end, by seeing if it reached the end
Guess it depends on your definition of what a "silent fail" is.
alive command specifically checks, and returns false if the object is null. There isn't really any "fail" there thats just by design
distance, distance2D and distanceSqr.
If either of the objects is null, it returns 1e10.
If either of the Position arrays fail to parse, it sets script error but also returns 1e10.
Have fun documenting π
The last thing being written to rpt is 3:19:25 SteamAPI initialization failed. Steam features wont's be accessible!
despite appearing to be a value
Then you're just missinterpreting what you're seeing.
"nil"'s have a type.
That is a nil of type string.
I don't quite know why that was done either, that goes back very far.
When you pass nil to a command. The command is never executed.
It aborts before executing because nil argument is always invalid.
And it puts a typed nil, with the commands return type, back onto the stack.
The most common type of a "nil" is any, which is what you see when you print out the result of the nil command.
const int CHUNK_SIZE = 9000; // Leave safety margin for Arma 10KB limit
There is no limit if you return data using extension callback. But that would be a bit harder to use as the return would not be instant but instead come via a deferred eventhandler.
Also why does a simple extension for reading/writing files for a mod, have so much stuff in there?
You are doing alot of cheat/malicious code like things, which BattlEye will dislike. That has nothing to do with the mod being "safe to use" for users.
You run the risk of causing a mass BattlEye ban on all the users of your mod...
Your code is also actively performance harmful because its intentionally doing random-length sleeps for which I can't see any purpose.
If you just want a key/value store. Instead of letting people write arbitrary files on disk, just use a SQLite database?
If you need text files. Then.. instead of all your checks for extensions and path traversal and shit. How about you just block /\. characters in the filename, and enforce a .txt extension at the end?
You can do that in like two lines of code, instead of all the complex and probably still unsafe (because its so complex its hard to make sure you got "everything") checks.
Your super complex 900 lines of code, could literally be 30 lines while also being much safer, and as bonus, not getting your users perm banned for cheating.
"not working" is a very broad spectrum, not possible without being able to tell what exactly is not working in what way..
parsingNamespace also persists between missions
Extensions only apply if it is NOT a web source. Which http/https is.
Why are you trying to mess with Wildcards, just put the full URL in there?
Your += makes no sense there. That is to append values, you are not appending. The array doesn't exist before you define it, there is nothing to append anything to.
Wow, cheers thank you for all the info today. Had no idea about that with nil. Very interesting and makes sense the way you put it- that the most common is any but that others exist as well and explains why I got those results.
Later I'll troubleshoot and see more specifically what isn't working with CT_WEBBROWSER. Something maybe a little better than "it no worky on stable" haha π
Your problem is the http?://
The ? is a wildcard, for, "there can be any character here" but.. "No character" isn't "Any character". A ? wildcard MUST have ONE character.
There must be a character after the http. But you have none. It simply doesn't match the pattern.
You probably want "(http|https)://*.domain.de/*" instead.
no
Read #rules, next time I'll hand you a written warning
huh
Yes it got patched.
Use connectToServer script command.
I don't understand what you mean. How does a server-side only eventhandler, get the event from the client?? Its server side only?
and if the client crash no events are sent
You mean PlayerDisconnected server side eventhandler, is not triggering when a player is disconnected? That would simply be a bug. Make a repro and make a ticket and post in #arma3_feedback_tracker
roger!
BUT send by the client
No its not.
The server triggers it. Right before it prints the "Player X disconnected." message to console.
There is also MissionEvent "OnUserDisconnected" and Server side event "OnUserDisconnected" too.
(Which fire right after that disconnected console message)
It isn't. Thats bullcrap.
thank you for the info, it's hard to find reliable document on some EH behavior.
btw, we do some test with @granite sky (thanks to him), and notice that the HandleDisconnect EH is not called on server when (persistent is off, and the client lost brutally his connexion)
How about making the server not kill the mission when last player disconnects, but keep it running?
but when he's the last... no EH code execution
No the EH executes before the server closes. And its unscheduled.
it's a CTI mission, if I lets the persistence on, the game continue without player
ok, but even with some diag_log in each EH, we don't see the execution
Note HandleDisconnect works much different than the others, it works on Entity owner change
If you want player disconnect, I'd expect you'd use the PlayerDisconnect eventhandler.
HandleDisconnect fires when the players unit changes ownership to the server because the old owner disconnected.
But with persistence 0 its deleting all objects.
There is nothing to change ownership of, if its deleted. That's just not the proper EH to use to detect a disconnect really
thanks, if fact I use PlayerDisconnected, HandleDisconnect and MPEnded, when the client CTD or have network issue, there is the log on server
15:47:01 "Civilian vehicle CUP_C_Volha_Blue_TKCIV incident 20 at 1987.42" 15:48:04 Player toto is losing connection 15:48:09 NetServer: cannot find channel #1084154869, users.card=0 15:48:09 Message not sent - error 0, message ID = ffffffff, to 1084154869 (toto) 15:48:09 Player toto disconnected. 15:48:09 All users disconnected, waiting for users.
even if all my EH begin with a diag_log
The Wiki might need some updating.
"Triggered when player disconnects from the game." is imprecise.
Better "Triggered when a players controlled unit changes ownership due to the owning player being disconnected"
Which then might make you think, that if the unit is deleted, it wouldn't fire.
you're right
Also the Similar to onPlayerDisconnected event but can be stacked is a bit pointless.
There is a OnPlayerDisconnected event that can be stacked.
Yes you do need filePatching to load files outside of missions/pbo's
yep, the test we made, show "PlayerDisconnect " EH is the right one to call,
but we don't have the unit in this EH (in opposition to HandleDisconnect)
I can live with that π
anyway thanks for clarification π
You can also script the mission end.
after your cleanup save script runs. Do the endMission yourself
yes, that can solve my last player issue, I was reticent to let's the server run when there is no need.
I'll make a test version on this idea
You can have the unit if you need to. But you need to store it somewhere before.
OnUserDisconnected gives you the playerid.
PlayerDisconnected does too.
You just need to store somewhere, the playerid's unit, before the player connects.
Then you can just look up by the playerid, what unit they had.
https://community.bistudio.com/wiki/getUserInfo also gets you the player object.
It looks like the info is deleted only after the EH's are fired, so that should still have it
"Then you can just look up by the playerid, what unit they had." it is not too late ? there is still an player object accessible by the server ?
I thought only "HandleDisconnect" can allow me to save, for exemple, the unit loadout
I expect the owner reassignment to happen after the player is disconnected
PlayerDisconnected should fire before HandleDisconnect
And if the unit is still present for HandleDisconnect, then it definitely is before that too
yes, diag_log test confirm that, but the unit is not accessible in HandleDisconnect
I store new player uid through PlayerConnected,
so I usually reference user by uid, but in some case (loadout) I need to access to the player object
and when I search for all unit / or getunitbyuid, when HandleDisconnect fire, I found no object available
Because HandleDisconnect fires after the disconnect happened and the player is gone
The other EH's fire AT the disconnection, not after it
ok, make sense now
I test your suggestion of persistent server with custom end of game management. (should save me from critical timing when the server shutdown)
and it seems that HandleDisconnect don't fire at all when the server is not persistent and the last client disconnect brutally
so a player just disconnecting won't trigger it?
If the player has no unit, no
oookido, worth noting the difference indeed
better?
Yes but also
instead of onPlayerDisconnected, link to OnPlayerDisconnected mission EH.
And remove "can be stacked and"
Maybe also note that HandleDisconnect fires AFTER the player is disconnected.
So the player will already be gone from player lists and getUserInfo command
boom
maybe time for https://feedback.bistudio.com/T188806 (Game ending)
This was working for a time but now seems to be unresponsive on a tank+crew placed editor-side.
Script as follows:
commander myTank doTarget targetObj;
commander myTank doWatch targetObj;
gunner myTank doTarget targetObj;
gunner myTank doWatch targetObj;
// FORWARD 50m
private _startPos = getPos myTank;
while { (_startPos distance getPos myTank) < 50 } do {
myTank sendSimpleCommand "FORWARD";
sleep 0.01;
};
// brief brake pulse
for "_i" from 1 to 10 do {
myTank sendSimpleCommand "STOP";
sleep 0.01;
};
// WAIT UNTIL STOPPED
waitUntil { abs speed myTank < 0.5 };
sleep 1;
// FIRE
gunner myTank forceWeaponFire ["cannon_120mm", "close"];
sleep 2;
// BACK 50m
_startPos = getPos myTank;
while { (_startPos distance getPos myTank) < 50 } do {
myTank sendSimpleCommand "BACK";
sleep 0.01;
};
// brief brake pulse
for "_i" from 1 to 10 do {
myTank sendSimpleCommand "STOP";
sleep 0.01;
};
cursorObject sendSimpleCommand works when executed in debug console - on any vehicles+crew OTHER THAN myTank.
The key variable seems to be the Eden-placed crew - if I replace them with a dynamically spawned crew via Zeus, the above script works.
```sqf
// your code here
hint "good!";
```
β turns into β
// your code here
hint "good!";
Possible locality issue.
Editor-placed AI are typically local to the server unless something happens to move them. Zeus-placed AI are typically local to the Zeus's machine unless something happens to move them.
sendSimpleCommand doesn't have locality information listed, but many AI commands are Local Argument (must be executed where the target is local). When you use the debug console you're probably clicking Local Exec, which executes the code only on your machine.
Did you check who the effective commander is in editor & zeus cases?
Thank you, I will try and see if this fixes my issues!
Is it possible to trigger a trigger?
I am asking this because of a composition. It's more a script than a trigger, but in the editor, it shows up as a trigger. It's called Blackout Script
I want the blackout to happen when I walk into a certain area
Trigger how?
Just walk into a trigger area, and the composition is kicked off
Isn't that what triggers normally do?
They do, yes
But I tried syncing one trigger with the composition and absolutely did not work
Might need a script in the activation field, maybe?
The composition is also a trigger?
What is the activation of that one?
Shows up as a trigger
Saying what another guy already said is quite helpful, I have already made those changes
though I would like to know how to get this down to 30 lines of code
Using raw SQL instead could probably do that in 30 lines: sending [SQL_STATEMENT, OPTIONAL_LIST_OF_LIST_BIND_PARAMS] to the extension and receiving a list of rows back.
Sending something like:
["SELECT playerUID, grenadeType, grenadeCount FROM inventory WHERE playerUID=? AND insuranceData >= ?",
[
[431232434, "2025-15-01"],
[343434342, "2025-15-01"]
]
]
And receiving back in sqf:
[
[431232434, "M69", 2],
[431232434, "F1", 1],
[343434342, "F1", 2]
]
Possibly silly question, but im trying to get a AI to be interactable via the scroll wheel hold action, so that someone walks up tot eh AI holds space bar for 3 seconds then it pops up a small message on the screen in blue from the named AI, i thought i had a script that did this in Multiplayer but after testing it dosent work. Any help would be possible ( note for some reason it works in singleplayer but not on a dedicated Multiplayer server)
Bellow is the Script that works in Singleplayer
this,
"Speak to Wg Cdr. M. Connor",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_Search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{ call{cutText ["<t color='#00bfff'size='1.4'>Wg Cdr. M. Connor: </t> <t size='1.4'>Hey, *Insert screaming Child* God dam it Lenny, Sorry gotta go deal with the Child<<br/></t>", "PLAIN DOWN", -1, true, true];} },
{},
[],
4,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, this];}```
i have tried changing the following line remoteExec ["BIS_fnc_holdActionAdd", 0, this];} to be remoteExec ["BIS_fnc_holdActionAdd", 2, this]; in a hope it would work but it didnt work in either single or multiplayer
I'm guessing the problem is that you're running other mods on the server and one of those is overriding the JIP ID.
0 is the correct target anyway. holdActionAdd needs to run everywhere (at least, everywhere with a UI)
Hm i shall see if any mods are causing problems
for testing you could try using a unique JIP ID.
Is there any way to make glassy UI like this? I guess PIP texture?
if you don't care about the blur effects you can just change the alpha of pretty much all UI controls to make things transparent
in your image it seems to be also applying a negative color effect
no it's just some parts
I do care about blur effect
Nah thats not really important tho, would like the blur
I meant procedural
imo browser control is the best way to do that
My goal is making menus, notifications, etc with that glassy style
yes and you can do that with the browser control to make fancy UIs
Gotcha
Hopefully it wont eat much performance
When will browser control be on stable branch?
I thought it already is 
BIKI doesnt say so
#perf_prof_branch message this hints at it already being in the game so yea
Ty Leopard!
@still forum sry for the ping. Dont you have a git repository on how to setup UI with HTML i believe i saw it somewhere.
Use a WebBrowser and do it with CSS 
Yessss
As soon as I saw chromium I got a little scared
(RAM Prices are up for a reason)
But I know this one chromium wont harm performance that much riiiightttt?
By the way, wiki not updated regarding the introduction of browser control to stable branch
30 lines of code was referencing doing it in C++ with reading/writing text files, not rust with databases.
import std;
using namespace std::string_view_literals;
#include "RVExtensionUtil.hpp"
int CALL_CONVENTION RVExtensionArgs(char *output, unsigned int outputSize, const char *function, const char **argv, unsigned int argc)
{
if (argc != 3)
return 1;
std::string fileName(argv[1]);
std::transform(fileName.begin(), fileName.end(), fileName.begin(), [](const char x) {if ("\\/."sv.contains(x)) return '_'; return x; }); // Sanitize filename
if (fileName.empty() || fileName.length() > 64) // Too long filenames might fail to create, so just cap it
return 2;
if (argv[0] == "write"sv)
{
auto len = strlen(argv[2]);
if (len > outputSize - 2) // Make sure we can read it back and the file is not too large
return 3;
std::ofstream outFile(fileName + ".txt");
outFile.write(argv[2], len);
}
else if (argv[0] == "read"sv)
{
std::ifstream inFile(fileName + ".txt");
inFile.read(output, outputSize-2);
output[inFile.gcount()] = 0;
}
return 0;
}
Here 31 lines. Could be 22 with some uglier formatting
Missing feature is that the disk can be filled with junk files. (Which your code didn't have either)
That needs one extra line for creating a subfolder to put everything in.
And about 5 lines to count number of files already present in folder, and block creating a new file if too many.
Also note your 9000 chunksize limit. Arma's limit is currently 20KiB, not 10KB.
Also Arma's limit might change and you cannot depend on it staying the same, so you should not hardcode that and instead use the buffer size that gets passed to you.
If you need to read larger files.
+7 lines for a command to get total filesize.
+3 lines for an optional offset argument in the read command.
(or use extension callback and Arma's new async script handle feature, to transmit the whole content but async)
If you want to delete files
+5 lines for the delete command.
I think with all that stuff maybe 50 lines? I don't wanna calculate.
In comparison to your 180 lines rust or 980 lines first C++ code or your 210 lines second c++ code...
Also noticed your code is doing stuff with mutexes, there is no need for that, your extension will only be called from one thread.
I am replying to things before I read the answers because there's too much backlog to read all first and then remember to scroll back to the things I wanted to answer.
https://github.com/dedmen/ArmaWebBrowserTests
JavascriptWebpack contains my Radar HUD thing
#dev_rc_branch message
That was in 2024??!!! Where did the year go wtf
Fixed
I'm sure steam is already running it for you
It's crazy isn't it. I feel like I'm putting a mod away for a few weeks to focus on life. Then I realize people have waited 2 years for an update
Speaking of radar - I want to create a custom radar UI for my project, most likely using the UI to texture renderer
Do you have to remind me 
I leave a channel with bug reports in my discord on unread to remind myself that I have to fix it.
Its.. been on unread for a while..
I wanted to take a peek under the hood of the default arma jet radar UI (activated with the square brackets) but it's all compiled
I didn't even think to attempt it, because I don't want to mess with Arma UI code.
Javascript and CSS was sooo smooth, and there are so many examples on the web
Are there any ways to get the information from the sensors onboard a jet or do I have to script it up from scratch?
https://community.bistudio.com/wiki/Category:Command_Group:_Sensors
getSensorTargets I think is what you see on Radar
Yeah haha well, I could just write it in bare MFD classes as I yhink they have the infofmation
Oh sweet
Thanks, I'll give it a read
Okay this is, in fact, great
I need to give the js approach a shot once i get to this stage of the project, is there any drawbacks? Js is pretty much a native language to me so it would be useful lol
Drawback is that it depends on Steam providing the Webbrowser API.
Which they could remove and make unavailable.
Steam added the API in 2014. And Steam needs the browser for itself to display everything in the steam client itself.
So next arma version number is having a web view control based on Steams web api?
Is that one affected by steam overlay being enabled? I run with that disabled in games and some games break with that especially ingame friend lists.
Looks like ISteamHTMLSurface should be safe, but not ActivateGameOverlay
Oh I thought it was already released
Maybe it is, am in the mid of an Arma break.
Current Arma version has it. No steam overlay doesn't matter
Okay, I need help with readable documents. I want players to pick up a document and read it from their inventory instead of the map
I know about addaction, or something like that but I do not want the pop up notification
If there is a mod for it, that would be amazing as well
you may be able to do something like that with https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Put / https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Take
This one might be it, but now I have to figure out how to make this happen. Really new to scripting so all of it is very confusing to me
It works, yes. But I want it to be more like a notepad or a page that the player can access through their inventories.
Or.
They can just pick up and read the intel without retrieving it in the map or inventory
Welo, problem solved
Ace has intel items that does not even need scripting
I am just a dumbarse
You can only read them on the map screen
I was going to suggest ace but you said it had to read through the inventory
I mean, I guess you can only read it through map, but the documents are physical objects in your inventory. And it is much more immersive than the regular intel
So I am happy with it
Fair enough
Though, adding pictures might be a struggle
How would i go about doing that?
Just put "MyUniqueJIPID" or whatever instead of this as the final remoteExec parameter.
ah
is this code written in the AI's init field or somewhere else? if it's in an init field, it seems odd to be using remoteExec there...
its in the init field of the AI
yeah, init fields run on all clients so remoteExec'ing inside one is usually not needed
i'd try without it, e.g. sqf [ this, ... ] call BIS_fnc_holdActionAdd;
ah okay
waste of network traffic fr
hmm, makes even less sense why it wouldn't be working then, because it'd reinstall itself every time a client joined.
yeah... placed below some exit condition perhaps?
So the orginal script works now i took out a mod and it fixed it, only downside is it shows up 3 times in the scroll wheel menu
yeah that's the expected behaviour.
What other people said. If it's in an editor init field, it runs on every machine, so you can drop the remoteExec entirely here.
Noted
@eagledude4 I had a similar problem, turns out the userconfig folder was incomplete
userconfigs are useless nowadays tho (except serverside ones)
I dont know if this is the right place for this but is it possible to bind the default βnext opticβ and cba βnext opticβ commands to the same key? Possibly through CBAβs keybind script system?
i would guess yes: but i don't use any mods:
maybe this helps https://community.bistudio.com/wiki/Arma_3:_Modded_Keybinding
with addUserActionEventHandler, you can detect the vanilla keybind being activated.
And from there can call the CBA function that CBA uses on its hotkey
Is there a way to change the zoom level from holding right click?
I'd want to half it if possible.
I believe you would need to do that in the config of everything.
Not with scripting. That's controlled by config - both the weapon config (for ADS) and the unit/vehicle config (viewPilot/ viewOptics / viewCargo subclasses and turret equivalents)
Ah, so basically, pain
Almost every playable unit in the game inherits its standard values from CAManBase, and most weapons inherit their standard values from Default, so you could make a fairly simple config mod to change those globally. But changing vehicles with more complex turret setups could be more difficult, and if any mod has a weapon or unit that explicitly sets those values rather than inheriting them, you'd need to make a specific patch for that.
Gotcha. I'd only really want to make this a change for default infantry view, and infantry weapons.
I have yet to make an Arma 3 Mod, but have done a good amount of Reforger mods.
If you think this is possible, I'd love to attempt it.
google for mod
Hey chaps, does anyone happen to know how I might script a sniper shot hitting an ai fellow close to the player? Either by using an AI unit or spawning a tracer round. Whichever, I would like the shot to use tracer
_bullet = createVehicle ["B_762x51_Tracer_Green", getPosASL sniper, [], 0, "NONE"];
_vector = vectorNormalized ((getPosATL _bullet) vectorFromTo (target modelToWorldVisual (target selectionPosition "head")));
_bullet setVelocity (_vector vectorMultiply 900);
I have this script, which fires the shot, but there's no tracer
I don't know of any way to enable tracers or something, so I would try different bullets and see if they have tracers.
Tracers are created in a magazine's CfgMagazines entry with the lastRoundsTracer and tracersEvery variables
Sorry for the delay, would you be able to elaborate?
In the context of the code that is
Bullet config determines the colour of a tracer when a tracer is to be shown, but whether a tracer is to be shown is determined by the magazine config from which the bullet is fired.
Since script-created bullets are not fired from a magazine, there may not be any way to make them show a tracer.
Secondary note: your implementation of createVehicle may cause the bullet to be positioned wrong.
createVehicle does not use ASL positions, it uses a variety of AGL/ATL types - which means your ASL position, when treated as an ATL position, is likely to be between 1 and several hundred metres too high.
Also, a unit's position is at its feet, meaning that even if you were using the correct altitude type, you would want to adjust the position upwards by, say, a metre or two, to avoid hitting the ground. And maybe move it forward a bit to avoid spawning it inside the sniper.
When a player uses an FPV drone to crash into something, they always get a negative score. Is there an easy way to prevent this with a mission side event handler or something?
HandleRating
I just dont know how to make it so it only adjusts the rating from player controlled drone kills. Ive tried in the past and couldnt figure it out
I'm not sure if you should add the event to the player, the drone vehicle, or the drone dummy AI (depends who the game adds the rating to), but anyway:
_drone addEventHandler ["HandleRating",
{
params ["_drone", "_rating"];
if (unitIsUAV _drone && {isPlayer remoteControlled _drone}) then {0} else {_rating};
}];
also it should be added locally
I'd assume dummy AI, I don't think vehicles can have a rating but could be wrong
Yeah I think I have to add it to the UAV unit
I will figure it out and this will help tons, thanks
in that case you can use params ["_unit", "_rating"]; private _drone = vehicle _unit;
also if you want to distinguish FPV drones you can use a variable on them, e.g. _drone setVariable ["TAG_isFPVDrone", true] and check this variable in the EH. or you can use isKindOf if they share the same type
This is brilliant, good idea
so i've put together a data collector for my unit so we can analyze our actions post-op; it essentially gathers all the basic events (fired, getin/out, etc...) as well as positional data among other things every 0.1s - im storing this data in missionNamespace before saving it to our own file format using an extension, however during recording i appear to get a pagefile out of memory after a while as presented in the screenshot (i mean i kinda expected it on the first run since im kind of collecting *a lot) however i noticed that the RAM usage never really went anywhere near the limit (i was at like... 20gb out of 128gb) - im kind of baffled by why the game decides to use pagefile instead of RAM to store the seemingly massive missionnamespace array holding all the data
anyone else experience this with storing massive amounts of data within the game's own namespaces?
i suppose i could segment it and write to file in pieces to prevent the issue but... still curious
(also unsure if this is even the right channel but it's technically an issue concentred entirely within sqf so...)
IIRC A3 does have a hard cap on maximum memory usage.
There may be a separate cap on SQF-allocated memory but I haven't heard of one.
I don't think the game explicitly uses pagefile. It is more likely a side effect of how it uses memory.
Though surprising it hits a memory limit in the script engine.
I made mine with dumping to RPT (guess a side effect is that also made it "crash-friendly"). Then a postprocessing step to convert it to a replayable format in JSON. About 1 MB per hour of gameplay.
How much is your massive data ?
Well I only stored every 5 for movement and dir data and only one changes. If you store it every 0.1s without reducing non-state changes it can grow. That's 36000 entries per entities per hour, or short of 4 million entries per hour for 100 entities. Unreduced position and dir with some unknown SQF overhead that might be 100-200 MB/hour as an estimate.
Pagefile is a misunderstanding. The allocation unit of memory is the page. Usually 4KB.
Ah yeah, my bad, this is purely a memory allocation issue. (I just assumed OP's point since Arma does require unusual large amount of pagefile "availability" at least).
I suspect the pagefile usage issue is that it allocates VRAM in a way that requires it to be backed by reserved memory, in case you switch tasks.
I think that's default behaviour in modern D3D versions though. I remember in older APIs you were expected to reload the texture data yourself.
My previous system had 10 GB VRAM and Arma required a sizeable pagefile to not crash. Recently got 16 GB VRAM, but haven't tried Arma yet, but in other (more) intensive titles actual page file usaged in performance monitor is zero (or 64kB one time).
So at least partially the way Arma operates.
But the 2 GB number shown in the picture would make me suspect 32bit, but Arma has been 64 bit for long
Another option is to back the textures in system RAM. And then you have no pagefile reservation but you use more RAM.
But I don't know what's common in modern engines.
yeah the 2GB value is suspicious, but it's hard to guess what that's referring to.
Arma did just allow me to allocate more than that in SQF. Took a few seconds :P
0.1s rate is BONKERS
Jesus christ
If I wanted to have my trigger activate when a round hits within the triggers radius how would I go about it?
I first tried to use shotInAreaDetected in the condition field to no avail.
All I am trying to do is make it so when a shot connects against an invisible energy field it shows the shield prop, then hides it again.
since thisList doesn't detect bullets, you have to find another way
(8 allObjects 2) findIf {
_x inArea thisTrigger &&
{(toLowerANSI (getText (configOf _x >> "simulation"))) == "shotbullet"}
} != -1
probably a faster way though, not in game to test
I'm in-game.
Will test, thanks for the input. I am assuming just put this in it's Condition field?
I'm not getting anything sadly.
i just tested it, works fine for me
I don't know what is bolters though. Also we have no known shotInAreaDetected term in Arma 3
figured he was asking AI
Was about to say
What I can suggest is ProjectileCreated MEH + HitPart projectile EH
allObjects is anyways incredibly performance unfriendly
Understood, I have two invisible walls setup that should intercept projectiles.
So maybe using it on those walls as long as I setup an variable name should help?
yes, if they are actual objects with hitpoints/hitparts. don't know what object you are using. otherwise, since you asked for how to do it in a trigger, I responded with a trigger. using the EHs are going to be much preferred if you know how to use them
Sadly I do not, I am just really getting into the scripting part of arma so I don't have to do all the heavy lifting with Zeus.
I anticipated you were new since you were trying to use a command that didn't exist lol
Yeah
I am using two Land_InvisibleBarrier_F stacked ontop of one another.
They do have hitboxes from what I tested.
IIRC converting your data to JSON drops the memory usage dramatically, like 100x or something. Try with toJSON and fromJSON commands
it does yes
iirc you can't reserve more than 16 GB
He is using custom extension so just dump it regularly, rather than store it.
any script way to add more smoke grenades to tanks in desperate attempt to make them survive longer ? π€
Ugh, I set up the css filters but it seems like it doesnt detect arma video like it were in the html so the filters dont work
this i believe https://community.bistudio.com/wiki/addMagazineTurret
sorry I haven't used the browser ctrl myself so I can't really help with it. but if the browser has a console/inspector you can try to see what's wrong
I think it's just that css filters will apply to the website content, but it doesnt detect the arma video as website content so it cannot filter anything
And I think theres no solution to this
thanks for the responses, i should pay more attention to pings, got a little distracted last night
Ill run another test today, it never saved fully because of the crash so idk but in regards to what you said just below this yeah im only storing changed data and using a timestamp, so it helps a lot with position for example.
Interesting, i was not aware of that - considering my usage peaked at 20gb and leopard said it potentially cant reserve more than 16 that.. would check out
I could get away with a way less generous rate but i also wanted to make it err.. look nicer visually π but seeing as the system is largely designed for figuring out group cohesion and organization (and actions people take but that is done through events anyway) i suppose it can be the first thing thats dropped in case i cant make it work at such a frequent interval
i'll also give JSON a shot
To be clear by nice visually, you can interpolate in the view. I separate position and dir from "state changes"/attributes. Here is an example of the pos dir time stream input data.
[
//...
{"t": 2333.14, "args": [[[13384.2, 8378.15, 7.4061], 100.273]], "e": "posdir"},
{"t": 2342.02, "args": [[[13472.5, 8362.28, 7.36883], 101.564]], "e": "posdir"},
//..
]
This is loaded into a Timeline struct consisting of snapshot, where the state part (.attributes , basically side, classname, "containing vehicle" etc, most things never change) is shared by multiple:
function Snapshot(time, posdir, attributes) {
this.time = time;
this.posdir = posdir;
this.attributes = attributes;
}
I wanted to do all kinds of fancy things, but ended up doing binary search for any given time, and lerping the position and dir and using the last active attributes was basically a no-op when rendering at requestAnimationFrame (so at least 60 fps) speed on a canvas smoothly. This also means you can instantly skip hours back and forth without any hiccup. But trying to replace canvas with hundres of small SVGs was much more performance intensive.
as MuzzleFlash said, if you already have an extension for writing data, just continuously write data. no need to store them in memory only to dump them way down the road
Yeah ill give that a shot too
any idea how to show remaining time of the mission? Lets say its 50 min and I want to check how much minutes are remaining ? setVariable but how ... π€
or maybe this will help https://community.bistudio.com/wiki/BIS_fnc_loop
you can show a cooldown and when it ends you could call an endmission module
a countdown*
your question is about how to show it? like what to use to display it?
or how to compute it?
I just need to diplay the cooldown, its actually for a task
even better on the task itself
I know how to show it in hint, but it'd need some tweaking to show it in task description
if possible at all
I am surprised they don't have it included in the task framework ...
well you can update the task description. but idk how well it'll work
if you update it every min, it should be ok
every second ... that's a thing to test
I don't need to display it constantly just to check how much time left before the task will be a time fail, probably alongside other admin things in the comms menu
theoretically, you could set the result of the countdown in a private variable and call it every time you open the task menu, but idk if you can update a private variable that many times
well just set the start time and read it:
// Kiba_fnc_createTask
params ["_taskName"];
private _task = [...] call BIS_fnc_taskCreate;
missionNamespace setVariable [format ["Kiba_Task_%1_startTime", _taskName], time];
and you can get the elapsed time by subbing:
params ["_taskName"];
private _startTime = missionNamespace getVariable [format ["Kiba_Task_%1_startTime", _taskName], 0];
private _elapsedTime = time - _startTime;
or if you want to do it "remaining style", you can do:
_taskEnd = time + _duration;
// in another place:
_remainingTime = _taskEnd - time;
if remaining time is negative it's done
i've used BIS_fnc_setTask a few times for live-updating the description too, although annoyingly it unassigns you from the task each time
what about BIS_fnc_taskSetDescription? it shouldn't unassign it
i was originally going to write that until i double checked my source code, but i cant remember why i didn't choose that method
might be in my commit history, one sec
ah, because it internally does the same thing: ```sqf
// BIS_fnc_taskSetDescription
private ["_taskID","_info"];
_taskID = _this param [0,"",[""]];
_info = _this param [1,["","",""],[[]], 3];
[_taskID,nil,_info] call bis_fnc_setTask;```
strange, because I use BIS_fnc_taskSetDestination and it doesn't unassign
(for another reason)
but it bother me that there is no alert of any kind
I might have to use hint or something like that to let people know destination changed
I guess its squad leader's job to check how many minutes remaining to do the task and changing the plan accordingly
Can you change a Spawn AI moduleβs blacklist after mission launch? There is a variable for it but setting after launch doesnt do anything.
Possible to set an AI's communication channel?
I have a hypothesis that drone pings cant be seen due to the fact the AI are not on the correct channel, if any at all. I assume they are in group channel which leads to your (their ping) not being visible to teammates while you are controlling the UAV unit
Won't have time to test it yet, but does that sound about right? Maybe I could just set the AI's communication channel to "side" and solve this issue?
in the environment section in 3den, you can edit the time it takes for the forecasted changes to take effect. is there any scripting equivalent for setting that time for changes?
There are script commands like setRain, etc that have a time component.@tiny.dm
There is no equivalent. Every command that changes a weather parameter also has a time parameter. That's basically it.
Ah makes sense, ok
Is there a way to force POV for all players on a specific character so you get the feeling that you're watching a cutscene?
I remember for operation Harvest Red for Arma 2, it starts off with you getting briefed in a carrier. You're obviously yourself in that situation, but i was wondering if I can imitate that, but forcing pov, and then return the POV once the "cutscene" is done.
switchCamera supposed to do it
From what i can see on the forum, switchCamera only change perspective of your own character? Correct me if I'm wrong.
I'm talking about when i load my players into a mission, i want them to see the POV of this random Rifleman, to make it seem like a cutscene. When the cutscene is done, fade to black and skip time. (The players spawn in boats for the sake of avoiding teleporting.) When the black screen dissapears again, the players will find themselves in boats ready to begin the mission.
You can switchCamera to anything
I'm not sure what im doing wrong then. I cant change the POV. Note, I'm not too good at scripting.
if (isNull camSoldier) exitWith {};
player enableSimulation false;
player camPrepareTarget camSoldier;
player switchCamera "INTERNAL";
sleep 5;
player camPrepareTarget objNull;
player switchCamera "EXTERNAL";
player enableSimulation true;
Why exitWith here? camPrepareTarget won't work here too because it's not a camera object
Yeah, I was just trying to make sure the unit exists before doing the camera part. I tried using CamCreate before, And CamAttachto, I figured some logic would transfer over for "switch". I guess not. Again, i'm not that good. π
Just try player switchCamera "Internal" and see if it works. I didn't ask you to clarify you're not good. Just your logic you're building does matter
Yes, switchCamera "Internal" works.
However it doesnt make you view it from the POV of the AI.
Iβm honestly pretty gobsmacked, I thought Iβd need a whole setup to make my view switch to another unit. I didnβt expect it to work with just
camSoldier switchCamera "INTERNAL";
Cheers. Would this work within an MP setting, if i did a remoteExec?
yes
can you only use https://community.bistudio.com/wiki/Arma_3:_Animated_Opening for campaigns?
Nothing limits you to do it anywhere
ah okay thanks
What's a script I can use and where in which if respawn tickets run out mission ends with one side winning?
Will (_blu > _opf && _blu > 0) work as a trigger condition?
It will have to satisfy this for one minute before activating
Can't get it to work
Tried loads of things but don't understand why it doesn't work. I'm quite new to the scripting and in my mind that should work
We don't know what is _blu and _opf
So if i add _private blufor = _blu and same for opfor before that
Ah and obviously it needs to count them aswell beforehand
That's not how it works at all
Let's keep it simple, what are they and supposed to do
Well, if there is more blufor than opfor in given trigger area for 60 seconds it should trigger
Is it a side?
I think thisTrigger, count are the key
So should i add a game logic to defy _blu and _opf or do not need to at all and just use the full blufor and opfor names
I think maybe this is kinda what you're looking for maybe?
{group side _x isEqualTo west} count thisList > 0
What does _x do?
It is the current array item in count- in this case thisList
BTW this syntax is very broken because:
- You cannot use
_private whatever = 0;because underscore is to tell it is a local variable bluforis reserved variable aka a script command where you cannot overwrite- You cannot define a variable without underscore (aka global variable) using
private
(You don't need to understand these, just saying you are doing not right that's the only thing you need to learn for now)
Aha aha, copy. I understand
Nah i've done some reading and i do understand what you are saying
Didn't know _private was voor local
IF (and i don't have to in this case) i need to make a global one it'd be a public variable
Alright
Im trying so hard to remember all those things lol
Been hammering hours into this and can't quite get the hang of it.
Done some simple intel missions and now am trying to make a zone that blufor can capture by being in greater numbers than opfor for 60 seconds
I also haven't used "group" yet. I assume this refers to _x when i've mentioned what list i want it to count?
So i've looked up the variables and group in this case checks how many people in the trigger area are equal to west
And the condition them being that that outcome is greater than zero.
Is this a good observation @warm hedge?
i think milo made a typo in that since the order of the commands is flipped around, but the group command returns the Group of which a unit is part of, so side group _x (the intended order) would return the Side that the Group is from, that being blufor/west, opfor/east, etc.
Ah that makes a whole lot more sense
But if i'd use that command, it would check only if west is greater than 0. Not if its also greater than east. How do i work around that?
{group side _x isEqualTo east} count thisList;
{group side _x isEqualTo west} count thisList > 0 && east
This wouldn't work
i'd assign the result of each expression to variables first, that'd make it easier to understand how to write the final condition
for example: sqf private _bluforCount = {side group _x isEqualTo blufor} count thisList; private _opforCount = {side group _x isEqualTo opfor } count thisList; _bluforCount > _opforCount
That looks so much more simple
And easier to understand
I have the tendency to make things very complicated aswell (so i've noticed). I should just do this stuff more and more to understand how simple it can be.
Thanks alot for your help @errant iron, i'll give it a whirl tomorrow and see how it goes.
Question, if i spawn lotsa ai on HC, Do i need to enable dynamic sim for them on server?
As apparently local managers are disabled
entirely depends on what you're doing, but the point of AI on HC is to offload the CPU overhead of processing their behaviour - dynsim and HC are kind of their own thing and are not really related
should you use dynamic simulation even with AI offloaded to a headless client? sure, there's still a small benefit of entities not being simulated when it comes to network traffic, but that applies regardless of headless clients
I understand that. Imagine it like this: about 300 units are spawned by HC, and they dont all need to be simulated at the same time. Only when enemy is near. Ambiental ai if you will.
The thing is, that all are simulated, regardless of enableDynamicSimulation. Since this has local effect, and wiki states Each client have it is own dynamic simulation manager, all script commands do affect the local simulation manager. (While this is true, according to dedmen, these local systems are disabled internally and only the manager on the server is being used)
I wonder if i should set dynsim for these groups on server
As in remote exec enableDynamicSimulation
ah... i see - well given the locality i've always been running the command on all clients (including server) and haven't had any apparent issues so... i'd say yeah, given the context i can't see it going wrong to execute it on the server as well tbh (i wasnt aware of that quote from the wiki however)
yeah, i believe R3vo added that note last year based on dedmen's explanation:
https://community.bistudio.com/wiki?title=Arma_3%3A_Dynamic_Simulation&type=revision&diff=373712&oldid=351608
#community_wiki message
Welp, ill try doing it on server tommorow. Enough for today.
If in doubt, test it. Plonk a new unit far from the player. Call enableDynamicSimulation on it. See whether it gets its simulation disabled.
feel like the wiki should be updated to have the SE tag for those commands to avoid confusion (or unnecessary global exec)
When done locally on hc (its owner) it remains simulated according to DS and my client.
Was just wondering if anyone knows before i rewrite it to remote exec
(And if that will even work) since unit isnt local to server
And to clarify, if same script is ran by server, they are unsimulated.
well even with your assumption (and wiki's tag) that the command was local (and not server-only) which is why you executed it on the HC only - it's local effect - so you would've had to globally execute it anyway (hence why it worked for me as i was doing so regardless),
Given that enableSimulationGlobal works on the server regardless of object locality, it'll probably work.
^
But yeah, should that be the case, perhaps wiki can change its tag to server only.
@errant iron was right here #arma3_scripting message it was a typo- on my phone and reversed the two by mistake. The only reason I use group is because otherwise you have the chance of picking up dead or unconscious units as civilian- for that reason checking the group side is more reliable. Apologies for the error on that.
Can someone tell me which approach is better?
_this setUnitLoadout (getUnitLoadout (typeOf _this));
or
private _loadout = getUnitLoadout (typeOf _this);
_this setUnitLoadout _loadout;
The latter,
Much clearer and readable.
What is better in this context
Faster/more functional, to be honest I'm not entirely sure if the first option would actually work
Cool bananas, appreciate the feedback π
You can actually test the code's perforrmance
can someone help me call arma 3 campaign dialogue into a mission, i used a sound browser to find it yet it won't play
private _line = {
params ["_name", "_text", "_file", ["_pause", 0]];
// Chat log for players (simple + reliable)
player globalChat format ["%1: %2", _name, _text];
// Audio (local to whoever runs this file)
playSound3D [_file, player];
if (_pause > 0) then { sleep _pause; };
};
["Kamino", "Kamino to Broadway, shots fired!",
"a3\\dubbing_f_epa\\a_in\\120_range\\a_in_120_range_ran_0.ogg", 4] call _line;
["Kamino", "Requesting support. Broadway do you copy?",
"a3\\dubbing_f_epa\\a_in\\120_range\\a_in_120_range_ran_1.ogg", 5] call _line;
["Broadway", "Kamino, Broadway. We read you. Wait one.",
"a3\\dubbing_f_epa\\a_in\\120_range\\a_in_120_range_bhq_0.ogg", 20] call _line;
["Broadway", "Copy that, Kamino. Dispatching reinforcements. Just hold on!",
"a3\\dubbing_f_epa\\a_in\\140_enemies\\a_in_140_enemies_bhq_0.ogg", 6] call _line;
};```
the text displays but the sound doesn't play
change \\ to \
let me give tha ta try
you are a lifesaver
Is there a way to make it as Blue chat like the campaign
The allocator used for script values only supports signed 32bit number of bytes (So about 2GB, which it says there)
It is pending to be replaced but... don't store so much stuff into script values please, that's so terrible.
Open the debug console?
If you mean debug a website without ever opening it.. Uh. no
and you can even use the translation key as well!
playSound3D is weird because it returns some id even if it fails to play the sound
Can you do the blur with Arma UI behind it?
Afaik UI can only blur whole screen, not just small area?
what is the translation key?
something like STR_M01_S42 you can combine with the localize command to tap into the game's translation table π
Some of my UI work dims the screen and I'm able to make UI look as if it's being projected into the world. If I recall I was even able to do glass morphism on a test UI but I no longer have it, lol.
Glassmorphism on top of Arma3 or on top of another UI? As in, did it blur the arma pixels or was it unable to detect them? Afaik, it's impossible to blur A3 using CSS
#arma3_gui message
But I really want to do glassmorphism!
Need some help with unit capture. How do I make multiple replays at the same time?
Suppose, I want to make a scene where two jets are weaving in a valley, one behind another. How will I use unit capture to show both of the aircrafts
Well playing it back is pretty easy. Making the capture data is more complex - not technically, just logistically.
You can always record each track separately, but that will be difficult if you need them to be close together. So you've got a couple of options:
- capture one plane, then play back that track while you're capturing the second, so you can use the first as reference
- use two players
I will go with the first one.
But playing both the tracks at the same time is the issue
What's the problem?
Nothing prevents BIS_fnc_unitPlay from running twice at the same time.
The problem is I do not know where to add the second plane's data. I can make a second sqf file, sure, but I would have to replay twice. One for the first plane, and another time for the second
Dude this is fantastic. Do you do it as a dialog or a HUD? Also how do you create that look of depth?
Yes.
You can't put two target objects in one function call, but you can just run the function twice. Just take whatever you did for the first one, and do it again.
private _data1 = ...;
private _data2 = ...;
[_unit1, _data1, ...] spawn BIS_fnc_unitPlay;
[_unit2, _data2, ...] spawn BIS_fnc_unitPlay;```
(if you have a lot of units you can use `forEach` to condense this)
Ohhh
Basically, make a duplicate line for each function and change the variable name
That's genius
Thanks! @hallow mortar
hi
in a dedicated server setting, if i have the players start in an AI controlled heli that will then transport them to a base of sorts and drop there and then get deleted off to the distance, if another player takes an available slot and/or crashes and rejoins, they will just plummet to their death at where the heli first was at the start
how to make it so that to avoid that and they spawn somewhere at the base for example or near their squad that has moved off?
One way would be to move chopper to corner of the map, instead of deleting it and move players to base once they join. But wait for others opinios I have never done anything like this.
Is it possible to make only part of the players to have any major medical mod on a server (while the rest would play vanilla)? I assume not?
At least not with ACE.
The slot starting position isn't attached to the helicopter, so it doesn't matter if you delete it or not. If the helicopter is alive but has moved, they'll still be spawned in the slot's initial position.
In theory a medical system could support different UIs for different players. But you'd still be running that system everywhere.
I would suggest having the players start outside the helicopter, and having a script that immediately moves them into the helicopter when the mission starts. Make sure the script only runs once, on mission start, and not on JIP (server execution would be a good way).
Or it only moves them in if the heli still exists when they connect.
but yeah, start outside, move in conditionally.
I think you'd want a more complex condition for that, because that alone could move them into the helo before it's deleted, but after it's departed from the LZ, leaving them with no escape from the helo's pending deletion
Oh, if it flies off empty before being deleted, yes.
Stick a setVariable in a setWaypointStatements or something.
In teory it could work by removing ACE's handleDamage EH from certain units. But you still gonna run into issue of not having vanilla healing items, since they all will be replaced by ACE ones. And I have no idea how unconsciousness would behave.
Issue is that these people are probably expecting to treat each other.
ACE would see a unit without the ACE handleDamage running as uninjured.
and vice versa.
Tried this with thisTrigger; infront but it doesn't seem to work unfortunately
I forgot you would still see ACE medical menu on all units
Funny thing there is that ACE prevents the vanilla healing action being visible by keeping units at zero damage. So you could probably still vanilla-heal a unit that wasn't running the ACE handleDamage.
@errant iron I've now went with private _bluforCount = {alive _x && side _x == west} count thisList; private _opforCount = {alive _x && side _x == east} count thisList; _bluforCount > _opforCount
This seems to work perfectly
Really appriciate the help.
Hey folks, I am having a problem with sendSimpleCommand and I can't seem to break through it.
I recorded some APCs with unitCapture. Now they drive around with unitPlay, but I hoped I could make the tracks move with sendSimpleCommand. Doesn't seem to work at all.
I used setEffectiveCommander, in every vehicle there are two AI soldiers, I tried it with AI disabled, I can't seem to bring them to move these stupid tracks ^^.
Is there another way this could work or am I doing something terribly wrong here?
Thanks for the help.
_unBMP_1 = [[12117.8,14494.1,-5.72205e-06], 121, "CUP_I_BMP2_UN", west] call BIS_fnc_spawnVehicle;
_unBMP_1 params ["_unBMP_1Veh","_unBMP_1Crew","_unBMP_1Grp"];
_unBMP_1Veh engineOn true;
_unBMP_1Veh allowDamage false;
_unBMP_1Veh setEffectiveCommander (commander _unBMP_1Veh);
(commander _unBMP_1Veh) disableAI "ALL";
_routeBMP_1 = []; //Cut because overflow
[_unBMP_1Veh,_routeBMP_1,[_unBMP_1Veh,"unitPlayDone"],true] spawn BIS_fnc_unitPlay;
_forwardHandle_1 = [driver _unBMP_1Veh] execVM "scripts\moveForward.sqf";
//--------------------------------
// Move Forward Script
//--------------------------------
params ["_driver"];
while {true} do
{
_driver sendSimpleCommand "FORWARD";
};```
disableAI "ALL" prevents the commander from audibly issuing the command.
I don't remember how to make sendSimpleCommand work though.
Generally they get the order and they ignore it.
Maybe it was broken in a patch. I definitely had it working a few patches back.
Yeah, I also thought I had that working once. The disableAI "ALL" was just a desperate try, you know, when you used all your braincapacity and then just do stuff because maybe it works ^^.
LEFT/RIGHT do actually stick, or at least show up in vehicleMoveInfo. The other one is always STOP
I did wonder if the AI was countermanding the order afterwards but there's not even one frame where it changes from STOP.
Regarding enableDynamicSimulation. It HAS to be run on server. Regardless where object is local
Could this get server only tag, as it has no useful effect on any other machine?
To bad. unitPlay in combination with sendSimpleCommand was really useful when it came down to scripting some events or cutscenes, but it looks so shitty without it. Damn.
Do you happen to know any other usable way to script vehicle movements besides driveOnPath? SetDriveOnPath is nice, but only if nothing is around them (like OPFOR or Civs). They touch one and they go crazy.
Usable is a stretch for any of these.
I think Leopard had sendSimpleCommand working. Maybe he'll show up at some point.
This did roll backwards fairly plausibly, but it'd take a fair amount of work to get it doing anything useful:
{ _x disableAI "ALL" } forEach crew mrap;
mrap disableBrakes true;
mrap engineOn true;
mrap setVelocityModelSpace [0,-2,0];
huh, tried that on a Panther IFV and the thing kept rolling backwards forever :P
well in regards to the recording thing i mentioned a while back - i've managed to optimize it enough to the point where the capture per unit is much smaller and i'm not getting the crash anymore; and have managed to successfully "replay" 5 minutes of a mission - horray
(now it's the shiny object syndrome in me wanting to try using this data with an ML algorithm to see if i can't make AI units act more like players lmao)
you can get it to work but it's useless because of significant delays
That's what I was trying to determine, but I couldn't convince it to do anything at all.
there was a way to stop it but I don't remember off the top of my head. maybe doStop?
sendSimpleCommand takes vehicle as parameter, not driver. also id imagine the correct use isnt to call it too often but put some sleep in the loop. like 3 seconds or so
i just tested the command and it looks like it only works if player is on commander seat of the vehicle
doesn't have to be the player
iirc I did it with agents
humm with marshall that was the only way i got it working (With "normal" units)
Okay, this does not work
The command returns only local connections.
https://community.bistudio.com/wiki/UAVControl
What is a "local connection"?
Adjusting a script that sends a message to the pilot/driver of a vehicle to also work for drones, so that the drone's controller gets it (whether they're currently controlling it or not)
I'd rather say, what are "not local connections"?
I think it refers to the command being local-arg
The wiki even has a link to what it mean
Wiki has it as global arg though
That just links to the local command page though, and there isn't anything about drones on there
That detail was added by KK just a couple of days ago. Maybe you could ask him what it means.
@unique sundial ?
Does seem to be local arg like Dedmen said, testing in LAN and server returns [objnull, ""] while connected client returns [me, "DRIVER"]
Also running into an issue where a player connects to a UAV, but hasn't taken control of it
Meaning the server (or whatever other machine) still owns it, but I'm not sure how I can get which player(s) are connected to it other than just running it on every machine and checking if they're connected
Also local arg, needs to run on the player that controls the uav
My mistake, the command actually is borked, it should return all terminals connected but it only returned first person found
Basically this is kinda true for when terminal is connected to the uav but the player is not controlling it, gonna fix that
Yeah I had to use a workaround for now by sending it to all players and filtering by getConnectedUAV
Greetings, I've been searching but can't find something precise on the Wiki, is there a command that return when a player is in collision with an object and if yes can it return the object its in collision with ? All I can find is either nearestObjects or doing it manually with the boundingBoxReal command and do a AABB detection.
No, there isn't an SQF command to do an engine collision check for some reason. So you have to do godawful bounding box and nearestObjects checks where at best it works 99% of the time.
thanks ! I image the player bounding box is not a classic brick like most games and I have to invoke some trickery like you said ?
I'm not sure. When I'm working with units I'm trying to spawn them well out of contact, so their shape doesn't matter.
It is a semi-capsule, its just that there simply isnt a collision event exposed to sqf
There is one for physx objects but players aint that
For physX objects there is an event which you could theoretically trial & error with. But yeah, nothing for units.
Also depending on the size of the object involved you may need to be generous with your radius for nearobjects
I.e player touches a 30 metre wide building - nearobjects needs to be 30 metres to catch it and grab that bounding box
You want raycasting for buildings.
Tbh youre probably better off just building a raycast grid around the unit and detecting that way
Worst case is trees where the object center isn't aligned with the trunk.
Need a lot of rays to catch them, and the nearObjects doesn't work at all angles.
yeah, if you're only doing it for a player, and it runs on their machine, you can comfortably do a few dozen raycasts without much of a performance hit (esp if you use the multithreaded method)
if you wanna do it for every unit that's another can of worms, might want a headless client designed solely to run raycasts π
You can Multithread scripts ? I thought that was impossible.
I'm gonna be honest I think I'm way over my head here xD, all of the very basic raycast knowledge I have is only coming from, people who explain the original Doom Engine, and sebastian lague's videos.
Even more when talking about Headless clients, always been a mystery to me.
I don't think trees are horrible to deal with. What trees don't have center aligned with trunk? At least closely
no that's only for some commands, like lineintersectssurfaces' alt syntax which is multithreaded
I did not write down the model name. But it is a thing.
raycasting in SQF just means running a command that looks for surfaces along a line that you specify the start and end positions for.
The engine does the hard part :P
depending on your use case, at least to help with trees, you could for example just raycast from slightly above the position of the unit, upwards 2 metres (recalc depending on stance) and outwards maybe 1 metre, and have it really dense as opposed to raycasting a cube that fills the "volume" - already you get a lot more leeway with density
but that method has the issue of not detecting collision properly if it happens very low to the ground (player collides but raycast says nothing) - i used this method only for cases where i once disabled collision on a unit and did collision detection and "pushing" manually - worked welll
would be nice if line intersects was capable of using the GPU to cast the rays 
but i imagine that'd be a whole nightmare to do properly
For trees I get their radius and multiply it by 0.2. It gives me size of trunk, at least roughly. For smaller trunk it's larger, but for large tanoa trees it's quite accurate
Thanks to all of you for you help and knowledge, it gave me some ideas. I'll see if I can use this for my use case. Otherwise I might just move on from collision detection till a moment where i'm more comfortable with more complex problem ^^.
Branches at the bottom of spruce trees don't have any collision
You can just walk through them
cant think of a scenario when you'd ever even interact with those or see them lol
(well, see them sure, when the tree falls, but at that point there's no collision on the entire tree anyway)
OK the note is correct, when it comes to showing connected terminals it can only show local terminals. I will explain it better I guess on the wiki. To return remote connections it will need some sorcery and I might look into it later
https://community.bistudio.com/wiki/UAVControl feel free to make it more clear if needed @winter rose
Can datalink detect projectiles or units only? i want to add one to one of my vehicles (projectiles means rpg rockets and etc)
I'm wondering. Is it possible with a script to get the specific door in a building the player is looking at?
And maybe even it's location in worldspace?
Ace does that for their door opening keybind iirc
https://github.com/acemod/ACE3/blob/master/addons/interaction/functions/fnc_getDoor.sqf
Yeah they do some camera position logic
thx, ill check it out
How can I make subtitles like the ones in the SOG CDLC
Probably what I was looking for, I will check later today
Trying to make an AI place a backpack-deployed static weapon, tried doing _this action ["Assemble", backpackContainer _this]; and the unit played the gesture but didn't assemble a weapon. The Disassemble action works fine
Wiki only has the example, no other data
https://community.bistudio.com/wiki/Arma_3:_Actions#Assemble
Does the unit's backpack contain the weapon itself?
Is the unit near to the backpack with the tripod?
Does the unit's backpack contain the weapon itself?
It's the vanilla style deployable weapons, i.e. you scroll wheel, select "Deploy xyz", and then the backpack is removed and the weapon is deployed in front of you
Is the unit near to the backpack with the tripod?
They're wearing it, hence thebackpackContainer
