#arma3_scripting

1 messages ยท Page 161 of 1

timid glen
#

livetests are my passions

little raptor
#

You have to get it then increase it then set it

timid glen
#

And there is no easier way? seems like a lot for simply increasing a value by one

little raptor
#
_map set ["var", (_map get "var")+1]
timid glen
#

Ah thanks! I was worried I would have to do it outside of the set command due to limitations

little raptor
timid glen
#

Alright

#

I used that method ^^ looks good

little raptor
timid glen
#

well I dont use it enough for that to be fair, it only happens I think 4 times in the entirety of the file so its fine

#

Im just using it to count the groups assigned to each Headless client and then subtracting from a counter to see where I need to assign more groups dynamically

#

It feels very rudamentary to have to iterate through all groups just to sort by owner, do you by chance know of a command or function that already does it?

#
                    private _unassignedgroups = [];
                    private _assignedgroups = [];
                    {switch (_x owner) do {
                        case (!player && !((_x owner) in _allhcs)) : {
                            _unassignedgroups pushBack _x;
                            };
                        case(!player && ((_x owner) in _allhcs)) : {
                            _assignedgroups pushBack _x;
                            _allhcs set [(_x owner), (_allhcs get _x)+1];
                            };
                        };
                    }forEach allGroups;```
tulip sluice
#

Yes!

timid glen
#

cause this is my way rn but it feels very suboptimal

little raptor
#

Syntactically

timid glen
#

Im realtively new to sqf syntax, whats wrong with it?

little raptor
#

_x owner => owner _x
!player => !isPlayer _x
At first sight

tulip sluice
#

Could I perhaps dm you about this? I can show you my code and the website from which it needs to fetch the data.

timid glen
#

Oh shit its owner object not the other way around lmao

#

thx

warm hedge
#

No DMs. Also it is not possible to fetch an online data anyways via scripts (AFAIK)

little raptor
timid glen
#

Yeah I messed it up when I read it on the wiki

#

but do you think this code will work in principle?

little raptor
#

No

#

Your switch is comparing the owner to a bunch of booleans

timid glen
#

Oh, yeah thats fair

#

So how would you suggest that I could filter it into these cases?

little raptor
timid glen
#

Is the boolean in the begiining and the cases would be smt like switch(owner _x != player, owner _x in _allhcs) and then case(true, true) and case(false, false)?

#

Would that be possible?

little raptor
#

No

tulip sluice
warm hedge
#

boolean = boolean and boolean not boolean = (boolean, boolean)

little raptor
timid glen
warm hedge
#

There is no syntax of (boolean, boolean)

timid glen
#

Okay so how would I implement this then? Just use if statements instead?

#

I was just interested in how switch cases work, I would love to know how to properly use them

warm hedge
#
switch 0 do {
    case 0: {hint "works"};
    case 1: {hint "I don't think it works"};
};```

```sqf
0 call {
    if (_this == 0) exitWith {hint "works"};
    if (_this == 1) exitWith {hint "I don't think it works"};
};```
Idea is basically same
timid glen
#

I guess switches are not useful when comparing multiple booleans like this?

little raptor
# timid glen Okay so how would I implement this then? Just use if statements instead?

First you need to get the headless clients, then assign the groups to them:

