#arma3_scripting

1 messages ยท Page 191 of 1

cosmic lichen
#

If you wanna script then learn it from ground up and never use AI for it.

lean ice
#

Okey I'll do it, thanks !

thin fox
#

well, start working in one good and well made mission first lol

lean ice
atomic niche
lean ice
#

Okey I didn't know ! Gotta learn then

ancient gull
#

any scripts that allow players to build, public zeus compatible?

split scarab
#

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

old owl
split scarab
thin fox
#

see if pathCalculated EH helps

frozen seal
#

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?

drifting dome
#

how does one call a script at start of mission?

warm hedge
#

Use init.sqf

drifting dome
#

make a file called init.sqf in the mission folder and then use that to call my script?

warm hedge
#

Yes

#

Urm, no

#

init.sqf will be run automatically

drifting dome
#

yeah but I want my script to be called at startup

warm hedge
#

Then it is

pallid palm
#
[] execVM "Scripts\briefing.sqf";
//or
[] execVM "briefing.sqf";
drifting dome
#

cool cool

river whale
#

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

warm hedge
#

Triggee_Con is not helitrig1

pallid palm
#

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

fleet sand
warm hedge
#

Either way, it doesn't matter

pallid palm
#

agree

river whale
#

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

pallid palm
#

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
};
fleet sand
#

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.

pallid palm
#

agree

#

yeah i fogot he was using a Labtop to exec it

split scarab
#

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";
warm hedge
#

Wrap everything into {} and remoteExec"call"

split scarab
proven charm
#

_x invalid?

split scarab
#

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];
split scarab
proven charm
#

well if you remoteExecCall the code without _x being defined in the code it makes sense that _x is nil

split scarab
#

You mean that _x isn't defined on the client recieving the call?

proven charm
#

yeah

split scarab
#

Hmm yeah that's very likely

#

No way to set the value before sending it to the client?

tender fossil
proven charm
#

it should be possible... ```
[args,code] remoteExec ["call"];

tender fossil
#

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];

split scarab
#

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

proven charm
#

was other way around^

split scarab
proven charm
#

like this: ```
[777,
{
params ["_x"];

systemchat (str _x);

}] remoteExec ["call"];

split scarab
warm hedge
#

Yes. remoteExec'ing it is not so different with regular ones

#

Just "network compatible" variant, you still need to pass args like that

split scarab
#

Works! Thank you guys :)

split scarab
#

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

proven charm
#

OB_hvtTarget not supposed to be local? to the player i mean

split scarab
#

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

proven charm
#

yes i know its a global variable ๐Ÿ™‚

proven charm
#

so you as player are west side?

#

and OB_hvtTarget east AI?

split scarab
split scarab
# proven charm so you as player are west side?

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

proven charm
#

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

thin fox
proven charm
#

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

median perch
#

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

split ruin
#

@median perch didn't test it myself but you can try this, ready to implement framework

lost leaf
#
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?

median perch
#

nevermind i found the section

split ruin
errant iron
#

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).

drowsy geyser
lost leaf
# lost leaf ```// config.cpp class CfgFunctions { class TAG { class Weapons { ...

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.

split scarab
#

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

urban rover
#

hi! is it possible to restore fallen tress after they got damaged? I know how to restore damaged buildings, but trees ? thx!

errant iron
# lost leaf A small addendum to my question that's probably much more complicated - is it po...

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)

fair drum
#

do HashMapObjects support a kind of pseudo Super for method overrides?

little raptor
#

no. you can use the base tho

edgy dune
#

is there any case where I should use execVM over defining a function and using call/spawn etc

little raptor
#

no

#

if you just want to test something maybe

#

or if it's just something that you run once or twice

little raptor
#

in Arma you can't "revive" something once it's dead (a fallen tree is a dead object)

shy siren
edgy dune
tidal idol
#

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.

granite sky
#

vehicle _unit == _unit or isNull objectParent _unit

hushed turtle
tidal idol
#

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 ==

granite sky
#

Not in this case, no.

broken forge
#

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

fair drum
#

you gotta run addRating on the client where player is local. Local argument, global execution.

stable dune
#

Ah , hypo was there before me ๐Ÿ˜

jovial sinew
#

okay yeah i didn't know about this, and this was the solution lmao, many thanks misc_chma_pepe_heart

split ruin
#

@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

lime rapids
#

is there any command like set acc time for multiplayer? or would one have to slow every animation and vehicle manually?

cosmic lichen
#

Simulation time cannot be changed in multiplayer.

