#arma3_scripting
1 messages ยท Page 191 of 1
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting here is a good starting point.
Okey I'll do it, thanks !
well, start working in one good and well made mission first lol
Thanks, I thought ai could help me but it's triggering me more
Using AI for SQF is 95% hallucination. better off just searching for examples or browsing the SQF scripting commands on the wiki
Okey I didn't know ! Gotta learn then
any scripts that allow players to build, public zeus compatible?
Back again with the dogs, seems they get stuck in the waitUntil loop but I can't think of a way to more consistently make sure they've reached the waypoint or just assign them a new waypoint if they were unable to get to it
[_dogs select _i] spawn {
params ["_dog"];
private _grp = group _dog;
private _animMovement = ["Dog_Walk", "Dog_Run"];
private _animStop = ["Dog_Stop", "Dog_Sit"];
while { alive _dog } do {
try {
_randomPos = [] call randomDogPos;
private _wp = _grp addWaypoint [_randomPos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointSpeed "LIMITED";
_wp setWaypointBehaviour "CARELESS";
_dog playMoveNow (selectRandom _animMovement);
[[sideLogic, "Base"], format["%1 new move order %2", name _dog, _randomPos]] remoteExec ["sideChat"];
waitUntil { sleep 0.5; _dog distance2D _randomPos < 3 };
deleteWaypoint [_grp, currentWaypoint _grp];
[[sideLogic, "Base"], format["%1 completed move order", name _dog]] remoteExec ["sideChat"];
_dog playMoveNow (selectRandom _animStop);
sleep ([15, 60] call BIS_fnc_randomNum);
} catch {
[[sideLogic, "Base"], format["%1 messed up, exception: %2", name _dog, (str _exception)]] remoteExec ["sideChat"];
};
};
};
Once in a while they get a waypoint which should be totally manageable but for some reason they can't do it or something so it just ignores it and walk in a straight line and they're stuck in the waitUntil because they never reach it
Really not sure what I can do to avoid that
Never really played around with waypoints so take this with a grain of salt but could currentWaypoint be of use?
Actually yeah that might help, it seems when they're unable to path to the waypoint, the waypoint position is set to [0,0,0], so I can make a failsafe to exit the waitUntil loop
see if pathCalculated EH helps
hello! I'm having issues with setAirplaneThrottle.
Here is my code:
_vehicle = vehicle player;
[{
params ["_args", "_idPFH"];
_vehicle = _args select 0;
_vehicle setAirplaneThrottle 1;
if (speed _vehicle > 20) then {
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
}, 0, [_vehicle]] call CBA_fnc_addPerFrameHandler;
It is loosely inspired by how ACE handles cruise control in ace_vehicles_fnc_autothrottle.
My problem is that my code appears to have zero effect on how the car throttles.. I'm not sure what I'm doing wrong, surely ACE uses the same setAirplaneThrottle command? What am I doing wrong?
Please disregard, this command seems to only be used on planes.
In fact, there is a vanilla command for cruise control:
https://community.bistudio.com/wiki/setCruiseControl
how does one call a script at start of mission?
Use init.sqf
make a file called init.sqf in the mission folder and then use that to call my script?
yeah but I want my script to be called at startup
Then it is
[] execVM "Scripts\briefing.sqf";
//or
[] execVM "briefing.sqf";
cool cool
so ive been experimenting with unit capture and i got it to work fine when the trigger is called locally via an addaction running the trigger. however im having an issue with it where it only runs the unit capture playback for the person who ran the addaction. how would i go about with making sure that when the trigger is run the playback is run for all clients?
here is my code:
On Laptop
this addaction ["Call in Pickup",{Trigger_Con = true; publicVariable "helitrig1";}];
On trigger condition:
Trigger_Con;
On trigger activation:
nul = execVM "go_Unit1.sqf";
nul = execVM "go_Unit2.sqf";
nul = execVM "go_Unit3.sqf";
inside the sqfs are just the capture data from each aircraft
Triggee_Con is not helitrig1
and get rid of the nul = stuff also
and do this
[] execVM "go_Unit1.sqf";
[] execVM "go_Unit2.sqf";
[] execVM "go_Unit3.sqf";
that nul = and 0 = stuff was from way back when the game used to mess up,,,, thats been fixed for years and years now
You can also remove the [] so just:
Its a bit faster but not enough to make any diffrence.
execVM "test.sqf";
Either way, it doesn't matter
agree
so will doing all this get the trigger to run on all clients at once?
because the playback has only been able to be seen by the person who run the addaction for some strange reason
well what i would do is make a script, with all the stuff in the script, that i need, then exec it from the trigger and i would wrap the code in this```sqf
if (hasInterface) then {
//some code here
// run on all player clients incl player host
};
options also
//Server Only Run
if (!isServer) exitwith {};
//some code here
//Client Only run
if (!hasInterface) exitWith {};
//some code here
if (!isDedicated) exitwith {};
//some code here
//-----------------------------------------------------------
if (isDedicated) then {
// run on dedicated server only
};
if (isServer) then {
// run on dedicated server or player host
};
if (hasInterface) then {
// run on all player clients incl player host
};
if (!isDedicated) then {
// run on all player clients incl player host and headless clients
};
if (!isServer) then {
// run on all player clients incl. headless clients but not player host
};
if (!hasInterface) then {
// run on headless clients and dedicated server
};
if (!hasInterface && !isDedicated) then {
// run on headless clients only
};
You dont even need a trigger you can just do this:
this addAction
[
"Call in Pickup",
{
params ["_target", "_caller", "_actionId", "_arguments"];
["go_Unit1.sqf"] remoteExec ["execVM",[0,-2] select isDedicated];
["go_Unit2.sqf"] remoteExec ["execVM",[0,-2] select isDedicated];
["go_Unit3.sqf"] remoteExec ["execVM",[0,-2] select isDedicated];
},
nil,
1.5,
true,
true,
"",
"true",
5,
false,
"",
""
];
Now this will execute on server and client or each client depending is it hosted mission or dedicated server.
Now if you see duplication with multiple people then you would need to exectue it once on server and it should work.
I dont know on top of my head is it enough to execute it once on server or do you need to execute it for multiple clients. But its a easy fix if you see duplication.
Can I remoteExec these lines of code on one specific client in one remote call somehow?
private _marker = createMarkerLocal ["inspection_point", getPos _x];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "mil_warning";
_marker setMarkerTextLocal "Inspection Point";
_marker setMarkerColorLocal "colorIndependent";
private _areaMarker = createMarkerLocal ["inspection_point_area", getPos _x];
_areaMarker setMarkerShapeLocal "ELLIPSE";
_areaMarker setMarkerSizeLocal [OB_inspectionMarkerSize, OB_inspectionMarkerSize];
_areaMarker setMarkerColorLocal "colorIndependent";
Wrap everything into {} and remoteExec"call"
I get this error but I should be providing 2 elements?
_x invalid?
Shouldn't be, in the same loop _x is used to set the _objName and then sent in sideChat
private _objName = format["%1%2", toUpper ([vehicleVarName _x, 5, 5] call BIS_fnc_trimString), ([vehicleVarName _x, 6] call BIS_fnc_trimString)];
[[east, "Base"], format["Officer, please head to the %1 objective for inspection before the round timer reaches %2 or face a penalty.", _objName, [OB_matchTimer+OB_inspectionTimeLimit, "MM:SS"] call BIS_fnc_secondsToString]] remoteExec ["sideChat", OB_hvtTarget];
Would it be better if I defined ^this as a function for each player? Like createInspectionMarkers = {}; and then remoteExec that function?
well if you remoteExecCall the code without _x being defined in the code it makes sense that _x is nil
You mean that _x isn't defined on the client recieving the call?
yeah
Hmm yeah that's very likely
No way to set the value before sending it to the client?
Save the _x to another variable and send that one to the client?
it should be possible... ```
[args,code] remoteExec ["call"];
Or if you need the position only, save the value e.g. like this _inspectionPointPos = getPos _x; and then use it as is: createMarkerLocal ["inspection_point", _inspectionPointPos];
This... works but if I could use args instead somehow, that'd be nice
OB_inspectionPoint = _x;
publicVariable "OB_inspectionPoint";
[{
private _marker = createMarkerLocal ["inspection_point", OB_inspectionPoint];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerSizeLocal [0.5, 0.5];
_marker setMarkerTypeLocal "mil_warning";
_marker setMarkerTextLocal "Inspection Point";
_marker setMarkerColorLocal "colorIndependent";
private _areaMarker = createMarkerLocal ["inspection_point_area", OB_inspectionPoint];
_areaMarker setMarkerShapeLocal "ELLIPSE";
_areaMarker setMarkerSizeLocal [OB_inspectionMarkerSize, OB_inspectionMarkerSize];
_areaMarker setMarkerColorLocal "colorIndependent";
}] remoteExec ["call", OB_hvtTarget];
Edit: whoops forgot the code...
Not sure how I use the right argument tho
was other way around^
Do you know how to use the args?
like this: ```
[777,
{
params ["_x"];
systemchat (str _x);
}] remoteExec ["call"];
That's handy
If I wanted to send two arguments, it would be like this right?
[[arg1, arg2],
{
params ["_x","_y"];
systemchat (str _x);
}] remoteExec ["call"];
Yes. remoteExec'ing it is not so different with regular ones
Just "network compatible" variant, you still need to pass args like that
Works! Thank you guys :)
Idk if it's cause I'm testing using local MP server and that it's not on dedicated server but everything works EXCEPT the messages and markers I want shown to only one specific player is visible to all..
This is all handled server side:
// Chat example
[[east, "Base"], "You successfully inspected the asset before the time limit, please await your next inspection order."] remoteExec ["sideChat", OB_hvtTarget];
// Marker example
[
[_x, OB_inspectionMarkerSize],
{
params ["_inspPoint", "_inspAreaSize"];
private _marker = createMarkerLocal ["inspection_point", _inspPoint];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerSizeLocal [0.5, 0.5];
_marker setMarkerTypeLocal "mil_warning";
_marker setMarkerTextLocal "Inspection Point";
_marker setMarkerColorLocal "colorIndependent";
private _areaMarker = createMarkerLocal ["inspection_point_area", _inspPoint];
_areaMarker setMarkerShapeLocal "ELLIPSE";
_areaMarker setMarkerSizeLocal [_inspAreaSize, _inspAreaSize];
_areaMarker setMarkerColorLocal "colorIndependent";
}
] remoteExec ["call", OB_hvtTarget];
OB_hvtTarget being the specific unit that I want to be the only one able to see them
OB_hvtTarget not supposed to be local? to the player i mean
Nah OB_hvtTarget is a global variable, the value of OB_hvtTarget is the unit of a randomly selected OPFOR player
And it's broadcast with publicVariable "OB_hvtTarget"; after it's been set
yes i know its a global variable ๐
Doesn't this break it?
It's been working so far, I set and broadcast it before it's used anywhere
It's a pure PVP mission, all EAST side units are able to see the messages and markers.
I only want the chat messages and markers visible to OB_hvtTarget and OB_hvtTarget is a randomly picked EAST player at the start of the match
ic
well if you run editor MP they are all local to you
only in dedi they would be local to the server i think
Idk if this will help, but I have a pvp with side missions for each team
https://github.com/PiG13BR/PIG-Air_Supremacy_PVP/tree/main
dont know if this is the best solution but you can pass OB_hvtTarget as one of the args and then do check if _OB_hvtTarget == player to see if player is the target object
might not be the right channel for this but how do i get my server to save mission progress on restart? if its running 24/7 i would like to keep the progress in the mission when it restarts
oh and thank you for the help with arsenal restriction it worked great @split ruin
@median perch didn't test it myself but you can try this, ready to implement framework
class CfgFunctions {
class TAG {
class Weapons {
file = "TAG_addon\functions"; // Set where your function files will be placed
class fired {}; // Compiles your function into a function named TAG_fnc_fired
};
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
TAG_yourAddon = "call TAG_fnc_fired"; // This runs your function whenever a unit fires
};
};```
```// \functions\fn_fired.sqf
// This is an example of a function header, telling you what parameters it recieves, who made it, and what it returns
// These aren't mandatory, but make development much easier
/*
* Authors: Your Name
* Plays a sound when a grenade is thrown.
*
* Arguments:
* 0: Shooter (unit or vehicle) (unused) <OBJECT>
* 1: Weapon (unused) <STRING>
* 2: Muzzle (unused) <STRING>
* 3: Mode (unused) <STRING>
* 4: Ammo (Unused) <STRING>
* 5: Magazine <STRING>
* 6: Projectile (unused) <OBJECT>
* 7: Gunner (unused) <OBJECT>
*
* Return Value:
* None
*/
params ["", "", "", "", "", "_magazine"];
private _sound = switch (_magazine) do {
case "TAG_yourMagHere": {
"AlarmCar";
};
case "TAG_yourOtherMagazine": {
"SomeOtherSound";
};
};
playSound _sound;```
continuing off my question from a few days ago a bit, the above script is what I was helped out with before. It does work, and it plays a sound when a grenade is thrown.
However, in multiplayer, the sound plays twice for the local player when you throw the grenade. Any suggestions on how to fix this?
how would i go about implementing this?
nevermind i found the section
@median perch just read the wiki https://github.com/gruppe-adler/grad-persistence/wiki and follow the instructions
Given a unit's config, what icons can I get associated with their role? I've got a 3D friendly icon handler and want to provide a visual role indicator, like how it's shown in the commanding menu:
I've checked out >> "icon" and >> "picture", but I think the former looks awkward as a 3D icon (filled circle and arrow) and the latter is only defined for a few classes (medic, engineer, explosive specialist).
Also a separate question that I'm not too worried about, what methods can I use to check if the camera is detached from the player besides cameraOn? That command returns the player even when in the zeus interface or a scripted camera (cameraEffect).
A small addendum to my question that's probably much more complicated - is it possible to actually get the position of the grenade at the time it detonated? So in other words, the FiredMan EH plays a sound when the grenade is thrown, but is it possible to have say, a lightning bolt strike at the position of the grenade when it detonates? I can't seem to find anything on this particular part.
Am I missing something here? This doesn't work on dedicated server for some reason
initPlayerLocal.sqf:
[player] spawn {
params ["_player"];
_player setVariable ["tf_unable_to_use_radio", false];
while { alive _player } do {
sleep 0.5;
if (incapacitatedState _player == "UNCONSCIOUS" && !(_player getVariable "tf_unable_to_use_radio")) then {
_player setVariable ["tf_unable_to_use_radio", true];
};
if (incapacitatedState _player != "UNCONSCIOUS" && (_player getVariable "tf_unable_to_use_radio")) then {
_player setVariable ["tf_unable_to_use_radio", false];
};
};
};
onPlayerRespawn.sqf:
[_newUnit] spawn {
params ["_player"];
_player setVariable ["tf_unable_to_use_radio", false];
while { alive _player } do {
sleep 0.5;
if (incapacitatedState _player == "UNCONSCIOUS" && !(_player getVariable "tf_unable_to_use_radio")) then {
_player setVariable ["tf_unable_to_use_radio", true];
};
if (incapacitatedState _player != "UNCONSCIOUS" && (_player getVariable "tf_unable_to_use_radio")) then {
_player setVariable ["tf_unable_to_use_radio", false];
};
};
};
Exact same code, just different passed parameter depending on which file it's in
I'm trying to disable the ability to use TFAR radio while the player is downed
hi! is it possible to restore fallen tress after they got damaged? I know how to restore damaged buildings, but trees ? thx!
i haven't really touched event handling with projectiles, but i think you'd want an Explode or Deleted handler on the projectile object:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Projectile_Event_Handlers sqf _projectile addEventHandler ["Explode", { params ["_projectile"]; private _group = createGroup [sideLogic, true]; private _module = _group createUnit ["ModuleLightning_F", getPosATL _projectile, [], 0, "CAN_COLLIDE"]; _module setVariable ["BIS_fnc_initModules_disableAutoActivation", false, true]; }]; (i'm not sure about creating lightning like this either, but it seems to work)
do HashMapObjects support a kind of pseudo Super for method overrides?
no. you can use the base tho
is there any case where I should use execVM over defining a function and using call/spawn etc
no
if you just want to test something maybe
or if it's just something that you run once or twice
no. you have to recreate them
in Arma you can't "revive" something once it's dead (a fallen tree is a dead object)
i know this is a dumb question, but is there any other site or resource for scripting help when the website is slow or doesn't respond? aka a clone of https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands
๐ซก ty
Is there some condition I can use to check if a unit is in any arbitrary vehicle? in [vehicle] looks like it needs a known vehicle to work; I just want to filter out in-vehicle units from an array.
vehicle _unit == _unit or isNull objectParent _unit
Looks legit, besides the fact that I don't see _newUnit defined anywhere
So in context, tacking it on to the end of this working filter like so should do the job?
_groupFlareUnits = (units _group) select {alive _x && ([_x] call B47_fnc_WZ_GetFlareAmmo) isNotEqualTo [] && (vehicle _x) == _x};
or is there a potential reason I should use isEqualTo instead of ==
Not in this case, no.
I'm not sure if this is a bug or not, but when using the addRating command on the server side after getting the player object, it doesn't update the player rating. Here is the function:
params ["_uid"];
private _player = objNull;
{
if ((getPlayerUID _x) isEqualTo _uid) exitWith { _player = _x; };
} forEach allPlayers;
_player addRating 100;
Using this same function I'm able to get the player rating just not set it
you gotta run addRating on the client where player is local. Local argument, global execution.
https://community.bohemia.net/wiki/addRating
Local ARGS.
Ah , hypo was there before me ๐
okay yeah i didn't know about this, and this was the solution lmao, many thanks 
@broken forge server means its MP game? In this case is better to use addScore and addScoreSide, they use gloabl argument and execution is global too
is there any command like set acc time for multiplayer? or would one have to slow every animation and vehicle manually?
Simulation time cannot be changed in multiplayer.
_newUnit is a default parameter for onPlayerRespawn.sqf
The information is provided as part of the _this array. It's not parsed into a variable called _newUnit unless you use params or select to do so.
I'm looking for arma 3 commands/functions that relay the ETA and spread of an arty/mortar shell before firing. Basically the information in the artillery computer UI. Anyone here that can push me in the right direction?
Thx!
Is there also a function for spread info?
you can get the _shell and put a projectile Explode EH to get position (where the shell landed) https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Explode
Yeah but that is after the shell has fired. Which isn't what I'm looking for
what are you trying to achieve?
I'm making a BF2 look-a-like commander menu. Where HQ can order squads around with that menu. But also provide support like arty and such. Where arty is fired by AI, so I need the info from that Arty computer in the command UI
But if it isn't possible, then I'll just leave the spread out and yolo it ๐
so you want precise strikes?
do you need the spread out info for what?
markers?
No precise strikes. It will pop a marker on the map, which is the requested position. But maybe a circle around that, which has the radius of the spread
Something like that... how exactly is still in consideration
oh, that, well I just tend to put 75x75
I mean, if there's something to get spread out before firing xD I'm all ears
Thx for sharing. I already had my own firearty script. But it always helps to see others approach ๐
Haha yeah, maybe that's the fastest way. Max spread I've encountered was around 270 meters on altis orso... so 150 would be decent on average
This is my GUI in game, see if there's something that helps you.
https://www.youtube.com/watch?v=Zm9aRIA88gQ&t=1s&pp=ygUZZ3VudGVyIHNldmVybG9oIGFydGlsbGVyeQ%3D%3D
Thx for sharing! Looks good. Mine will be a little different. From the Map display itself
np, I had nightmares with AI arty, but it's now solved haha
The joy from solving these "nightmares" can be somewhat addictive though ๐
oh yeah lol agreed
i am trying to cut grass from large areas. I have set up a way that spawns bunch of grass cutters and then removes the grass cutters becasue having hundreds of them seems to lag the game.
However if i enter area later the grass is there
apparently cutter has to be there when i load the area or something?
Any idea how i could approach this without having to spam hundreds of grass cutters over time of mission?
use the largest cutter obj "Land_ClutterCutter_large_F" and use createSimpleObject to create them. the grass cutters must stay for it to work. thats the only way i know of
You can mass create it via script. Or you may try setsObjectScale
you got any guesstimate on how much better it is for performance?
instead of spawning shit ton of grass cutters just use:
setTerrainGrid 50;
for each person
https://community.bistudio.com/wiki/setTerrainGrid
scale didnt work
what happens here?
it removes the grass if you want to re add it just set number to lower value. Note its Local Effect.
does the resolution make cutters chonk bigger pieces?
Grass rendering is done locally for each player in a radius of +/-200 meters. Maybe attach the cutter obj to the player (in front because you wont see the rear of course). Though I dont know if it would work or be performance intensive. You should test it out
the issue is that im trying to make mud. Where grass exists or not actully matters for players and it should have limits to differ from regular terrain
this doesn't only remove grass but also the map detailed ground
Grass cutter dosent update as the player moves around.
ah, check
i also thought about creating cutters dynamically around player in grass render distance but there doesnt seem to be way to find it either
then maybe an on eachFrame script locally to the player with spawning and removing it. But that isn't really practical xD
As I said, you can really just mass create the cutter
i already did and it did cause quite a bit of lag
Hm
areas i needed would require several hundreds of them
any idea how hard it would be to mod a bigger one?
for "_x" from -500 to 500 step 25 do {
for "_y" from -500 to 500 step 25 do {
private _cutter = createVehicleLocal ["Land_ClutterCutter_large_F",getPos player vectorAdd [_x,_y,0],[],0,"CAN_COLLIDE"];
_cutter setObjectScale 15;
};
};```It actually works very finely to me. Performance is no change also
I ran into this issue earlier too trying to set grass cutters larger
This is not the issue from vanilla game
what is that step portion at beginning you do in the script?
Oh wait, yeah it is
aha, ill try to see if i catch what of my mods it is
does grass cutter have colllision?
i was kinda baffled when this first happened to me before too
You can try hideObject cutters then
and createSimpleObject becuz createvehicle breaks AI pathfinding
halipatsui โ 19.06
the issue is that im trying to make mud. Where grass exists or not actully matters for players and it should have limits to differ from regular terrain
@chrome hinge wot ? ๐ตโ๐ซ
the visuals work decently nice from distance but when you get close grass covers the mud often
and up close
still you can completely remove it by provided command, why not using it ?
it removes all grass?
yes, completely, for each player
its probably what i have to do if nothing else works yeah. but if i can have both grassless mud and normal grassland id rather find way for that
you want no grass only where "the mud" is ?
yeahh, grass is apparently "clutter"
With createTrigger how do you make it only server handled?
I guess set the third parameter to false, and then only call setTriggerStatements on the server.
moved to GUI channel @granite sky
How would I set/get the variable name of a trigger created with createTrigger? Like how you do on a trigger in the editor
The command returns trigger object, assign it to a global variable.
If I wanted them numbered via a for loop, how would I do that?
for "_i" from 0 to _numOfDogs-1 do {
private _dog = _dogs select _i;
private _trgName = format["trig_guard_dog%1", _i + 1];
_trg = createTrigger ["EmptyDetector", getPos _dog, false];
_trg setTriggerArea [50, 50, 0, false, 20];
_trg setTriggerActivation ["WEST", "PRESENT", true];
_trg setTriggerInterval 0.5;
_trg setTriggerType "NONE";
_trg setTriggerStatements [
"x",
"x",
"x"
];
};
So I'd want the value of _trgName to be the variable name of the created trigger
I'll give it a shot, thank you
But I'm not sure you need these vars.
addGoggles doesn't do nightvision, what does?
linkItem
Im pretty new to scripting in arma (3) and i am looking to have a system that does the following:
Player puts ItemX into a vehicles inventory
Vehicle consumes/deletes ItemX
Vehicle spawns ItemY in its inventory (or bonus points if it puts ItemY into a nearby box)
Would like it to be repeatable
Hi, what'd be a good way to script a moving vehicle marker on a vehicle that gets deleted when it gets destroyed?
The variable for the vehicle would be _this
There's this, but I'm not sure if the container version is accurated documented: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Put
I'm mainly asking what I should do to make it track, what's the most efficient loop system in 2025 for a while do-style loop, if I should use that or a PFH instead
Depends how frequently you need to update.
If every second is fine then use a while + sleep. If you need it to be more accurate then client-side EachFrame handler.
server-side EachFrame calling setMarkerPos is probably a lot of spam for a poor effect.
Every 0.1 or 0.5 seconds perhaps?
I also want the marker to delete when the vehicle is destroyed
Man, I hate that the forums are down rn
I'm looking for a simple script
How to add an incrementing number to setVehicleVarName
So for example, every time I spawn in a car via a script, it goes from car_1, car_2, car_3 etc
Not sure why you'd need forums for that.
Create & increment a global variable. Format a string with it?
_obj setVehicleVarName format["myVar_%1", _number];
how you come up with _number is up to you
Yes idk how to increment the number
Especially since I'm doing it in a mod module
It's like such a basic script that someone's definitely asked it before, I don't wanna ask and bother people while have to wait for an answer when I could just look it up on the forums
if (isNil "myTag_vehCount") then { myTag_vehCount = 0; };
_obj setVehicleVarName format["myVar_%1", myTag_vehCount];
myTag_vehCount = myTag_vehCount + 1;
It's such a basic script that you just write it :P
yeah this is one of those things that is so basic, that there a billion ways to do it. there's no right way, just the way that works for your current setup
Okay, that works
Thanks
Keep in mind I'm a very novice scripter
consider yourself one step closer
Right, thanks
_x linkItem "NVGoggles_OPFOR";
_x linkItem "NVGoggles";
_x linkItem "NVGoggles_INDEP";
No, you use linkItem
Which is what Nikko said just under their message
oh i missed that thx m8
you are right i remember now
thx @tulip ridge i forgot
its only addweapon for "binoculars";
i knew that, i just forgot sorry m8
thx for keeping me correct @tulip ridge
...apparently BIS_fnc_objectVar is already a thing and does it so much easier lmao
BIS_fnc_objectVar is a function, meaning it's just a wrapped-up package of the same kind of code we're all writing. You might find it enlightening to open it in the Functions Viewer and see what it actually does inside.
Fair point!
Now that I've gotten it to change it to something I want (e.g. myVehicle_1, myVehicle_2, etc.), how do I do the opposite and actually read the object varnames from 1 - to - infinite?
I'm reading it has something to do with forEach or for to but I'm not exactly sure how to implement it
Could I just do something like
{
_boughtvehicle = call compile format ["boughtVehicle_%1", _number]
_vehicleName = getText (configFile >> "CfgVehicles" >> (typeOf _boughtvehicle) >> "displayName");
} forEach _boughtvehicle;```
Well, some of that is correct. Not the forEach at the end though.
Can use missionNamespace getVariable instead of call compile but they'll both work.
If you want to store an array of vehicles then store an array of vehicles though. Don't bother with the varname stuff.
if (isNil "myTag_vehicles") then { myTag_vehicles = []; };
myTag_vehicles pushBack _obj;
Uhhh basically what I'm doing is I'm using the Simplex Support Services logistics module, I want a script to create a moving marker on every vehicle spawned by the module
The module itself has an init section but it fires on local I believe
Please check pinned post for your starting point
Hi, thanks, which one?
Top one
No. The top one
The one about ChatGPT? Or functions/remoteExecCall?
I did this code and it seems to work fine
//Does the script from "boughtVehicle_1" until "boughtVehicle_1000"
for "_number" from 1 to 1000 do
{
//Wait until a vehicle named "boughtVehicle_[number]" exists, then
waitUntil {sleep 1; !isNil (format ["boughtVehicle_%1", _number]);};
_boughtvehicle = call compile format ["boughtVehicle_%1", _number];
_vehicleName = getText (configFile >> "CfgVehicles" >> (typeOf _boughtvehicle) >> "displayName");
//Destroys the vehicle as confirmation that the script all works
_boughtvehicle setDamage 1;
};
}```
(Btw how do you guys make the code show colors?)
put sqf on the first line after three commas and then start typing code in next line
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
Thank you
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
How can I check if a unit is equipped with NVGs and remove them if so?
Was hoping https://community.bistudio.com/wiki/removeGoggles would do the trick but it says to use unassignItem, removeItem or unlinkItem to do it but I don't know how to identify if a unit has NVGs
hmd returns the currently used NVG
not sure if it works with headgear NVG
probably not
@split scarab You don't have to identify if a unit has NVGs,,,, just run the unassignItem anyway
But I need to identify what the item class name is first right?
In order to be able to remove it
I did what Leopard suggested but I believe it only detects equipped NVGs
_nvgs = hmd player;
if (_nvgs != "") then { player unlinkItem _nvgs; player removeItem _nvgs; };
But like, I can't just do this right?
player removeItem "nvg";
Or whatever
I have to "scan" the player to see what their equipped NVGs are or if they have them in their inventory
Then I can remove it
_x unassignItem "NVGoggles_OPFOR";
_x unassignItem "NVGoggles";
_x unassignItem "NVGoggles_INDEP";
That'll work for all modded NVGs as well?
you don't need to detect if some one has NVGs just get rid of them
yes. if you want unequipped ones, you must also iterate thru the items and find the ones whose type matches that of nvg
look at the config viewer of some nvg item to see what values it uses
ofcorse, i only use Vanilla Arma 3 so well you know
This works for all the NVGs that are within my mission
private _nvgs = items player select {
private _lower = toLower _x;
(_lower find "nvg" > -1) || (_lower find "pvs" > -1)
};
nice
I think using isKindOf is more reliable way.
can lag cause serverTime not to update?
getting weird load phase times when time it takes is ~2 seconds but (serverTime - lastLoadPhasechangeTime) is never above 1
I've tried looking, maybe not hard enough but. Is there any way to download poseidon tools now that the forum is down or is there a better alternative?
params ["_curator", "_entity"];
systemChat "Object Placed!";
hint format ["You placed: %1", typeOf _entity];
}];```
For some reason the following is not working, I am opening the debug console and executing local, then placing a module, but I am getting nothing. Any ideas why?
That EH is for curator module not player
For what purpose
is it possible to disable/deactivate the flashlight while in spectator mode? (the flashlight when pressing L button)
The curator is zeus correct?
Yes
Ok so the EH needs to be added to the Curator module instead of the player, thank you makes sense!
can playSound3D just not work in junction with CfgSounds ? seem to be having a weird one with this.
I want to modify a mod, figured I would need it. Been trying to ask the creator for permission and while waiting for an answer I figured I might get the software I would need and stuff
ah alright. I used say3D in the past lol so I was confused about using playSound3D. say3D did take in CfgSounds so I guess I got confused at that part
Just look at the wiki
https://community.bistudio.com/wiki/playSound3D
If you're just making a config patch (i.e. you're making a mod that just patches the original, not reuploading content), you don't need permission to do so
E.g. original mod has:
class CfgPatches {
class OriginalMod { ... };
};
class CfgAmmo {
class SuperStrongBullet { hit = 100 };
};
You can just make your own mod that modifies the classes from the original
class CfgPatches {
class YourPatchMod {
requiredAddons[] = {"OriginalMod"}; // makes your mod load after
};
};
class CfgAmmo {
class SuperStrongBullet { hit = 50 };
};
okay yea, thats really what im trying to do
Then you don't need permission from the other, just patch whatever config you want
If were you doing like a retexture of models from the original, then you will need permission to use, modify, and reupload textures from the original. Otherwise you would have to make textures from scratch and not use the original mod's textures to create yours
Just check the type of the item
#define TYPE_NVG 616
private _cfgWeapons = configFile >> "CfgWeapons";
// Note that items doesn't include your currently equipped stuff
// Use `hmd player` if you need the current nvgs that the player is wearing
private _nvgs = items player select {
getNumber (_cfgWeapons >> _x >> "ItemInfo" >> "type") == TYPE_NVG
};
right okay, and how can I get the files I want and actually modify them?
alr, just to be on the safe side how do I correctly extract and repack them when im done?
Use something like Addon Builder to build it into a pbo
That's all more #arma3_config related though, not scripting
ok, thanks man :)
how do I get a position 1 meter to the right of a unit relative to the direction they are facing? If someone could point me to the right function to use or has a code snippet that'd be appreciated.
this i think: origin getPos [distance, heading]
_thepos = (getPosATL player) getPos [1, getdir player + 90];
Unit modelToWorld [1,0,0]
oo so short
thanks!
how would one setup a 'camp' for players to interact with and create a respawn point/fast travel point? I've been somewhat planning out a ghost recon wildlands like setup and wanna do something similar to how camps are setup in that game; well more akin to breakpoint where you have to find the site and interact with it before it becomes an actual camp
*edit, if anyone responds please ping me so I notice your message ๐ posting this here now that I can see this chat
If you're creating the camps in like Eden, you can hide the objects for the camp itself and just have a single box that the players interact with
Then just use an action to delete the box and unhide all the camp objects
Then you could either make them respawns or have actions to teleport them to other camps, and make the condition check if something about the camp exists
ooo okay
Sorry if this is a very basic question but how do I set a limit to how long this is in effect? Say I want the unit to fire for 5 seconds and then stop.
tracerMan doSuppressiveFire tracerTarget;
Sleep for 5 seconds and stop him
right... so how do I stop him?
try doStop, not sure
Based on what I found on the BIKI doStop just stops the unit from moving, not firing.
so that would look like this?
tracerMan doSuppressiveFire tracerTarget;
sleep 5;
tracerMan doSuppressiveFire objNull;
yes
regarding event handlers, do i need to pass variables and functions to it if i want to use them, like with spawn?
this sadly did not work :/
could always disable ai weapon fire feature for a moment, no?
you speak wise words (I hope)
only mission event handlers support args
for other events you can set a variable on the object that you add the EH to, and read it in there
aha, excellent. thanks
EH wiki has quite a bit of info, had me dumbfounded ๐
where do you run it from?
this seems like it will work, the unit this is working on will never be seen so it does not need to have simulation on when not necessary
tracerMan enableSimulation true;
tracerMan doSuppressiveFire tracerTarget;
sleep 5;
tracerMan enableSimulation false;
im not super familiar, what do you mean?
this is part of a larger script run in a while loop
e.g trigger activation statement, init.sqf, using execVM, spawn, etc
the reason I asked is that sleep only works in scheduled environments, and I figured you were not in one
that's scheduled yeah
Hi ! I have a quick question on unit capture. I have a car that use UnitCapture, the thing is when using the UnitPlay, it cut the engine off even if I try to force it, so the car is just sliding without sound, just the sound of the tires on the road.
@drifting dome this worked for me but i dont know if it messes up the AI ๐ ```sqf
tm doSuppressiveFire tt;
sleep 2;
tm doWatch objNull;
A bit late, but thanks for this! I think I've entirely got my custom grenade working now thanks to you.
The capture only captures the positions. Not the engine sounds. It's why it works "better" with aircraft. How are you trying to force it?
Kinda stupid question but i could not find any decent info, let's think of this code:
//info gotten from a display gui
_armatak_short_address = ctrlText 999995;
_armatak_port = ctrlText 999996;
_tak_server_fulladdress = _armatak_short_address + ":" + _armatak_port;
// This codeblock MUST run on serverside
{
[{
_syncedUnits = missionNamespace getVariable "_armatak_marked_units";
// DO SUPERCOOL STUFF WITH SQF
} forEach _syncedUnits;
}, 2, []] call CBA_fnc_addPerFrameHandler;
}
- How can i make a local call from this script (let's think as a admin logged zeus running a zeus module) run the last codeblock as serverside?
- Does the
_syncedUnitsif update will be also updated inside the CBA_fnc_addPerFrameHandler block?
i am a absolute beginner at coding arma 3 and i am looking to create ambient threats that spawn in addition to the ones from antistasi ultimate where should i begin? I was thinking of patrolling heli's that moved between towns and also foot patrols on the road and spawn from small patrol base's like in vietnam.
any help is welcome just need to know were to start.
CreatevehicleLocal in a MP setting makes the object only visible to the owner or it just prevents it from transfering ownership to the server/different client?
Neither (well technically the first but not full truth) the object only exists on the machine where it was created
So a player A runs the code, player A can see the object, player B thinks player A is a schizo? Or player B sees the object but cannot interact?
First
The object wouldn't exist at all for player B
Thank you, this gives me ideas to troll rule breakers
For my use I ended up realising that simply enabling and disabling simulation was good enough, but thank you for the help!
class CfgPatches
{
class AAIR_A3A
{
name = "Ambient Air โ Antistasi Ambient Threats";
author = "YourName";
requiredVersion = 2.12;
requiredAddons[] = { "CBA_Main" }; // loads CBA first
skipWhenMissingDependencies = 1; // wonโt error if Antistasi missing
units[] = {};
weapons[] = {};
};
};
// Register your functions as before
class CfgFunctions
{
class AAIR
{
tag = "AAIR";
class Main
{
file = "\AAIR_A3A\fnc";
class fn_settings { preInit = 1; };
class fn_initPatrol { postInit = 1; };
class fn_spawnPatrolForSide {};
class fn_initRoadPatrol { postInit = 1; };
class fn_spawnRoadPatrolForSide {};
class fn_initConvoy { postInit = 1; };
class fn_spawnConvoyForSide {};
class fn_initMortar { postInit = 1; };
class fn_spawnMortarForSide {};
class fn_initQRF { postInit = 1; };
class fn_spawnQRFForSide {};
};
};
}
// *** NEW: force your init scripts to run for every mission ***
class Extended_PreInit_EventHandlers
{
class AAIR_RegisterSettings
{
init = "call AAIR_fnc_settings";
};
};
class Extended_PostInit_EventHandlers
{
class AAIR_GlobalInit
{
init = "[] call AAIR_fnc_initPatrol; [] call AAIR_fnc_initRoadPatrol; [] call AAIR_fnc_initConvoy; [] call AAIR_fnc_initMortar; [] call AAIR_fnc_initQRF;";
};
};
here is my config i keep getting that arma can't find my fn_setting.sqf
Don't put fn_ in the name of the function class in CfgFunctions. The game automatically looks for a file called fn_whateverYouCalledIt.sqf, so if you do that, it will try to find fn_fn_settings.sqf
ok thanks
Also, you're running these functions with the BI pre/postinit systems and with CBA's pre/postinit EHs, so...twice. Probably should just pick one way of doing it.
Also #arma3_config
pinging my question one last time since I've still yet to figure it out. The script works fine, but in MP, the sound always plays twice for the local player when they throw the grenade (even though it only plays once when someone else throws it). Only thing I've changed here is using playSound3D over just playSound, with the source of the sound being player.
I'm guessing the sound stacks for the local player for each additional "player" in MP but I'm not really sure how to get around this. It's also peculiar that the local player only hears the sound once (as intended) if someone else actually throws the grenade.
One thing that stands out is that the EH is probably being added on all machines, and subsequently firing on all machines. Since playSound3D is global effect, this will cause duplication.
For the same reason, you shouldn't use player as the sound target, because that will refer to the player of the machine where the EH fired, not necessarily the player who actually fired the shot. Adjust your params to give you the shooter object as a variable (first element in the params array) and use that instead.
You can also use the reference to the shooter object to make a protective check to fix the first issue. The EH will fire on multiple machines, but you can make every machine other than the actual shooter discard it, leaving you with just the one authoritative instance.
e.g.
params ["_shooter", ... ];
if !(local _shooter) exitWith{};```
Something else to watch out for, if you're doing this with players, is respawns. Object EHs persist across respawns, and CBA might add that Fired EH again each time they respawn (because it's a new unit being created, and I don't see any duplication protection for this in the CBA code). I could be wrong about this and CBA might actually account for this, but it's something to keep an eye out for.
I just turn the engine on before and after the unit play
Is there a better solution than UnitCapture for that sort of thing ?
With that, I think everything is fully functional now. Thank you! I usually work with models, and don't know much about this sort of thing, so I really appreciate how helpful everyone on this Discord has been with helping explain how stuff works. I didn't even know it was possible to check if an object was local or not, that's super useful.
Hi Guys! Does anyone know if its possible to invoke a SupportProvider module programmatically?
havent seen any documentation on it so wanted to double check here
taking a look yeah that might be the ticket, thanks for the quick response!
I am working on a custom support script that uses one of the new EF Hunters with the AT, variable name Truck2 and the weapon using "EF_Magazine_Titan_NLOS_2Rnd", I am going to have a custom support action added to the ingame command menu. Which is also part of the process, anyone willing to help out?
The idea is that similar to the vanilla support module, player would hit 0-8-1 select the Hunter (Orion 2) and the Hunter(AT) would fire a single missile at the Player's laser target.
Here's what I have so far
// Define the truck and weapon
_truck = Truck2;
_weapon = "EF_Magazine_Titan_NLOS_2Rnd";
// Define the target laser
_targetLaser = laserTarget player;
// Ensure the truck is in a position to fire
_truck doTarget _targetLaser;
_truck fire _weapon;
@warm hedge Do you know of a reason why I can't put scripts in a subfolder of a mission called Scripts? I try calling it from ingame and it cannot find it, though Sounds seems to work just fine.
You can do that just fine, you probably didn't update the path
Also use code blocks
```sqf
systemChat "hi";
```
vv
systemChat "hi";
Oh, thanks for that! It helps!
Heya
A simple question: i want to simulate mud and dirt for heavier vehicles etc
Like a mud season, road fill up with big holes, everything bogs down
Is there a mod for that or maybe a script? Like maybe with a invisible object placed on a road or whatever?
Would be cool if anyone has an idea.
My current idea is to use deformer and dirt piles with and just rougen up the terrain but thats a lot of work and also heavy for performance
wow that white code hert's my eyes ahhhhhhh
Praying that someone has a script that dynamically creates a curator for any player with a specific SteamID64, which works for both self hosted MP and dedicated server? And possibly where to put it?
Someone gave me this script to put in initPlayerServer.sqf but it doesn't work on dedicated server and on local it doesn't let me edit units by double clicking but does seem to work in pre-adding editable units/objects:
[[player], {
params ["_player"];
_adminArray = ["76561197981365461"];
if (getPlayerUID _player in _adminArray) then {
waitUntil { isNull (getAssignedCuratorLogic _player) };
private _grp = createGroup sideLogic;
private _curator = _grp createUnit ["ModuleCurator_F", [0, 0, 0], [], 0, "NONE"];
systemChat str _grp;
systemChat str _curator;
_curator setVariable ["showNotification", false];
_curator setVariable ["birdType", "", true];
_curator setCuratorWaypointCost 0;
_curator setCuratorCoef ["place", 1];
_curator setCuratorCoef ["edit", 1];
_curator setCuratorCoef ["delete", 1];
_curator setCuratorCoef ["destroy", 1];
_curator setCuratorCoef ["group", 1];
_curator setCuratorCoef ["synchronize", 1];
_curator setVariable ["Addons", 3, true];
_curator addCuratorEditableObjects [vehicles, true];
_curator addCuratorEditableObjects [(allMissionObjects "Man"), false];
_curator addCuratorEditableObjects [(allMissionObjects "Air"), true];
_curator addCuratorEditableObjects [(allMissionObjects "Ammo"), false];
[_curator, [-1, -2, 2]] call BIS_fnc_setCuratorVisionModes;
_curator addEventHandler ["CuratorPinged", {
params ["_curator", "_unit"];
private _zeus = getAssignedCuratorUnit _curator;
if (isNull _zeus) then {
unassignCurator _curator;
deleteVehicle _curator;
};
}];
_player assignCurator _curator;
};
}] remoteExec ["call", 2];
If they already have a curator then you don't want to add a second one at the same time, I guess, and then you can wait until they (theoretically) die or whatever
nvm read rest of the script ๐
You can't use waitUntil there though
when remoteExec'd, commands are executed in the unscheduled environment, which means no suspension. waitUntil is a suspension.
Either remoteExec spawn, or make a function and remoteExec that (functions are executed scheduled)
myb something like this not tested just on top of my head:
private _adminUids = ["76561197981365461"];
[_adminUids,{
params ["_uids"];
if(!isnull getAssignedCuratorLogic player) exitWith { systemChat "you are all ready a zeus";};
if(getPlayerUID player in _uids) then {
private _cruatorGroup = createGroup sideLogic;
private _myCurObject = _cruatorGroup createUnit ["ModuleCurator_F",[0,90,90],[],0.5,"None"];
_myCurObject setVariable ["showNotification",false];
_myCurObject setcuratorcoef["place", 1];
_myCurObject setcuratorcoef["delete", 1];
_myCurObject setcuratorcoef["Edit", 1];
_myCurObject setcuratorcoef["Destroy", 1];
_myCurObject setcuratorcoef["Group", 1];
_myCurObject setcuratorcoef["Synchronize", 1];
private _cfg = (configFile >> "CfgPatches");
private _newAddons = [];
for "_i" from 0 to((count _cfg) - 1) do {
private _name = configName(_cfg select _i);
_newAddons pushBack _name;
};
if (count _newAddons > 0) then {_myCurObject addCuratorAddons _newAddons};
_myCurObject addCuratorEditableObjects[(allMissionObjects "All"), true];
unassignCurator _myCurObject;
sleep 0.4;
player assignCurator _myCurObject;
systemChat format ["%1 is now a zeus.",name player];
};
}] remoteExec ["spawn",[0,-2] select isDedicated];
Really appreciate it, I'll give this a try โค๏ธ
Assuming this would also go in initPlayerServer.sqf?
You can run it there or on InitPlayerLocal.sqf
If you run it on InitPlayerServer idk becouse of RE would it run twice havent tested that IDK so
Put it in initPlayerLocal.sqf works on local MP but on dedicated it says "Cake is now a zeus." but the button to enter Zeus just pings Zeus :(
My recollection is that the curator object needs to be created on the server, and the assignCurator needs to run there too.
I don't see anything obviously wrong with the first version.
Should be able to just paste that one into the debug console and run it as local.
Maybe it runs too early somehow? Don't know a whole lot about the initialization order and timings
Probably needs to be run on server
That's what ACE does
https://github.com/acemod/ACE3/blob/master/addons/zeus/XEH_postInit.sqf#L51
would anyone happen to know the classname for RHS's BM-21 ammunition such as the M-210F?
https://community.bistudio.com/wiki/magazinesAllTurrets I believe this returns magazines classnames, if you need cartridge(rocket) name you gonna need to look into config
It should be artillery
this is getting too complicated I'm just wanting a mass missile barrage to beckon the end of the mission...
Virtual barrage? (without vehicle firing it)
that's just a support provider, wouldn't I have to manually call it in using an action?
I want it to happen when the players reach an area so I don't have to do anything on my end.
Although I could probably just zeus it.
Function BIS_fnc_fireSupportVirtual does virtual fire support, but I never tried with rockets
https://community.bistudio.com/wiki/BIS_fnc_fireSupportVirtual
editor -> place it down, variable name ie: Arty
console: magazinesAllTurrets Arty
will give you an array, you need a classname between quotes
ie: "classNameOfMagazine"
Having trouble scripting healing a unit from vanilla unconscious state
I've tried player setDamage 0; and player setUnconscious false; but the unit stays unconscious
u mean he stays down?
Yeah
Seems player setCaptive false; might have done the trick? But the visual effects from being damaged/wounded stay on screen
hey guys question about EHs the init or PostInit.
I have this code running on an object ive made for my mod, on the init tried PostInit too. Placing it in eden editor the all code runs as expected. (tested on dedicated)
But if this object is placed in zeus (testing on a dedicated server as its the place it will be used) The action is added for everyone but the code in the IF does not run. It dosnt initialize the vars I need.
any ideas why the server code dosnt run? when placing an object from zeus does it only run the init for all clients? That would be absured
params ["_computer"];
if (is3DEN) exitWith {};
_computer addAction ["Open Halo Drop Menu", {
params ["_target", "_caller", "_actionId"];
[_target, _caller, _actionId] call MDIH_fnc_openDialog;
}];
if (isServer) then {
//Used to store all the flight list names
_computer setVariable ["MDIH_Drop_List", [], true];
//Used to stroe all the flight variables (data)
_computer setVariable ["MDIH_Drop_List_Data", [], true];
//Used to store the counter for selecting automatically generated flight names.
_computer setVariable ["MDIH_Drop_List_Counter", 0, true];
};
but player is not dead?
Anybody good with supply drop set ups?
Struggling with something atm. Trying to figure out how to prepare a paradrop with a trigger. I lifted crates in air and sync them to Show/Hide module. So they would not be visible all time. Then when planes fly over I would activate the trigger.
BUT the boxes with ammo just drop like rocks to the ground without deploy parachute.
Any ideas how to force the parachute to deploy? or better way. via script
It's probable it's only running on the machine of the Zeus that placed it. This is the same for e.g. compositions with saved init fields.
I'd suggest using if (local _computer) instead; that should be safe for all contexts.
I just did some tests actually it is running the code in the IF. But there is something wrong with how the setvariable is written? As that code is not working as expected. It should be setting the var for all cleints hence the true on the end but its not...
How are you retrieving the variables?
_computer getVariable "MDIH_Drop_List";
just to test im getting the value that it set not a default value
When is this happening, and how is _computer being defined? Are you certain you've got the correct object?
I have some other code in that server IF and it runs and sets missionNameSpace vars. so the IF is running just these 3 setvars are not working
class Eventhandlers
{
Init = "_this call MDIH_fnc_init;";
};
this in my objects config.cpp code
omg... I spotted it
in config you dont use _this
you use this
_this is only in zeus enhanced xD
welps thanks.
Playing around with the Debug Console trying to work it out, so far I have this:
_unit = player;
_unit setUnconscious false;
_unit setCaptive false;
_unit setDamage 0;
_unit setFatigue 0;
_unit setBleedingRemaining 0;
_unit setVariable ["BIS_revive_incapacitated", false, true];
_unit setVariable ["#rev", nil];
Which successfully revives the player, but the screen stays very unsaturated and the unit dies after 3 minutes (because that's my revive bleedout duration)
but player is not dead?
Nope, but dies after 3 minutes
ok
Have a look at https://community.bistudio.com/wiki/BIS_fnc_reviveOnState
oh wait no. Sorry I jumped the gun. that wasnt the issue. The _computer param was correct because the addaction in the code was running. So its just the setVars that are not. ( as mentioned there is more code i nthe IF that is running fine. Its just setting vars on the object is not working.)
I wasn't asking about how _computer is defined in the function that sets them, I was asking about how it's defined when you retrieve the variables
I'm pretty sure configs use _this too. only eden init and createVehicle init use this
yup your right I had that first but ive been tying to solve this for while thought id got the wrong one haha.
wait one checking
so in that action that it adds in the code above it runs this function.
//MDIH_fnc_openDialog;
params ["_target", "_caller", "_actionId"];
//Store the Computer Obj for later use with vars.
_caller setVariable ["MDIH_Computer", _target];
//used to know when to rotate the planes position on the GUI Map.
_caller setVariable ["MDIH_Plane_Rotate", false];
createDialog "MDIH_GUI";
And then a button in the GUI does this to get the variable.
private _computer = player getVariable ["MDIH_Computer", objNull];
_drop_List = _computer getVariable "MDIH_Drop_List";
so when the user opens the dialogue it sets the computer obj ref into a var on the player so the UI can use it.
I checked with debug console though the problem is the variable is not being set, not how its retrieved. If I set it with debug console after placing the obj it the UI works fine.
You are aware that you're setting the variables to empty arrays?
yup. Just initalizing them, then they are filled with buttons on the UI
I have a workaround I can try. When grabbing them just set a default value and then use that if the var dosnt exsist. But that dosnt explain why this simple code dosnt work lol
if it's for UI buttons why do you broadcast it? just set it locally
because the UI is used by anyone and it needs to have data that goes across all clients
any estimation how much performance can be saved if large amounts of AI have staggered pathfinding. Lets say only half of them pathfind at once and it switches every 10 seconds maybe?
pathfinding is async so if by performance you mean FPS pretty much none
in my experience AI waste more FPS when they're in combat mode so you can work on that instead
if you have ideas what and how to possibly shave off im all ears. apparently fatigue is one?
so question, because this code works fine if the objects are placed from eden, how does the Init or PostInit EH work when placed from zeus do you know? because when zeus placed it cant seem to do setVariable properly
maybe. dunno
alright thanks
I was replying to halipatsui 
called on the zeus player
not server
ah oops. haha well I have it fixed and I have no idea why but it works..
I just changed how im getting the param from using params to this
_computer = _this select 0;
and now it works in zeus too
I know it does. But its the only thing ive changed and it worked
so Idk what to tell you
params makes the var private too
maybe that is the difference
well feel free to change it back and it'll still work I bet
and?
takes a minute to test as im packing and putting it on a dedi.
It works and I hate that haha. I know it does the same thing but its the ONLY thing I changed.
It wasnt working.
I change from using params to _this select 0 (same thing IK)
It works.
I change back
It works?!
maybe the restart is what "fixed" it because your code wasn't updated 
maybe who knows oh well thanks
Greetings,
Following question:
I am trying to select (/ count) the number of AI on a given side in a
forEachlogic, but I can not wrap my head around the logic atm
what I have:
private _ai_sides = [
west,
east
];
private _ai_count_east = count (allUnits select {side _x == east && alive _x && !(isPlayer _x)});
{
...
}forEach _ai_sides;
How do I make it so the
selectstill works soallUnitsgives me my desired side?
Something like this:
private _aiCounts = [];
{
private _side = _x;
private _aiUnits = (units _side) select {!(isPlayer _x) && (alive _x)};
_aiCounts pushback count _aiUnits;
} forEach [east, west];
private _aiCountEast = _aiCounts select 0;```
Also another question:
How do I un-string-ify something like this:
{
private _to_spawn_selected = selectRandom [
format["cqs_ai_group_3_%1", toLower str _x],
format["cqs_ai_group_5_%1", toLower str _x]
];
}forEach _ai_sides;
Notes:
unitsmay already only return alive units, so you might be able to skip that check. I don't know though, so that's something to test.- changed the order of the sides array to match the standard numerical side IDs, so you can use them for selection if needed.
thx alot, will try!
What do you want to use it for? Are you trying to dynamically generate variable names? Use getVariable and setVariable.
as in, i want to use cqs_ai_group_3_east as a variable from this
ohhhh so
private _someVar = missionnamespace getVariable [format["cqs_ai_group_3_%1", toLower str _x]];
Essentially, yes
thx alot! Its working now
Does anything look wrong? For some reason, group indicators are still showing on my server. Also, I have a question about the active keys. What are they?
also how would i disable the new compass ui at the top of the screen?
This is part of the DUI mod, not the vanilla game. You can disable it in DUI's addon options.
DUI is probably what's showing you group indicators, as well.
The "keys" referenced there are flags used by the game to track whether you've completed a given mission.
what does this mean for me exactly like what does the key do
it looks like vannila group indictators are you sure?
The key will mark the mission as completed in the scenario menu, and if other missions require you to complete a previous mission before playing them, that's how they do it.
99% of the time you don't need to worry about this at all.
Well, why don't you try looking in DUI's settings and finding out? Or just turning off DUI.
The other possibility is that you have defined this custom difficulty setting, but not actually selected "Custom" as the active difficulty preset.
custom difficulty is on I'll see if the problem keeps persisting after I've tweaked DUI
okay cool
This isn't a scripting problem btw. If you have further problems with this, try #arma3_troubleshooting , #server_admins , or #arma3_questions
sorry
Anyone knows a simple system for within-mission-persistence? Something I can use to have players recieve the same gear if they reconnect after a disconnect? I don't need cross-mission persistence and I don't need player position/health persistence, im only concerned about gear. Can be a mod, but I would prefer a script under a free license.
// Save it to missionProfileNamespace
missionProfileNamespace setVariable ["Andx_playerLoadout", getUnitLoadout player];
// Apply it again
player setUnitLoadout (missionProfileNamespace getVariable ["Andx_playerLoadout",[]]);
just need to find a way to include it in your mission, for applying it again you can use initplayerlocal.sqf
waitUntil{player == player};
player setUnitLoadout (missionProfileNamespace getVariable ["Andx_playerLoadout",[]]);
For saving lazy way would be just a addAction 
player addAction ["Save Loadout & Quit", {
missionProfileNamespace setVariable ["Andx_playerLoadout", getUnitLoadout player];
0 spawn {
hint "Loadout saved! You will get disconnected in 5 seconds!";
uiSleep 5;
endMission "END1";
};
}];
will give that a try, thanks!
also don't forget saveMissionProfileNamespace to commit your changes, you need that for persistence
derivative question, is there an event that fires client-side when the player quits the mission under any context? e.g. from eden editor, SP scenario, or aborting to lobby in MP
the mission events i see like HandleDisconnect and OnUserDisconnected only run server-side, and Ended doesn't seem to catch this either
Hmm. Doesn't look like it.
does anyone know if its a possibility to add a scrollwheel menu to a vehicle to swap texture on the fly?
it is
Simplest way is just making an action for each thing in a vehicle's TextureSources
Hi Im trying to hide objects in the map through code instead of using Hide Terrain Objects module. For whatever reason hideobjectglobal doesn't seem to work for that.
Post your code
hideObjectGlobal nearestObject [2500, 2500, 0];
hideObjectGlobal nearestBuilding [2500, 2500, 0];
tried both of these dont seem to work
You sure you have a building to hide in [2500, 2500, 0]
Also hideobjectglobal takes in a object and not array of objects
nearestObject returns an object so syntax is correct
Keep in mind hideObjectGlobal must be run on the server
Like poplox asked, you have an object in the current position , and the nearest object command has
Hardcoded radius is 50 meters.
Think i might be getting confused doing Hideobjectglobal it should hide any object within the radius i specified correct?
No
or should nearestObject be replaced with a variable of a specifc object i want hidden
There is no radius specification anywhere of your code
The answer is literally depends on your goal
oh thought [2500, 2500, 0];
was radius
so if i wanted to remove objects that are built into a map within a radius without specifying them. what would i use instead of HideObjectglobal
Use hideObjectGlobal
Or rather, it is much more efficient with hideObjectGlobal
Again, you did not told us what really is your goal
You can use forEach to iterate with found objects within a certain radius anyways
im trying to hide any objects that are objects built into the map within a radius of the trigger that contains hideobjectGlobal
{
hideObject _x;
} forEach (nearestTerrainObjects [2500, 2500, 0], [], 200]);```or something, not tested
ok after fiddling around a bunch i got what i wanted. Thank you
{
hideObject _x;
} forEach (nearestTerrainObjects [TomPos, ["HIDE", "ROAD"], 100]);
This is what i ended up with. which works perfecelty
seems like its every object from what im seeing
https://community.bistudio.com/wiki/nearestTerrainObjects
"HIDE" is one of the terrain object categories. It contains a lot of small to medium stuff like small rocks, junk piles etc.
Think of it as "hide" as in "things to hide behind", like "cover"
can you do anything with objects that dont have typeof? like get some sort of class. for Rocks, etc
With nearestTerrainObjects?
i mean after nearestTerrainObjects, i would like to get the unique type, not just ROCK
It does not use classNames to detect anything but P3D's specification
yeah, can i get the P3D though?
Get what?
Not sure what you ask
Not all terrain objects have a class
yeah
getModelInfo
thx im going to try getModelInfo
seems to work. im just using this to save some object sizes to hashmap. this gives small improvement in speed
i hope there arent any objects using same models though, which are just scaled to another size
i mean two objects defined in configs using same model
hmm ok i guess i cant use my hasmap optimization then
why do you need to know about the size that's so slow?
to spawn vehicles in free spot
a simple BB check should be fast
im just testing distances
Anyone know the 'Deploy Weapon' action name, for use with the actionKeys command, expected someting like 'DeployWeapon' but it seems not. Also couldn't find it on the wiki.
findEmptyPosition command?
in my experience those commands dont work too good.
wiki says "This command ignores moving objects present within the search area." i guess that means it cant find free position among vehicles?
hey all, its been some time ive been doing this stuff, and used to have an eject script on a mission i made.
you get inserted by helo in a mission and upon landing it would auto eject all players/playable chars (AI).
decided to rework the mission to include base game stuff instead of rhs and cup and i cant get this eject script back to work, neither can get transport unload or vehicle get out waypoints to work on the AI does anybody have a clue because im kinda lost atm and google isnt much of a help either
hey I'm using
_players = call BIS_fnc_listPlayers; //Creates array of players.
to create an array of players, however I'd prefer to remove the Zeus from this array, is there some function or variable I can use to grab the name of the Zeus and remove them from the _players array?
You can check each player for getAssignedCuratorLogic, or check each curator for the assigned unit
but does listplayers return the names of the players or their controlled units? Like will it return ["JohnPlayer12", "GuyPlayer13", "JohnnyPlayer14"] (the actual usernames of the players) or ["JohnsUnit", "GuysUnit", "JohnnysUnit"]?
cause if I'm zeus and I try to remove "KreshniksUnit" from an array containing "Kreshnik" it wont work
cause as far as I can find out checking the assigned unit of a curator will return "KreshniksUnit"
You'd want to with with the units (objects) before turning to names, yes. Check what the function returns
_allPlayers = call BIS_fnc_listPlayers;
{ systemChat _x } forEach _allPlayers;
Ok I might be stupid but when I try to do this to check what it returns it just throws an error
Error systemChat: Type array, expected string
str _x
Trying to get all players within the vicinity of an addaction to TP into a plane, it seems to only work for the person interacting with it though
{
if (
_x distance _target <= 10 &&
isPlayer _x &&
alive _x &&
side _x == independent
) then {
[_x, _plane1] remoteExec ["moveInAny", _x];
};
} forEach allPlayers;
10-metre radius isn't very far. There could be another problem, but start by making sure they're all close enough.
Definitely had players close enough for it.
Make sure your server/mission's CfgRemoteExec allows clients to send that command
How might I do that for a mission?
https://community.bistudio.com/wiki/Arma_3:_CfgRemoteExec
Note the order of precedence for different definitions of CfgRemoteExec; the mission description.ext overrides all the others, provided it's defined.
Alright I'll give that a go. Thank you.
@spiral trench Try "DeployWeaponAuto"
Move in any have global args and global effect.
Have you just tried _x moveInAny plane1
Currently you are sending it to every client and server and it will multiple times try to do move in any
Yeah I've given that a go. Didn't know moveinany was global though.
isnt it being sent to where _x is local?
Hello , on live feed script i set monitor screen to show the target , every thing work fine but when i go to zeus and move back screen is black , any fix?
you have to redo it every time you enter and exit the curator interface.
the issue is due to terminating r2t iirc
You can do it in CBA_fnc_addPlayerEventHandler "featureCameraโ camera changed (Curator, Arsenal, Spectator etc.)
Is there somewhere I can find leads as to how the VR Arsenal does it's "Entity Deletion" flashing effect? I have one of my own but it's kinda clunky and it would be nice if I can change it to a pre-existing one if i can.
How to it
More explain plz
After camera change, you have to redo the rtt cameraEffect part of the feed script. Try just picking that line and running it first.
Then you can use the cba event to do it as necessary https://cbateam.github.io/CBA_A3/docs/files/events/fnc_addPlayerEventHandler-sqf.html
RemoteExec without defining target, no , default is 0, which is for every client+server.
Or what did you mean?
he defined target
Yeah, true.
My bad, didn't read what I read.
But anyway, it should work without remoteexec.
no problem , had to check ๐ (sanity check)
Hello
How do I put a thumbnail on my scenario I made and published
Publisher app doesnt do scenarios anymore for some reason, mod file only has a SQM extension file, no JPG or anything
I know this is not scripting but I cant find a Arma 3 modding channel
I asked ChatGPT
https://community.bistudio.com/wiki/Description.ext#Mission_Information
chatgpt for Arma 3 will give you wrong hallucinated information 95% of the time
I meant like steam workshop thumnail
But this will be useful
thanks
private _players = allPlayers - entities "HeadlessClient_F";
_players = _players select {isNull (getAssignedCuratorLogic _x)};
_players = _players apply {name _x};
// _players is now a list of all the names of the non players
I'm assuming that's what you're looking to do
hello,
does anyone know how to get the relative velocity (speed of an object, getting closer or further away) between two objects?
does anyone also know how to clear the player's radar target while in a SPAA vehicle?
thanks!
I have tried player doWatch objNull; in an attempt to cause the player to lose lock, but it does nothing. also i have made the following code below in an attempt to try make a 'getRelSpeed' script, however my maths must be wrong as the speed is only relative to north...
params ["_observer", "_target"];
//_observer = vehicle player; _target = getAttackTarget _observer;
_relWorldVelocity = velocity _target - velocity _observer;
_direction = vectorNormalized (position _target - position _observer);
_relWorldVelocity vectorDotProduct _direction; // Returns closing velocity in m/s
vectorWorldToModel might be useful to you
i had a eureka moment, thanks anyway
_dir = _target getRelDir _observer;
_targetLocalSpeed = velocityModelSpace _target;
_targetForwardSpeed = _targetLocalSpeed select 1;
_fwdVelFactor = (abs ((_dir + 180) % 360 - 180) - 90) / 90;
_targetForwardSpeed * _fwdVelFactor;
far from the perfect solution, but it works as intended...
I still need to find a way to force both AI and players to break radar lock, doWatch works okay for AI but nothing of the like works for players...
That's it, thanks @native hemlock
Is there a scripting command that would allow changing the aiming deadzone setting?
It's a vanilla client-side game setting, so I'm not certain that anything exists for it
No
i'm not a math guy but i think you had the right idea, you just used - which doesn't actually subtract two vectors, vectorDiff would be the correct command for that:
https://community.bistudio.com/wiki/vectorDiff
not sure of any command to break sensor locking either, but for the relative speed i came up with this function (probably with some unnecessary normalization but it works): sqf TGC_fnc_getAbsClosureSpeed = { params ["_observer", "_target"]; private _dir = getPosATL _target vectorFromTo getPosATL _observer; private _velocity = velocity _target; private _angle = vectorNormalized _velocity vectorDotProduct _dir; vectorMagnitude (_velocity vectorMultiply _angle) }; and i also had some fun making a little missile notching system out of it:
https://gist.github.com/thegamecracks/9f564b8d4901ddd3902a20aeafc4dfef
When I use gesture from SOGPF it shows multiple times on the screen when I have AI in the group. Is this normal? ๐ค
can you show pic of what you mean?
did you script that or is it vanilla behaviour?
In the VR Arsenal, after you kill one of the test dummies, the body flashes visible/invisible a few times before being cleaned up.
It's probably just hideObject tbh
ok
This might be the function responsible, but I'm not certain. https://community.bistudio.com/wiki/BIS_fnc_VREffectKilled
Hi guys, please, why it's not working ?
setObjectViewDistance ((getObjectViewDistance + 400) min 1200)
setObjectViewDistance ((getObjectViewDistance - 400) max 200)
any way to raise/lower the turrets of some vehicles (such as the commander's camera in the Strider) via scripting? It probably doesn't have any effect on the AI detection capabilities, but it'd be neat to control that in some scenarios
@proven charm vanilla SOGPF, just added the gestures default module to the mission
I guess it's best to ask in SOGPF server
@little raptor already did, but nothing for now ...
Literally what i was working on!
im making an advanced RWR / Radar system
the main thing is you can't really change the RWR sound effects on the fly, or hear DCS radar pings like in the A10 or the F15
Open up Virtual Arsenal. Equip weapon. Shoot entity. Watch the body flash and despawn
NikkoJT left you a message above ^
HideObjects better than my current implementation lol. I change the object material very fast to make it blink
I think he meant this message.
#arma3_scripting message
Nah I'm very sure periscope won't solve my request
Yeah i found that its on my todo list
Is there actually a way to play a video on a TV screen? I've got the .ogg and .ogv in my \videos missionfolder and my description.ext made but its not working.
[] spawn {
private _screen = tv1;
private _texture = "#(argb,512,512,1)r2t(myVideo,1.0)";
private _video = "videos\myVideo.ogv";
private _soundClass = "MyVideoAudio";
private _duration = 130;
while {true} do {
_screen setObjectTextureGlobal [0, _texture];
playVideo [_video, "myVideo"];
_screen say3D _soundClass;
sleep _duration;
};
};
and
class CfgSounds {
class MyVideoAudio {
name = "MyVideoAudio";
sound[] = {"videos\myAudio.ogg", 1, 1, 50}; // volume, pitch, maxDistance
titles[] = {};
};
};
playVideo is not a command that exists. You need this: https://community.bistudio.com/wiki/BIS_fnc_playVideo
BIS_fnc_playVideo makes it play in my UI and on the screen.
[] spawn {
private _video = "videos\myVideo.ogv";
private _screen = tv1;
_screen setObjectTexture [0, _video];
[_video, [0.2, 0.2, 0.6, 0.6]] spawn BIS_fnc_playVideo;
_screen say3D "MyVideoAudio";
};
and
class CfgSounds {
class MyVideoAudio {
name = "MyVideoAudio";
sound[] = {"videos\myAudio.ogg", 1, 1, 50}; // volume, pitch, maxDistance
titles[] = {};
};
};
This works fine, but theyre both in the UI and on the screen. I only want the screen.
I've been trying to find the Orbat Insignia Markers. it's either
texture = "a3\ui_f_orange\data\displays\rscdisplayorangechoice\faction_nato_ca.paa";
or
insignia = "a3\missions_f_epa\data\img\orbat\b_aegis_ca.paa";
I'm referring to the FIA Insignia in the Arma 3 campaign. I've been looking and I cant find one. If it's dev only then it's fine but I would assume it's not?
If you are looking for the texture used 3den Enhanced's Texture finder.
instead of
[[3042.21,7918.51,1.44269],"asset\pow.sqf"] remoteExec ["execVM",0];
can I just use
[[3042.21,7918.51,1.44269]] remoteExec ["asset\pow.sqf",0];
?
You could create function from your .sqf and then use it like your 2nd option.
So you cannot remoteExec .sqf, you need use exec VM
Hey guys,
Is it possible to overwrite the vanilla FSM via a mod? Specifically, some of the Warlordsโ FSMs. Iโm trying to change the AI purchasing behavior. I know my way around the FSM editor, but I canโt figure out how to make my mod overwrite the base gameโs FSM.
Anyone wanna point me in the right direction, using Eden Enhanced and tried to use the action hold stuff it has built in to create some interactable intel to pick up but I cant seem to get it to actually create the intel in the diary under its own catagory or even just to work at all, am I doing something wrong or is there a better way to do this
This one is probably simpler, try the example 1: https://community.bistudio.com/wiki/BIS_fnc_initIntelObject
You place down the item, then paste the code with your title and text to the object's init field in the Editor. It's a simple action, not a hold action.
But if you really want the hold action, then start by studying this:
https://community.bistudio.com/wiki/createDiaryRecord
You can do a hold action via script too, it's more difficult, but it's more organized than using Eden:
https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd
Hey there, my unit is trying to figure out how to end a PvP mission only when all BLUFOR players have died, ignoring GREENFOR players who will be actively killing them.
Any simple Trigger script that would do this? There's a forums post about it but, yknow...
ok thanks, ill give it a try and see what I can come up with
There's plenty of tutorials on YouTube and forums for that.
I tried a quick search on youtube but everything I found was dated and didnt really see anything for the holdActionAdd way of it and most of the links for forums are for BI which is down
Do the BLUFOR units respawn?
Negative
It's ok, we figured out to do this
{side _x == west && alive _x} count playableUnits <= 0
This may work well enough. Just make sure that the trigger (if you're using one) runs only on the server. You most probably don't want it to be executed on all machines every X seconds.
Yeah that's it, we have it server only and then executing a remoteExec for the mission completion
Do you know if the Warlords' FSMs are packed within the scenario file or somewhere among the official files inside A3 add-ons folder?
Hello , to save fps and keep mission performance i want use hide/show enable/disable sim of layer objects
I use the code on trigger act part with true condition
With no serveronly check it work good on my editor mp test
But on dedicated server it wont work even if serveronly box checked
Any guid ?
Post your trigger setup
Condition true
Onactivation:
[] spawn {
{ _x enableSimulation false;
_x hideObject true;
} forEach (getMissionLayerEntities "test" select 0);```
On the server , when i test , ais are not hide and have not any movement(patrol/waypoints) just stay where they placed,
And when show layer trigger enabled they start move and patrol
hideObject is local effect, so the objects are only being hidden where the code runs (i.e. the server)
Use hideObjectGlobal (and keep the server only box checked)
Thank you for help
Also if the trigger is supposed to ran in first second, using trigger is unnecessary
I have a problem with HC, it does not spawn AI
[[3027.05,8719.83,0],0.1,"asset\garrison.sqf"] remoteExec ["execVM",0];
and this in the sqf
if !(hasInterface && isServer) then {
//bla-bla
} else {hint "No luck!"}
when ran on dedicated = "No luck!" ๐
Obviously, your condition is wrong.
Official files, inside the A3 addons
Is there a way to limit items in an arsenal (either vanilla or ACE)? I'd like to have it so the arsenal has a limited quantity of each item instead of โ
๐
if !(hasInterface && isServer)
๐
if (isDedicated)
you wrote "if (it does not have interface AND is not the server)" ๐
@winter rose HC is not the server and don't have interface, right?
yes, but your condition is saying:
if it doesn't have interface or is not server
in other words it will run on every computer anyway
except for a non-dedicated server
as for why this doesn't work, you're passing 3 args to remoteExec
that's not how it's supposed to be written
@little raptor so I am limited to only two ?
well technically in every sqf command you're limited to 2 maximum
but when you need more you group them into arrays
anyway, see this
sounds simple enough to try
in your case it would be:
[[...], "script.sqf"] remoteExec ["execVM", 0]
@little raptor if I want the target machine to be the HC, can I refer to it somehow?
how is this script supposed to run? by trigger? init.sqf? etc.
otherwise have to execute it globally and then write extiWith withing the sqf
from initServer.sqf
Name your HCs and use these vars.
I have var names HC1 and HC2
well you can just use init.sqf and use exitWith
instead of remote execing
the HCs won't be initialized at that time
they join after initServer is already done
you can remoteExec using JIP but why do that when you can use init or initPlayer (iirc it did work on HC but double check to make sure)
yeas but it shouldn't execute upon beginning of the mission. thats the problem
then when?
after some time
there are lot of zones and it should activate zone after some period of time, triggers don't work because I will have 100 triggers for every zone ...
well then use [HC1, HC2] as the remote target in your remoteExec (instead of 0)
like this ?
[[[3027.05,8719.83,0],0.1],"asset\garrison.sqf"] remoteExec ["execVM",HC1];
if you want both use this
actually you're missing one opening bracket
@little raptor yes ๐
I want to split the load, hlaf will go to HC1, half to HC2
great help, thanks @little raptor and @faint burrow
Question from a first time mission maker
I want to make an intel file have an image, the mission will be uploaded to a server so i cant really set a full filepath for the script to know where the image is
Is there a way to make the script look for an image in a path that starts from the mission file itself ? If so how ?
(attached image from a exacmple script i got from a youtube guide - it points to specific paths and i would like if it could for example look for it in \Missions(mission file)\Image.paa instead of the full path)
did you try just "image.paa"?
example
hm
so if i theoretically pack this together as a .pbo with the "path" being just the image itself it should know to look inside its own folder ?
no matter how you've putted, the path is the path in your mission folder
so it should be just "image.paa"
huge, thank you
or if in a folder: "folder\image.paa"
getMissionPath "images\img_intel.paa"
or that
I just had a script error that * really was * a missing semicolon
I have little to no experience with this, but I will do my best.
It certainly is not possible just by using simple SQF commands. You would need to somehow override the original FSM.
You can try to ask in #arma3_config channel. Theoretically, it is possible, since mods like LAMBS do change the danger.fsm, although it is a different case. The way LAMBS do that is through configs, as far as I can tell: https://github.com/nk3nny/LambsDanger/blob/master/addons/danger/CfgVehicles.hpp.
But the Warlords may be doing it simply through the scripting mechanisms during the mission time, and there would be no class variable containing the reference for you to change. You can also try to look it up somewhere in the config viewer within the game.
If it's not possible this way, then the only thing that is left is editing the scenario file itself or the addon package.
Take this response more like a hint rather than a final answer.
can anyone help me figure out how to set a respawn for ai vehicle and crew in eden
@mild tiger there is not such thing as respawn for non-player units, but there is a mod that do this https://steamcommunity.com/sharedfiles/filedetails/?id=1682280809&searchtext=prierre+MGI
is this client side or would my friends need it too
@mild tiger everyone
It is possible, albeit not perfect. You can use the vehicle respawn modules. Place down a vehicle, place down the module, sync them, and then in the options for the respawn module, add a command that will be executed when the vehicle respawns. This command will create the default vehicle crew, like pilots for a helicopter or a driver for a jeep.
Something like this:
if (!isServer) exitWith {};
createVehicleCrew yourVehicle;
There's just a slight problem, because it will leave the original units running around if they survive. You would need to code some script to remove them if you really needed that.
Whatโs the way to make it to where players respawn on the position you put them in on Eden again?
I forgot itโs been a while, could use a hand
I remember it being something to do with the empty module under Markers -> System but idk what to put in it exactly
This is just to set a general respawn location for players, I donโt think itโs what Iโm looking for ๐ค
Thereโs something specific I remember
Not sure if your server is intended to be private but if public, I would highly advise against using execVM like this. Cheaters are able to execute really anything they want through memory. If you allow execVM to be ran on client, it would allow cheaters to entirely bypass CfgRemoteExec and execute whatever script they want on whoever they want.
If you do not know about CfgRemoteExec or CfgFunctions I would check out these two links:
https://community.bistudio.com/wiki/Arma_3:_Functions_Library
https://community.bistudio.com/wiki/Arma_3:_CfgRemoteExec
Putting security aside, using a CfgFunctions will make your life a lot easier when it comes to executing scripts. Instead of having to do something like:
[[3027.05,8719.83,0],0.1,"asset\garrison.sqf"] remoteExec ["execVM",0];
You would be able to do this instead and not have to worry about the path whatsoever:
[[3027.05,8719.83,0],0.1] remoteExec [TAG_fnc_garrison, 0];
Anyways if any of that helps ๐
Also not sure if you wish for garrison.sqf to be executed on server or not but you could also use [-2, 0] select hasInterface for the target too. Prevents a script from running server unless client isServer. Not super necessary in most circumstances but generally a good practice especially for scripts that are being remoteExec often and may not need to run on server 
@old owl thanks for the info, I have a "zone" with all kind of enemy AI - garrisons, patrols, static weapons, etc. they are all packed as functions - the "zone" sqf has only positions (or density) as argument to these functions
//garrison grp
[[3027.05,8719.83,0],0.1] call KIB_fnc_garrison;
//static grp
[[3027.05,8719.83,0],0.1] call KIB_fnc_staticgrp;
What is the best way to spawn a temporary bluefor unit (invisible and invincible) then delete it ?
Needing this to make tree destroy and laying down oposite of explosion position
Just createUnit?
createVehicleLocalโฆ + setDamage ๐
(+ deleteVehicle ofc)
let me test that ๐
Before testing you code, what do you think of
private _temporaryGroup = createGroup [west, true];
_temporaryGroup createUnit ["B_RangeMaster_F", position player, [], 0, "CAN_COLLIDE"];
?
I guess Global effect so might be better to use createlocal if possible
sure, you can also disable all its AI, disable its simulation, hideObject it too and only place it where needed, when needed
jsut asking because I always test my code on dedicated before merging and this takes time xD
issues with locality are pain in the ass
but thx for your input about createVehicleLocal
private _temporaryGroup = createGroup [west, true];
private _temporaryUnit = _temporaryGroup createUnit ["B_RangeMaster_F", position player, [], 0, "CAN_COLLIDE"];
_temporaryUnit allowDamage false;
_temporaryUnit enableSimulation false;
_temporaryUnit hideObject true;
then will delete it
if you have multiple usages, you can keep it, it does not cost much
out of curiosity, can you createVehicle an object, like B_MRAP_01_F or something and test it to setDamage the tree?
I am genuinely intrigued
yes, here it works with an AI, now will test with a vehcile ๐
private _temporaryVehicle = createVehicle ["B_MRAP_01_F", getPos player, [], 0, "CAN_COLLIDE"];
cursorObject setDamage [1, true, _temporaryVehicle];
This is working (at least on local multiplayer) ๐ Wiki could include this :p
If this is just for alt syntax of setDamage (so the tree falls away from the player), why not just use the player outright?
You're already using the player's position here
Beacsue the Bomb is dropped by an air plane, player are not close to the explosion
(the player pos here is when testing with me as center of explosion)
Wiki could include this :p
this is exactly why I ask :D
Maybe even game logic object would work too ๐ค
definitely would work
AI > game logic > inert objects
done! ๐ป
Did you put it in the CreateUnit ?
no, it is only relevant to setDamage
how does the IncomingMissile EH work? I keep getting it triggered twice
In context of a player-hosted server, does CfgRemoteExec's allowedTargets consider the host as both client and server, or only as one of them? I have some hint functions that clients can remoteExec on other clients, and I want to know if allowedTargets = 1; allows execution on the player host, but I couldn't find clarification on this in the docs.
i have (almost) done it
https://steamcommunity.com/sharedfiles/filedetails/?id=3483887471
Hey so I'm trying to achieve a system here where save spawns to a script so that the units aren't on the map unless we are within a certain distance is this possible
It's to try to boost the performance
Has it been done before?
Use dynamic simulation
The built in one
Yes
Oh your right
So if I have a mod like Drongos Map Population can I still use dynamic simulation to save drongos tools with the proximity distance type deal
I don't know. But I'd expect the mod to handle that automatically.
Hi all, question about the best implementation to schedule a call in the future after a given amount of time.
I used to deal with triggers and *KK_fnc_setTimeout * from http://killzonekid.com/arma-scripting-tutorials-triggers-v2/ in the past.
Is it still the best way to go? Is it better to go with a BIS_fnc_countdown then a while loop like:
[] spawn {
while {sleep 1;(ceil([0] call BIS_fnc_countdown)) < 1;} do {
// time's up
};
};
or some implementation from CBA to recommend?
Thanks a lot!
AIBulletDeviation mod
Hi,
I have tried to make a mod that can deviate the bullet from the muzzle veloctiy and decrease their accuracy better than adjust in AI skill
I have only 2 sqf file
fn_handleFired.sqf:
params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"];
if (isPlayer _unit || {!alive _projectile}) exitWith {};
// Grabbing muzzle velocity
private _origVel = velocity _projectile;
private _origSpeed = vectorMagnitude _origVel;
// Calculate 18% error from original aim
private _deviation = 0.18 * _origSpeed;
// Apply error to each vector axes velocity X/Y/Z
private _newVel = [
(_origVel # 0) + random [-_deviation, 0, _deviation], // X
(_origVel # 1) + random [-_deviation, 0, _deviation], // Y
(_origVel # 2) + random [-_deviation, 0, _deviation] // Z
];
// Apply new velocity
_projectile setVelocity _newVel;
And fn_init.sqf
if (!isServer) exitWith {};
// Add event handler to all existing AI units
{
if (!isPlayer _x) then {
_x addEventHandler ["FiredMan", AIBallisticDeviation_fnc_handleFired];
};
} forEach allUnits;
// Add logic for dynamically spawned units
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
if (_entity isKindOf "CAManBase" && {!isPlayer _entity}) then {
_entity addEventHandler ["FiredMan", AIBallisticDeviation_fnc_handleFired];
};
}];
It works very well. The idea is the same with turret tweak mod on steam workshop
Maybe you guys can help me to apply the CBA adjust slide to the percent of error apply to each bullet?
Thank you
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
CBA settings are just global variables that you can read
So you can use https://cbateam.github.io/CBA_A3/docs/files/settings/fnc_addSetting-sqf.html in your init.sqf and then just real the variable
E.g.
[
"AIBallisticDeviation_deviation", "SLIDER",
["Setting name", "Setting tooltip"],
"AI Ballistic Deviation", [0, 10, 5, 0] // read linked page for meaning
] call CBA_fnc_addSetting;
Also use a class event handler rather than adding your event handler to every unit like that
["CAManBase", "firedMan", AIBallisticDeviation_fnc_handleFired] call CBA_fnc_addClassEventHandler;
You can use a perFrameHandler (which despite the name has the ability to loop every X seconds as well, not just every frame) which will run unscheduled
My goal is to wait on the server something like 2 hours before launching the scoreboard on all clients. Is it suitable still?
If its just a single time, you can just use a waitAndExecute, no need to use a loop for something that only happens once
I just need something that does not consume a lot of CPU for nothing. Is a sleep 7200 ok in that purpose?
I also need rough accuracy.
(I mean 2h later, I don't care about a missing second, but he should not be shortened by 10 minutes)
It'd probably be fine
There's more than likely a smarter way to trigger what you're wanting though
WAE works though
private _twoHours = 60 * 60 * 2;
[{
// Show scoreboard
}, nil, _twoHours] call CBA_fnc_waitAndExecute;
(The nil is any arguments you'd want to pass to the code block)
thanks a lot
Not sure if it optimized though
it just relies on perFrameHandler from what I understand https://github.com/CBATeam/CBA_A3/blob/de3ef9f713de3f49a2a1a72ecd7efa73785ce288/addons/common/init_perFrameHandler.sqf#L10
Yeah anything that's going to be checking the time like that is going to be running every frame
So it consumes a lot with condition evaluation.
Its not a lot
Everything thats checking if X amount of time has passed, vanilla or CBA, is going to be running every frame and checking if the amount of time has passed
in comparison with my sleep 1 + countdown check, it looks to be heavier.
since I am testing only each second
Engine is still checking every frame if 1 second has passed because of the sleep
I dunno how the sleep is implemented.
The same way
sleep is several times faster ofc
for long sleep just use sleep. no need for CBA
if you need accuracy, use CBA tho
if you don't care and you prefer performance, use sleep
for such long delays you can't be too accurate anyway
ya, I don't care if it +/- 2s after 2 hours.
In the end of the game, I will do a remoteExec to everyone to freeze the game and open the scoreboard.
also I should point out that the performance won't matter too much for just 1 wait until
a few micro seconds at worst
Ya but I may have several later, and I want to know the optimized implem since I don't like to waste for nothing.
Random question but was interested since I saw CBA_fnc_waitAndExecute come up here again and I am not super familiar with CBA. Does anyone know if there is any significant performance advantage to using this over something like?
[] spawn {
uiSleep 10;
// code
};
Seems like in either example you would still be spawning a script. Is it more just for utility purposes within other CBA functions or is there something that it does better?
CBA's is unscheduled, there is no spawn
CBA's functions are also based on normal mission time, so they're affected by increasing/decreasing the accTime
thats good to know thx @tulip ridge
Are you saying that all CBA functions cannot be spawned? What would be the purpose of using this function over call if it has to be called? Is the delay CBA_missionTime based off of normal mission time as well?
Apologies for the barrage of questions just curious since I've not really messed around with CBA too much.
That's now what I said
CBA's functions like waitAndExecute, waitUntilAndExecute, and addPerFrameHandler are based off of mission time. For a vanilla comparison, it's like sleep vs uiSleep
he means thats (not) what he said i think
So is that time still somehow in a way unique to CBA? Would uiSleep and sleep not be optimal while using CBA as a dependency? I guess I am just wondering what the practical application would be.
You can do spawn CBA_fnc_whatever, but CBA accounts for modders calling functions that need to be unscheduled from scheduled. Functions that need to be run in an unscheduled environment will exit and call themself unscheduled if needed
I.e.
// Needs to be run unscheduled, exit and call with same params
if (canSuspend) exitWith {
[CBA_fnc_whatever, _this] call CBA_fnc_directCall;
};
No
CBA_missionTime is just a variable that is synchronized for all machines
Because time is different for each client and before 2.18, serverTime always returned 0 in singleplayer
Ah okay I think I understand then. I guess that's why I was confused because from what I remember serverTime syncs every 5 minutes and is pretty accurate.
It just makes time related stuff easier, because you don't need to handle timing differently in SP/MP
A short one: how can I pad left a number with a zero in format or any alternative when formatting a string?
you mean decimal places? toFixed
Minutes on 2 digits
ah to left 
Even when <10
Hi, I'm looking to add a specific backpack (ideally also remove a launcher) to a specific unit class whenever they are created. Been looking at adding an eventhandler for this but frankly I have no clue how to go about this.
in this case the unit I want to edit upon spawn is: AFR_I_AAF_AntiAir
and the backpack I want to add is: I_Crocus_AP_Bag
ahm, one idea I had just now:
_fnc_padWith2Zero =
{
private _str = (_this + 100) toFixed 0;
_str select [count _str - 2]
}
This solution is actually what I have never thought
I've ever done similar of course but like
private _return = str _this;
for "_i" from count _return step -1 do {
_return = "0" + _return;
};
_return```
(not tested)
Ok, let's reinvent the wheel ๐คฃ
here's a general version then:
_fnc_padZero =
{
params ["_n", "_zeros"];
private _str = (_n + 10 ^ _zeros) toFixed 0;
_str select [count _str - _zeros]
};
e.g. [1, 2] call _fnc_padZero -> "01"
Kind of surprised negative integers can't be used in toFixed for that. Looks like you can't do that in JS version either so perhaps I don't exactly understand what is going on under the hood for that.
Ahh okay probably because it just shifts the decimal place and doesn't round.
I think there was a request either for toFixed or round to do something like this?
actually I think it was for round the first n digits iirc (e.g. 1234 round 2 => 1200)
yeah * 100 (well round not floor)
For my needs, maybe there is something already existing:
I have a time in seconds to be displayed like 10:23
So I do my own floor(_x/60) and _x mod 60
Then pad left both
Oh. Would BIS_fnc_secondsToString do what you are seeking?
Perfect, thanks
I synced several vehicles to this module. I added an arsenal script to one of the cars and changed the paint jobs for the helicopters, but when they respawn, the helicopters have their original paint jobs and the car doesn't have the script.
How do I keep the changes using the Expression tab? I added that code to try to solve the problem because it seemed to make some sense, but it didn't work. I don't know anything about programming.
You should write a code to get applied changes from old vehicle and apply them to the new one. For textures use https://community.bistudio.com/wiki/getObjectTextures and corresponding setter command.
I think he doesn't know how to apply it to the new vehicle (the use of the expression field)
There are a lot of examples on BIKI, internet, etc. For example: https://web.archive.org/web/20200621094446/https://forums.bohemia.net/forums/topic/205689-custom-textures-on-vehicle-respawn/
A possible solution:
params ["_oldVehicle", "_newVehicle"];
switch (true) do {
case (_oldVehicle isKindOf "Car_F"): {
// code to optionaly remove the arsenal script from _oldVehicle and add it to _newVehicle
};
case (_oldVehicle isKindOf "Helicopter_Base_F"): {
{
_newVehicle setObjectTextureGlobal [_forEachIndex, _x];
} forEach (getObjectTextures _oldVehicle);
};
};
Looks like solid work, Dennis. Your renders still tend to be pretty dark though.Finally got around to finish the exterior LOD for my Eagle IV model. 12,800 faces and four diffuse maps, tho the map count might eventually drop to three once I get around to mess with the RVMATs. The cargo LOD is als...
trying to increase the RPM/decrease the reload time on vehicle main gun, ive tryed using the one on the official website and nothing changes, either im putting the wrong number in or the script no longer works, any thoughts?
ive tryed using the one on the official website
what did you try?
unit addEventHandler ["Fired", {
_this # 0 setWeaponReloadingTime [_this # 0, _this # 2, 1/3];
}];
and you replaced "unit" with the actual vehicle you want it to affect? or how are you running that code
coppied it into the init box just as it said on the site
They're using unit as a placeholder in the example.
If it's an editor init box then use this
userMFDValues get broadcast to all machines, right?
thanks
You mean https://community.bohemia.net/wiki/setUserMFDValue?
Pretty sure it's local effect from experience using it
Is there a way to remove a weapon from a container that doesn't involve using the clearWeaponCargo command?
addWeaponCargo, funnily enough
Because that command straight up wipes the entire container lol
Oh my lord
please, call me Lou
I have a question with an undefined topic. I have a server mod that stores functions for the client. When a mission starts, these functions are sent to the player and he locally assigns them to variables with the same function name. So I was able to completely separate the client code from the mission folder. But there is one unpleasant problem with initialization in init in the editor and JIP. remoteexec JIP occurs earlier than the player creates variables of functions passed from the server mod in his missionNameSpace. Is it possible to somehow prevent all JIP calls from being called until a certain moment, or to assign a variable to a function earlier than the remoteExec JIP call occurs? 
i haven't done this kind of thing before, but i do know that duda's server-side mods (advanced sling loading/rappelling/towing) work the same way; apparently in their source code, they have one big function that defines a bunch of global functions, and that's broadcasted over the network: ```sqf
if (!isServer) exitWith {};
AUR_Advanced_Urban_Rappelling_Install = {
...
};
publicVariable "AUR_Advanced_Urban_Rappelling_Install";
[] call AUR_Advanced_Urban_Rappelling_Install;
// Install Advanced Urban Rappelling on all clients (plus JIP) //
remoteExecCall ["AUR_Advanced_Urban_Rappelling_Install", -2,true];```
so i'd guess that JIP'd variables are received before JIP commands
if jip is executed sequentially upon creation then this is quite possible.
In my version, there is a function in initserver. In this function, functions with a property equal to 1 in the class are collected via foreach. Through missionnamespace servariable ["Var_functions",_array,true] I create a global variable with the jip mode. And through initplayerlocal there is a function that already uses this variable to form variables. (I also use this array for a beautiful loading screen)
But this led to the fact that objects with init in the editor, on a dedicated server did not have functions in which addaction was written. And even errors in rtp and on the screen did not show. Surprising, isn't it. And after this I begin to fear that if I add actions during the mission through functions in remoteexex ["fnc",0,object] then they will not appear in jip
If calling remoteexeccall is the very first thing from the start of the mission that solves the problem with jip then that would be awesome 
remoteExec ["fnc", 0, object] has its own problems...
(only one of those can be stored in JIP per object)
Hey fellas, i'm currently using some code I wrote to allow our guys to pick up a dog on our dedicated server. The code works properly, other than the orientation of the dog once it's picked up doesn't work on the dedicated server. It works properly on my own computer when hosting a LAN game. The code is as below
/Picks the dog up and attaches it to the player/
private _dog = dog1 getVariable "dog1";
dog1 attachTo [player, [0, .25, .5]];
dog1 setDIR 270;
dog1 remoteExec [setPosWorld, 0, true];
dog1 remoteExec [getPosWorld, 0, true];
dog1 allowDamage false;
Anyone have experience making something like this work in multiplayer? I see the dog's position change for a split second, and then it goes back to its default position on multiplayer.
- Prefix your global variables.
- Those two remoteExec lines are nonsense.
Okay, I put the setPos/getPos lines in because according to the BI.Wiki you needed to use those commands after using setDir to broadcast the position over the network in multiplayer. They weren't orignally remoteExec, that was something I tried just to see if thats why the position was being reset. What do you mean by prefix the variables? As in _dog1, instead of dog1?
Rather, _dog*
No I mean those remoteExec lines don't make any sense. You would pass the commands as a string, and the setPosWorld doesn't even have a position that you're passing.
SetPosWorld is also global effect, there's no reason to remoteExec it on any machine
I mean the getVariable name. Variables assigned to objects are still global, i.e. getVariable ["YourPrefix_dog", objNull]. But that line isn't even doing anything and should just be removed.
Alright, so I took the first line out. Since it wasn't doing anything at all.
dog1 attachTo [player, [0, .25, .5]];
dog1 setDIR 270;
dog1 setPosWorld getPosWorld dog1;
dog1 allowDamage false;
is what I have now
I think the note on direction networking is obsolete.
Your problem is likely that you're running this somewhere that dog1 isn't local.
Okay, so if thats the case, I can get rid of the setpos/getpos line as well.
This could just be:
dog1 attachTo [player, [0, 0.25, 0.5]];
[dog1, 270] remoteExec ["setDir", dog1];
[dog1, false] remoteExec ["allowDamage", dog1];
(Untested, written on my phone)
should be fine.
Let me copy that, and ill see if it works on our dedi server
The original one works on my local machine, which makes me think you're right @granite sky as far as it being a locality issue.
That took care of it, thanks for your help.
@tulip ridge @granite sky
Small question about remoteExec with the object as a target. I would naturally do a call like [dog1, 270] remoteExec ["setDir",2]; if I know the dog is a bot owned by the server.
You proposed [dog1, 270] remoteExec ["setDir", dog1];
it is identical to [dog1, 270] remoteExec ["setDir", (owner dog1)]; with an implicit owner call in the background?
How much does the owner cost? Is it a call to the server who is the only one to have the ownership of all units?
Coz if it is the case, it is better to go with the target 2 to avoid unnecessary network traffic.
Since there are 2 remoteExec in a row, I would get the ownerID once then do the calls on the right target if I don't know it in advance.
owner only works on the server
and it doesn't cost anything
using the object as the remoteExec target is always better
it's best to create a function and remoteExec the function instead
Yes, so the remoteExec with an object will be executed first on the server to get the owner then pushed to whoever owns the unit. I don't understand how it can be better than targeting the right target from the beginning. (When you know it)
There is almost no diff when the owner is the server itself for sure, but if there is an HC for example who owns the dog, it looks better to target it directly.
because you can never know for sure
and it's best not to care anyway
I mean I think the performance difference is negligible regardless. I think he's just saying it's generally better convention to use the object when it is available. Using remoteExecutedOwner is also something I tend to frequent in cases where I don't have an implicit reason to pass the player object but need to execute back on the client.
Neither is worse off than the other just preference ๐
yeah. when there's no difference in cost and one is more flexible, it's obvious which one to go with
In my case, I really need to optimize the network traffic on the server, so if I can skip a call on the server to reach the final target, I go this way.
the cost of processing a network message is several thousand times higher than checking the final target
Indeed
if you want to save performance, focus on reducing the number of your remoteExecs
Already the case. But a different topic.
well the point is that this is not an optimization at all (I mean using 2 instead of obj)
Why? It always goes first to the server?
yes
If you're looking to reduce network I would say one of the largest things you could do even maybe larger than just optimizing existing remoteExec is checking your current public broadcast usage. Any variable that is defined public with true is broadcasted and updated across every connected client in mission and added to the JIP queue. Same thing with global entities.
I thought it was skipping the server. If you target -2 for example.
It is.
The target -2 is all clients but not server. Where as 2 is server. When you use true you are basically doing 0 all clients and server if I am not whiffing on my memory.
But my point is remoteExec targets
To be clear: Leopard20 said it is always better to use the object as target coz' whatever the target is, it always goes first to the server. Is it true or not?
Just to know how it is implemented behind. Specifying the target is just to save a "owner" on server side, or does it call directly the target from the client bypassing the server? (The latter would mean that targeting the object itself is NOT the best choice for all cases)
I understand. I was just adding that since you were talking about network usage being very critical. What I'm saying is reducing public variables and global objects may do you even more of a service then cleaning up remoteExec usage. The largest network and JIP enhancements we have had in this past year have come from cleaning up our public variable and global object usage.
Sure. Dealing with local vars as much as possible, attached to the right namespaces, and so on.
I know how the structure of your code matters also and so on
(prof. experienced full stack dev here)
My question is just how remoteExec is implemented.
I have a question. I'm trying to add in local to player dynamic music to a mission. I used to use a convoluted series of map triggers, but I've stumbled across BIS_fnc_jukebox. Unfortunately documentation on the wiki is very scarce, and I've been trying to figure out how to change its state via trigger. ["terminate"] call BIS_fnc_jukebox doesn't seem to stop the music, nor does ["forceBehavior","Combat"] call BIS_fnc_jukebox seem to change the group behavior
every message always goes to the server first
then the server "forwards" your message to the final target(s)
the server stores the owner and always knows who the owner is
it's like reading a variable
With all IPs stored on the server only. Makes sense.
But depending on how remoteExec is implemented, it could have been different.
Thanks for your answer!
where do you execute it from?
did you try running it locally using the debug console to make sure it works at all?
another big issue I'm having with BIS_fnc_jukebox is that it seems extremely slow to react to changes in behavior state. I've set it with a transition of 3 just as a guess, but there's literally nothing in the wiki describing what the "transition, radius, executionRate" parameters actually ddo and how
running it from a trigger set for local evaluation. I did get it running, it does run with "initialization", but everything is a mystery
if I try to put it in an init script for a group, then all players get music
even those not in the group
doing the inits for individual objects nets the same thing