_hcclients = createHashmap;
{
  private _info = getUserInfo _x;
  if (_info param [7, false]) then {_hcclients set [_info#1, []]};
} forEach allUsers;

{
   (_hcclients getOrDefault [groupOwner _x, []]) pushBack _x;
} forEach allGroups;

diag_log _hcclients; // shows an hashmap of headless clients and which groups are assigned to them as arrays; 
warm hedge
#

...Comparing multiple booleans is simply not a thing. Just use and

timid glen
#

but thanks that definetly is easier then what I had planned

little raptor
#

What I wrote is more reliable and does everything you wanted, but I guess so

#

Also just keep in mind that you have to run it on the server

#

It won't work anywhere else

timid glen
#

Yeah ofc

#

ah wait wait

#

you cant store the group objs in hashmaps, right?

#

I thought only a very limited amount of things can be stored in there

timid glen
#

yeah it says objects falls under unsupported

#

but is it fine when putting objs into an array?

hallow mortar
#

You can store them as values, just not as keys

timid glen
#

Ahhhh

#

Thank you for that clarification ^^

#
//gets all hcs clients into the Hashmap
                    private _allhcs = createHashMap;
                    {_allhcs set [(groupOwner _x), []];
                    } foreach entities "HeadlessCLient_F";

                    //calls all groups excluding player owned ones and pushes the groups either to the HC into an unassigned grouparray
                    private _unassignedgroups = [];
                    private _assignedgroups = 0;
                    {    if(!player _x && !((groupOwner _x) in _allhcs)) do {
                            _unassignedgroups pushBack _x;
                        };
                        if(!player _x && ((groupOwner _x) in _allhcs)) do {
                            _assignedgroups +1;
                            (_allhcs getOrDefault [(groupOwner _x), []]) pushBack _x;
                        };
                    } forEach allGroups;```
Did it like this now, I think it should work?
meager granite
#

if do

timid glen
#

fuck its then

#

mb mb mb

#
                    //gets all hcs clients into the Hashmap
                    private _allhcs = createHashMap;
                    {_allhcs set [(groupOwner _x), []];
                    } foreach entities "HeadlessCLient_F";

                    //calls all groups excluding player owned ones and pushes the groups either to the HC into an unassigned grouparray
                    private _unassignedgroups = [];
                    private _assignedgroups = 0;
                    {    if(!player _x && !((groupOwner _x) in _allhcs)) then {
                            _unassignedgroups pushBack _x;
                        };
                        if(!player _x && ((groupOwner _x) in _allhcs)) then {
                            _assignedgroups = _assignedgroups + 1;
                            (_allhcs getOrDefault [(groupOwner _x), []]) pushBack _x;
                        };
                    } forEach allGroups;
                    
                    //average expected number of groups per hc
                    private _expectedgroups = floor (((count _unassignedgroups) + _assignedgroups) / count _allhcs); 

                    //freeing up the HCs with extra slots
                    {
                        if(count _y > _expectedgroups) then {
                            for "_i" 1 to (count _y - _expectedgroups) do {
                            private _freedgrouparray = (_allhcs get _x);
                            (_freedgrouparray select 1) setGroupOwner 2;
                            _unassignedgroups pushBack (_freedgrouparray select 1);
                            _freedgrouparray deleteAt 0;
                            _allhcs set [_x,_freedgrouparray];
                            }
                        }
                    }foreach _allhcs;

                    //reassigning the freed groups to HCs with no or little groups
                    {if (count _y < _expectedgroups) then {
                        for "_i" 1 to (_expectedgroups - _y) do {
                            ["transfer",[(_unassignedgroups select 0), _x]] spawn SOEM_FNC_OWNER;
                            _unassignedgroups deleteAt 0;
                            }
                        }
                    }foreach _allhcs;```
#

Did I at least get the syntax right? :D

meager granite
#

_assignedgroups = _assignedgroups + 1;

#

missing ; after foreach _allhcs

timid glen
#

Ah shit

#

fixing ittt

timid glen
meager granite
#

idk, test run it

timid glen
#

I will tommorow

#

its 4Am for me :D

#

im just glad there arent any more obvious mistakes in the code

#

its a start I guess :D

pallid palm
#

dam yull be later for GOLF you better go to bed lol he he

#

just kidding

timid glen
#

golf? :D

#

huh

#

Sorry I think Im too tired to get that one

pallid palm
#

ti love GOLF as much as Arma 3

timid glen
#

like the sport?

pallid palm
#

yes ofc

timid glen
#

yeah I dont play golf

pallid palm
#

im glad u called it a sport

timid glen
#

I mean I call chess a sport dont take it as a compliment

pallid palm
#

lol

timid glen
#

:D

pallid palm
#

i like chess tho

timid glen
#

gn yall thanks for the help <3

pallid palm
#

can i use a if then else inside a Eventhandler

hallow mortar
#

Yes, why wouldn't you be able to?

pallid palm
#

ok cool

#

i ask 1st then i act

#

thx mate

#

man i cant w8 to play GOLF tomarrow im going to shoot like 3 under

#

and win all the money ofc

#

then when i get home its Arma 3 all day WooHoo

#

Good night all love you Guys and girls CU

warm hedge
#

How about to... actually stop to spam your offtopic Scotty?

lime rapids
#

just curios does contact when loaded under the launcher dlc tab work when in multiplayer or does it break most things?

warm hedge
winter rose
pallid palm
#

yeah ok i'm a bad person shees 4 lines is spam ok

warm hedge
#

It definitely is much more than 4 lines and offtopic. I hope you can understand us

pallid palm
#

yes i can

#

and i will do so

#

im just a happy guy thats all sry mate

#

i still love you

#

thxs you Valen for the server info

#

ok m8s i'm off for you know what, C U

runic surge
#

how can I retrieve an objects exact pitch bank and yaw?

#

specifically the values useful for the "rotation" attribute in the editor

little raptor
#

Like this

runic surge
#

what is _v?

little raptor
#

An object (it was probably _vehicle)

runic surge
#

gotcha

#

[_ax, _az, _ay] are the outputs?

little raptor
#

Yes

#

X Y Z angles (pitch bank yaw)

runic surge
#

that is so close. slight elevation difference but the rotation looks perfect

#

thank you lol

#

vector math is my weakness

little raptor
#

Which command do you use for setting position?

runic surge
#

it's the command used for retrieving it that would be the problem, the position is set via set3DENAttributes [[[_ent], "Rotation", [_pitchBankYaw select 0,_pitchBankYaw select 1,_pitchBankYaw select 2]], [[_ent], "Position", _pos]];

where _pos is defined: _pos = getPosATL _source;

#

eden position is 0 at terrain level so ATL made sense but I'm not sure if that's exactly what it uses or not

little raptor
#

wiki says it's ATL so blobdoggoshruggoogly
You can try rotating first then setting position (or the other way around)

runic surge
#

I'll try that. I would guess though that setting the attributes together like that ensures one doesn't modify the other

little raptor
#

If you're getting the position of a terrain object, they sometimes are super simple object so their land contact is sometimes different that ordinary objects

little raptor
runic surge
#

I know. I'm testing on a regular model that doesn't have any land contact or autocenter settings

runic surge
little raptor
#

They're not simultaneous

#

The game still does it one by one

runic surge
#

splitting the commands and doing them in different orders had no effect

#

I'll test whether the actual position value is wrong

#

again though 3den attributes are akin to variables in the way they are set and retrieved, including the transformation values

#

you can actually rotate the 3d model for the entity independent of the entity itself if you wanted to do that for some reason (but that doesn't change the attribute values)

little raptor
#

Then it probably uses the center for setting position

#

In which case maybe you should try getting the position like this: ASLtoATL getPosWorld obj instead of getPosATL

runic surge
#

Well, it's different. It isn't quite correct though

#

the icon for the eden objects are centered, and at the point where the model touches the surface by the looks of it

#

might need to find that offset by messing with the bounding box somehow

#

getPosWorld seems like a step in the right direction though

#

in fact I believe there are config values for how eden objects should be aligned

runic surge
#

looking at tanoa and livonia, the powerline placement for the smaller lines is perfect. even at angles. Looks like they even scale the wire to get it to line up.

#

what I have is sort of almost close to that quality, but I don't know how to improve it further

jade acorn
#

to my knowledge the power lines adapt automatically when you place them in the terrain builder, might be tricky to get the same thing with scripts

#

same with skewed walls on uneven terrain.

runic surge
#

they don't

#

only the larger ones have land contact and memory points

jade acorn
#

ah alright

ocean folio
#

What is the difference between BIS_fnc_unitCaptureSimple and BIS_fnc_unitCapture? The wiki for both is almost identical

#

disregard, I see the data format is just in a different spot that I missed on my first look

#

I'd assume since it's logging less information, the simple version would be more performant for both capture and play?

jade acorn
#

well there is a difference mentioned in the respective wiki pages. First one logs [frameTime, unitPosition, unitDirection] for each frame, second [frameTime, unitPosition, unitDirectionVector, unitUpVector, unitVelocity]

#

so simple one does not count the vectors, only direction and position in 3D

#

doubtful there performance impact is that different between them, if anything the data is smaller

tough abyss
#

I've got epic help with this script that works, haha well, some of the time BUT when it works its so damn perfect!
Reaching out for a last call for help, is there a possibility to add so the infantry that spawns goes in under my command?

faint burrow
jade acorn
#

since the group positions are remembered by the game when someone dies (so a 1, 2, 3, 4 squad will turn to 1, 3, 4 for example), can I move group members to "free" a position? so a group 1, 2, 3, 4 would become 1, 3, 4, 5 and I can joinAs a unit into the slot 2 then

faint burrow
#

Try to remove units from group, then joinAs them.

jade acorn
#

ok so no other way then

runic surge
#

kinda works

#

can connect any (configured) power pole to another

#

as long as they are spaced correctly, it works

#

sometimes there are gaps, and sometimes wires double up. and of course manual correction by scaling is necessary for any strong turns or larger/smaller spacing

#

Definitely not as good as BI terrains but good enough for me tbh

acoustic abyss
turbid nymph
#

is there any way to make addForce work on players? this is my code, basically just launches objects and units by applying a force to them with addForce:

    player addAction [ 
        "<t color='#FF0000'>Launch</t>", 
        { 
            params ["_target", "_caller", "_id", "_args"]; 
 
            _viewDirection = eyeDirection _caller; 
 
            _speed = 80000; 
 
            _force = _viewDirection vectorMultiply _speed; 
 
            systemChat format ["Force applied: %1", _force]; 
            systemChat format ["Object Launched: %1", (name targetLaunch)];
            systemChat format ["PhysX Mass: %1", (getMass targetLaunch)];
            targetLaunch = cursorObject; 
            targetLaunch addForce [_force, targetLaunch selectionPosition "rightfoot", false]; 
        }, 
        [], 
        1.5, 
        true, 
        false, 
        "", 
        "", 
        0, 
        false, 
        "", 
        "" 
    ];```
ive tried a bunch of stuff and it works fine on NPCs but i cant get it to work on players for some reason...
runic surge
#

it is technically functional

next gust
#

im having trouble using setUnitLoadout
im storing the loadout, exportet from ace arsenal, in a file - lets call it rifle.sqf, in a loadouts folder inside my mission folder.

in my onPlayerRespawn.sqf im doing
private _loadoutSQF = ["loadouts\", (player getVariable ["loadout", "rifle"]), ".sqf"] joinString "";
to get the path of the file and then:
player setUnitLoadout preprocessFileLineNumbers _loadoutSQF;
but it just failes withouth error.

if i remove the preprocessFileLineNumbers I get the error "Bad Vehicle Type loadouts\rifle.sqf".

neon plaza
#

Any scripts that would ban a player for certain amount of time on death?

hallow mortar
# next gust im having trouble using `setUnitLoadout` im storing the loadout, exportet from a...

Doing it without preprocessFileLineNumbers doesn't work because then you're just doing player setUnitLoadout "loadouts\rifle.sqf", which can't work because setUnitLoadout doesn't accept file paths. If you give it a string like that, it expects the string to contain the CfgVehicles classname of a unit (see: https://community.bistudio.com/wiki/setUnitLoadout).
Doing it with preprocessFileLineNumbers doesn't work because preprocessFileLineNumbers doesn't return the results of the code in the file being executed - it returns a string containing the file contents, plus debug markers for the line numbers. So you're once again giving setUnitLoadout a string containing information it doesn't expect.
If you want to do things this way, you'll need to:

  1. preprocess the file
  2. compile the returned string into a Code data type
  3. call the code to return the array it contains.
private _loadout = call compile preprocessFileLineNumbers "loadouts\rifle.sqf";```
This is a really clunky way of doing it though, and there are better ways.
#

For example, you can define your loadouts as configs in description.ext (as described on the setUnitLoadout page, and retrieve the information there. Or, you can define your loadouts as global variables, in init.sqf or a preinit function.
e.g.

my_loadout_rifle =
#include "loadouts\rifle.sqf"

player setUnitLoadout my_loadout_rifle;```
turbid nymph
acoustic abyss
#

(NB meant to be humorous)

true frigate
#

Hey guys! For things like setObjectTexture/setObjectTextureGlobal I've had bad luck with them on the dedicated server. Do they need to be called with RemoteExec?

true frigate
#

Currently I'm trying to make a vehicle invisible but still have a hitbox. The script is run through initPlayerLocal - I'm not sure if that would be a problem - but I assume it might cause some issues in MP.

winter rose
#

and what is your code?

#

(and why initPlayerLocal?)

true frigate
#

Ahh alright, it's rather long so I'll do my best to condense it. When a player moves over a certain speed or talks using TFAR, it adds to their detection meter. When a player's detection meter goes over 10, they're targeted. It causes an invisible car to slam into them and make the body go flying - essentially just having fun with a concept like the monsters from A Quiet Place, and learning a lot along the way.

I've got the detection down fully, which took a little while - but due to the update process I've decided to go with, it executes from initPlayerLocal to avoid having to store every player's volume and speech on the server in one massive lookup table.

The actual code for "attacking" the player is pretty simple:

#
            sleep (random 7)+5;
            private _monster = createVehicle ["B_Quadbike_01_F", player getRelPos [10, 90], [], 0, "CAN_COLLIDE"];
            _monster setObjectTextureGlobal [1, ""];
            _azimuth = _monster getDir player;
            _monster setDir _azimuth;
            _monster setVelocityModelSpace [0, 200, 0];```
#

I'm not sure if I should be calling this function from a different script, or if this is acceptable, but it works in my local MP testing.

warm hedge
#

How you could be sure it is not working on dedicated?

true frigate
#

Ah I forgot to mention, right now it's not actually hiding the texture and I'm not sure if that's something that I'm doing wrong. Sorry.

#

Also I can't believe I never noticed this. Lou is your profile picture Hugh Laurie?

warm hedge
true frigate
#

I'll try adding it in, I think you might have it though because sometimes it works, sometimes it doesn't kek

winter rose
#

most importantly, such ragdoll thing exists as BIS_fnc

#

and you can script it now ๐Ÿ™‚

true frigate
#

You can? Oh damn that would save me a huge headache

#

I was wondering how I'd go about getting it to work around forests, terrain, etc

warm hedge
#

Oh yeah true. It's addForce

true frigate
warm hedge
#

Nop

winter rose
#

old way:```sqf
_unit setUnconscious true;
_unit setPosATL (getPosATL _unit vectorAdd [0, 0, 0.05]);
_unit setVelocity [0, 0, 50];

new way:```sqf
_unit addForce [[0, 0, 50], [0, 0, 1], true];
winter rose
true frigate
#

Ahh gotcha

#

And so vector is the force and direction the character gets thrown in, but what does Position represent here? At first I thought it'd be the origin point of the force, but that's under the vector

winter rose
true frigate
#

Yeah, sorry I looked it up but I'm not too sure on what the relative position is - if it's not the origin of the force, is it to do with where the force impacts the object?

runic surge
winter rose
true frigate
#

Alright - thank you mate, legend as always pepelove

formal bobcat
#

hey all, im trying to rename items from a couple mods.
ive got pretty much everything worked out except for the cfgweapons classes.
Im not sure how i should be structuring it to actually rename an item rather than make one.

For instance i am trying to rename the ACE Epinephrine autoinjector to Adrenaline,

        displayName = "Adrenaline Pen";
    };```
If anyone could tell me how stupid i am that would be great.
#

in my patches for this im only mentioning "ace_medical_tretement" do i need to mention "ace_main" aswell?

winter rose
formal bobcat
#

sorry about that lol

winter rose
#

np, good luck with it ^^

pallid palm
#

hay mates how do i get the BIS TaskPatrol to work on spawned in enemy this dont work here

#

[group this, getPos this, 150] call BIS_fnc_TaskPatrol;

#

i use _grp to ID the enemy group

#

[_grp this, getPos this, 150] call BIS_fnc_TaskPatrol; dont work eathier

#

[_grp this, getmarkerpos "HQ", 150] call BIS_fnc_TaskPatrol; dont work eathier

faint burrow
#

_grp is not a command.
What is this?

pallid palm
#

ummm its a var

faint burrow
#

Yes. Then what's this: _grp this? Var + var?

pallid palm
#

yes umm _grp = _grp in my script

faint burrow
#

Doesn't make sense.

pallid palm
#

you just gave me an idea

#

thx m8

#

i see now what im missing

#

_grp = createGroup east;
_grp = _grp;

faint burrow
#

The last line doesn't make sense.

pallid palm
#

oh no ok darnit

stark fjord
#

Dont do _grp this

#

Only _grp

pallid palm
#

ah ok cool

#

thx m8s i love u guys

#

it works awsome

#

woohoo Arma 3 hell yeah

#

thx for your help mates

indigo wolf
#

is there a way to prevent ai from glitching through vehicle when setcaptive is set to true? they stand up from inside the passenger seat of car making their heads appear on the rooftp of car

tulip ridge
sage wind
#

In a preInit XEH from CBA I have this little event handler to be able to log players for easy export. But it never updates or run when on a dedicated server. It runs Eden MP it update the mission namespace, but does not run on the dedicated. Am I running it wrong?

if (!isServer) exitWith {};

[QEGVAR(log,player), {
    params ["_guid","_name"];
    private _unit = [_guid] call BIS_fnc_getUnitByUID;
    private _playerLog = GETMVAR(EGVAR(log,players),createHashMap);
    INFO_3("PlayerLog","Connected %1 [%2] (GUID: %3)",_name,_unit,_guid);
    
    if (!isNil{_playerLog get _guid}) then {
        INFO_1("PlayerLog","Updating Log Entry [%1]", isNil{_playerLog get _guid});
        private _data = _playerLog get _guid;
        /* SNIP magic */
    };
    SETMVAR(EGVAR(log,players),_playerLog);
}] call CBA_fnc_addEventHandler;

addMissionEventHandler ["PlayerConnected", {
    params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
    [QEGVAR(log,player), [_uid, _name]] call CBA_fnc_serverEvent;
}];
tulip ridge
#

Can't check right now, but is !isNil{_playerLog get _guid} your intention?

sage wind
sage wind
tulip ridge
blissful current
#

I have _caller as a param in the code portion of an addAction. How would I pass that to a .sqf that gets remoteExec'd in the same addAction?

fair drum
#

You mean you are executing a file, then later you want to pass that arg to that file? Why do you want to do that instead of just passing it in the original?

#

Post what you got so far so I can see what you want in the end.

blissful current
# fair drum You mean you are executing a file, then later you want to pass that arg to that ...

I want to _caller to go to that RadioHQ.sqf. Below is the hold action code.

params ["_target", "_caller", "_actionID", "_args"]; //needed for finding player that made the action
missionNamespace setVariable ["ActionCallHQ", false, true];  
["scripts\RadioHQ.sqf"] remoteExec ["execVM", 0];

So that in that .sqf I can do this:

[_caller, ["wait1",100]] remoteExec ["say3D"]; // prolly dont need to remoteexec this if its in the .sqf
faint burrow
#

What's the problem to do that?

#

Of course, if the script accepts such an argument.

blissful current
#

I haven't tested it but I assume that the .sqf isn't going to know who is the _caller unless it is defined in the sqf or somehow passed?

hallow mortar
#
[[_caller],"scripts\RadioHQ.sqf"] remoteExec ["execVM"];

// then in the script:
params ["_caller"];
hallow mortar
#

execVM normally looks like this:

_arguments execVM "filePath";```
So you convert it to `remoteExec` like this:
```sqf
[_arguments,"filePath"] remoteExec ["execVM"];```
blissful current
#

Awesome, I will test this now. If I have multiple arguments would they simply be separated by commas within the square brackets?

hallow mortar
#

Yes. [] indicate an array; you are passing an array of arguments; , is the element separator in an array.

#
[[_argument1, _argument2],"filePath"] remoteExec ["execVM"];```
#

If you're using target 0 with remoteExec, you don't need to specify that because it is the default
* unless you want to use another non-default parameter that comes after it

cosmic lichen
#

execVM? meowsweats

blissful current
#

Custom Chat Help

raw vapor
#

Using a trigger, how can I make all map objects in the area invulnerable?

I am having an annoying issue where a map maker left all these cool props in an area, but they are possible to destroy, making them fall into the ground, leaving objects floating or exposing bare terrain. The issue is there's so much stuff here that I can't get every object reliably using the "Edit Terrain Object" module.

I've also had issues with that module just not working in multiplayer. So I'm after another solution.

blissful current
raw vapor
#

Well in this case I don't want the object to be destroyed. If the props get blown up that kind of ruins this location.

#

The map maker should have made the objects invulnerable but didn't for some reason.

#

And there are a lot of objects.

blissful current
#

Ah my mistake. I dont know that one.

raw vapor
#

I mean I can still use that block of code in other scenarios!

#

So leave it! :P

#

Still helpful, just not the use case I need currently.

blissful current
#
myBuilding = ((nearestObjects [getpos chair1,["Land_vn_hut_02"],20])#0);
addMissionEventHandler ["BuildingChanged", {
    params ["_from", "_to", "_isRuin"];
    if (_from isEqualTo myBuilding) then
    {
        deleteVehicle chair1;
        deleteVehicle desk1;
        deleteVehicle radio_hut1;
        deleteVehicle hut_cup1;
        hint "hut 1 deleted"; // put your deleteVehicle commands here
    };```
tulip ridge
raw vapor
#

That's what I was talking about.

silent cargo
#

I'm trying to check if a vehicle is nearby.

But I can't figure out how to have the script check the returned vehicles list, to make an exception where if vehicles nearby are part of "allowed vehicle" array, then it continues - but if the vehicles are not in the allowed array, then exit there with a hint

tulip ridge
tulip ridge
open hollow
#

ive failed epically lol
i guess is not just download the code and compile it

next gust
winter rose
#

2.18* ๐Ÿ˜„

warm hedge
#

3.18 sounds an update from 2035

still forum
stark fjord
#

Lets talk triggers for a second, for i am bamboozled...

If trigger is set to any player present, server only, and only this in condition, it will activate when any player enters it, then deactivate when all players leave, right? Dandy.

However if condition for same activation is set to this && MY_VAR, where my var is true, it will activate if any player enters, cool so far.
However, if MY_VAR is later set false, with players still in the trigger, condition will evaluate false and trigger should deactivate, yet it remains active, why?

#

On same note, why does non repeatable trigger continue to evaluate condition, even after its been "used up"?

hollow lake
#

HI guys, have you ever edited max zoom in vehicle?

my idea is:

edit how far/max zoom for vehicle gunner can be done - how much can gunner zoom. I want to limit it to like 4x for example

hallow mortar
hallow mortar
hallow mortar
cosmic lichen
#

Just don't use triggers.

winter rose
stark fjord
stark fjord
stark fjord
# cosmic lichen Just don't use triggers.

For my linear missions i do prefer using them as opposed to scripting and FSM.
Also its much easier than doing own area detections etc.
And if game provides "wheel", why reinvent it?

hallow mortar
#

Well...the game provides tractor wheels. Normally that's fine, but sometimes you're trying to run the Nurburgring, and then it is not fine :P

stark fjord
#

Imean as ive said, for what i need it to do, it works fine. Just that i will have to delete triggers once their use has been, well, used.

#

Also, some performance improvements if bi fixed condition bug

exotic gyro
#

one line ish

#

Oh lol, I did not read far enough down

open hollow
open hollow
#

well adding #include <string> in webbrowsercontrol.hpp solve it
ngl chatgpt suggested that

open hollow
#

that was me until this thing worked

winter rose
little raptor
stark fjord
#

Imean what mission would rely on condition evaluation past tripping (if non repeatable)

#

Ill make a ticket

#

@winter rose

winter rose
#

sure thing

shell fog
#

Got a question.

So for context Iโ€™m absolutely rubbish at anything scripting related and need even the most basic stuff that isnโ€™t a module spelled out for me,

What I want is a script or something whereby you go into a plane hanger and walk up to a laptop and it opens the virtual garage (like the one in the virtual arsenal scenario) with (ideally) just aircraft from one modded factionโ€ฆ is something like that possible?

#

Iโ€™ve looked at some YouTube tutorials but they keep saying stuff about opening mission files and it just looses me at that point

winter rose
#

to answer your question: yes, something like that is possible.

pallid palm
#

so you want the labtop to create aircraft is this correct

#

sounds easy enough

#

is this for DeD server or no

#

would this be correct

stable dune
#

use

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
stable dune
#

Easier to read your content

#

```sqf
// your code here
hint "good!";
```

pallid palm
#

ill try again

stable dune
#

you can edit your message, just add before code
```sqf

and end of
```

pallid palm
#

copy

gusty rivet
#

for some reason ever since the update, the "ok" button for some of our modules just refuses to work so we cant make any changes, our unit relys heavily on simplex support services for our vehicles and equipment spawners, but since the update we cant change enything since the button refuses to work unless the code is removed, anyone else having this issue?

if i copy the spawners directly they work perfectly fine, i just cant make any changes unless the code is removed, so i know the code is not the issue since it works otherwise and was working fine before the update...

the code in question:
private _posASL = getPosASL Car_1 vectorAdd ((getPosASL Car_2 vectorDiff getPosASL Car_1) vectorMultiply 0.5); _posASL set [2,_posASL # 2 + 7.4]; { if (_x != _this) then {deleteVehicle _x}; } forEach nearestObjects [ASLToAGL _posASL,["Car", "Armored"],5]; _this setPosASL _posASL; _this setDir (Car_1 getDir Car_2);

more specifically when this exact part of the code is entered it refuses to work:
_this setPosASL _posASL; _this setDir (Car_1 getDir Car_2);

stable dune
#
if (hasInterface && !isServer && !isDedicated) Exitwith {false};

this part wont work if you call your .C1_Green.sqf on client.
its local event, and it have interface, it is not server, it is not dedicated.
so you need

"Scripts\C1_Green.sqf" remoteExec ["execVM",2]; //will be executed on server
#

Sleep 1;
Exit;

is part what you dont need there

pallid palm
#

ok

#

thx m8

runic surge
#

Is there any reason the following should fail?

waitUntil {speed _leader > (_maxSpeed/4)};

Presuming the variables are appropriately defined. I suppose there could be a zero divisor error with _maxSpeed but that shouldn't happen in my use case.

#

The variables are defined properly, so there shouldn't be a problem there. Nevertheless I get Error Undefined behavior: waitUntil returned nil. True or false expected. on execution

faint burrow
#

Are you 100% sure that the variables are defined properly? If so, then try to use parentheses.

pallid palm
#

ok will do

#

ah ok thx m8

thin fox
#

does anyone knows a version of this CBA_fnc_addBISEventHandler but for Group EH?

pallid palm
#

hhmmm thats funny my script works and no errs and the chopper spawns on the server and it work good hmmm

runic surge
#

how do you use drawIcon3D with format?

#

nvm. Just define a string with a variable inside the event handler

gusty rivet
#

so i changed the code as requested, now its just the issue of it finding the two markers and spawning on them correctly, those being Tank_1 and Tank_2, it knows what its looking for as its spawning in the rough area, just in the wrong spot and direction, and ideas?

#

updated script:
private _posASL = getPosASL Tank_1 vectorAdd ((getPosASL Tank_2 vectorDiff getPosASL Tank_1) vectorMultiply 0.5); _posASL set [2,_posASL # 2 + 7.4]; { if (_x != _this) then {deleteVehicle _x}; } forEach nearestObjects [ASLToAGL _posASL,["Car", "Armored"],5]; this setPosASL _posASL; this setDir (Tank_1 getDir Tank_2);

tulip ridge
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
fleet sand
gusty rivet
# fleet sand So what exactly are you trying to do ?

basically we use the mod simplex support services to have spawners for all our vehcles, supplies, assets, all sorts, the code was working totally fine origionally before the arma update a few days ago, now....it still works, but i cant make any changes unless i get rid of the following part of the code: this setPosASL _posASL; this setDir (Tank_1 getDir Tank_2);

so the spawners work, but we cant make any changes because it stops the "ok" button or the enter key from saving any changes and just leaves you in the module, but if you take the code out, it works totally fine, but its not giving any errors or anything, and we know it clearly works because the current spawners are working...

we only found out about this because we need to make some changes to it but now we cant, i have no idea at all whats wrong with it and we heavily depend on these working

#

iv also tried contacting the dev for simplex and even they have no idea, but a few other have had the same issue

runic surge
#

I have one particular unit that doesn't want to listen to limitSpeed. Any ideas why this might be the case?

fleet sand
fleet sand
#

Dev or main ?

gusty rivet
#

dev

gusty rivet
# fleet sand Dev or main ?

just for clarification, as shown in the code, we are using two invisible parachute markers to identify where to spawn and what direction to face by referencing them, tied running absolute minimal mods again, still no success, genuinely ran out of ideas on what the hell is wrong with it now

fleet sand
gusty rivet
stark fjord
#

question bout setObjectScale is it JIP compatible or should i remoteExec it on where object is local, whenever someone joins?

fair drum
#

Should be JIP compat.

#

As long as it doesn't move and is unsimulated. Simple object preferred.

stark fjord
#

its attached and simulation disabled, thanks

runic surge
#

are limitSpeed and forceSpeed broken now?

gusty rivet
fleet sand
#

nah IDK honesly.

gusty rivet
#

iv exhausted every possibillity i can think of, i have no clue whats going on, it was working totally fine before the game updated, they work sure but i cant change anything about them, it wont give me any errors or anything...

gusty rivet
#

Anyone else have any ideas by chance?

fair drum
runic surge
pallid palm
#

woohoo Arma 3 woohoo yeah it works thx all that helped me

#

i freeking love you guys woohoo

stark fjord
# runic surge https://pastebin.com/kbUDCt4c

What kind of values are we looking at < 5kmh or >

Wiki doesnt specify, but i imagine these commands need to be ran where unit is local.

Side note, unrelated to issue, you can do _parameters params ["_minSpeed", "_maxSpeed", "_minDistance", "_maxDistance"]

tough abyss
#

Ok don't chase me with pitchforks and fire now, but, how good is ChatGPT to use for getting scripts?

stark fjord
#

Not good for sqf

tough abyss
#

Oh, ok

real tartan
#

is it needed to broadcast variable with jip = true ( 3rd param ) when it is used with missionNamespace ?

missionNamespace setVariable [ "TAG_variable", 0, true ];
faint burrow
#

No.

stark fjord
#

Depends,, mission namespace is more or less same as just setting a global variable.

warm hedge
#

Why you wanted to do it, is the question

real tartan
stark fjord
#

If you do it only at the start of the mission, during init, then no.

If it changes later via some script, then yes

stark fjord
#

Also if you set it later on one machine and need to sync across all machines

errant jay
#

i have this following script;
(not made by me, but using it)

player setvariable ["Soccer_Hit",false,true];
MY_KEYDOWN_FNCDCGETIN =
{
    switch (_this) do {
        case 29: 
                {
                    if (player getVariable "Soccer_Hit") then
                    {
                        player setvariable ["Soccer_Hit",false,true];
                        hint "Low kick.";
                    }
                    else
                    {
                        player setvariable ["Soccer_Hit",true,true];
                        hint "High kick.";
                    };
        };

    };
};
VCOMKEYBINDINGDCGET = (findDisplay 46) displayAddEventHandler ["KeyDown","_this select 1 spawn MY_KEYDOWN_FNCDCGETIN;false;"];```

However this script wont work on server for some reason, only on singleplayer. I'm newish to this stuff so don't know what to do. 

(It is in a .sqf file thats executed via init.sqf execVM, tried putting it in different init-.sqf files)
proven charm
errant jay
proven charm
#

ok where is it run from? that script wont work in server because of player/hints/keyDown need to be client side

errant jay
proven charm
#

like which script file

errant jay
proven charm
#

oh sorry missed that. just wrap it inside hasInterface command to run it only for clients

#

if(hasInterface) then { code here };

hollow lake
#

HI guys, have you ever edited max zoom in vehicle?

my idea is:

edit how far/max zoom for vehicle gunner can be done - how much can gunner zoom. I want to limit it to like 4x for example

pallid palm
#

how do i limit the distance of this from the flagpole on DED server ```sqf
this addAction ["<t color='#FF0000'>Teleport To BlackHawk</t>", {_this spawn compile preprocessFileLineNumbers "Big_Chopper\TeleportToChopper.sqf"}];

#

i want it to be < 5

pallid palm
#

oh thx m8

#

ah i see yes its the radius thx m8

#

thx you for your help

true frigate
#

Am I being stupid or is there no difference between _weapon and _muzzle in the Fired EH

oblique lagoon
#

Is there still no answer on how to ignore/suppress 'no entry' popup?

true frigate
#

I have this

player addEventHandler ["Fired", {
    // params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    systemChat format ["Unit = %1", _this select 0];
    systemChat format ["Weapon = %1", _this select 1];
    systemChat format ["Muzzle = %1", _this select 2];
    systemChat format ["Fire Mode = %1", _this select 3];
}];``` But Weapon and Muzzle are returning the same value.
oblique lagoon
#

sometimes like gun with GL

#

may have different muzzle i guess

oblique lagoon
#

wow

#

NOTE: Use the -nologs command line parameter instead if you are not a developer. This mod is helpful for those who would like a faster development experience without their game being suspended by verbose warning messages that present themselves as logs anyway.

#

does -nologs delete that window?

true frigate
#

Never used it, but most of us keep logs on because we work on shit anyway kek

oblique lagoon
#

Will give it a try. Thanks pal

hallow mortar
oblique lagoon
#

fuck yeah this is the what I wanted

oblique lagoon
#

I'll force this mod in our server

hallow mortar
#

Keep in mind that if you suppress all errors, you will also miss errors that actually matter. It's usually better to fix the error rather than ignore it.

meager granite
oblique lagoon
#

I guess there's no fix where I want to delete specific item from player and it gives me error.

#
{
        _bannedItemClassname = _x;
        player removePrimaryWeaponItem _bannedItemClassname;
        player removeMagazines _bannedItemClassname;
        player removeItems _bannedItemClassname;
    }foreach GRLIB_blacklisted_from_arsenal;
#

In this simple script... Why would one give me no entry error???

#

I wanted to remove doomsday shell and so on

meager granite
#

Post exact error here

oblique lagoon
#

Fun part is that the error popup and script works fine..

oblique lagoon
meager granite
#

You're not supposed to use magazines with items commands and other way around

oblique lagoon
#

I dont understand..

meager granite
#
    {
        _bannedItemClassname = _x;
        player removePrimaryWeaponItem _bannedItemClassname;

        if(isClass(configFile >> "CfgWeapons" >> _bannedItemClassname)) then {
            player removeItems _bannedItemClassname;
        };
        if(isClass(configFile >> "CfgMagazines" >> _bannedItemClassname)) then {
            player removeMagazines _bannedItemClassname;
        };
    }foreach GRLIB_blacklisted_from_arsenal;
oblique lagoon
#
player addWeapon "rhs_weap_M590_8RD";  
player addPrimaryWeaponItem "rhsusf_5Rnd_doomsday_Buck";  
for "_i" from 1 to 13 do {player addItem "rhsusf_5Rnd_doomsday_Buck";};
meager granite
#

You're trying to remove your magazine with removeItems command

#

magazines and items are different and have their own command

oblique lagoon
#

Because the mags and backpacks are mixed in GRLIB_blacklisted_from_arsenal

meager granite
#

Well, you'll need to add a case for backpacks too then

#

check whats in that array and use proper command

#

backpacks are vehicles btw

oblique lagoon
#

Then if I just mixup items and mags,

#

Am I good to go without class check? I thought removeItems is safe function which does not give you error when you type in wrong classname or mags.

#

Maybe that was the cause which popup no entry window...

#

Thank you!

foggy stratus
#

What is the sqf equivalent command for telling a selected unit to Advance? Via vanilla controls, you hit tilde to bring up commands then 1 for Move commands, then 2 for Advance. He then moves forward until you stop him. Is this simply a doMove to some distant point in direction of player?

stark fjord
#

Think its like that

little raptor
#

It's an engine feature that is not exposed via SQF
It's not a doMove. It's more like a formation command

stark fjord
#

speedwise?

runic surge
#

you mean the input speeds?

#

recent test was [15,55,16,50]

#

Got improved results by using a different value for each vehicle in a convoy + using the separation command.

The minimum speed being too low can cause instances (ones where the unit/vehicle in question is actually obeying the command) where the vehicle moves at min speed right at the max distance. I have ways to remedy this in mind but I can't do that if the AI units won't all consistently obey the limitSpeed and forceSpeed commands

#

I know there are scripts that use velocity to force a vehicle speed limit with players, but I don't want to adapt something like that for AI since it could mess up their behaviour and overall just look far less elegant.

#

the problem I am facing is that some of the units in my convoy seem to ignore the speed limit being applied to them. Most obey, but there is always at least one that doesn't

sharp parcel
#

hey there. I'm using this _fuelTruck = createVehicle ["O_Truck_02_fuel_F", _selectedFuelTruckPosition, [], 0, "NONE"]; to place my fueltruck. I'm using random 3d locations and finding the truck is sometimes wrecked on spawn. I'm I missing something that would assist in this not happening. I thought the "NONE" was to check for collision.. If I change 0 for centre readius, how large a number can I choose and would this help? I was thinking 10?

hallow mortar
#

The placement radius is in metres. I don't know if there is a limit; if there is it's certainly more than 10. However, the radius is a randomisation radius, so it doesn't really help; if the collision protection isn't perfect, it could still choose an unsafe position, just further from the centre point.

#

One thing to try would be using vectorAdd to add a little bit of height (say 0.5 to 1 metre). This would help avoid small objects and terrain irregularities, while being a short enough drop to not damage the vehicle.

#

You can also try BIS_fnc_findSafePos

sharp parcel
#

thank you, will jump on it now

tough abyss
#

I'm interested in a script that make artillery and mortars (Spearhead units) shoot at a specific location, having unlimited ammo and only stops if I blow it up/kill the units.
Would be amazing if anyone could help me, since my knowledge in scripting is equal to zero haha

open hollow
tough abyss
open hollow
#

dont use chatGPT, there is no enought SQF code to make things even usable

tough abyss
open hollow
#

its awful, but it was my first one meowawww

tough abyss
#

I prefer awful instead of no script at all haha

thin fox
indigo wolf
#

Is it better to call in scripts like this sqf [_object_ap, _anti_device, _killrange] execvm "\Metho\scripts\antid\aob_remove.sqf"; or is it better to make it a function and spawn it as a function?

errant jay
#

I have this old script from genesic for football;

if (isServer) then
{
    SoccerBallArray = [];
    Soccerball = "Land_Football_01_F" createvehicle getpos SoccerSpawnPoint;

    SoccerBallArray pushback Soccerball;
    sleep 5;

        while {alive Soccerball} do
        {
            _Closestplayer = [allPlayers,Soccerball] call BIS_fnc_NearestPosition;
            if (_Closestplayer distance Soccerball <= 0.5) then
            {
                [[SoccerBall,"Kick1"],"PlaySoundEverywhere"] call BIS_fnc_MP;
                _GetVelocity = velocity _Closestplayer;
                _playervelocityX = _GetVelocity select 0;
                _playervelocityY = _GetVelocity select 1;
                _playervelocityZ = _GetVelocity select 2;
            
                _boostX = _playervelocityX * 3;
                _boostY = _playervelocityY * 3;
                _boostZ = _playervelocityZ * 3;
                _Punt = _Closestplayer getVariable ["Soccer_Hit",false];
                _Boost = 0.5;
                if (_Punt) then {_Boost = 3;};
                Soccerball setVelocity [_boostX,_boostY,_boostZ + _Boost];
            };
            sleep 0.01;
        };
        if (!(isNil "Dis_ResourceMapDone")) exitWith {deleteVehicle Soccerball;};
};```

Problem is, when the ball is "kicked" it moves very laggily for anyone else for anyone else than the host/singleplayer or when on dedicated server it obviously. For the host or on singleplayer the ball moves smoothly, with correct "physics" and no lagginess/floating. 

Is there anyway to basically "sync" it for everyone so it behaves the "singleplayer" way and not in the "laggy" way
thin fox
indigo wolf
#

The script would only be executed one or two times but internally it has multiple while / for / waituntil loops

#

and some remote execs (within the while loop post condition checking)

tender fossil
#

Ugh, I can't read ๐Ÿ˜„

stark fjord
#

Question are CBA event handlers and ACE

["ace_captiveStatusChanged", 
{
  params["_unit", "_state", "_reason"];  
}] call CBA_fnc_addEventHandler;```
Where would souch event handler be executed? globally, only on "handcuffer" or "handcuffee"?
indigo wolf
#

@thin fox and @tender fossil how will you make it a 'compiled' function? Do I just put function name and add the code in it and call it in or does it require any other additional work to be done?

sullen sigil
#

CBA_fnc_globalEvent, CBA_fnc_targetEvent, CBA_fnc_localEvent

#

read the docs

stark fjord
#

well ace docs dont state much, ill have to look into how its created on github

sullen sigil
stark fjord
#

gotcha, so global event

foggy stratus
#

How can I look up the voice line sound for a unit type? I want my script to get the unit for cursorObject and then say the sound file for "Sniper" or "AT Soldier", etc. The sound file for sniper is here:

#

a3\dubbing_radio_f\data\eng\male01eng\radioprotocoleng\normalcontact\010_vehicles\veh_infantry_sniper_s.ogg

#

But I want to be able to look that up dynamically based on type of unit.

finite bone
#

Let me rephrase my question, is the setVariable unique for each object is set to? i.e. Can I have multiple setVariable to multiple targets with different values? Example: sqf _dummy1 setVariable ["DUMMY_variable", 0]; _dummy2 setVariable ["DUMMY_variable", 2]; Would _dummy1 and _dummy2 have different variables set?

foggy stratus
finite bone
#

Oh thats cool thanks!

tender fossil
finite bone
tender fossil
finite bone
#

Wait I think I figured it out(?)

_demon setVariable ["demon_dmg_total", 0];
    _demon removeAllEventHandlers "Hit";
    _demon removeAllEventHandlers "HandleDamage";
    _demon addEventHandler ["HandleDamage", { 
                _unit = _this select 0;
        _current_damage = _unit getVariable ["demon_dmg_total"];
        _current_damage = _current_damage + (1/100);
        if (_current_damage > 4) then 
        {
            _unit setDamage 1
        };
        _unit setDamage 0;
        _unit setVariable ["demon_dmg_total", _current_damage];
    }];```
#

Yea it does thanks ๐Ÿ™‚

indigo wolf
tender fossil
fleet sand
finite bone
#

I tried that but for some reason, it does not work in our modded server consistently.

finite bone
#

Yes

fleet sand
finite bone
#

Yea I think so too - Hence the elaborate method.

thin fox
thin fox
#

weird stuff happening with ace and CBA if I add EH "UnitKilled" to a group and kills a unit in this group

ember sphinx
#

such a simple question but I can't find it anywhere

#

what is the syntax for "self"

#

ie if !alive self then { stuff; };

tulip ridge
ember sphinx
#

bruh

#

so I have to give the object a variable

tulip ridge
#

Probably

ember sphinx
#

sucks

tulip ridge
#

Can't say without knowing what you're doing obviously

ember sphinx
#

well I'm making an ambulance that has a siren playing for as long as it is alive and I want to make it a composistion so I can drop it anywhere in Zeus

#

if it has a variable though

#

means only that one ambulance I place down will work

#

cant have multiple

hallow mortar
#

In object init fields, the magic variable this refers to the specific object in question.

tulip ridge
#

Beat me to it

ember sphinx
#

i tried searching for that term too but couldn't find shit lol

#

such a generic term

#

thanks bro

hallow mortar
#

Other notes:

  • if is a one-time check. If you're writing this as part of a repeating loop, then great. If not, you need to, or use waitUntil.
  • object init fields are Unscheduled, meaning any suspension (sleep or waitUntil) cannot be used. You'll need to spawn a new Scheduled thread.
  • if you spawn a new scheduled thread, you'll need to pass it this as an argument since it is a new scope where this does not exist.
  • when placed in Zeus, object init fields only execute on the machine that placed the object, rather than on all machines as when placed in the Editor.
ember sphinx
#

yeah the example above as just a example but the other insights are great!

#

So if I were to place the ambulance as zeus it will only play the sound for me and not anyone else?

hallow mortar
#

Depends on the command you use, some of them are Global Effect and play on all machines.

#

If you're using a Local Effect command, use remoteExec to broadcast it to other machines.

ember sphinx
#

Got it, thanks!

opal zephyr
#

Does anyone know of a way to filter items that have collision (with player and or bullets)? Right now I can do most player collisions by checking the mass value of an object with getModelInfo. However some objects, like the vanilla ied's collide with the player still despite their mass being 0 (wiki says 10 is required for collision). Also some objects with geo and components in their list can stop bullets and some cant, possible based on armor property or maybe rvmat/thickness?

tulip ridge
# ember sphinx Got it, thanks!

Also note that an object's init code runs locally on the server and for each player who joins.

So if you have some code with a mission on a (dedicated) server and two players, it would run three times.

If a third player joined halfway through, it would also run again.

#

If you only want something to run once, you could check if the object is local, since it would only be local to a single machine, or set a custom variable on the object and then set it once it runs.

I.e.

if !(local this) exitWith {};

Or

if (this getVariable ["TAG_initialized", false]) exitWith {};

this setVariable ["TAG_initialized", true, true];
foggy stratus
#

I'm asking this again, as my first question got buried in another discussion above.

#

How can I look up the voice line sound for a unit type? I want my script to get the unit for cursorObject and then say the sound file for "Sniper" or "AT Soldier", etc. The sound file for sniper is here:
a3\dubbing_radio_f\data\eng\male01eng\radioprotocoleng\normalcontact\010_vehicles\veh_infantry_sniper_s.ogg
But I want to be able to look that up dynamically based on type of unit.

warm hedge
#

nameSound I recall

warm hedge
#

I do believe the answer is just "no"

#

I had a similar concept yeeears ago, and I used a workaround by switching the local user upon somebody kick the ball

tough abyss
errant jay
stark fjord
#

Even if you change locality, (that ussualy takes a few seconds) it will only look good for player that kicks it. Rest will just see ball lagging around

stark fjord
#

And have the ball on server as "source of truth"

stark fjord
#

Create ball with createVehicleLocal, have two functions, one for setting velocity (on kick) other for synchronizing position, direction, velocity and angular velocity across cliens

#

Eg setVelocity sqf params["_vel"]; if (!isNil "my_fine_ball") then { my_fine_ball setVelocity _vel; }; }
my_fine_ball would be global variable pointing to each of the clients local ball

#

You would remoteExecCall that function to each client and server when ball is kicked in your event handler.

#

For synchronization youd get posASL, vectorDir, vectorUp, velocity and angular velocity from hosts ball periodically, then and remoteExec it to all clients except host every <arbitrary but not too often> seconds
Func "ball_fnc_syncer"```sqf
params["_posasl", "_up","_dir","_vel","_ang"];
If (isNil "my_fine_ball") exitWith {hint "muh balls missing"};
my_fine_ball setVectorDirAndUp [_dir, _up];
my_fine_ball setPosAsl _posasl;
my_fine_ball setAngularVelocity _ang;

And init script:
```sqf
my_fine_ball = //createVehicleLocal;
my_fine_ball setPos somewhere //it should sync anyways

If (hasInterface) then
{
//attach your event handler here, with remoteExec'ed set velocity function mentioned above
};

If (!isserver) exitWith {};
[] spawn {
while (alive my_fine_ball) do
{
[getPosASL my_fine_ball, vectorUp my_fine_ball, vectorDir my_fine_ball, angularVelocity my_fine_ball] remoteExec ["ball_fnc_syncer", -2];
sleep 1; //adjust to avoid jittering/teleportation
};
}```

Mind you there will always be some teleportation involved. Physics dont always behave same on all clients
south swan
errant jay
stark fjord
#

Also, before kicking the ball, kick all players with high ping first ๐Ÿ˜‰ they will cause it to be all over the place

stark fjord
#

You could also add some interpolation to sync function to make transition smoother

thin fox
cobalt path
#

Question, I am getting undefined variable error skyhook_aircraft_1
Before Executing the script I spawn an aircraft with variable skyhook_aircraft_1
Code:
https://pastebin.com/KqDNjEih

Issue is that it executes everything up until line 76. It gives errors for lines 76 and 80, but still executes 77.

winter rose
#

@south swan that was your catch too? ^^

south swan
#

ja

cobalt path
south swan
#

you typo'ed variable name a whole bunch of times in lines 76 and below

cobalt path
#

..............................

#

๐Ÿ™ƒ ๐Ÿ™ƒ ๐Ÿ™ƒ ๐Ÿ™ƒ ๐Ÿ™ƒ

#

I see it

#

Thanks

thin fox
#

or someone else

south swan
#

3DEN, one player unit, one group with grp variable name, play scenario, following code in the debug menu, shoot some guy. "ace_medical_death" gets called wtih grp as argument once ๐Ÿคทโ€โ™‚๏ธ

["ace_medical_death", 0] call CBA_fnc_removeEventHandler;
grp addEventHandler ["UnitKilled", {systemChat str ["Group's UnitKilled",_this, _this apply {typeName _x}]}];
["ace_medical_death", { systemChat str ["ace_medical_death",_this, _this apply {typeName _x}]; }] call CBA_fnc_addEventHandler;```
south swan
#

sure

thin fox
#

thanks

south swan
#

with no ["ace_medical_death", 0] call CBA_fnc_removeEventHandler; i still get the error popup, but my "ace_medical_death" EH doesn't get called even once i don't get that single call of "ace_medical_death" with GROUP as agrument. That's some bizarre behavior

thin fox
south swan
#

fun stuff

cobalt path
#

question, I am trying to move people from cargo of one vehicle, into another

[crew _mfap1] moveInAny skyhook_aircraft_1;

I am getting error: Type array, expected object.
is there another way of doing what I need?

thin fox
#

try

{
  _x moveInAny skyhook_aircraft_1;
}forEach crew _mfap1;

cobalt path
#

thx

tulip ridge
nocturne tartan
#

What is (In |#|Seconds) Error Missing )

warm hedge
#

Probably weirdly made script

wicked roostBOT
#
Arma RPT

Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.

To get to your RPT files press Windows+R and enter %localappdata%/Arma 3

Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files

To share an rpt log here, please use a website like https://pastebin.com/ (Set expiry time to 1 week or less) to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.

hallow mortar
# nocturne tartan What is ```(In |#|Seconds) Error Missing )```

Someone has tried to write "(in seconds)" in a script, as a comment or as a string to use in the UI. But they've done it wrong and it's being interpreted as active code...only it doesn't make sense as active code and the game is getting confused when trying to run it.

real tartan
#

I have this action on player, it works in editor, editor MP, but not on dedicated server

// initPlayerLocal.sqf
[
    player,
    "action",
    "",
    "",
    "( typeOf cursorObject ) in [ 'Land_Atm_01_F', 'Land_Atm_02_F' ] && { ( player distance cursorObject ) < 5 }",
    "true",
    {},
    {},
    { /* do stuff */ },
    {},
    [],
    0.5,
    1000,
    false,
    false,
    true
] call BIS_fnc_holdActionAdd;
tulip ridge
real tartan
#

action does not show up on screen, when I point it at object ( ATM )

faint burrow
#

Check if player is null. Or use passed parameter.

tulip ridge
#

Haven't used hold actions in years, does the condition run on the server?

I assume it would be local though

real tartan
#

I tried with _this distance cursorObject < 5

tulip ridge
#

If it does run on the server, cursorObject would be null

real tartan
#

condition run on player, hence initPlayerLocal.sqf

finite bone
#

Have you tried replacing player with this?

real tartan
tulip ridge
#

Try logging cursorObject's return in the condition

finite bone
#

_this is different from this

finite bone
#
// Sample Add Action to Enter/Exit from a location
this addAction [
    "Enter Inside", {
        1 cutText [
            "", "BLACK OUT", 1
        ];
        sleep 2; 
        player setPosASL (getPosASL shipint_exit);    
        player setDir 180;   
        sleep 0.5;     
        1 cutText [ 
            "", "BLACK IN", 1 
        ]; 
    }, 
    nil, 1.5, true, true, "", "true", 5, false, "", "" 
];``` I usually put this inside the ``init`` section of the object/player and it works fine even in dedicated server
tulip ridge
#

It's not running in an object's init

#

And initPlayerLocal should be fine for this

finite bone
tulip ridge
#

in the condition

#

As in doing like a systemChat or whatever in your condition

fleet sand
#

why add addaction on a player and not on a object ?

faint burrow
#

Because sometimes it's better to add action to player.

tulip ridge
tulip ridge
indigo wolf
#

can anyone point me to some simple zeus curator addon (in workshop or github) that I can learn from and properly create one myself?

#

no complex like macro pleae as trying to decrypt it is a big pain all together

fleet sand
indigo wolf
#

i want to create a module for zeus curator that when i place it down it will 'create' aa barrage to simulate ww2 feeling - i will then customize the lenght, duration and damage from it

real tartan
tulip ridge
#

Because if it runs local (and you're looking at an object) it should definitely show something

fleet sand
# indigo wolf i want to create a module for zeus curator that when i place it down it will 'cr...

Just ues ZEN modules its really easy to make that with Zeus Enhanced:
Mod:https://steamcommunity.com/workshop/filedetails/?id=1779063631
DOC:https://zen-mod.github.io/ZEN/#/
Simple Example:

//InitPLayerLocal.sqf
["[ Legions Stuff ]", "- Dialog Talking", {
    params [["_pos",[0,0,0]],["_object",objNull]];

    if (!isNull _object) exitWith {
       ["You dont place this on object.", []] call zen_common_fnc_showMessage;
    };
    
    _color = [
        "COLOR",

        ["Input Color", "What type of color would you like your big text to be:"],

        [1, 1, 1, 1],
        true
    ];

    _editBox = [
        "EDIT",

        ["Who is talking","Type in who is talking this will be big bald letters"],

        
        [
            
            "Enter Text Here",
            { params ["_inputText"]; _inputText; },
            5
        ],

        true
    ];
    
    _editBox2 = [
        "EDIT:MULTI",
        ["Input Text:","Type in what i am talking"],

        [
            "",
            { params ["_inputText"]; _inputText; },
            5
        ],
        true
    ];

    //craete dialog
    [
        "Create Dialog Talking",
        
        [_color,_editBox,_editBox2],
        {
            params ["_dialogValues","_args"];
            _dialogValues params ["_color","_bigText","_mainText"];
            _args params ["_arg1"];
            
            private _hexColor = _color call BIS_fnc_colorRGBAtoHTML;
            private _text = format ["<t align = 'center' shadow = '2' color='%1' size='2' font='PuristaMedium' >%2</t><br /><t color='#ffffff' size='1.5' font='PuristaMedium' shadow = '0.5' >%3</t>",_hexColor,_bigText,_mainText];
            [2,[_text,"PLAIN DOWN", 2, true, true]] remoteExec ["cutText",[0,-2] select isDedicated];
            
        },
        {}, 
        []
    ] call zen_dialog_fnc_create;
    
},"a3\ui_f\data\igui\cfg\actions\talk_ca.paa"] call zen_custom_modules_fnc_register;
opal zephyr
#

@real tartan I would suggest also doing a few second sleep and then running a test systemChat in your initPlayerLocal to make sure that the script is actually running. I've had issues in the past with those files not automatically running on dedicated servers

thin fox
#

hello devs, the parameter _unit in this EH is actually returning the _killer

unreal wharf
#

I'm currently trying to set up an object so that it has a hold action on it that adds a diary record to all players. I also want the object to not be deleted once this is performed.
IE, a radio antenna. Players performs the hold action of rebooting it. Upon completion of the hold action, it adds an intel entry to all players "Radio rebooted" or something along those lines. Antenna object itself is not deleted afterwards.

real tartan
# tulip ridge Try checking isDedicated

turns out, that I was referencing _unit (execVM script) variable passed from player ( initPlayerLocal.sqf), and missions was running respawn on start
TL;DR;
respawnOnStart = -1; fixed issue, correclty passing player variable into BIS_addAction

thin fox
# fleet sand show your code ?

In group init:

this addEventHandler ["UnitKilled", {
  params ["_group", "_unit", "_killer", "_instigator", "_useEffects"]; 
  [str _unit] remoteExec ["systemChat"];
}];
indigo wolf
fleet sand
thin fox
#

instigator is returning a bool? lol

#

I'm running ace and CBA, let me check without them

#

same result without any mods

unreal wharf
thin fox
fleet sand
# unreal wharf Effectively, I want to adapt this <https://community.bistudio.com/wiki/BIS_fnc_i...

Try something like this add this in init of a object:

[
    this,
    "Collect Intel",
    "", "",
    "true", "true",
    {},
    {},
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
        [_caller,["my_intel","Intel"]] remoteExec ["createDiarySubject", [0,-2] select isDedicated, true];
        [_caller,["my_intel", ["Intel", "Lisen to audio Log <execute expression='hint ""my Log""'>LOG 1</execute>"]]] remoteExec ["createDiaryRecord", [0,-2] select isDedicated, true];
        private _text = format ["Player %1 has collected intel", name _caller];
        [_text] remoteExec ["hint",[0,-2] select isDedicated];
    },
    {},
    [], 10, nil, true, false
] call BIS_fnc_holdActionAdd;
unreal wharf
thin fox
unreal wharf
unreal wharf
#

Thanks.

fleet sand
unreal wharf
#

Don't know, I'll have to test it, which I'm currently doing.

finite bone
#

Someone help me convert this unholy if to select - my brain is friend from overthinking

((headgear _this == detect_smug) or (goggles _this ==detect_smug) or (uniform _this ==detect_smug) or (vest _this ==detect_smug) or (backpack _this ==detect_smug) or (detect_smug in (assignedItems _this  + items _this )))```
hallow mortar
#
[_this, detect_smug] call BIS_fnc_hasItem;```
finite bone
#

wait does it also check the equipped items?

hallow mortar
#

Yes

finite bone
#

damn i missed this completely kmao thanks ๐Ÿ‘๐Ÿป

hallow mortar
#

Keep in mind the note that it's too slow for per-frame execution, which includes e.g. action conditions. If you "need" to check the whole inventory that frequently, consider taking an approach where you actually don't (for example, allowing the action to be used regardless, and only doing the check when it's actually attempted)

finite bone
#

It wont be per frame - just a while loop when a player is in a controlled area. Doesnt get triggered after the player leaves.

hallow mortar
#

while loops can be (more than) per frame :U

finite bone
#

oh boy

hallow mortar
#

By default, a while loop will run as fast as it possibly can, and will happily eat all of the per-frame time budget for scheduled scripts. If you need to run one continuously, you should include a sleep in it to limit how often it can iterate.

finite bone
#

Yea luckily ive added a 5 second sleep so it should be fine

finite bone
hallow mortar
#
if !([_this, detect_smug] call BIS_fnc_hasItem) then { ... };```
#

!, alias not, reverses whatever bool you give it

finite bone
#

Yea but I want to pass both (true/false based on that function) to the next set of operation so was looking to a one-liner.

hallow mortar
#

It would probably be cleanest to just save the result.

private _hasItem = [_this, detect_smug] call BIS_fnc_hasItem;
if _hasItem then {
  // ...
};
_hasItem```
#

The way you mentioned before would also work, but I'd prefer to do it this way because it's neater.

eternal steeple
#

Hello, i have a question for my problem, i use TFAR the latest version .335 my code is :

    private _pluginCommand = format [
        "TANGENT PRESSED %1%2 %3 %4 %5",
        call TFAR_fnc_currentSWFrequency,
        _radio call TFAR_fnc_getSwRadioCode,
        ([_radio, "tf_range", 0] call TFAR_fnc_getWeaponConfigProperty) * (call TFAR_fnc_getTransmittingDistanceMultiplicator),
        ([_radio, "tf_subtype", "digital"] call TFAR_fnc_getWeaponConfigProperty),
        _radio
    ];

    ["", _pluginCommand, 0] call TFAR_fnc_processTangent;```

Its the same code in the source of TFAR but the call not working, let me explain, I've been testing fixes and other things for weeks but nothing works, when I run this command I want the radio to be a continuous activation, but nothing happens, I've changed to test the TFAR_fnc_processTangent source code with a variable, the activation doesn't start but if I press the radio it starts and stays continuous, so I don't understand why the TANGENT PRESSED doesn't work from the start. any ideas?

Thanks for helping !
#

Let me ping you as you are the creator of TFAR @still forum sry & thanks

indigo wolf
fleet sand
fleet sand
stark fjord
#

Does velocity on local vehicle always return 0,0,0 (on dedicated server that is) local vehicle exists on server.

grand otter
#

I'm looking at gettings items to spawn on just random objects by name, Does anyone know what function i need to utilise to get coords of random objects

#

essentially using it for random item spawns

granite sky
#

Not sure what "random objects by name" means.

#

You have a bunch of objects with var names assigned in the editor?

hallow mortar
#

Might mean by classname

#

Either way the command to get an object's position is the same, regardless of how you acquired the reference to the object: getPosASL or getPosATL. You'll probably also need forEach to deal with a list of objects, and perhaps select along with entities, nearObjects, or nearestTerrainObjects to generate that list if you did mean by classname.

grand otter
warm hedge
#

nearestTerrainObject it is, then. It can be very slow to execute if you're running on a big/dense terrain

grand otter
#

yup seems like it, thanks folks

tough abyss
#

Is it possible to override the path finding for AI? The problem is AI are following the road but the map in particular has bridges and the calulatePath is not going over the bridge It's bypassing it and when AI is placed on that, road it does nothing.

warm hedge
#

What pathfinding

tough abyss
#

AI vehicle driving.

#

It literally doesn't "see" the bridge as a viable path.

warm hedge
#

If this doesn't work, I don't think anything does

tough abyss
#

Wish we had the ability to define Navmeshes.

tough abyss
tough abyss
#

It works now I just need to get it working with groups of vehicles.

little raptor
sonic orchid
#

I'm trying to use BIS_fnc_hasItem & removeItems so i can make sure my players have explosives and it takes said explosives away from them on a helper COD style. issue is im running into an error. this is my init.

[ 
Helper_1, 
"Plant Bomb",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa", 
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa", 
"_this distance _target < 3", 
"[_caller,"TIOW_melta_bomb_placeable_Mag"] call BIS_fnc_hasItem", 
{}, 
{}, 
{_caller removeItems "TIOW_melta_bomb_placeable_Mag"}, 
{}, 
[], 
15, 
1, 
true, 
false 
] remoteExec ["BIS_fnc_holdActionAdd", 0, Helper_1];```
and this is the error
#

plz help

meager granite
#

You have " inside "

#

"[_caller,"TIOW_melta_bomb_placeable_Mag"] call BIS_fnc_hasItem",
=>
"[_caller,""TIOW_melta_bomb_placeable_Mag""] call BIS_fnc_hasItem",
or
"[_caller,'TIOW_melta_bomb_placeable_Mag'] call BIS_fnc_hasItem",

fringe granite
#

I've come to the conclusions that i need an external database for my script, but I'm making a singleplayer mission, will EXTDB3 or equivalent solutions work for singleplayer scenarios also? I've never used it before and would appreciate some guidance on how to use it

proven charm
fringe granite
#

Yeah, I thought about it, but I need to potentially have a lot of entries, i don't know how much storage i can use in the missionProfileNamespace

#

If I could write to a file that would also be great

meager granite
#

Storage is virtually unlimited

#

But there is a big drawback, it won't save just changes but serialize and overwrite the entire contents each time

proven charm
#

so how much are you saving?

old owl
#

Currently trying to troubleshoot someone having a PBO issue and their C:\Users\Username\AppData\Local\Arma 3\MPMissionsCache appears to be empty. He speaks a different language and I think may even have Arma in a different language. Is there any chance that this directory could be somewhere else?

meager granite
#

If you don't have much data and time your saves right (during loading, UI, waiting parts of gameplay), its not a problem

#

Saving large amount of data during gameplay is a bad idea as it will do a micro freeze which is very annoying to the player

#

As they have enough micro freezes from the game itself already

fringe granite
proven charm
#

whats in each row?

fringe granite
proven charm
#

hmmm well you could test how arma handles saving / loading that

meager granite
#
private _mydata = createHashMap;
for "_i" from 1 to 10000 do {
    _mydata set [_i, [1,2,3,4,5,6]];
};
missionProfileNamespace setVariable ["mydata", _mydata];
diag_codePerformance [{saveMissionProfileNamespace}];
#

replace 1,2,3,4,... with data closer to yours

#

This is persistent only within game install though

#

profile lifetime in my documents even

#

its also per player profile

fringe granite
#

Ok, that's sound perfect:)

#

Is it possible to read the data inside missionProfileNamespace somewhere so i can have a look whats stored in there?

meager granite
#

Anywhere you want if you have same tag in description.ext

#
missionProfileNamespace getVariable "mydata" get 100
``` for example
#

File on the disc is never touched on these reads, entire namespace is in your memory all the time

#

Only on mission load and when you do saveMissionProfileNamespace

#

So you can read from the namespace as much and whenever you like

fringe granite
#

Ok, perfect, is it possible to edit the data from an outside application as well? Say i want to manually change it on the disk outside duoing edits using sqf?

meager granite
#

Not easily, you'll need to deserialize the data, edit it and serialize back

fringe granite
#

Ok, thank you so much for your help @meager granite and @proven charm , I feel like I have a better intuition on how to solve this propblem now!

#

I will try to find some resources on how to deserialize the data

#

Much appriciated!

meager granite
#

Instead of messing with the files I'd just recommand editing your data through a console

stable dune
#

Hmm, ๐Ÿค”
Can I create hashMap of hashmaps.
Like

private _myHashMap =
createHashMapFromArray [
    ["a", createHashMapFromArray [["aa", 11], ["ab", 12], ["ac", 13]]], 
    ["b", createHashMapFromArray [["ba", 21], ["bb", 22], ["bc", 23]]], 
    ["c", createHashMapFromArray [["ca", 31], ["cb", 32], ["cc", 33]]]
]; 

private _key = (_myHashMap get "a") get "aa";
_key = 11;

?

meager granite
#

missionProfileNamespace getVariable "mydata" get 100 => [1,2,3,4,5,6]

missionProfileNamespace getVariable "mydata" get 100 set [0,100];
saveMissionProfileNamespace;

missionProfileNamespace getVariable "mydata" get 100 => [100,2,3,4,5,6]

fringe granite
old owl
meager granite
#

I guess his problem is that his mission download fails, its a known issue in current 2.18 stable, just tell him to restart his PC

#

Restarting the game didn't fix it for me personally

old owl
meager granite
stable dune
#

That could be added to wiki example.

old owl
# meager granite It could be corrupt download so writing access is not an issue. Restarting the P...

The funny thing is just recently we also had a really bad issues from a map designer doing something really dumb so I'd just assumed a the majority of this was because people were downloading corrupted PBOs. Really horrible timing lol. I've since been instructing people to delete their PBO within that directory and that has resolved a majority of players issues but this is the first time I've heard of it not working and the guy did mention that it was happening on every other server too. Very strange.

stable dune
meager granite
warm hedge
#

data get "a" get "b" get "c"

stable dune
meager granite
#

You can assign it into variables too, etc.

#

Whatever you want

warm hedge
#

I used this method sometimes. Sometimes it gets confusing anyways... just don't overthink it

meager granite
#
_x set ["lasers_assists", _x get "lasers" apply {_x getVariable "laser_hashmap" get "unit" call server_func_ehs_getAssist}];
warm hedge
#

Get, get, get, gitgud

meager granite
#
_unit getVariable "server_ehs_damage_parent_hitparts" get _scored_hash get _scored_hash;
```This must be the worst, same variable used with `get` twice in a row
warm hedge
#

Maybe macro'ing is a workaround/headache killer

meager granite
#

It would stop making sense the next day just the same, I think

#
if(_y get "has_playable_variant" && !(_y get "is_repeated") && (!_same_world || (_y get "mission" get "world" == worldName))) then {
```Hate this one too
warm hedge
#

lmao

meager granite
#

What's the best about these condition is that if you have any undefined, entire if then block gets ignored

#

Its a feature you can utilise, but sometimes it gets annoying to debug

stable dune
#

im stuck.
Just example

private _type = getModelInfo _vehicle select 0;
private _pos = [0.002, 1.325, -0.53];
private _dir = [1, 0.003, -0.002];
private _up =  [0.002, 0, 1];
private _displayName = "User1";
[_type, _pos, _dir, _up, _displayName] call PSR_fnc_hashMap;
PSR_fnc_hashMap = {
    params ["_type", "_pos", "_dir", "_up", "_displayName"];`
      private _data = createHashMapFromArray [
        [_type, createHashMapFromArray [
            [_displayName, createHashMapFromArray [ 
                ["pos", _pos], ["dir", _dir], ["up", _up]
            ]]
        ]]
    ];
        // dont know how to create HashMap (
        if (isNil "PSR_userDefined") then {
          PSR_userDefined = .. createHashmap?
        } else {
          // how to set if not exist type?
          // how to set if type exist but not displayname
          // how to set if _type exist, and displayname exist -> re set pos dir up
        };
};
meager granite
#

You're calling the function before defining it

#
if(isNil"PSR_userDefined") then {PSR_userDefined = createHashMap};

if!(_type in PSR_userDefined) then {PSR_userDefined set [_type, createHashMap]};
private _type_hashmap = PSR_userDefined get _type;

if!(_displayName in _type_hashmap) then {_type_hashmap set [_displayName, createHashMap]};
private _display_hashmap = _type_hashmap get _displayName;

_display_hashmap set ["pos", _pos];
...
#

Pro mode:

PSR_userDefined getOrDefaultCall [_type, {createHashMap}, true] getOrDefaultCall [_displayName, {createHashMap}, true] merge [createHashMapFromArray [
     ["pos", _pos]
    ,["dir", _dir]
    ,...
], true];
#

First define PSR_userDefined outside of the function for this

stable dune
#

Holy shit.

#

Nice, thanks alot

meager granite
#

Fixed pro mode*

#

otherwise private it to do several sets later instead of one merge

#

I hate true in getOrDefaultCall and merge ๐Ÿ˜ก

stable dune
# meager granite Fixed pro mode*

Damn, you make my weekend.
It's working.

[
    ["someModel_2.p3d",[
        ["User3",[["pos",[3,3,3]],["up",[3,3,3]],["dir",[3,3,3]]]],
        ["User2",[["pos",[2.3,21,-1]],["up",[1.2,2,2]],["dir",[1.2,2,-12]]]],
        ["User1",[["pos",[1.3,1.1,-1]],["up",[1.1,3,2]],["dir",[1.1,3,-1.1]]]]]],
    ["someModel_1.p3d",[
        ["User3",[["pos",[3.3,1.3,-5]],["up",[3.1,3,2]],["dir",[3.1,3,-1.4]]]],
        ["User2",[["pos",[2.3,1.3,-5]],["up",[2.1,3,2]],["dir",[2.1,3,-1.4]]]],
        ["User1",[["pos",[1.3,1.3,-5]],["up",[1.1,3,2]],["dir",[1.1,3,-1.4]]]]]]
]
PSR_userDefined get "someModel_2.p3d" get "User1" get "pos" // [1.3,1.1,-1]

Thanks, I don't know how long I would have struggled with this without your help

timid glen
#

Hey, is it possible to make a single big object from multiple small objects?
So for example create a house with interior, then export it from eden as a composition and have it become a single united object?

#

To optimise for performance?

meager granite
#

Not possible

#

You can script the tricks like hiding interior stuff at certain camera angles/distances etc but no guarantee it will give you much or any performance gain

timid glen
#

Okay, can I ask why it wouldnt be possible?
If I create a small bunker via eden, then save that as a composition, why cant i turn that composition into a singular united object?

#

Instead of having multiple small objects, why wouldnt that save on performance?

warm hedge
#

Because they are objects, not an object

meager granite
#

Because composition is just a list of individual objects

warm hedge
#

Dynamically edit P3D is not possible too

timid glen
meager granite
warm hedge
#

Which still is not possible via a script

timid glen
meager granite
#

No such tool, you'll need to learn A3 modelling to do that

timid glen
#

Okay but technically when i export a compositon

#

it includes positional data aswell as the actual object names?

warm hedge
#

Yes

timid glen
#

So in theory everything is there to create a new asset, I would just have to create a tool, transcribing the values

warm hedge
#

In theory. But still not really sure why it is a big concern to you

timid glen
#

Well a friend of mine created a custom map with game realistic map studios. he built a bunch of custom houses on it via eden then exported that back into the programm which then made it part of the map

#

However due to the high level of customisation it is not very performant

#

So my idea was to combine some of the assets

#

like a big custom house into a single asset

warm hedge
#

Well, if you're after a terrain creation, it is really optimized already. Which, there really is no big point to make a new P3D to optimize. Maybe only cons too

timid glen
# warm hedge Well, if you're after a terrain creation, it is really optimized already. Which,...

Well I dont exactly understand how it works, but the map is essentially made with the placed down objects. However the objects act independent from each other. So for example the circle of lawnchairs each has physics and can be destroyed individually. I dont like that functionallity as I am sure it taxes the server performance. I would just like a singular simplified object that looks like a circle of lawnchairs but doesnt calculate as such

magic dust
#

Does while-do loop and waitUntil loop have performance difference?
And do we have a Code Optimisation channel? i think im addicted to ittanking

meager granite
#

This channel is a great fit for code optimization stuff

meager granite
#

But it could depend on how you script it, just measure it

meager granite
#

Its a wrapper to diag_codePerformance command

magic dust
#

Trying to use diag_tickTime to measure it,

[] spawn { // Suspending not allowed in Debug Console
    _tempLoop = 0;
    _startTime = diag_tickTime;  // Start timer

    waitUntil {
        _tempLoop = _tempLoop + 1;
        _tempLoop > 100;
    };

    _endTime = diag_tickTime;  // End timer
    hint format ["waitUntil loop execution time: %1 seconds", _endTime - _startTime];
};

It takes 1.7 seconds while while-do takes less than 0.0001think_turtle

[] spawn {
    _tempLoop = 0;
    _startTime = diag_tickTime;  // Start timer

    while {_tempLoop <= 10000} do {
        _tempLoop = _tempLoop + 1;
    };

    _endTime = diag_tickTime;  // End timer
    hint format ["while-do loop execution time: %1 seconds", _endTime - _startTime];
};
eternal steeple
#

Hello, i have a question for my problem, i use TFAR the latest version .335 my code is :

    private _pluginCommand = format [
        "TANGENT PRESSED %1%2 %3 %4 %5",
        call TFAR_fnc_currentSWFrequency,
        _radio call TFAR_fnc_getSwRadioCode,
        ([_radio, "tf_range", 0] call TFAR_fnc_getWeaponConfigProperty) * (call TFAR_fnc_getTransmittingDistanceMultiplicator),
        ([_radio, "tf_subtype", "digital"] call TFAR_fnc_getWeaponConfigProperty),
        _radio
    ];

    ["", _pluginCommand, 0] call TFAR_fnc_processTangent;```

Its the same code in the source of TFAR but the call not working, let me explain, I've been testing fixes and other things for weeks but nothing works, when I run this command I want the radio to be a continuous activation, but nothing happens, I've changed to test the TFAR_fnc_processTangent source code with a variable, the activation doesn't start but if I press the radio it starts and stays continuous, so I don't understand why the TANGENT PRESSED doesn't work from the start. any ideas?

Thanks for helping !
meager granite
stark fjord
stark fjord
#

~~Go figure its a mod causing it... ~~

BALLTest = {
    if (isNil "ABCDEF" || {isNull ABCDEF}) then
    {
        ABCDEF = "Land_Football_01_F" createvehicleLocal ((getPosASL (allPlayers # 0)) vectorAdd [0,0,3]);
        if (hasInterface) then
        {
            systemChat "Client creating ball";
        } else {
            ["Server creating ball"] remoteExec ["systemChat", -2];
        };
    };

    ABCDEF setVelocity [0,0,10];
    if (hasInterface) then
    {
        systemChat format ["Client applied velocity %1", velocity ABCDEF];
    } else {
        [format ["Server applied velocity %1", velocity ABCDEF]] remoteExec ["systemChat", -2];
    };


    [ABCDEF] spawn {
        params[["_ball", objNull]];
        if (isNil "_ball" || {isNull _ball}) exitWith
        {
            if (hasInterface) then
            {
                systemChat format ["Client ball nil/Null? %1 %1", isNil "_ball", isNull _ball];
            } else {
                [format ["Server ball nil/Null? %1 %1", isNil "_ball", isNull _ball]] remoteExec ["systemChat", -2];
            };
        };
        sleep 0.5;
        if (hasInterface) then
        {
            systemChat format ["Client velocity %1", velocity _ball];
        } else {
            [format ["Server velocity %1", velocity _ball]] remoteExec ["systemChat", -2];
        };
    };
};

call BALLTest;
[] spawn {
    sleep 10;
    call BALLTest;
};```
thin fox
stark fjord
# stark fjord ~~Go figure its a mod causing it... ~~ ```sqf BALLTest = { if (isNil "ABCDEF...

Actually i stand corrected, velocity return [0,0,0] after some time on both client and server
First output is:

Client creating ball
Client applied velocity [0,0,10]
Server creating ball
Server applied velocity [0,0,10]
Client velocity [0,0,5.1]
Server velocity [0,0,5.0833]

~~10 seconds later~~
Client applied velocity [0,0,10]
Server applied velocity [0,0,10]
Client velocity [0,0,0]
Server velocity [0,0,0]

OR am i doing something wrong here? Tested on DS ofc code ran globally in debug console, no mods

#

Also ball does jump as observed on client, and changes position on server. Which means velocity sure does its thing, but returns 0

wheat geyser
#

Is there still some A2/A2OA scripting going on or a subdivision for this, here in Disc?

#

(((Yeah yeah, I know it's old)))

wheat geyser
#

For "i" from 0 to 12 step 7 do { systemChat str(i) }

#

gives, in the latest version of A2OA, 0, 7, 14 ...

stark fjord
#

Hmm maybe it first checks if _i > 12 then adds _i+=7 right before it runs code?

faint trout
#

Heya all,

I am trying to reactivate the marked symbol to "find yourself on the map", unluckly I dont rly know why its gone.
Is it a ACE "Feature"?

south swan
wheat geyser
wheat geyser
winter rose
#
for "_I" from 0 to 3 do { systemChat str _I }; // errors in A2 (OA is fine), as capital var is not "found"
#

like, it's case-sensitive where variables were not ๐Ÿ˜„

stark fjord
stark fjord
wheat geyser
magic dust
# meager granite Use `diag_codePerformance`

Im havingSuspending not allowed in this context error when running

diag_codePerformance [{
    _tempLoop = 0;
    waitUntil {
        _tempLoop = _tempLoop + 1;
        _tempLoop > 100;
    };
}]

Wiki says diag_codePerformance runs in in unscheduled environment, and waitUntil should be used inside non-scheduled environment, and I have no idea to use [] spawn {} in it

south swan
#

waitUntil
Description:
Suspends execution of scheduled script until the given condition satisfied.
meowhuh

south swan
south swan
winter rose
magic dust
south swan
#

This cause 'waitUntil' slow.
no, it doesn't. waitUntil is roughly equivalent to while {_tempLoop < 100} do {_tempLoop = _tempLoop + 1; sleep 0.016;} ๐Ÿคทโ€โ™‚๏ธ It's not "until 3 ms limit is reached". It's literally "single check per frame". 100 checks = 100 frames = 1.7s@60FPS

hallow mortar
#

What happens in waitUntil if the condition is so absurdly complex that a single iteration exceeds the 3ms limit? Frame extended, or check doesn't complete on that frame?

south swan
magic dust
south swan
#

if the code is executed at most once per frame - i'd say you only care for the performance of a single run so you should diag_codePerformance the insides of waitUntil blobdoggoshruggoogly

winter rose
south swan
magic dust
#

Thank you guys I'll continue figuring it out tomorrow cuz now I need to have some performance test of

waitUntil {sleep 60;12PM_on_Sunday};
doWakeUp;
south swan
#

cya

raw vapor
#

I have returned to attempt my burning-a-place-down idea again for a mission.

  • The goal: I want to set fire to an area in a multiplayer mission using the Wildfire module. I already know how to intensify the fire.
  • The problem: I need to detect if a player is looking at the right spot with the right weapon (probably something like if (currentWeapon player == "ClassNameOfFlamethrower")) before I activate the trigger, since I don't think it's possible to detect a particular kind of projectiles in an area. If it is possible, I don't know how to do that even with normal bullets.

Does anyone know how to make it so looking at a trigger area and doing something (such as firing your gun) will activate said trigger? I need to check things like how close the player is to the trigger when they shoot at it, and what weapon is in their hand when they fire.

#

My planned use is, when a player shoots while pointing at the desired spot with the desired weapon in their hand, each time they shoot will intensify the fire of a wildfire module. If they don't have the right gun, nothing will happen.

#

Later I also plan to figure out how to detect if certain types of grenades have exploded in the area (such as molotovs from SOG or ACE incendiary grenades) but that idea will come later.

hallow mortar
#

Personally I would likely just do a Fired EH on the player that checks the fired weapon and whether they're inside the trigger area. Inside but looking outwards? eh, good enough, no one will notice

hallow mortar
keen grove
#

How can I make zamak MLR rockets refill after set duration?

raw vapor
#

Honestly this same kind of script could be helpful later in a recon mission context.

hallow mortar
#

Use a Fired EH on the player. It includes a reference to the fired projectile. You can then use that to add EHs to the projectile.

raw vapor
#

Well, does a trigger even respect hitPart?

#

Since otherwise the projectiles might just hit the leaves and vanish.

#

And I'm not going to set a hit event for every individual bush I'll shoot myself and probably so will ArmA

jade acorn
#

I was thinking of adding a feature to my mission that would render a cicle around a vehicle to show the approx. possible distance it can reach before going null fuel. Thing is I am not really sure how to convert the vehicle's maximum speed and the fuel amount (lowered by the fuel coef) to meters in straight line. Any ideas how to approach and if it's even possible?

hallow mortar
hallow mortar
raw vapor
raw vapor
hallow mortar
#
player addEventHandler ["Fired",{
  params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
  if (_ammo == "flameThrowerProjectileClass") then {
    _projectile addEventHandler ["HitPart",{
      params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius" ,"_surfaceType", "_instigator"];
      if (_pos inArea my_trigger) then {
        systemChat "aeiou";
      };
    }];
  };
}];```
might need to use an intermediate `submunitionCreated` EH depending on how flamethrowers actually work
raw vapor
#

Well the first big problem is I don't know how to get this flameThrowerProjectileClass to begin with.

fair drum
hallow mortar
#

possibly need to use a different projectile EH, Exploded or Deflected maybe, it depends on which events work with flamethrowers and which give you reliable detection

hallow mortar
raw vapor
#

Gimme a second then

#

Ammo appears to be Flamethrower_Fuel

#

Let me actually pull open the config tho if that's not what you mean

#

Actually, I'll figure that out later. Let's just fuck around with a proof of concept for now using like, 5.56 ammo or something from vanilla.

#

I still think my more reliable solution is just going to be "check if a player is looking at a certain spot and has fired a certain gun from a certain distance" but whatever. This is actually closer to the original solution I wanted but Webknight made it sound like that wasn't possible.

#

I'll just start from the top.
When some_specific_kind_of_projectile_class goes into that area, trigger gets activated. How do I do that?

winter rose
raw vapor
# winter rose I wouldn't do it this way. what is the use case?

The goal is I want it so when a player shoots a Webknights flamethrower at a particular spot, it sets fire to the spot by using a wildfire module.

A previous "solution" that I also didn't know how to do was check if the player is just looking at the right spot, and is the right distance, and has fired the right kind of gun.

#

If I can figure this out I might later expand it to other types of flamethrowers like SOG flamethrowers but I'm not even to the point of making anything happen yet.

#

The problem right now is I have not even the faintest idea on how to determine that the player is even shooting at the correct spot, much less with the correct gun. I can't just bullshit it and check if the player has fired inside a trigger area; what if they are looking in the opposite direction that I want them to?

winter rose
raw vapor
#

My experience/knowledge is very poor, so I wouldn't know how to do that either other than brute force. I am hoping there is some way to determine that the player is pointing at the spot I want them to when they shoot. I don't know how to check what direction they are looking. https://community.bistudio.com/wiki/cursorObject sounds like something important to this but I'm very not sure.

#

If I can figure out how to know if the player is looking at the right spot, I can then figure out how to check what gun they have, how far away they are, then check if they fire. Maybe a little delay after their shot to account for travel time.

opal zephyr
hallow mortar
#

A Fired event handler is the best way to detect when the player fires their gun. The EH also gives information about which gun they fired, and you can use the event to trigger your check of where they're looking - or where the projectile actually ends up.

"Where is the player looking" is actually a fairly complex check in Arma. What if, for example, they are looking "through" the target area? Their actual sightline passes over the ground, and between any objects, so the position their cursor is over ends up being somewhere in the distance. But because of gravity, the projectiles actually end up in the target area. It's harder than you think. This is why I am trying to tell you to use event handlers on the projectile. When a projectile event happens, the EH tells us exactly where that projectile is at that moment. We know its position, we can then easily check if it is inside the target area.

#

It's really not a complex chain of logic, and it's not difficult to implement.

  1. The Fired EH activates when the player fires.
  2. If the projectile is of the correct type, the Fired EH adds a new EH to the projectile.
  3. The projectile EH activates when the projectile hits something.
  4. If the position of the projectile when it hits something is inside the target area, <something happens>
granite moat
#

Did a script for interactive intel: https://www.youtube.com/watch?v=keq_PWKWQsc (works on dedicated multiplayer). Sharing it here since git is in the comment of the video and this might help people making their own version of the script, etc.

Feel free to remove this message if not compliant with the channel description ๐Ÿ™‚

Short video showcasing my new script adding intel document on killed units. Works on dedicated server !

For installation and how to use, see documentation & implementation on Git: https://github.com/gerard-sog/arma3-macvsog-columbia-scripts

Arma 3 Vietnam unit: https://discord.gg/dyeUNXHFqS

โ–ถ Play video
void sleet
#

Couldn't find a recent answer anywhere else, and my question is pretty specific, so I'm asking here.

Is there a way to use scripts to hide the hull/chassis and treads of, say, a tank, and leave the turret intact? That way the turret can be slapped onto a blank hull in the 3DEN editor to make a kitbashed vehicle?

fair drum
#

some models you can hide the turret, but none can hide the hull/treads

void sleet
#

Damn, that sucks.

#

Thank you though!

warm hedge
#

Is this an SQF question or config question

#

Well, regards to that, it is not that "linear". If, let's say put the pedal to the metal, it consumes much more. Or if you increase throttle

warm hedge
#
currentFuel = 1;
onEachFrame {
   systemChat str (currentFuel - fuel vehicle player);
   currentFuel = fuel vehicle player; 
};```sidenote, you can see how it is not linear
warm hedge
#

I really don't think it really does that complex thing

#

But I also am sure not much documents are there to explain anything about it

#

I said about influences

#

I guessed similar

#

Ah well, I think I misunderstood what you really meant by linear. But this really is the assumption/guess, I really have never seen a detailed explanation about fuel at least

#

I know what linear is. I thought you meant fuel consumption is never influenced by anything but just engine on/off, so it linearly consumes the fuel tank

#

Yeah I get your point

tough abyss
#

Still interesting, actually it might infact be modelled using a ODE very simple ODE.

warm hedge
#

And * setFuelConsumptionCoef, but it should never be a very complex and simulation

warm hedge
#

Well removing near to entire your post will never make any sense ยฏ_(ใƒ„)_/ยฏ

thin fox
#

lol

fringe granite
#

@meager granite Thank you for all the support yesterday! In the end I found it easier to just write my own extension for writing to a file, that way i dont have to go through the trouble of deserializing. I made it a public repo wich can be found here for those interested: https://github.com/MayAllBeForgiven/Arma3FileWriter

GitHub

Extention for arma 3 in order to write to file. Contribute to MayAllBeForgiven/Arma3FileWriter development by creating an account on GitHub.

cobalt path
#

Question,

private _vehicle = "C_UAV_06_F" createVehicle position player;

spawn the uav at the ground level. That means if player is standing on a building, UAV will spawn well, way below. How do I make it spawn at the same altutide as the player?

warm hedge
#

getPosATL

cobalt path
#

can I just replace "position" or do I need to do playerpos = getposatl player; or smth

warm hedge
#

Yes and no need to

jade acorn
#

what's the purpose of setSide? As in, when does it matter if location has its side set to some faction? Is it to provide compatibility for some gamemode frameworks or something?

cobalt path
warm hedge
jade acorn
#

first time hearing of something like this

#

is it an alternative name of OFP's CTI?

warm hedge
#

A2's, yes

warm hedge
faint burrow
manic flame
#

Hi, im using triggers to spawn subtitles like this;

[ 
 ["Shadow 1", "Quite silent...", 0], 
 ["Shadow 2", "Don't Jinx it...", 3],
 ["Seal 1", "Shadow 1 this is Seal 1, ive started frying the AO", 6],
 ["Shadow 1", "Affirmative", 10]
] spawn BIS_fnc_EXP_camp_playSubtitles;

In singleplayer, the subtitles work as intended, but on dedicated servers they dont appear.

The trigger is set to serverOnly

How can I get these subtitles to appear for all players?

faint burrow
manic flame
faint burrow
#

Depends on the condition.

manic flame
#

I'd like to show to all players, at the same time, the same subtitles

#

im guessing server only for this use case

#

since i dont want each player to trigger the subtitles everytime they enter the arae

faint burrow
#

You're talking about what should happen when the trigger is activated, I'm talking about the activation condition. Again, it depends on the condition.

manic flame
#

Player present

faint burrow
#

I would you server trigger.

proper sigil
#

Does anyone here uses typesqf and knows what could be a cause for it not launching? It worked for me for years and recently it just stopped launching. I tried using admin priviliges, added exception to firewall, reinstalled, changed installation path, even upgraded to damn win11 xD, but it just does not launch and I literally did nothing, it just sopped working out of blue.

proper sigil
#

Like there is a process in taskmanager for split second and it dissappears

winter rose
brittle minnow
#

Hi, Is there any way to disable date synchronization between server and client?
I want to have a underground location that upon entrance player get a setDate to night, but it should not apply for all units because some of them might be on surface.
Any suggestions or alternative ways to solve this problem is appreciated.

proven charm
real tartan
proven charm
#

ah sorry

fringe granite
cobalt path
# warm hedge You can always setPosATL it afterwards

Fair enough thats what I did.

However new issue now, after a few seconds I want to spawn a few other vehicles on drones location. If I do it in a regular way. Than they still spawn on ground level, if I do setposatl they spawn in the drone and blows it up

hallow mortar
#

Well then you're going to have to either move the drone or spawn the new vehicles somewhere else

keen grove
#

Hi can I have some help? trying to make a arti piece fire are dots in a seprate layer, here is the obj init I'm trying to work with.

[this] spawn { params ["_this"];
private _targets = (getMissionLayerEntities "Anthrakia_Targets") select 0;
{ _this doArtilleryFire [getPos _x,((getArtilleryAmmo  [_this]) select 0), 1 + (random 3)]}forEach _targets;
}
stable dune
keen grove
stable dune
keen grove
#

why are there 2 functions for the same thing Q_Q

#

well it still doesn't work...

[this] spawn { params ["_this"];
private _targets = (getMissionLayerEntities "Anthrakia_Targets") select 0;
{ _this doArtilleryFire [getMarkerPos _x,((getArtilleryAmmo  [_this]) select 0), 2]}forEach _targets;}
stark fjord
#

Is artillery unit local to server?

#

cause getMissionLayerEntities can only be run on server and doArtilleryFire can only be run where artillery unit is local

#

Also markers are retrieved from getMissionLayerEntities "layer" by selecting 1 eg:
private _targets = (getMissionLayerEntities "Anthrakia_Targets") select 1;
0 returns objects, but you said you store markers in there

stark fjord
#

and local as in server?

keen grove
#

singleplayer?

stark fjord
#

in singleplayer you are both server and client which is fine.
But you inted to run this multiplayer at some point you need to be carefulings

keen grove
stark fjord
#

Anyhow try this ```sqf
[this] spawn
{
params ["_this"];
getMissionLayerEntities "Anthrakia_Targets" params [["_objects", []], ["_markers", []], ["_groups", []]];
{
_this doArtilleryFire [getMarkerPos _x,((getArtilleryAmmo [_this]) select 0), 2]
waitUntil {sleep 1; unitReady _this}; //Wait until gun is done firing before giving it next target
} forEach _markers;
};

keen grove
stark fjord
#

yep private _targets = (getMissionLayerEntities "Anthrakia_Targets") select 1; and getMissionLayerEntities "Anthrakia_Targets" params [["_objects", []], ["_markers", []], ["_groups", []]]; return same thing anyhow

keen grove
#

it doesn't reload dynamically tho

#

hmm...

#

which I want

stark fjord
#

thats your next problem to solve

#

one example is just adding _this setVehicleAmmo 1; after its done firing salvo to magically replenish units ammo

keen grove
#

yea but that's not hard enough.

#

๐Ÿ˜›

stark fjord
#

If you want hard, load ace, enable advanced artillery, and script an AI to reload each shell manually

keen grove
#

wait I think it just partially reloaded...

#

hmm... i think what is happenign is that when the ammo runs out it overrides the doarrtiliary thing and cancles that mission.

I wounder how I can check if the ammo is empty before giving the artiliary mission to let it reload somehow

๐Ÿค”

thin fox
#

you simply add arty setVehicleAmmo 1 after the waitUntil

old owl
#

Hi, dumb question but does lbData have a default? According to the wiki it looks like lbCurSel does but couldn't find anything about lbData.

keen grove
thin fox
hallow mortar
# keen grove but I want it to still dynamically load, not just have maigcally reload

but y tho?
Is anyone going to be monitoring the ammo state of this artillery piece closely enough to notice?
Artillery working with magazines is an Arma abstraction btw. In reality an artillery crew would notice their ready ammo getting low and top it up between fire missions - they don't need to completely expend their ready ammo before getting more.

stark fjord
hallow mortar
#

There is still a limited amount of ammunition on the vehicle/near the gun, which is what the Arma magazine system is an abstraction of

keen grove
#

Keeping base game behaviour makes it more seamless

hallow mortar
#

I don't see why "magic" reloading prevents the script from being reusable - and I really doubt anyone will ever notice the "seams". There's a good chance no one will ever even look at the artillery while it's firing, given it's likely to be several kilometres from the action.

keen grove
#

Just make a layer with targets, and put its name in the script. Boom you have a natural feeling artillery

thin fox
#

why complicate this

keen grove
stark fjord
#

then as PIG13BR said, step by step and google until you achieve what you want.

keen grove
#

I think i did

stark fjord
#

grand

keen grove
#

Check ammo count, if it's 0 waitUntil ammo is full.

#

Needs to find how to do it and if the ai will still reload on waitUntil

thin fox
thin fox
stark fjord
thin fox
#

it seems like you also ignored that, awesome

keen grove
keen grove
thin fox
#

really, okay

keen grove
stark fjord
#

dunno check

thin fox
#

to get ammo count you can use magazinesAmmo. The MLRS that you are using returns just one array (just one type of magazine), so it's okay. Just do like

_rounds = (((magazinesAmmo arty) select 0) select 1);
#
if (_rounds == 0) then {
  // Do something here
};
keen grove
#

Will _rounds dynamically update?