split scarab
hallow mortar
#

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.

grand narwhal
#

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?

warm hedge
grand narwhal
#

Is there also a function for spread info?

grand narwhal
#

Yeah but that is after the shell has fired. Which isn't what I'm looking for

thin fox
#

what are you trying to achieve?

grand narwhal
#

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 ๐Ÿ˜‰

thin fox
#

do you need the spread out info for what?

#

markers?

grand narwhal
#

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

thin fox
#

I mean, if there's something to get spread out before firing xD I'm all ears

grand narwhal
#

Thx for sharing. I already had my own firearty script. But it always helps to see others approach ๐Ÿ™‚

grand narwhal
thin fox
grand narwhal
#

Thx for sharing! Looks good. Mine will be a little different. From the Map display itself

thin fox
grand narwhal
#

The joy from solving these "nightmares" can be somewhat addictive though ๐Ÿ˜…

chrome hinge
#

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?

proven charm
#

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

warm hedge
#

You can mass create it via script. Or you may try setsObjectScale

chrome hinge
#

you got any guesstimate on how much better it is for performance?

fleet sand
fleet sand
chrome hinge
#

does the resolution make cutters chonk bigger pieces?

grand narwhal
chrome hinge
#

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

grand narwhal
fleet sand
grand narwhal
chrome hinge
#

i also thought about creating cutters dynamically around player in grass render distance but there doesnt seem to be way to find it either

grand narwhal
#

then maybe an on eachFrame script locally to the player with spawning and removing it. But that isn't really practical xD

warm hedge
#

As I said, you can really just mass create the cutter

chrome hinge
warm hedge
#

Hm

chrome hinge
#

areas i needed would require several hundreds of them

#

any idea how hard it would be to mod a bigger one?

warm hedge
#
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
warm hedge
#

This is not the issue from vanilla game

chrome hinge
#

what is that step portion at beginning you do in the script?

warm hedge
#

Oh wait, yeah it is

chrome hinge
#

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

warm hedge
#

You can try hideObject cutters then

proven charm
#

and createSimpleObject becuz createvehicle breaks AI pathfinding

split ruin
#

why not just add

//initPlayerLocal.sqf
setTerrainGrid 50;
#

this will remove grass

chrome hinge
split ruin
#

@chrome hinge wot ? ๐Ÿ˜ตโ€๐Ÿ’ซ

chrome hinge
#

the visuals work decently nice from distance but when you get close grass covers the mud often

#

and up close

split ruin
#

still you can completely remove it by provided command, why not using it ?

chrome hinge
#

it removes all grass?

split ruin
#

yes, completely, for each player

chrome hinge
#

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

split ruin
#

you want no grass only where "the mud" is ?

chrome hinge
#

yes

#

and i managed that too by spamming the grasscutters but they get too numerous

split ruin
#

rip performance if you stack a lot of them

#

this finds anything but grass ๐Ÿ˜ฆ

chrome hinge
#

yeahh, grass is apparently "clutter"

split scarab
#

With createTrigger how do you make it only server handled?

granite sky
#

I guess set the third parameter to false, and then only call setTriggerStatements on the server.

fair drum
#

moved to GUI channel @granite sky

split scarab
#

How would I set/get the variable name of a trigger created with createTrigger? Like how you do on a trigger in the editor

faint burrow
#

The command returns trigger object, assign it to a global variable.

split scarab
#

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

shy siren
#

_mytrigger set3DENAttribute ["Variable Name","newvarname"];

#

probably...

split scarab
#

I'll give it a shot, thank you

quick sky
#

addGoggles doesn't do nightvision, what does?

hallow mortar
#

linkItem

marsh schooner
#

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

haughty timber
#

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

granite sky
haughty timber
#

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

granite sky
#

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.

haughty timber
#

Every 0.1 or 0.5 seconds perhaps?

haughty timber
#

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

granite sky
#

Not sure why you'd need forums for that.

#

Create & increment a global variable. Format a string with it?

fair drum
#
_obj setVehicleVarName format["myVar_%1", _number];

how you come up with _number is up to you

haughty timber
#

Yes idk how to increment the number

#

Especially since I'm doing it in a mod module

haughty timber
granite sky
#
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

fair drum
#

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

haughty timber
#

Thanks

#

Keep in mind I'm a very novice scripter

fair drum
#

consider yourself one step closer

haughty timber
#

Right, thanks

pallid palm
tulip ridge
#

Which is what Nikko said just under their message

pallid palm
#

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

haughty timber
#

...apparently BIS_fnc_objectVar is already a thing and does it so much easier lmao

hallow mortar
#

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.

haughty timber
#

Fair point!

haughty timber
#

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;```
granite sky
#

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;
haughty timber
#

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

warm hedge
#

Please check pinned post for your starting point

haughty timber
#

Hi, thanks, which one?

warm hedge
#

Top one

haughty timber
#

Ok

#

The CfgDisabledCommands one?

warm hedge
#

No. The top one

haughty timber
#

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?)

lime rapids
tender fossil
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
haughty timber
#

Thank you

cosmic lichen
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
split scarab
#

How can I check if a unit is equipped with NVGs and remove them if so?

little raptor
#

hmd returns the currently used NVG

#

not sure if it works with headgear NVG

#

probably not

pallid palm
#

@split scarab You don't have to identify if a unit has NVGs,,,, just run the unassignItem anyway

split scarab
#

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; };
pallid palm
#

why would you have to detect NVGs

#

just run the unassignItem anyway

split scarab
#

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

pallid palm
#
    _x unassignItem "NVGoggles_OPFOR";
    _x unassignItem "NVGoggles";
    _x unassignItem "NVGoggles_INDEP";
split scarab
#

That'll work for all modded NVGs as well?

pallid palm
#

you don't need to detect if some one has NVGs just get rid of them

little raptor
#

look at the config viewer of some nvg item to see what values it uses

pallid palm
#

ofcorse, i only use Vanilla Arma 3 so well you know

split scarab
#

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)
};
pallid palm
#

nice

faint burrow
proven charm
#

can lag cause serverTime not to update?

proven charm
#

getting weird load phase times when time it takes is ~2 seconds but (serverTime - lastLoadPhasechangeTime) is never above 1

forest thicket
#

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?

abstract veldt
#
    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?
warm hedge
#

That EH is for curator module not player

drowsy geyser
#

is it possible to disable/deactivate the flashlight while in spectator mode? (the flashlight when pressing L button)

abstract veldt
warm hedge
#

Yes

abstract veldt
#

Ok so the EH needs to be added to the Curator module instead of the player, thank you makes sense!

nocturne timber
#

can playSound3D just not work in junction with CfgSounds ? seem to be having a weird one with this.

tulip ridge
#

It takes a path

#

Not a CfgSounds class

forest thicket
# warm hedge For what purpose

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

nocturne timber
# tulip ridge Not a CfgSounds class

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

tulip ridge
tulip ridge
#

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 };
};
forest thicket
#

okay yea, thats really what im trying to do

tulip ridge
#

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

tulip ridge
forest thicket
tulip ridge
#

Can just extract them from the pbo

#

Need author's permission to reupload though

forest thicket
#

alr, just to be on the safe side how do I correctly extract and repack them when im done?

tulip ridge
#

Use something like Addon Builder to build it into a pbo

forest thicket
#

ok, thanks man :)

abstract veldt
#

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.

proven charm
#

this i think: origin getPos [distance, heading]

#
_thepos = (getPosATL player) getPos [1, getdir player + 90];
digital hollow
#

Unit modelToWorld [1,0,0]

proven charm
#

oo so short

abstract veldt
#

thanks!

ionic merlin
#

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

tulip ridge
#

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

ionic merlin
#

ooo okay

drifting dome
#

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;
hushed turtle
#

Sleep for 5 seconds and stop him

drifting dome
#

right... so how do I stop him?

proven charm
#

try doStop, not sure

drifting dome
#

Based on what I found on the BIKI doStop just stops the unit from moving, not firing.

proven charm
#

yea i know

#

you can also try tracerMan doSuppressiveFire objNull;

drifting dome
#

so that would look like this?

tracerMan doSuppressiveFire tracerTarget;
sleep 5;
tracerMan doSuppressiveFire objNull;
proven charm
#

yes

agile bolt
#

regarding event handlers, do i need to pass variables and functions to it if i want to use them, like with spawn?

drifting dome
#

this sadly did not work :/

agile bolt
#

could always disable ai weapon fire feature for a moment, no?

drifting dome
#

you speak wise words (I hope)

little raptor
#

for other events you can set a variable on the object that you add the EH to, and read it in there

agile bolt
#

aha, excellent. thanks
EH wiki has quite a bit of info, had me dumbfounded ๐Ÿ˜„

little raptor
drifting dome
#

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;
drifting dome
#

this is part of a larger script run in a while loop

little raptor
#

the reason I asked is that sleep only works in scheduled environments, and I figured you were not in one

drifting dome
#

im calling it as its own .sqf file

#

execVM i think

little raptor
#

that's scheduled yeah

charred monolith
#

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.

proven charm
#

@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;

lost leaf
fair drum
naive wigeon
#

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;
}
  1. 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?
  2. Does the _syncedUnits if update will be also updated inside the CBA_fnc_addPerFrameHandler block?
granite sky
#

The code's wrong. Brackets are mismatched.

#

1 is just remoteExec(Call).

pseudo crow
#

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.

gritty escarp
#

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?

tulip ridge
gritty escarp
tulip ridge
#

First
The object wouldn't exist at all for player B

gritty escarp
#

Thank you, this gives me ideas to troll rule breakers

drifting dome
pseudo crow
#

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

hallow mortar
#

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

pseudo crow
#

ok thanks

hallow mortar
#

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.

warm hedge
lost leaf
# lost leaf ```// config.cpp class CfgFunctions { class TAG { class Weapons { ...

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.

hallow mortar
#

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.

charred monolith
#

Is there a better solution than UnitCapture for that sort of thing ?

lost leaf
azure mural
#

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

proven charm
#

probably with createUnit

#

well thats what i use for civilian module

azure mural
narrow isle
#

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.

tulip ridge
#

You can do that just fine, you probably didn't update the path

#

Also use code blocks
```sqf
systemChat "hi";
```

vv

systemChat "hi";
narrow isle
#

Oh, thanks for that! It helps!

vagrant elm
#

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

pallid palm
#

wow that white code hert's my eyes ahhhhhhh

split scarab
#

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];
hallow mortar
#

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

proven charm
#

nvm read rest of the script ๐Ÿ™‚

hallow mortar
#

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)

fleet sand
#

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];
split scarab
#

Assuming this would also go in initPlayerServer.sqf?

fleet sand
#

If you run it on InitPlayerServer idk becouse of RE would it run twice havent tested that IDK so

split scarab
granite sky
#

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.

split scarab
tulip ridge
plain bramble
#

would anyone happen to know the classname for RHS's BM-21 ammunition such as the M-210F?

proven charm
#

or is it not artillery?

hushed turtle
#

It should be artillery

plain bramble
#

this is getting too complicated I'm just wanting a mass missile barrage to beckon the end of the mission...

hushed turtle
#

Virtual barrage? (without vehicle firing it)

plain bramble
#

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.

hushed turtle
agile bolt
split scarab
#

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

proven charm
#

u mean he stays down?

split scarab
#

Yeah

#

Seems player setCaptive false; might have done the trick? But the visual effects from being damaged/wounded stay on screen

royal quartz
#

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];
};
proven charm
novel mountain
#

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

hallow mortar
#

I'd suggest using if (local _computer) instead; that should be safe for all contexts.

royal quartz
hallow mortar
#

How are you retrieving the variables?

royal quartz
#

_computer getVariable "MDIH_Drop_List";

#

just to test im getting the value that it set not a default value

hallow mortar
royal quartz
#

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

royal quartz
#

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.

split scarab
# proven charm but player is not dead?

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)

proven charm
#

but player is not dead?

split scarab
#

Nope, but dies after 3 minutes

proven charm
#

ok

royal quartz
hallow mortar
little raptor
royal quartz
royal quartz
# hallow mortar I wasn't asking about how `_computer` is defined in the function that sets them,...

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.

hallow mortar
#

You are aware that you're setting the variables to empty arrays?

royal quartz
#

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

little raptor
royal quartz
chrome hinge
#

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?

little raptor
#

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

chrome hinge
#

if you have ideas what and how to possibly shave off im all ears. apparently fatigue is one?

royal quartz
royal quartz
#

alright thanks

little raptor
#

I was replying to halipatsui meowsweats

little raptor
#

not server

royal quartz
#

and now it works in zeus too

little raptor
#

params already does that

#

that wasn't your issue

royal quartz
#

so Idk what to tell you

#

params makes the var private too

#

maybe that is the difference

little raptor
#

well feel free to change it back and it'll still work I bet

royal quartz
#

ok ill do that and see now.

#

changed to this.
params ["_computer"];

little raptor
#

and?

royal quartz
# little raptor 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?!

little raptor
#

maybe the restart is what "fixed" it because your code wasn't updated blobdoggoshruggoogly

royal quartz
candid narwhal
#

Greetings,
Following question:

I am trying to select (/ count) the number of AI on a given side in a forEach logic, 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 select still works so allUnits gives me my desired side?

hallow mortar
#

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;```
candid narwhal
#

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;
hallow mortar
hallow mortar
candid narwhal
candid narwhal
hallow mortar
#

Essentially, yes

candid narwhal
#

thx alot! Its working now

lyric gulch
#

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?

hallow mortar
#

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.

lyric gulch
lyric gulch
hallow mortar
hallow mortar
lyric gulch
hallow mortar
next gust
#

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.

sharp grotto
#
// 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 blobdoggoshruggoogly

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";
    };
}];
next gust
#

will give that a try, thanks!

errant iron
#

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

granite sky
#

Hmm. Doesn't look like it.

light burrow
#

does anyone know if its a possibility to add a scrollwheel menu to a vehicle to swap texture on the fly?

tulip ridge
upbeat hill
#

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.

warm hedge
#

Post your code

upbeat hill
#

hideObjectGlobal nearestObject [2500, 2500, 0];
hideObjectGlobal nearestBuilding [2500, 2500, 0];

#

tried both of these dont seem to work

warm hedge
#

You sure you have a building to hide in [2500, 2500, 0]

fleet sand
#

Also hideobjectglobal takes in a object and not array of objects

warm hedge
#

nearestObject returns an object so syntax is correct

hallow mortar
#

Keep in mind hideObjectGlobal must be run on the server

stable dune
upbeat hill
warm hedge
#

No

upbeat hill
#

or should nearestObject be replaced with a variable of a specifc object i want hidden

warm hedge
#

There is no radius specification anywhere of your code

#

The answer is literally depends on your goal

upbeat hill
#

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

warm hedge
#

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

upbeat hill
#

im trying to hide any objects that are objects built into the map within a radius of the trigger that contains hideobjectGlobal

warm hedge
#
{
  hideObject _x;
} forEach (nearestTerrainObjects [2500, 2500, 0], [], 200]);```or something, not tested
upbeat hill
#

{
hideObject _x;
} forEach (nearestTerrainObjects [TomPos, ["HIDE", "ROAD"], 100]);

#

This is what i ended up with. which works perfecelty

warm hedge
#

"HIDE"what

#

I actually don't know what it supposed to detect

upbeat hill
#

seems like its every object from what im seeing

hallow mortar
#

Think of it as "hide" as in "things to hide behind", like "cover"

proven charm
#

can you do anything with objects that dont have typeof? like get some sort of class. for Rocks, etc

warm hedge
#

With nearestTerrainObjects?

proven charm
#

i mean after nearestTerrainObjects, i would like to get the unique type, not just ROCK

warm hedge
#

It does not use classNames to detect anything but P3D's specification

proven charm
#

yeah, can i get the P3D though?

warm hedge
#

Get what?

proven charm
#

filename

#

model name

warm hedge
#

Not sure what you ask

cosmic lichen
#

Not all terrain objects have a class

proven charm
#

yeah

little raptor
cosmic lichen
#

Such as vegetation for exanple

#

Ah lol. You were looking for the p3d

proven charm
#

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

little raptor
#

use the model path

#

not name

proven charm
#

i mean two objects defined in configs using same model

little raptor
#

as for scale, they do vary for terrain objs

#

especially rocks and trees

proven charm
#

hmm ok i guess i cant use my hasmap optimization then

little raptor
#

why do you need to know about the size that's so slow?

proven charm
#

to spawn vehicles in free spot

little raptor
#

a simple BB check should be fast

proven charm
#

im just testing distances

spiral trench
#

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.

still forum
#

findEmptyPosition command?

proven charm
#

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?

ruby delta
#

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

drifting dome
#

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?

digital hollow
#

You can check each player for getAssignedCuratorLogic, or check each curator for the assigned unit

drifting dome
#

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"

digital hollow
#

You'd want to with with the units (objects) before turning to names, yes. Check what the function returns

drifting dome
#
_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
drifting dome
#

instead of just _x?

#

thank you!!

wind basin
#

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;
hallow mortar
#

10-metre radius isn't very far. There could be another problem, but start by making sure they're all close enough.

wind basin
#

Definitely had players close enough for it.

hallow mortar
#

Make sure your server/mission's CfgRemoteExec allows clients to send that command

wind basin
hallow mortar
wind basin
#

Alright I'll give that a go. Thank you.

native hemlock
#

@spiral trench Try "DeployWeaponAuto"

stable dune
wind basin
proven charm
buoyant hound
#

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?

little raptor
#

you have to redo it every time you enter and exit the curator interface.
the issue is due to terminating r2t iirc

digital hollow
#

You can do it in CBA_fnc_addPlayerEventHandler "featureCameraโ€ camera changed (Curator, Arsenal, Spectator etc.)

tidal idol
#

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.

digital hollow
stable dune
stable dune
#

Yeah, true.
My bad, didn't read what I read.
But anyway, it should work without remoteexec.

proven charm
#

no problem , had to check ๐Ÿ™‚ (sanity check)

arctic linden
#

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

arctic linden
#

I asked ChatGPT

atomic niche
arctic linden
#

But this will be useful

#

thanks

exotic gyro
#

I'm assuming that's what you're looking to do

lost grove
#

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
hallow mortar
#

vectorWorldToModel might be useful to you

lost grove
# hallow mortar `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...

spiral trench
#

That's it, thanks @native hemlock

dusty steppe
#

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

warm hedge
#

No

errant iron
# lost grove I have tried `player doWatch objNull;` in an attempt to cause the player to lose...

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

split ruin
#

When I use gesture from SOGPF it shows multiple times on the screen when I have AI in the group. Is this normal? ๐Ÿค”

proven charm
proven charm
hallow mortar
#

It's probably just hideObject tbh

proven charm
#

ok

hallow mortar
minor timber
#

Hi guys, please, why it's not working ?

setObjectViewDistance ((getObjectViewDistance + 400) min 1200)

setObjectViewDistance ((getObjectViewDistance - 400) max 200)

dry nexus
#

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

split ruin
#

@proven charm vanilla SOGPF, just added the gestures default module to the mission

little raptor
split ruin
#

@little raptor already did, but nothing for now ...

lost grove
#

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

tidal idol
proven charm
tidal idol
tidal idol
#

Nah I'm very sure periscope won't solve my request

tidal idol
#

Yeah i found that its on my todo list

quick sky
#

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[] = {};
    };
};
quick sky
#

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.

limpid cape
#

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?

cosmic lichen
#

If you are looking for the texture used 3den Enhanced's Texture finder.

split ruin
#

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];

?

stable dune
#

So you cannot remoteExec .sqf, you need use exec VM

shut lily
#

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.

dusky aspen
#

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

ornate whale
# dusky aspen Anyone wanna point me in the right direction, using Eden Enhanced and tried to u...

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

gleaming forge
#

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...

dusky aspen
#

ok thanks, ill give it a try and see what I can come up with

ornate whale
dusky aspen
#

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

gleaming forge
#

Negative

#

It's ok, we figured out to do this
{side _x == west && alive _x} count playableUnits <= 0

ornate whale
gleaming forge
#

Yeah that's it, we have it server only and then executing a remoteExec for the mission completion

ornate whale
buoyant hound
#

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 ?

warm hedge
#

Post your trigger setup

buoyant hound
#

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

tulip ridge
#

Use hideObjectGlobal (and keep the server only box checked)

warm hedge
#

Also if the trigger is supposed to ran in first second, using trigger is unnecessary

split ruin
#

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!" ๐Ÿ˜”

faint burrow
#

Obviously, your condition is wrong.

shut lily
split scarab
#

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 โˆž

winter rose
#

you wrote "if (it does not have interface AND is not the server)" ๐Ÿ˜„

split ruin
#

@winter rose HC is not the server and don't have interface, right?

little raptor
#

in other words it will run on every computer anyway

#

except for a non-dedicated server

little raptor
#

that's not how it's supposed to be written

split ruin
#

@little raptor so I am limited to only two ?

little raptor
#

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

split ruin
#

sounds simple enough to try

little raptor
#

in your case it would be:
[[...], "script.sqf"] remoteExec ["execVM", 0]

split ruin
#

@little raptor if I want the target machine to be the HC, can I refer to it somehow?

little raptor
#

how is this script supposed to run? by trigger? init.sqf? etc.

split ruin
#

otherwise have to execute it globally and then write extiWith withing the sqf

#

from initServer.sqf

faint burrow
#

Name your HCs and use these vars.

split ruin
#

I have var names HC1 and HC2

little raptor
#

instead of remote execing

little raptor
#

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)

split ruin
#

yeas but it shouldn't execute upon beginning of the mission. thats the problem

little raptor
#

then when?

split ruin
#

after some time

little raptor
#

why do you use init then?

#

have you put some sleep in it?

split ruin
#

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 ...

little raptor
#

well then use [HC1, HC2] as the remote target in your remoteExec (instead of 0)

split ruin
#

like this ?

[[[3027.05,8719.83,0],0.1],"asset\garrison.sqf"] remoteExec ["execVM",HC1];
little raptor
#

didn't you want HC2 too?

#

if you just want HC1 it's correct

little raptor
little raptor
split ruin
#

@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

chrome spoke
#

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)

thin fox
#

example

chrome spoke
#

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 ?

thin fox
#

so it should be just "image.paa"

chrome spoke
#

huge, thank you

thin fox
#

or if in a folder: "folder\image.paa"

little raptor
thin fox
#

or that

finite sail
#

I just had a script error that * really was * a missing semicolon

ornate whale
# shut lily Official files, inside the A3 addons

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.

mild tiger
#

can anyone help me figure out how to set a respawn for ai vehicle and crew in eden

split ruin
mild tiger
split ruin
#

@mild tiger everyone

ornate whale
# mild tiger can anyone help me figure out how to set a respawn for ai vehicle and crew in ed...

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.

tired nimbus
#

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

tired nimbus
#

Thereโ€™s something specific I remember

old owl
# split ruin I have a problem with HC, it does not spawn AI ``` [[3027.05,8719.83,0],0.1,"as...

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 popcat

split ruin
#

@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;
granite moat
#

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

winter rose
#

(+ deleteVehicle ofc)

granite moat
#

let me test that ๐Ÿ‘

winter rose
#

you might even be able to use any object, you may not need a unit

#

(saving perf)

granite moat
#

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

winter rose
#

sure, you can also disable all its AI, disable its simulation, hideObject it too and only place it where needed, when needed

granite moat
#

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

winter rose
granite moat
#

yes, here it works with an AI, now will test with a vehcile ๐Ÿ˜‰

granite moat
tulip ridge
granite moat
#

(the player pos here is when testing with me as center of explosion)

winter rose
hushed turtle
#

Maybe even game logic object would work too ๐Ÿค”

winter rose
#

AI > game logic > inert objects

granite moat
winter rose
west portal
#

how does the IncomingMissile EH work? I keep getting it triggered twice

errant iron
#

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.

raw pewter
#

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?

cosmic lichen
#

Use dynamic simulation

raw pewter
cosmic lichen
#

Yes

raw pewter
#

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

cosmic lichen
#

I don't know. But I'd expect the mod to handle that automatically.

modern plank
#

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!

quaint drum
#

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

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
tulip ridge
#

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;
tulip ridge
modern plank
#

My goal is to wait on the server something like 2 hours before launching the scoreboard on all clients. Is it suitable still?

tulip ridge
#

If its just a single time, you can just use a waitAndExecute, no need to use a loop for something that only happens once

modern plank
#

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)

tulip ridge
#

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)

modern plank
#

thanks a lot

#

Not sure if it optimized though

tulip ridge
#

Yeah anything that's going to be checking the time like that is going to be running every frame

modern plank
#

So it consumes a lot with condition evaluation.

tulip ridge
#

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

modern plank
#

since I am testing only each second

tulip ridge
#

Engine is still checking every frame if 1 second has passed because of the sleep

modern plank
#

I dunno how the sleep is implemented.

tulip ridge
#

The same way

modern plank
#

ok.

#

will try with that. Thank you!

little raptor
#

for long sleep just use sleep. no need for CBA

modern plank
#

Ah interesting ๐Ÿ™‚

#

Looking for this kind of feedback

little raptor
#

for such long delays you can't be too accurate anyway

modern plank
#

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.

little raptor
#

also I should point out that the performance won't matter too much for just 1 wait until

#

a few micro seconds at worst

modern plank
#

Ya but I may have several later, and I want to know the optimized implem since I don't like to waste for nothing.

old owl
#

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?

tulip ridge
#

CBA's functions are also based on normal mission time, so they're affected by increasing/decreasing the accTime

pallid palm
#

thats good to know thx @tulip ridge

old owl
#

Apologies for the barrage of questions just curious since I've not really messed around with CBA too much.

tulip ridge
#

CBA's functions like waitAndExecute, waitUntilAndExecute, and addPerFrameHandler are based off of mission time. For a vanilla comparison, it's like sleep vs uiSleep

pallid palm
#

he means thats (not) what he said i think

old owl
#

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.

tulip ridge
#

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;
};
tulip ridge
old owl
#

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.

tulip ridge
#

It just makes time related stuff easier, because you don't need to handle timing differently in SP/MP

modern plank
#

A short one: how can I pad left a number with a zero in format or any alternative when formatting a string?

little raptor
#

you mean decimal places? toFixed

modern plank
#

Minutes on 2 digits

little raptor
#

ah to left meowsweats

modern plank
#

Even when <10

drifting dome
#

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

little raptor
# modern plank Even when <10

ahm, one idea I had just now:

_fnc_padWith2Zero =
{
    private _str = (_this + 100) toFixed 0;
    _str select [count _str - 2]
}
warm hedge
#

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)

modern plank
#

Ok, let's reinvent the wheel ๐Ÿคฃ

little raptor
#

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"

old owl
#

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.

little raptor
#

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)

modern plank
#

floor ( _x/ 100) * 100

#

Not a difficult one

little raptor
#

yeah * 100 (well round not floor)

modern plank
#

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

old owl
#

Oh. Would BIS_fnc_secondsToString do what you are seeking?

modern plank
#

Perfect, thanks

willow saffron
#

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.

faint burrow
thin fox
#

I think he doesn't know how to apply it to the new vehicle (the use of the expression field)

faint burrow
#

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);
    };
};
reef sedge
#

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?

atomic niche
reef sedge
atomic niche
#

and you replaced "unit" with the actual vehicle you want it to affect? or how are you running that code

reef sedge
#

coppied it into the init box just as it said on the site

granite sky
#

They're using unit as a placeholder in the example.

#

If it's an editor init box then use this

digital hollow
#

userMFDValues get broadcast to all machines, right?

reef sedge
tulip ridge
buoyant frigate
#

Is there a way to remove a weapon from a container that doesn't involve using the clearWeaponCargo command?

winter rose
#

addWeaponCargo, funnily enough

buoyant frigate
#

Because that command straight up wipes the entire container lol

buoyant frigate
winter rose
#

please, call me Lou

buoyant frigate
#

Lord Lou

#

Man the answer was right under my nose lol

#

Much appreciated ๐Ÿ‘Œ

last cave
#

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? arma3

errant iron
# last cave I have a question with an undefined topic. I have a server mod that stores funct...

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

last cave
#

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 blobcloseenjoy

granite sky
#

remoteExec ["fnc", 0, object] has its own problems...

#

(only one of those can be stored in JIP per object)

calm ruin
#

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.

tulip ridge
calm ruin
#

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*

granite sky
#

setDir needs to run local to dog1.

#

first line doesn't do anything either btw

tulip ridge
tulip ridge
# calm ruin Rather, _dog*

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.

calm ruin
#

dog1 attachTo [player, [0, .25, .5]];
dog1 setDIR 270;
dog1 setPosWorld getPosWorld dog1;
dog1 allowDamage false;

#

is what I have now

granite sky
#

I think the note on direction networking is obsolete.

#

Your problem is likely that you're running this somewhere that dog1 isn't local.

calm ruin
#

Okay, so if thats the case, I can get rid of the setpos/getpos line as well.

tulip ridge
#

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)

granite sky
#

should be fine.

calm ruin
#

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

modern plank
# tulip ridge This could just be: ```sqf dog1 attachTo [player, [0, 0.25, 0.5]]; [dog1, 270] r...

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.

little raptor
#

and it doesn't cost anything

#

using the object as the remoteExec target is always better

little raptor
modern plank
#

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.

little raptor
#

and it's best not to care anyway

old owl
#

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 ๐Ÿ™‚

little raptor
#

yeah. when there's no difference in cost and one is more flexible, it's obvious which one to go with

modern plank
#

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.

little raptor
#

the cost of processing a network message is several thousand times higher than checking the final target

modern plank
#

Indeed

little raptor
#

if you want to save performance, focus on reducing the number of your remoteExecs

modern plank
#

Already the case. But a different topic.

little raptor
modern plank
#

Why? It always goes first to the server?

little raptor
#

yes

modern plank
#

Ah.

#

So ok. If it is just about skipping the owner call on the server, agreed.

old owl
#

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.

modern plank
#

I thought it was skipping the server. If you target -2 for example.

old owl
#

It is.

modern plank
#

??

#

I know for broadcasted var and so on.

#

Everything is optimized

old owl
#

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.

modern plank
#

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)

old owl
# modern plank But my point is remoteExec targets

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.

modern plank
#

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.

crystal ore
#

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

little raptor
#

then the server "forwards" your message to the final target(s)

little raptor
#

it's like reading a variable

modern plank
#

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!

little raptor
#

did you try running it locally using the debug console to make sure it works at all?

crystal ore
#

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

crystal ore
#

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