#arma3_scripting

1 messages · Page 196 of 1

fair drum
#

so you're saying pull my refs into the #create method instead of defining them as properties?

hushed turtle
#

I've meant to use _self set ["active_units", []]; in #create rather than array copy when calling createHashMapObject.
But do whatever

somber harness
#
for "_i" from 1 to 3 do { execVM "spawnAgrInfantry.sqf"; };
while { {alive _x} count units east > 4 } do { sleep 2; };


waveCount = waveCount - 1;

if (waveCount > 0) then {
    sleep 20; // Wait before next wave 
    execVM "waveSpawn.sqf";
 } else 
{
        "EveryoneWon" call BIS_fnc_endMissionServer;
}
;```

so, this is my "waveSpawn.sqf" script so far, it generally does work, as in it spawns 3 infantry squads, 1 vehicle, but something i've been figuring out is how i can make it so that 

1) it has 20 seconds between each spawn
2) it doesn't end the mission as soon as the 2nd wave spawns. (waveCount is set to 2 in initServer.sqf)

here's what i tried:

sleep 20 was set before the ifelse loop, after the whiledo also, but it didn't really work out. I decided to try putting where it is now as it is taking place after the condition is met for wavecount to be above 0, so it waits 20 seconds after, and then the script executes itself. however, it does it instantly pretty much. is there something wrong with how i wrote it?

when it comes to the victory condition in the else statement, i want it to happen after all of the waves have been spawned, and if it counts less than 4 east units in a specific trigger area (lets say it's called "DefenseZone") as well. will i just need to create a separate script that needs to be executed for it?

I attempted this on a separate script, however I struggle to find enough information on counting or enough knowledge on it. I tried for example `{alive _x} count (units east inAreaArray defenseZone) < 4` and I'm aware this is incorrect but I struggle with understanding how exactly to utilize variables and values with this. As far as I'm aware, this is like putting 2 statements together, and (units east inAreaArray "defenseZone") is the value here. Do I have set 2 count statements to == each other and set a specific number? Maybe like `{alive 3} count units east == count units inAreaArray "defenseZone"`?
somber harness
#

Or is it still nonsensical here

#

(huge delay btwn 2 messages because i been testing things out)

meager granite
#

{alive _x} count (units east inAreaArray defenseZone) < 4 looks correct

#

Since you're executing everything in scheduled environment, your while check happens before your spawnAgr* scripts finish spawning

#

So your condition meets before you have stuff spawned

#

Do you do any waits or sleeps or inifite loops in your spawnAgr* scripts?

meager granite
#

If not, you can try this

#

Or even avoid spawning separate threads so all your scripts are within same thread:

call compileScript ["spawnAgrVehicle.sqf"];
for "_i" from 1 to 3 do {
    call compileScript ["spawnAgrInfantry.sqf"];
};
while { {alive _x} count units east > 4 } do { sleep 2; };
#
while { {alive _x} count (units east inAreaArray defenseZone) > 4 } do { sleep 2; };
```This condition should also work
#

With defenseZone being trigger with area where your units are

somber harness
#

ah wait

#

I see now

meager granite
#

execVM spawns a separate script thread in scheduled environment

somber harness
#

I didn't let it run long enough for both to spawn

meager granite
#

and these threads execute alongside your main one with no guaranteed order

#

So your while condition starts checking even before your spawning scripts/thread actually spawn anything

somber harness
#

Ahh I see, tysm

meager granite
#

scriptDone checks if script has finished, reached its end. In call version of it it simply branches your main thread into that script so its all within same thread and your while never starts checking before all spawn scripts are done.

somber harness
meager granite
#

In first example separate new threads are spawned and main thread waits until new threads are done

#

In second example main thread simply calls the functions made out of script files so its all one single continuous thread

somber harness
#

Ohhhh

#

Alright I see

somber harness
#

I'll try the other one

#

I have a feeling it could be the sqf I made, I'll show it

meager granite
#

What's in your spawning scripts?

somber harness
#
_destination = "defensArea";
_enemCarType = selectRandom ["O_MRAP_02_hmg_F","O_LSV_02_AT_F","O_LSV_02_armed_F"];

_enemVeh = _enemCarType createVehicle getMarkerPos _stMarker;
_enemVeh setDir markerDir _stMarker;

_crew = createVehicleCrew _enemVeh;
_wayp = _crew addWaypoint [markerPos _destination,0];

////////////////////////////////////////////////////////////////////////////```
spawnAgrVehicle

```_stMarker = selectRandom ["infSpawn_1","infSpawn_2","infSpawn_3"];
_destination = "defensArea";
_enemInf = createGroup east; 
_enemInfArray = [
    "O_Soldier_SL_F", 
    "O_Soldier_F", 
    "O_Soldier_LAT_F", 
    "O_soldier_M_F", 
    "O_Soldier_TL_F", 
    "O_Soldier_AR_F", 
    "O_Soldier_A_F", 
    "O_medic_F"
];

{_enemInf createUnit [_x, getMarkerPos _stMarker, [], 0, "NONE"];} forEach _enemInfArray;


// "SAD" stands for "Search and Destroy" waypoint type
_wayp = _enemInf addWaypoint [getMarkerPos _destination,0];
_wayp setWaypointType "SAD";```

spawnAgrInfantry
meager granite
#

Post them too

#

What is your current script that resulted in lots of vehicles?

somber harness
#
for "_i" from 1 to 3 do {
    waitUntil {scriptDone execVM "spawnAgrInfantry.sqf"};
};
while { {alive _x} count units east > 4 } do { sleep 2; };

waveCount = waveCount - 1;
if (waveCount > 0) then {
    sleep 20;
    execVM "waveSpawn.sqf";
 } else 
{
        execVM "waveEndMission.sqf";
}
;```

waveSpawn

Here's the script I was also struggling with finishing the mission on due to counting

```if ({alive _x} count (units east inAreaArray defenseZone) < 4) then
{
    "EveryoneWon" call BIS_fnc_endMissionServer;
}

waveEndMission

meager granite
#

Its a single if check, if it fails once your mission never ends

somber harness
#

oh

meager granite
#

Oops, I messed up my waitUntil/scriptDone script

somber harness
#

gotta do while?

meager granite
#

Let me fix it

#

Check my script bits above

meager granite
somber harness
meager granite
somber harness
#

ohh so the issue was due to the fact it was checking while since the beginning

meager granite
#
call compileScript ["spawnAgrVehicle.sqf"];
for "_i" from 1 to 3 do {
    call compileScript ["spawnAgrInfantry.sqf"];
};
while { {alive _x} count (units east inAreaArray defenseZone) > 4 } do { sleep 2; };

waveCount = waveCount - 1;
if (waveCount > 0) then {
    sleep 20; // Wait before next wave 
    execVM "waveSpawn.sqf";
} else {
    "EveryoneWon" call BIS_fnc_endMissionServer;
};
somber harness
#

oh there we go

#

holy crap man you're a lifesaver 😭 tysm!!!

#

so I assume when it comes to having scripts run before a check I need to run call compileScript so it's sequential?

meager granite
#

Yes

#

You can do it with scriptDone and execVM too, I just messed it up in original script bit

somber harness
#

just don't do waitUntil?

meager granite
somber harness
#

Oh sweet, thank you

#

I'll try that

#

Gotta make sure, I'll be hosting a mission with my scripts for friends

#

I won't have to go like re-script everything specifically for MP will I?

#

I'm not exactly sure what requires using global scripts and local

meager granite
#

So it does all the spawning and checking

somber harness
hushed turtle
#

From where are you executing the code?

meager granite
somber harness
#

i was calling it on initServer.sqf but later I’d do it from triggers

#

ohh isn’t there a server only option or smth on triggers

meager granite
#

There is

hushed turtle
#

There is server only option on triggers

meager granite
#

Otherwise just wrap your first call with isServer check

thin inlet
#

Hello guys. Besides learning with GPT. What are good ways to learn scripting without any coding knowledge at all.
Im a noob but very creative

pallid palm
#

dont use ChatGPT

warm hedge
#

Forget ChatGPT and ask us

pallid palm
#

ChatGPT will fuck you all up

#

like POLPOX said my ChatGPT is the guys in Discord

thin inlet
pallid palm
#

@hushed turtle i PM-ed you

warm hedge
thin inlet
#

I don't even know what I don't know to know what I should know.

hallow mortar
#

The wiki has a lot of useful information. https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
Some things you don't really need scripting for at all. The Editor provides a lot of tools for doing things without actually writing any code.
There are some tutorials on Youtube but I would be very cautious about them. Literally anyone can poop out a video and there's absolutely no guarantee they know what they're doing. It's a regular thing for people to turn up with awful code and go "but I saw it on Youtube, and that means it's right!"

#

Generally I'd suggest picking an objective (not too ambitious) and trying to find out how to make that thing happen. It's difficult to start with "I want to learn all of scripting first". It's better to have a task to guide you.

thin inlet
#

Thank you.

thin inlet
lyric gulch
#

I'm trying to setup "Same SR frequency for side" in TFAR global settings but my radio just comes up blank.

#

when I set "TFAR_SameSRFrequenciesForSide = true;" it just makes my radio blank, no channel no frequency

somber harness
#

Not too long ago I was still learning just counting, in just one day I just learned how to write basic scripts and spawns and waves

#

It just adds up as you know more and can understand more

somber harness
ornate whale
#

Is it possible to assign (or pass) a function name to a variable and then call it (like a callback function)?

_nextFunction = TAG_fnc_someFunction;
[] call _nextFunction;

Thanks.

tulip ridge
#

Yes

#

A function is just a global variable assigned to code

lean kernel
minor viper
#

Does addAction need to be local for players?

stable dune
minor viper
#

_paratroopers = crew _xian;
_pilot = driver _xian;
private _index = _paratroopers find _pilot;
if (_index != -1) then
{
    _paratroopers deleteAt _index;
};

{
    _actionID = _x addAction
    [ 
        "Open Parachute", 
        { 
            params ["_target", "_caller", "_actionID", "_arguments"]; 
            private _pos = getPosASL _caller; 
            private _parachute = createVehicle ["Steerable_Parachute_F", [0,0,0]]; 
            _parachute setPosASL _pos; 
            _parachute setDir (getDir _caller); 
            _caller moveInAny _parachute; 
            _caller removeAction _actionID;
        }, 
        nil, 
        0, 
        true, 
        true, 
        "", 
        toString 
        { 
            isNull objectParent _this && 
            { 
                (getPos _this) # 2 >= 5 
            } 
        }, 
        -1, 
        false, 
        "", 
        "" 
    ];
} forEach _paratroopers;

Got an op in two hours and just discovered on the dedicated server that only the first player gets a parachute

#

How can I localise this addAction?

stable dune
#

You can use remote exec your add action on every client where unit is local and is player.

minor viper
#

Yeah so I've used remoteExec before but how would you format it for something with 10 parameters like addAction?

faint burrow
#

I would use a function.

stable dune
#

And
Use getPosATL rather than getPos when check altitude (like you get/set with ATL)

stable dune
faint burrow
minor viper
minor viper
faint burrow
#

The first is correct, the last isn't.

minor viper
#

which bit isn't correct sorry?

faint burrow
#

remoteExec doesn't accept file names.

minor viper
#

ah okay, how do you format it do pass the player as a parameter and execute the script then?

faint burrow
#

As I wrote, the same as for other cases:

{
    [_x, _actionParams] remoteExec ["addAction", _x];
} forEach (_paratroopers select { isPlayer _x });
minor viper
#

so I just need to add

_actionParams = 
[ 
    "Open Parachute", 
    { 
        params ["_target", "_caller", "_actionID", "_arguments"]; 
        private _pos = getPosASL _caller; 
        private _parachute = createVehicle ["Steerable_Parachute_F", [0,0,0]]; 
        _parachute setPosASL _pos; 
        _parachute setDir (getDir _caller); 
        _caller moveInAny _parachute; 
        _caller removeAction _actionID;
    }, 
    nil, 
    0, 
    true, 
    true, 
    "", 
    toString 
    { 
        isNull objectParent _this && 
        { 
            (getPos _this) # 2 >= 5 
        } 
    }, 
    -1, 
    false, 
    "", 
    "" 
];
faint burrow
#

Yes you can do that.

errant iron
#

i think that would make the action appear when you look at someone else too

faint burrow
#

addAction has local effect.

errant iron
#

yeah, local effect, global argument

faint burrow
#

And?

#

We are talking about command effect, not argument locality.

errant iron
#

wait, ah nevermind i missed the target you wrote there

#

ignore me 🙃

faint burrow
#

Exactly.

hallow mortar
ornate whale
#

Is it possible to pass a private array variable as a reference to a function (different scope), and still be able to change the original array within that function, not just a copy?

private _globalArrayVar = [1,2,3];
_globalArrayVar call TAG_fnc_reverseOrder;

Thanks

proven charm
#

yes because its passed by reference

ornate whale
proven charm
#

it should be still reference

ornate whale
stable dune
hushed turtle
#

Have you tested it before?

last cave
#

In the logs of the dedicated server, I often began to notice that these kinds of messages appear.

20:24:24 Road not found - (9117.232422, 18.814486, 11945.744141)
20:27:32 Road not found - (9117.232422, 18.814486, 11945.744141)
20:27:39 Road not found - (9117.232422, 18.814486, 11945.744141)

I checked the position (ScreenShot)

player setposworld [9117.232422, 11945.744141, 18.814486]

I have a suspicion that the nearRoads script command is giving an error.

proven charm
#
_arr = [1,2,3];

[_arr] call 
{
params ["_a"];

_a pushback 777;
};

hint str _arr;
```  prints [1,2,3,777]
hushed turtle
#

Yes that's true, but look again what the dude is doing. If he wants to edit his array he needs to do it like _this set [0,100]. You are passing array in array. He just passes array of numbers.

proven charm
#

not sure what we are talking about here but if you pass array like this: _arr call then the first element of _arr goes to the _a (so not passing the whole array)

hushed turtle
#

It gets passed into _this variable, that's where params is taking variables from

proven charm
#

ofc

hushed turtle
ornate whale
old owl
#

I can't see the attached changelog in this wiki post https://community.bistudio.com/wiki/allVariables since bistudio has been down, but is there any reason why we can't use profileNamespace or uiNamespace in multiplayer? I understand those variables could be set from other servers and they can't be implicitly trusted but it would be very helpful from a cheater prevention standpoint if server owners could still check these.

hallow mortar
#

uiNamespace typically contains variables that are extremely machine-specific and can't really be transferred over network in a useful way (i.e. UI control references).
profileNamespace can contain a lot of stuff; it's not mission-specific or server-specific and a lot of things store data in it. Exposing the entire contents with allVariables could cause issues with the amount of data to be transferred over the network, and it may be a security/privacy issue.
It's only using allVariables with them that's disabled in MP. If you need to check a specific variable, you can still do that with getVariable.

hallow mortar
thin fox
#

you can just teleport the entities of that group to the new position when they respawn

#

make the respawn_west your "base respawn" and then you teleport the rest of your guys where you need them

tawdry stump
#

Hello, Im not sure if this has already been discussed before but is it possible to add a custom inventory item for a mission using scripts? or would it need to become a mod? Currently working on a mission

granite sky
#

Has to be a mod. Config only.

old owl
tawdry stump
old owl
#

I wouldn't be surprised if a lot of cheat devs were using the uiNamespace and profileNamespace to avoid detection

idle violet
#
            idc = 14563;
            text = "Entrar no Discord";
            x = safeZoneX + safeZoneW * 0.22;
            y = safeZoneY + safeZoneH * 0.56;
            w = safeZoneW * 0.36;
            h = 0.04;
            onButtonClick = "openURL 'https://discord.gg/HWh4sqRQ5E';";
        };```

Would this be the correct way to add a clickable discord link? That directs the player to the group when clicked?
snow viper
#

i made a faction with a loadout randomizer script that relies on setUnitLoadout in a script that is run from the unit init, it works perfectly locally but not in multiplayer (all inventory items are missing while the rest of the loadout works fine), does anyone know why that could be?

granite sky
#

There's an issue floating around about calling setUnitLoadout during weapon switching but I haven't seem enough detail on that to know if it's related.

snow viper
#

OK ill implement that check from the wiki

somber harness
#

will spawning planes in the air on getMarkerPos work on markers I put into the air in the 3d editor (if i can do that, not at the pc rn cant check)?

snow viper
#

i simply copy pasted this from the wiki and replaced player with the proper unit variable, but i get this error?

warm hedge
#

It is not an error. It is just the highligher is not recognizing 2.20 command

snow viper
#

ohh ok thank you

#

btw should i do remote exec for this command?

#

even though its supposed to be global?

warm hedge
#

remoteExec what?

snow viper
#

setUnitLoadout

warm hedge
#

It is GA GE so no

snow viper
#

ok thank you

snow viper
warm hedge
snow viper
#

that looks scary 😮 but good to know its being worked on

#

my script runs from the unit init, so i can imagine that is what might be happening

simple lion
#

can someone help me how to make a laser marker that shows in map when you open your weapons laser in arma 3

#

?

fair drum
#

what are you trying to do?

#

at that point, I'd probably just use my own loop rather than a trigger

#
[] spawn {
    waitUntil {
        private _area = [getPostATL _vehicle, 10, 10, 0, false, -1]; // [center, a, b, angle, isRect, height]
        _monster inArea _area;
    };

    // Do something
};

add sleeps if you want to slow down the waitUntil

somber harness
#

lol just had the funniest bug so far. i was using my spawn script, and set it to spawngroup east, and put an array of independent units. the commander was fragging his entire squad lol on all spawns

elder veldt
#

Hello, I am trying to recode the laser system on the khot server. I currently have something like this. It does not work on vehicles and frankly I do not even know how I did it.

lazermode = false;

player addAction ["Lazer Marker Aç/Kapat", {
    lazermode = !lazermode;
    hint format ["Lazer marker %1", if (lazermode) then {"AKTİF"} else {"KAPALI"}];
}];

[] spawn {
    private _markerName = "lazermark";

    while {true} do {
        sleep 0.05;

        if (lazermode) then {
            private _unit = player;
            private _startPos = eyePos _unit;
            private _dir = _unit weaponDirection (currentWeapon _unit);
            private _endPos = _startPos vectorAdd (_dir vectorMultiply 1000);

            private _hit = lineIntersectsSurfaces [_startPos, _endPos, _unit];

            if (count _hit > 0) then {
                private _hitPos = (_hit select 0) select 0;
                _hitPos set [2, 0];

                if (markerType _markerName == "") then {
                    createMarker [_markerName, _hitPos];
                    _markerName setMarkerShape "ICON";
                    _markerName setMarkerType "mil_dot";
                    _markerName setMarkerColor "ColorRed";
                    _markerName setMarkerText name player;
                } else {
                    _markerName setMarkerPos _hitPos;
                    _markerName setMarkerText name player;
                };
            };
        } else {
            if (markerType _markerName != "") then {
                deleteMarker _markerName;
            };
        };
    };
};
proven charm
simple lion
#

yea

#

its aı generated

#

but we dont know this language

proven charm
#

my hunch was right then 🙂

drifting badge
#

weird that the AI has such issues with ARMA3 scripts

simple lion
#

help us

proven charm
#

you could ask someone to write the code for you.... (but no quarantees anyone will)

simple lion
elder veldt
drifting badge
#

might be because there are so many scripts out there and a lot of them are probably not working and the AI is not able to differentiate - because in other areas it does really, really well. It is a shame somehow as it would be a tremendous help if it actually could provide working scripts

proven charm
#

I have never seen working AI code posted in here

simple lion
elder veldt
#

In short, if anyone can help us with this issue, I would be very grateful. (I don't like to leave favors unreturned, maybe I'll send a wheel of cheese)

hallow mortar
#

Generative AI (LLMs) do not understand the actual meaning of things, why or how the code works. They just generate sequences of words that are mathematically plausible based on the dataset. For languages with a lot of complete examples of working code, this turns out "okay" (some of the time). SQF does not have a large dataset of working code - and also, SQF depends heavily on knowing how the game works (or doesn't), which is impossible for an LLM.
If you got working code out of an LLM, you're literally just lucky, and there's a strong chance it's not good code.

drifting badge
#

I wonder if the following is possible (bit complicated): I have a group of soldiers put down in the Editor that are "connected" to their leader via the "bis_fnc_attachtorelative" function (to force them to stay where they are, which works perfectly for what I need). But I wonder if it is possible if one of them dies that one could spawn a new soldier taking the place of the one that died (i.e. using the same attachedto info).

Would also be better if I could generate/spawn an entire squad linked like that (so I do not have to place every single one of those special cases in the Editor). Hope that makes sense.

hallow mortar
#

Yes, that's quite possible. createUnit, a few sets of relative positions or some light vector maths, attachTo, and an event handler.
Do you actually need attachTo, though? If the group as a whole is not moving, it would be preferable to just disable the AI's pathing or movement.

proven charm
#

if id code this I would give every soldier Killed EH and when they are killed create new unit in the eH. though not exactly sure what do you want

drifting badge
#

Yup I did try it with the disableAI "move/path" actually, but this did not do the trick in this case as the AI hates close formations and I also need them to be actually able to move off to adjust their heading or close some distances to the player and his units. It is a bit rigid but that can not be helped. Their moving though is also "forced" so they do not run around like mad chickens.

open nest
#

guys can you help me pls??

#

Hello, I am a new player. How can I play ARMA online?

drifting badge
#

I am sure you would laugh out loud of how my current "test" setup is, working with triggers and not really calling "outside" scripts. My goal is to simulate line formation fighting (hence the force the ai to stay put), and so far I have been able to get a few things done (but there is still a lot of work to do and I apparently suck at scripting and it takes me ages to do even simple things lol)

hallow mortar
hallow mortar
pallid palm
#

doStop this; - in the init of a soldier should do the trick

drifting badge
#

that I noticed quickly, so for now I did set it so the leader can only die if the rest of the squad is dead (to avoid all that hassle);

btw this reminds me: can one querry for "panic"? (i.e. that an AI panics and decides to flee)? did look around but could not find an eventhandler to match this

drifting badge
#

thanks Kerc, god I must be getting blind with age! (or I am just trying to do too many things at once)

ivory lake
#

group eventhandlers are kinda new (new by arma 3 standards, anyway, so a couple years old lol) so its easy to miss them

hallow mortar
hallow mortar
drifting badge
#

Thanks mate, will have a look how you did things and compare it to what I cobbled together so far (am pretty sure your's will be a million lightyears ahead of what I have). Will get back to you guys when I have the time to test.

thin fox
hallow mortar
#

and the offset for lines other than the first isn't being applied properly. And those lines will have a gap in line with the parent unit.
Probably should just ask someone good at maths to do this

#

And the horizontal offset is being applied to the Z value, not the X value 🙃

hallow mortar
snow viper
#

I found out the reason my loadout randomizer script doesn't work is the locality of the command addMagazines, but i saw there is only addMagazineGlobal not addMagazinesGlobal, any suggestions here? I just have an array like this and am trying to globally add it to AI units:

{
   {"magClass", 3}, {"magClass", 1}, ...
};
still forum
#

you cannot, only via button click

#

indeed. It takes the default values by reference. So all your objects are referring to the same underlying Array.
The fix is to set units in #create, won't be able to fix that before 2.22

snow viper
still forum
#

its a bit annoying to always copy the array for safety. Because you only need the copy if you actually end up editing it :/
Bit of a waste of performance/memory, for something people could handle in constructor, I'll probably leave it the way it is

hushed turtle
#

Little later we figured out the issue was objects sharing same units array. For a while I believed it somehow created just one object instance, because same array was used to create both of them krtecek

meager granite
#

But yeah, just run a loop with addMagazineGlobal

snow viper
# meager granite Why do you randomize remote units though?

its a little niche thing, its a faction made especially for small unit COOP with efficient unit spawning. Made a faction based on a large amount of items from a mod, the result is actually really satisfying 😄 here is a picture. A custom function called from the unit init, with faction and role abreviation (For example "ftl" or "gl") looks up array data in the arma Config and selects weighted random items, and some other things based on parameters. Some fun things in there like chance for primary, secondary, launcher, vest, helmet, facewear too. And a couple "pass through" functions for more specific loadouts. It results in consistent roles but with random equipment and weapons from predefined pools 😄

#

the above you see 5 sets of all roles in the faction. As you see they have very nice degree of randomization, but AA launcher guy always has an AA launcher, MG always has an MG and so on

meager granite
#

What unit init? CfgVehicles config? Inits are global so each client is gonna run your randomization code

snow viper
#

These guys are all the same "Rifleman Light AT" role 😄

snow viper
#

What is the best way or place to call this script on the newly created unit? Is it not that?

hallow mortar
#

You can put a locality check in the function so it'll immediately exit on every client except the unit's owner

snow viper
#

something like that

meager granite
#

Or better call local

hallow mortar
#
if !(local _unit) exitWith{};```
snow viper
#

okay very nice, i will do that for sure

#

but i am not sure if this would address the issue with addMagazines not working in multiplayer, right?

hallow mortar
#

addMagazines does work in multiplayer

snow viper
#

The script works very well in local, ive tested it in every possible situation, the data fed to addMagazines is ALWAYS correct. setUnitLoadout works perfectly too, but then the step afterwards thats supposed to add the magazines does not seem to work only when hosted multiplayer

#

any idea why that might happen?

proven charm
#

are you running dedi?

snow viper
#

thats only when i discovered the problem. When "testing solo" in editor, hosting local server from the game, the scripts work flawless

#

So then i was excited to play with my buddies only to find out that the loadouts generated by the script had completely empty inventories. These commands seem to not do what they are supposed to, in multiplayer. Or at least in my situation

addMagazines, addItemToBackpack, addItemToVest, addItemToUniform

proven charm
#

yeah you must check the commands argument and effect to use them properly. some commands needs to be run on client while others on server

stable dune
#

addMagazines, addItemToBackpack, addItemToVest, addItemToUniform
All these have Global Args and Global Effect,
So those should work when you execute event like Sa-Mantra and NikkoTJ said

if !(local unit) exitWith {};
//do stuff

or

if (local unit) {
// do stuff
}
proven charm
#

must be some other commands then or the way the scripts are executed

snow viper
#

thanks guys, gonna try this now

#

just added if !(local _unit) exitWith {}; to the top of my script right below the parameters

#

_unit being the parameter that refers to the unit, it was already there

#

that should do it ?

proven charm
#

that wont do it because you are just denying the code to run. what you need is more of running the appropriate code for each player

snow viper
#

i have no idea what that means, sorry im very new to arma script

#

the only way i could find to do dynamic loadout stuff inside a faction was by calling a script from the init= field of the CfgVehicles entry for the unit

#

what is the better way to do it ?

#

also i just tried it, now it has the inventory but not the uniform etc 😄

#

basically exact reversal from my previous problem

proven charm
#

i mean your codes needs to be run at proper place

#

init maybe ok

hallow mortar
#

CfgVehicles init with a locality check is a correct way of doing it

#

I believe we've already established that other code in the same function is working correctly

scenic shard
#

Is there a way to hide remote controlled stuff, like UAVs etc from the terminal?

I would like to have 2 operators from the same side but they should only see specific UAVs from the list.

hallow mortar
# scenic shard Is there a way to hide remote controlled stuff, like UAVs etc from the terminal?...

There is https://community.bistudio.com/wiki/disableUAVConnectability.
Note that it is actually specific to the terminal, not to the unit, so if players have some way of getting new terminals, you need to monitor and update over time to stop them bypassing it.
There is also locking the UAV, but locking commands are global, so it's a huge hassle to make it work.
Other than that there's not really any good solution, unfortunately.

fair drum
hushed turtle
#

What If you want your object to reference something by default?

fair drum
#

I would probably pass that to the constructor

open marsh
#

hi guys im trying to make ai sniper, with m107, fire with 5 seconds breaks, between each shot, but unfortunately hes successively semi auto firing, what do i need?

fair drum
#

Pastebin if it's long, hard to view on phone without downloading the file.

open marsh
#

im trying to mimick .50 cal bolt action rifle behavior cuz i simply cant find any .50 cal bolt action rifle mod , for cup

fair drum
#

But I bet you didn't disable the correct AI stuff

open marsh
#

Here is the pastebin

open marsh
#

yeah im using that and doing sleep 5; but hes still firing very fast

proven charm
#

oh sorry i thought you wanted to get rid of auto fire. well maybe you can disable the AI that slows him down 🙂

open marsh
#

completely disable it?

fair drum
#

Yeah you are only disabling path. You need to disable targeting, autotarget, autocombat

#

Or any combination. Can't test atm

#

I saw they added fire weapon to the disable list in 2.18 as well

open marsh
#

hmm i added it and he still fires quick

#

// Configure AI behavior
_sniper disableAI "PATH";
_sniper disableAI "TARGET";
_sniper disableAI "AUTOTARGET";
_sniper disableAI "AUTOCOMBAT";
_sniper setCombatMode "RED";
_sniper setBehaviour "COMBAT";

fair drum
#

Try turning him to hold fire. You are already controlling when he shoots.

#

Can you log when you tell it to fire, vs when the AI is doing the firing?

scenic shard
hallow mortar
#

There is a SlotItemChanged EH

scenic shard
#

perfect! that should work then. thanks again 🙂

open marsh
open marsh
# fair drum Try turning him to hold fire. You are already controlling when he shoots.

Without dotarget he cant aim properly, with dotarget he fires successively, even when i have

    // Configure AI behavior
    _sniper disableAI "PATH";
    _sniper disableAI "TARGET";
    _sniper disableAI "AUTOTARGET";
    _sniper disableAI "AUTOCOMBAT";
    _sniper disableAI "FSM";
    _sniper disableAI "AIMINGERROR";
    _sniper disableAI "WEAPONAIM";
    _sniper disableAI "COVER";
    _sniper disableAI "SUPPRESSION";
    _sniper setCombatMode "RED";
    _sniper setBehaviour "COMBAT";```
granite sky
#

If you just want to block the guy from firing for 5 seconds then there's disableAI "FIREWEAPON" since 2.18

open marsh
#

okay and then i renable it

#

wow this worked!

#
            if (!isNull _currentTarget && alive _currentTarget) then {
                // Debug message
                if (VILLAGE_SNIPER_DEBUG) then {
                    systemChat format ["Sniper targeting %1 at %2m", name _currentTarget, round(_unit distance _currentTarget)];
                };
                
                // Aim at target
                _unit doTarget _currentTarget;
                _unit doWatch _currentTarget;
                
                // Wait a moment for aiming
                sleep 1;
                
                // Fire the weapon
                // _unit forceWeaponFire [primaryWeapon _unit, "Single"];
                _unit disableAI "FIREWEAPON";
                // Wait 5 seconds between shots
                sleep 5;
                _unit enableAI "FIREWEAPON";
                
                if (VILLAGE_SNIPER_DEBUG) then {
                    systemChat "Sniper ready for next shot";
                };
            } else {
                // No targets found, wait and try again
                if (VILLAGE_SNIPER_DEBUG) then {
                    systemChat "Sniper searching for targets...";
                };
                sleep 3;
            };
        };```
#

i need to make it more structured

#

and put it in eventhandler

granite sky
#

Oh, if you're using forceWeaponFire then blinding the guy might be better.

#

(disableAI "CHECKVISIBLE")

open marsh
#

i commented that out

#

now im using dotarget

granite sky
#

ok

open marsh
#

forceweaponfire is not aiming at target like dotarget

granite sky
#

Yeah, if you want him to actually shoot at people then the 5-second FIREWEAPON loop is good.

snow viper
#

can i not make a faction that works both locally and dedicated?

#

it has to be one or the other?

granite sky
#

Is this the isSwitchingWeapon problem?

snow viper
#

i didnt have my thinking hat on last night, the setUnitLoadout part of the script works perfectly fine, it's the adding of magazines and items in a different way after that which fails

snow viper
#

after the setUnitLoadout part of the script, two arrays are known with the extra inventory items and magazines that should be added to the unit, they are added with addMagazines and addItemToUniform/Vest/Backpack in a forEach

#

but that doesnt seem to work on dedicated server only

snow viper
granite sky
#

addMagazines works in general. I use it routinely in Antistasi.

#

We don't do anything in init handlers though.

#

If you have a replicable issue then boil it down until it's clear exactly what the problem is.

snow viper
# granite sky If you have a replicable issue then boil it down until it's clear exactly what t...

ill recap once more what my issue is, its fully consistent and replicable:

  • script is passed 3 parameters, the unit, the faction and side
  • script grabs data from config based on parameters and sets up a unitLoadout array
  • while doing that, the arrays _li_items and _li_magazines are filled with {"className". #} # being int amount
  • unitLoadout is set on the unit with setUnitLoadout
    ⚠️ all above steps work perfectly in both local and dedicated
  • items are added to available container space (addItemToUniform, addItemToVest, addItemToBackpack)
  • magazines are added with addMagazines
    ⚠️ these last two only work when hosted local, and not when dedicated
snow viper
#

here is how i implemented the suggestion in CfgVehicles, but its a single line

init = "if (local (_this select 0)) then 
{
  [_this select 0, ""bb_fac_kla_civarmed"", ""sl""] call BlaBer_fnc_setUnitLoadout;
};"
proven charm
#

shouldnt that be just this and not (_this select 0) ?

granite sky
proven charm
#

ah ok

granite sky
#

@snow viper The same addMagazines code works fine from the debug console though?

snow viper
#

this is just getting weirder, i just tested this on dedicated, and it now tells me that a private variable is not declare when it very much is

granite sky
#

usually means that you're setting that variable to a nil value.

snow viper
#

ive tested the script fully, everything is working

#

there is no bad data being passed

granite sky
#

Paste code, paste error.

snow viper
#

can sombody give tips how to fix it ?

stable dune
#

You are only passing unit in args to spawn,
Your _temploadout its not available in spawn because it's local variable.


[_unit,_tempLoadout] spawn {
    params ["_unit","_tempLoadout"];
    waitUntil {!isSwitchingWeapon _unit};
    _unit setUnitLoadout _tempLoadout;
};
idle violet
# snow viper apearantly my interpretation of this was wrong but i have no clue why, this is a...

I had this same problem with setUnitLoadout, I solved it by setting a time for verification, what happened to me was that fnc_stripGear was executing after fnc_loadGear, setting the loadout before cleaning

    waitUntil {
        sleep 0.25;
        alive player &&
        !isNull player &&
        !isNull (findDisplay 46) &&
        !(isSwitchingWeapon player)
    };

    diag_log "[loadGear] Aplicando setUnitLoadout...";
    player setUnitLoadout _loadout;

    // Aguarda confirmação de aplicação (ex: uniforme presente)
    waitUntil {
        sleep 0.25;
        uniform player != ""
    };```
snow viper
#

interesting @idle violet thanks for sharing

idle violet
snow viper
idle violet
snow viper
#

but yeah im back to the mystery

idle violet
snow viper
#

ill recap once more what my issue is, its fully consistent and replicable:

  • script is passed 3 parameters, the unit, the faction and side
  • script grabs data from config based on parameters and sets up a unitLoadout array
  • while doing that, the arrays _li_items and _li_magazines are filled with {"className". #} # being int amount
  • unitLoadout is set on the unit with setUnitLoadout
    ⚠️ all above steps work perfectly in both local and dedicated
  • items are added to available container space (addItemToUniform, addItemToVest, addItemToBackpack)
  • magazines are added with addMagazines
    ⚠️ these last two only work when hosted local, and not when dedicated

so then i got this suggestion, and it just results in nothing happening at all at least when hosting local, about to test on dedi now. here is how i implemented the suggestion in CfgVehicles, but its a single line

init = "if (local (_this select 0)) then 
{
  [_this select 0, ""bb_fac_kla_civarmed"", ""sl""] call BlaBer_fnc_setUnitLoadout;
};"

No change in result from the list above

then i got this suggestion, but implemented it wrongly

_unit spawn
{
    waitUntil {!isSwitchingWeapon _this};
    _this setUnitLoadout _tempLoadout;
};

this resulted in the magazines, grenades and items being added but NOT the setUnitLoadout command being set. I added pics of the last two situations below here

https://cdn.discordapp.com/attachments/1386753415144800298/1386760589329694842/image.png?ex=685ae0f1&is=68598f71&hm=758c6e482fe01acfd532aa4ab80ccce9e125274937e8f4eee06cac1def635457&

https://cdn.discordapp.com/attachments/105462984087728128/1386753150123511930/image.png?ex=685ada03&is=68598883&hm=ef869c75126bea1ab1afc57d9851173bd7d0d89b51f0a073950c3fec451bb103&

#

and just to prove the script actually works here is the expected result from local

stable dune
#

You have script to share pastebin or here

snow viper
#

i'll send it to you in DM

#

ah you don't take DM's prisoner, could you send me one first?

hallow mortar
#

Pastebin and post it here would be better, that way everyone can see it

fair drum
#

Nothing you're going to post in the dm is going to be some new "revelation" of code. Just post it here lol.

proven charm
#

that way we can all laugh if the code is bad 😉 jk

hushed turtle
#

Looks like there is no way to change buildings destroyed state in SQF. Besides settings damage to 1, which switches state to most destroyed model, but no way to get partially destroyed ones without hitting it by something.

#

Or is there a way?

hushed turtle
#

No, buldings switch model when you damage them enough. They usually have couple of different models(like missing parts of walls)

#

Before switching to most destroyed model

hallow mortar
#

Try setHit or setHitPointDamage

#

There is an Editor module that can do this, and that will be doing it through SQF somehow. You should be able to find the function that module uses and see how it's done.

hushed turtle
#

There is module, that's true

fair drum
#

The module is wonky, especially for modded maps. Haven't taken the time to redo it/fix it. But go ahead and try it.

hallow mortar
#

The module uses setHitPointDamage

#

It's hardcoded to a couple of specific hitpoint names, which is why it doesn't work with all buildings. If the building has a more complex damage model...or is just set up inconsistently...the module won't work or won't be able to access all the damage states. But since you're doing your own thing, you can target whatever hitpoints work for your buildings.

hushed turtle
#

How did you find out it which command it uses?

hallow mortar
#

Inspect module in Config Viewer -> function attribute -> open Functions Viewer -> search for that name -> scroll through the function until you find the part that sets damage

hushed turtle
#

Had no idea you can inspect modules like that, thanks praise_the_sun

pallid palm
#

lol @proven charm hahahahah, that was funny

tropic summit
#

Is there a way to calculate the PositionRelative of an object from another object's model center? trying to update BIS_fnc_attachToRelative to work with the newer followBoneRotation param but having trouble finding out how to find the proper array to pass. Alternatively, is there a way to just completely omit a parameter of a command?

#

lol asked the question then immediately found the answer

#

attachedObj attachTo [baseObj, (baseObj worldToModel (getpos attachedObj))];

granite sky
#

getPos isn't correct for worldToModel (or anything much, really)

#

baseObj worldToModel ASLtoAGL getPosASL attachedObj would be correct.

#

Unless water is involved then getPosATL will return the same thing.

#

If you can guarantee that attachedObj is standing on terrain then getPos and getPosATL should return the same thing, but then getPosATL is much faster.

tropic summit
#

yeah i was just trying to get anything that would return even vaguely close to start

#

my issue now is finding a way to calculate the relative position of the base object to a specific memory point on the model

#

I assume I'll need to use selectionPosition

granite sky
#

The base object's model or the other one?

tropic summit
#

the base object

#

the idea is basically to rewrite the fnc so you could use it to say attach an object to a vehicle's turret and have it move and rotate with that bone while still being able to use 3den to manipulate the object and not have to sit there and figure out the right offsets by hand

granite sky
#

I would have thought you could shortcut that with the memPoint parameter of attachTo.

#

but yeah, otherwise selectionPosition.

tropic summit
#

yeah the hold up I'm having is figuring out how to calculate the attached object's position relative to the selectionPosition

granite sky
#

It doesn't just do it automatically if you specify mempoint?

#

The offset is applied to the object center unless a memory point is provided, in which case the offset will be applied to the memory point position.

#

Oh I see, you want it to keep its current relative position.

tropic summit
#

the issue is going back to trying to make it work like the attachtorelative function

#

yeah

granite sky
#

yeah in that case just do a vector subtract with the selection position.

#

(after doing the worldToModel, and then both values are in model space)

#

vectorDiff

#

But if it's already rotated then I'm not sure what's going to happen.

tropic summit
#

i have a diff solution for that part that should work

#

something like this? (baseObj worldToModel ATLtoAGL getPosASL attachedObj) vectorDiff (baseObj selectionPosition ["otochlaven", "Memory"])

granite sky
#

ASLtoAGL not ATLtoAGL

#

but yeah, I think that's correct for non-rotating at least.

tropic summit
#

works like a charm thx

digital hollow
tropic summit
#

always someone man 💀

#

i shouldve known lol

glossy aspen
#

Im trying to make a patch for Pook's Arty where the VFX on launch of the SCUD and the Iskander are like those of the FIR Cruise Missile , ive tried a lot of things but couldnt get them to work , ended up breaking the mod several times with patches , does anybody know the general way to get this to work ?

cobalt path
#

Hey, I am trying to remove a main rotor from a helo. Like they do when they hit a building. I just want a helo to spawn without a rotor.
So far I tried

_this setHitPointDamage ["hithrotor", 1];

It did damage the rotor, but its still there.
I am testing this on a Standard GhostHawk btw

digital hollow
#

I don't think you can by script. Create it far away, engine on, next to a VR block. Then when the rotor is destroyed, move it to where you want it.

cobalt path
digital hollow
#

Not all of the game engine is exposed to script or modding.
Another way is simple object if it just needs to be visual.

hallow mortar
cobalt path
#

Thanks I will try

#

yup

_this setHitPointDamage ["hithrotor", 1.0, false, objNull, objNull, true];```
and its beautiful
kindred zephyr
#

hello folks, quick question.

Are units spawned by a Zeus local to the zeus machine or to the server?

hallow mortar
#

By default they're local to the Zeus that placed them. However, they can be transferred; if the Zeus player disconnects, for example, or if a script force transfers them (e.g. headless client systems).

kindred zephyr
#

ty!

peak delta
#

call {SL sidechat ''Arriving in a couple! I'll pick you guys up and bug out!''};

#

it still says missing }

#

what?

#

what is wrong with this line of code

proven charm
hallow mortar
peak delta
#

it still says missing ]

hallow mortar
hallow mortar
peak delta
#

when i put } its missing }, if i change it to ] its missing ]

#

both sides i put the [ ]

#

im using the trigger system block

hallow mortar
#

Within the context of this line only, { } are correct (if unnecessary since call { } is not needed). Using [ ] would be wrong.
In SQF, {} are used to denote Code data type. [] are used to denote Array data type. They cannot be interchanged.

peak delta
#

okay i will do it without

hallow mortar
peak delta
#

the trigger flag

#

trigger, you know the blue flag

#

in the description thats where i put this code in

#

if that helps

#

ok so i removed the {}, now its says missing;

#

crazy work

hallow mortar
#

It probably doesn't matter for the purposes of this error, but triggers have several code fields in their attributes, and none of them are "description".
Is this the only code in...whichever code field you put this in?

winter rose
#

provide all your code?

hallow mortar
peak delta
#

now its

#

call SL sidechat ''____________________'';

#

oh

#

i missed your last message

#

ok

#

stil missing;

proven charm
#

SL defined?

peak delta
#

oh let me check if i did

#

its headquarters entity

#

i named it in variable names ''SL''

fair drum
#

At this point, just take a screenshot of your trigger and headquarters module

hallow mortar
#

Is the error happening when you exit the trigger attributes in the Editor, or when the trigger activates in the mission?

#

If it's the first one, then it's unlikely to be an undefined variable, as I don't believe the in-Editor syntax test actually checks for undefined variables.

peak delta
#

its when i press ok, i cannot press ok it wont save

winter rose
#

you are using '', not "

peak delta
#

wtf

#

its '' here

#

guess in arma not

winter rose
#

'' != "

#

'' != "

hallow mortar
#

Your alleged " is actually just two ' next to each other

peak delta
#

how do you chagne this

#

when i press the same buttons for ''

#

it changes in arma

winter rose
#

copy-paste "

peak delta
#

oh you can copy paste

#

well thank you all

#

aneurysm simulator 2025

hallow mortar
fair drum
#

Screenshot wins as usual

peak delta
#

yea youre right

#

my god 3 people for this

#

this gonna be a whole ride

hallow mortar
#

If you're pressing the " key on your keyboard and it's outputting two ', you have a problem with your system. It's not supposed to work like that.

peak delta
#

its not outputting in 2 seperate here

proven charm
#

i have " at number 2 key

peak delta
#

its just arma being a psycho bitch

hallow mortar
peak delta
#

alright]

winter rose
#

(…at least here 😄)

peak delta
#

the fault is my own doing

broken pivot
#

Hey people 😄
Did someone implemented a custom sound and can say me
why my Arma say "Member already defined" with following
input in description.ext:

//Benutzerdefinerte Geräuscheffekte
class CfGSounds
{
    sounds[] = {}; // OFP required it filled, now it can be empty or absent depending on the game's version

    class test
    {
        sound[] = { "EBER\Funktionen\Sirene\KrankenwagenSirene1.ogg", 1, 1, 100 };    // file, volume, pitch, maxDistance
    forceTitles = 0;            // Arma 3 - display titles even if global show titles option is off (1) or not (0)
    };
};
stable dune
#

class test,
Change that to eber_test
I bet some where , someone, something is defined in cfgSounds class test (which is not good define for unique class)

thorny osprey
#

Ideally, I would like the player to say/radio the messages defined in the RadioProtocolENG (GRE, CHI, etc)

broken pivot
#

Got the problem together with a friend. Its a already defined and included CfgSounds in another file

thorny osprey
lethal fern
#

hey guys how is everyone today, im very new to this scripting stuff on arma 3 and wanted to make a ww2 bomber mission where a group of bombers fly to target position and release the bombs (ofc ai controlled) is there a script or a mod for that sort of stuff??

weary ice
#

I suspect I already know the answer to this, but is there not a way of reading/writing to a txt file without an additional mod or extension or using SQL for something like storing persistent player data?

granite sky
#

No, you need an extension to do any external writing.

weary ice
#

eww

sharp grotto
foggy stratus
#

[_unit,selectRandom ["CheeringE_3","CheeringE_2","EndangeredE_3"]] call JBOY_Speak; [player,"Halt"] call JBOY_Speak;

thin fox
#

that's really interesting

snow viper
#

does anyone know how to turn on building interior lights? specificly on CUP chernarus 2020 buildings?

thorny osprey
hallow mortar
pallid palm
#

i just put a fireplace under the building or in where the fireplace would go

#

looks cool a fire burning in the fireplace

#

i raise the firepit or fireplace up to fit right where the fire should go in the fire place of

#

the building, and the building hides the rocks that are around the fire pit and it looks cool

#

imho

proven charm
#

particle effects?

pallid palm
#

no no just the regular fireplace

rugged coral
# sharp grotto You could store "persistent player data" in the profileNamespace / missionProfil...

Haha I thought of this approach too. But it might be more efficient but it's handing is worse.
I can recommend creating a centralised DB reader/writer which can write/read DB Data.
Also I do highly recommend reading out non (only) player related at the server start and saving them in variables locally on the server so you don't spam too much requests.
For me there are currently (highly dependent on player count ofc) like 250-20k read requests a day and like up to 1-2 mil update requests due event based saving.
I did not ran in any DB Update issue yet but would also be interesting to have some other feedback about that 🙂

proven charm
#

@pallid palm huh ok

pallid palm
#

roger m8

#

the building hides the rocks that are around the fireplace and it looks cool

proven charm
#

havent noticed that my self

rugged coral
#

I guess he means the rocks of the fire place are in the building -> not visible anymore?

pallid palm
#

yeah if you raise the fireplace up to fit in the fireplace in the building the building hides the rocks around the fireplace

#

only on buildings that have a kinda fire place in them

proven charm
#

cool

pallid palm
#

yes i love it

#

and you can even turn the fire off if you want also

#

or on

#

because its a regular fireplace from the game

proven charm
#

ok

pallid palm
#

or firepit as it were

#

and the sound is there also no need to do anything else

rugged coral
# rugged coral Haha I thought of this approach too. But it might be more efficient but it's han...

Oh and ofc you can stack the update requests too if you have issues with too many at once (for me this wasn't necessary yet)
Also try avoiding multiple update requests for 1 single event.

But for simple settings or so you can also use the other approach. But when it comes to stuff like being able to edit data when not having direct access on the server you have to do it that way I guess or write other extensions on your own

proven charm
#

i guess thats good for survival players they can warm themselfs up 😉

pallid palm
#

lol yeah lol

#

plus its looks so cool from far off

#

it looks like people were getting ready to cook lol

#

it realy gives you the feeling that people are in that building

#

and the sound is there also

proven charm
#

ya eat too

pallid palm
#

yes

#

and at night woooweee look out lol

#

looks so cool

#

on that one 2 story building in Arma3, i use it all the time you know witch one i mean

proven charm
#

ive only noticed fireplaces in takistan tbh

hushed turtle
#

Is it possible to make interiors dark without making it dark everywhere?

pallid palm
#

i sometimes board up the windows and that helps some

hushed turtle
#

I just found it weird, that tunnels from SOG have normal light inside of them. Unless I switch time to night.

proven charm
#

set gamma to dark when inside building - probably a bad idea and undoable

pallid palm
#

i make SOG missions with vanilla no Mods needed

hushed turtle
#

What about AI? Their visibility seems to be affected by amount of light. So, wouldn't it be bad, if I just make it dark for players?

pallid palm
#

hmmmm

#

interesting

proven charm
#

little challenge is always good hmmyes

pallid palm
#

yeah thats right ai can't see in the dark

#

the other day i did a night mission with just flashlights and holy moly WOW

proven charm
pallid palm
hushed turtle
#

I think that's workaround at best. It might be better to change time of day when entering a tunnel and change it back when leaving. This would only make sense in singleplayer though, since weather and time is synchronized in multiplayer

pallid palm
#

yes agree

hushed turtle
#

And you can make nights really really dark in Arma. At the right time, when there is no moon. Nights are literally pitch black.

pallid palm
#

and you can also make nights really light in Arma 3 if you set the date for a full moon WooHoo

#

Bark at the Moon lol

hushed turtle
#

It needs a little more brightness using colour correction, if you want to have nights really bright

pallid palm
#

no no i just set the date to a date that has a Full Mood and wala its light at night

hushed turtle
#

In opened areas, it seems to be true. But in buildings or woods - not so much

pallid palm
#

well yeah true that

#

but thats the cool thing

warm hedge
hushed turtle
pallid palm
#

Awsome

pallid palm
proven charm
#

i hear ya

pallid palm
#

ok cool

#

i love the fact that my missions need no mods to play, and you only need vanilla, that way its all good for everyone to play, at any time

#

and you can have mods if you want also

winter rose
#

yep, same 😎

proven charm
#

i have like CBA loaded but I hope im not using any one its features or my mission wont work for people without CBA XD

pallid palm
#

yes agree

#

i wont put anything in my clean Arma 3

thin fox
pallid palm
#

the Guy that started CBA was a good friend of mine and i still don't use the CBA lol

#

it still amazes me that i hear of all the things going wrong with pepoles game, i never had 1 thing go wrong ever with Arma 3

#

maybe cuz i started way back in OFP

#

i would like to fix the distance of the holdAction in ArmA3

#

but i cant get it right yet

hushed turtle
#

Yes, Arma is perfect, without any problems at all and always has been

#

I've literally send you edited version of that function with lowered distance

pallid palm
#

yes Arma 3 is the best game in the World

hushed turtle
#

That's being said, it's weird you can't just change it using parameter

atomic niche
pallid palm
#

yeah im working on it

coral summit
#

how can I set a speed boost for aircrafts? they took off so slow in aircraft carrier and just fall into the water

atomic niche
atomic niche
coral summit
#

modded ones, and for ai

pallid palm
#

oh i see i got it woohoo thx man @atomic niche

#

hell yeahhhhhh Arma 3 woohoo

#
    "_this distance _target < 5",// Condition for the action to be shown
    "_caller distance _target < 5",    // Condition for the action to progress
hushed turtle
#

Ok, that's not bad

thin fox
thin fox
coral summit
#

yes

pallid palm
#

@thin fox oh really, what makes you think i don't have complex Scripts you might want to rethink that, and how would you even know what i do or how complex my stuff is, its kinda funny your just like me, i speak with out thinking sometimes too, and also i was not taking about you, or anything you said, or did, when i said that:

#

well i dont know about you but simple is way better then complex

thin fox
coral summit
#

yeah, and a cargo plane that paradrops people

thin fox
pallid palm
#

i mean like neat and clean

#

and good scripting

#

im not saying im a master mind but from all the help i got from the guys in discord make my missions Awsome

thin fox
coral summit
#

thanks!

atomic niche
coral summit
#

adding velocity, i tried the catapults one and they steer the plane like badly

thin fox
#

I use bis functions but I had to modify a thing or two to work on IA and some modded aircraft with bad launch config

coral summit
#

[herc] call BIS_fnc_AircraftCatapultLaunch;
[herc_1] call BIS_fnc_AircraftCatapultLaunch;
[a1] call BIS_fnc_AircraftCatapultLaunch;
[a2] call BIS_fnc_AircraftCatapultLaunch; I used this on the mission file sqf something

thin fox
coral summit
#

ohhh okay thanks for the info

winter rose
winter rose
atomic niche
idle violet
#

Reverted: setUnitLoadout will now abort if a unit is in the process of switching weapons (may be revisited in future) - FT-T167015
when I finally finish adjusting my mission, this update comeshmmyes

thin fox
atomic niche
dire star
#

How do i make waitUntil my unit is not in vehicle anymore? So once he exits vehicle other script runs

tulip ridge
thin fox
#

or "GetOutMan" EH

tough abyss
#

Question, looking to have a scroll wheel option for one object to have equipment such as weapons, explosives, etc then another object have the uniforms. Anyone have a script or way of doing that ?

thin fox
tough abyss
#

Like arsenal boxes

pallid palm
#

why not just use the Bis_arsenal box

#
this addAction ["<t color='#ff1111'>BIS Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal},"",1,false,true,"","(_target distance _this) < 5"];
thin fox
atomic niche
faint burrow
#

RydHQ_Excluded = RydHQ_Excluded - [_value];

warm hedge
proven charm
#

parseNumber is weird, this prints 1: ```
parsenumber "1abc";

granite sky
#

What would you expect it to do?

proven charm
#

fail

#

return zero

granite sky
#

yeah can't do that now, some code might depend on it :P

proven charm
#

lol must be weird code

granite sky
#

It's probably an old C library thing anyway. You give it a string pointer and it attempts to get as much number out of it as possible.

proven charm
#

right

granite sky
#

The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function.

proven charm
#

well i just have to do the error check my self then

#

wow all the way from there

granite sky
#

shrugs

#

I don't have their source but it'd be in character.

proven charm
#

now how to check if character is letter or digit?

hallow mortar
#

regex, at a guess

proven charm
#

oh man i hate regex 🙂

#

but good thing i dont have to do a loop when using regex

#

googled this sqf if(count (_text regexFind ["\D+"]) > 0) exitwith { 0 }; // Only digits allowed

proven charm
#

thx 🙂

thin fox
# proven charm googled this ```sqf if(count (_text regexFind ["\D+"]) > 0) exitwith { 0 }; // O...

I did something with parseNumber to only accept digits in one of my controls

(displayCtrl 3631400) ctrlAddEventHandler ["EditChanged",{
    params ["_control", "_newText"];

    // https://community.bohemia.net/wiki/Talk:parseNumber
    if (!((parseNumber _newText) == 0) && (count _newText == 6)) then {
        ctrlEnable [3631603, true]; // Enable Grid button
        (displayCtrl 3631603) ctrlSetToolTip "Select grid position";
    } else {
        ctrlEnable [3631603, false]; // Disable Grid button
    };
}];
proven charm
#

thx the regexFind seems to work fine

coral summit
#

thanks

fleet sand
thin fox
fleet sand
# thin fox I'm still editing stuff before putting there, not much familiar to github

IT gives you version control so you can rollback if need be and see the changes you or somebody else makes if your repository is open or if you let people in if its private.
Its easy to learn you just need some practice at first if its your firt time using it. I would recomend to download Github Desktop and just use that app if you are just starting with Github.

thin fox
fleet sand
thin fox
#

I mean I can save the files without push and commit

fleet sand
kindred zephyr
#

by any chance, does anyone know if the
https://community.bistudio.com/wiki/addCamShake
command acts on the display 46 of a player or if its bound to something else?

I'm having some issues with persistent screen shaking even after restarting the mission I'm testing and im wondering if im missing something here or if this is a plain ole´ bug. This is happening on a machine that is running the game "natively" in Proton, doesnt seem to happen on a pair of windows based machines I have tested with

minor timber
hallow mortar
#

That comment (and the code) doesn't mean the mod won't work on a dedicated server. It means that units which are local to the dedicated server or headless client won't benefit from the mod - unconscious collision will not be disabled for them.
This isn't a problem because the only units that are local to the DS/HC are AI, and AI pathfinding doesn't care about unconscious collisions anyway.

hallow mortar
#

Basically, the mod operates on the machine of the player who wants to walk over the body (let's call them Player A). The mod running on Player A's machine detects when any unit enters the ACE unconscious state, and disables that unit's collision - only on Player A's machine (the command is Local Effect). Player B, who is not running the mod, is unaffected; the unconscious person still has collision on Player B's machine.
Because the mod works like this, it doesn't need to run on a DS or HC. DS and HC machines, by definition, cannot have a player who might want to walk through unconscious people, so they don't need to disable collision.

blazing zodiac
#

Does anyone have a work around for flyInHeight not being ASL and being ATL? Need it for a UAV Loiter type waypoint and haven't been able to come up with anything to keep it steady. I wish we could get the VBS variant of flyInHeight that has the option for ASL in it.

minor timber
#

Thank you so much @hallow mortar , its important for trench warfare, when we were moving unconscious player from btr it happens also that vehicle got blasted off, or jumped into the air, can we hope this will be solved too ? I know, could be hard to tell. (We also have bmp2 jumping, when driver is leaving the vehicle, it can be prevented by opening hatch for some reason notlikemeow )

proven charm
#

i thought allPlayers was fixed to update the player list faster (in MP), but i guess it wasnt?

faint burrow
#

It was.

#

At least according to changelog.

proven charm
#

maybe its server only fix then because i just tested in dedi and client was slow to update it

dire star
#

I want to make crashed huey with dead crew in it, but everytime i place unit in huey which has disabled simulation it turns back on, anyone knows how do i do it, i remember it didnt happen before

pallid palm
#

@dire star so can you explane more about the mission on whats going on before the crashed huey

#

or do you just want to put a huey somewhere and then crash it or damage it or expload it,

#

@dire star don't disabled simulation, just put the huey somewhere with the crew in it and then expload it, then as long as you don't have a clean up script, or the CorpseRemoval on, the dead guys should still be there

pallid palm
#

in some cleanup scripts you can exclude named guys or dead guys, then you can have Corpse Removal on

dire star
pallid palm
#

oh i see hmmm i need to think about that one lol

dire star
#

In my Black Hawk Down mission i use same script and heli stays out of simulation once i unhide it that's why i dont understand why it's happening

pallid palm
#

hmmm yeah i see

#

maybe the crews not in the huey till your team gets to the huey

#

and maybe then the crew gets spawned is the huey when your team is at a distance from the huey

#

just a guess tho

hallow mortar
#

You could try attaching the helo rather than disabling its simulation

#

(Might also need to disable damage on it to stop it exploding from being clipped into the ground, I don't remember exactly how attached objects respond to that)

dire star
hallow mortar
#

As long as whatever it's attached to doesn't bounce or move around

versed widget
#

has anyone figure out how to use playSound3D on moving objects ?

hallow mortar
#

You can't. (Well, you can but the sound won't follow the object.) If you want a moving sound, you need say3D or createSoundSource.

versed widget
#

I think createSoundSource should do it, thanks

proven charm
#

can you make the Diary Record have clickable link that opens webpage? I found ctrlSetURL from the wiki but that probably cant be used

proven charm
#

thx

hallow mortar
proven charm
#

hmm however this does not create link ```sqf
_index = player createDiarySubject ["testEntry","TEST"];

player createDiaryRecord ["testEntry", ["Info", "<a href='http://arma3.com'>Arma 3</a>"]];

hallow mortar
#

The documentation says the links aren't marked in any way, they just look like plain text. Have you tried clicking on it?

proven charm
#

yes

#

wait ill try to whitelist it

#

doesnt seem to work

#

RscStructuredText works

hallow mortar
#

I guess briefing doesn't support all the structured text tags

#

Weird, I thought I'd seen URLs in briefings before

proven charm
#

you can have clickable links there but they only execute code

edgy salmon
#

How does the object Transfer Switch work (the one from the Contact dlc). How do i make it so on hold button it sets the switch to the up or down position? I'm trying to make a mission where players have to use it to "switch on" a radio antenna but can't find anything regarding scripting this

hallow mortar
#

It's just animations

#

You can inspect the object in the Config Viewer to see what animations it has

edgy salmon
#

Ok i'll check it out, thank you

tough abyss
#

I think I broke it.

[isServer,clientOwner,owner player]
[true,5,2]
terse tinsel
#

I need your help. Is there a script that will lower the NVG onto the eyes but keep the view normal? (like without any googles?)

ocean folio
#

I'm curious if anyone has come up with a way to automate AI "hunting" players if they do something like crash land, eject, or get spotted?

hushed turtle
#

I would give AI squad a "MOVE" waypoint to the crashed aircraft

ocean folio
#

Well... I mean yes ultimately, but I'd like to detect that automatically and spawn or task a group to searching. It might just be something I have to write myself, just figured I'd see if anyone has already done it first

hushed turtle
#

You could use GetOut or GetOutMan EH to detect when player exited his vehicle

cyan dust
#

Does anyone else use doMove command in their mission? Did you notice that it is being ignored on dedicated server with the last update? 🤔
All my scripts that are using it suddenly do not work anymore and I'm looking into reasons and ways to fix this.

thin fox
sharp grotto
deft zealot
#

whats clientOwner?

rich bramble
#

I'm guessing I'm not the first one to realize this but I just tested it and was surpised just how well it works (apart from the ugly syntax): app = {_x = (_this select 1); call (_this select 0);};
Any guesses what that does/what it's for?

tough abyss
#

^ no idea

#

whats clientOwner
returns the clients owner id. It breaks in resumed MP games apparently.

rich bramble
#

It's the basis for lambdas in SQF. Well, really, really ugly lambdas, and I'm not even sure if you can get full lambda out of it

#

(\x -> x 5) (\x -> x + 4) turns into [{[_x,5] call app},{_x + 4}] call app;

#

Surprisingly (well, not really, once you think about it) you can even get the result back out: _result = [{[_x,5] call app},{_x + 4}] call app; will in fact return 9

tough abyss
#

uhm

rich bramble
#

I'm not quite sure how far (nesting) this actually works, though. Would have to be way more awake for that

tough abyss
#

What's it for? It looks beautiful.

rich bramble
#

In SQF it's just a toy. In theoretical computer science, Lambda Calculus is a super important theory of computation. It's also the basis/inspiration for so called "functional programming"

#

Some other non-functional (i.e. more mainstream/standard) languages also have "lambda function" support since it allows you to quickly write down a function without worrying about a name, variable names, etc. You just go func foo = \x -> x * cos(x) * 2 + 17*x; which is something we already do all the time in SQF.

kindred zephyr
rich bramble
#

Actually, I'm an idiot. "app" isn't even necessary, just use _this instead of _x and "call" will do exactly what we need.

#

I'm going to blame this on it being the middle of the night 😛

ocean folio
#

iiiiinteresting

#

Stalk looks just like lambs stalk just with more precision on how it works, I'll definitely be using that.

#

I think the hard part is figuring out when to do it, since gameplay wise it wouldn't be all that fun if you started getting hunted on a normal dismount

#

its a little wonky but I guess I could do something like use a trigger in the relevant area to add a LandedTouchedDown EH to the aircraft and write some spawning logic in there

Could possibly use knowsAbout to determine if their position was known when they touched down- hmmm that might be the answer

hushed turtle
# sharp grotto Also nice https://community.bistudio.com/wiki/BIS_fnc_stalk

Only thing I don't like about it is parameter radius. Because this number gets passed into addWaypoint's radius parameter, which is in my opinion very strange, since it creates waypoint, which seems to usually be placed close to the center of the radius. Rather than having even chance of being placed close or far from radius center.

You might not mind this, but think it's worth pointing out. It took me some time to figure this out.

ocean folio
#

That is good to know, I'll have to experiment with that to see if will cause problems

granite sky
hushed turtle
tribal crane
ocean folio
#

yup thats what I'm thinking, if knowsAbout` is high enough and it lands. I dont know how that would account for ejecting and parachuting from a plane but at least for helicopters it should (hopefully) work

real tartan
#

does anybody have a code snippet for selecting only roof positions of building ?

fair drum
real tartan
hushed turtle
real tartan
fair drum
rich bramble
#

@tribal crane: Yeah, that's the article that actually gave me the idea for this. But I'm still not sure if you can actually get full lambda calculus out of it, at least "neatly"

ocean folio
fleet sand
#

Quick question how do i get animation Duration. The lenght of animation ?

#

There is this Duration in Animation Viewer but i dont know how they got that duration ?

hallow mortar
#

I believe the Animation Viewer list is built from config, and the animation's duration is defined in its config

#

CfgMovesMaleSdr or CfgGesturesMale would be the places to look

hallow mortar
#

For State type animations it's determined by dividing 1 by the animation's config speed value

#

I can't figure out how it's determined for Action type animations

#

Okay no, I misunderstood. Animations in CfgMovesMaleSdr >> Actions is not a distinct category from CfgMovesMaleSdr >> States. "Actions" entries have corresponding "States" entries, and that's where the speed property lives for all of them. For all animations, duration is determined by abs (1 / _speed).

fleet sand
# hallow mortar Okay no, I misunderstood. Animations in `CfgMovesMaleSdr >> Actions` is not a di...

I dont think that is correct formula becouse i got this:

/*
-anim name: "Acts_Abuse_Lacey"
-anim length: 26.206
*/

TAG_fnc_getAnimDuration = {
    params ["_animName"];
    private _animSpeed = getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> _animName >> "speed");
    private _r = abs(1/_animSpeed);
    _r
    
};

private _test = ["Acts_Abuse_Lacey"] call TAG_fnc_getAnimDuration;

//resoult: 86.2069
systemChat format ["%1", _test];
hallow mortar
#

BIS_fnc_animViewer, line 516:

_cfgAnim = configfile >> BIS_fnc_animViewer_moves >> "States" >> _anim;
_file = gettext (_cfgAnim >> "file");
_speed = getnumber (_cfgAnim >> "speed");
_duration = if (_speed != 0) then {abs (1 / _speed)} else {0};
BIS_fnc_animViewer_animData = [_anim,_file,_duration,time];

_duration value is then passed to BIS_fnc_secondsToString to generate the displayed duration

#

The actual Acts_Abuse_Lacey animation clearly plays for substantially longer than 26 seconds, so clearly there's some error being introduced somewhere

fleet sand
hallow mortar
#

You'd have to check by timing it properly, but I suspect that the basic formula is correct, Acts_Abuse_Lacey is actually about 86 seconds long, and BIS_fnc_animViewer is screwed up somehow. I can't find where it's screwed up though, so 🤷

hallow mortar
#

I mean it can't hurt, unless a ticket already exists. But the BI anims viewer has been terrible for ages, I avoid it as much as possible

pallid palm
#

@real tartan yes look for the SHK_buildingpos.sqf

#

the script has full instructions on how to use it in the script

grim cipher
#

im trying to set up objectives to where the players need to kill all of the enemies, so I'm using "!alive infantry1" as the group's variable, this is giving me an error though. is there a way to go about it for the group as a whole without me having to name each individual soldier?

#

could i use something like this?

{alive _x} count units infantry1 == 0

stable dune
warm hedge
marble plume
#

I am looking for a way to multiply the base amount of ammo in turrets across an entire vehicle, ideally by something simple in the object init. I've tried a couple (e.g. setVehicleAmmo) and have had no success.
Anyone know a way?

warm hedge
#

"Multiply" as having more magazine or having more magazine capacity?

proven charm
#

can you set dialog above the chat messages?

cosmic lichen
proven charm
#

thats the next question 🙂

cosmic lichen
#

By creating a dialog over it

proven charm
#

hmmmm i am creating dialog

#

via createDialog

cosmic lichen
#

Yeah, I see now. The chat window is always on top.

proven charm
#

ya

proven charm
#

could it be possible to hide the chat temporarily? Im trying to find in which dialog the chat is , probably in some overlay (i found "RscDisplayChat" but havent been able to figure the right display/control) (NVM thats not the right display)

sly eagle
#

Hello everyone, I am looking for something, that can change cargo parachute opening height.

proven charm
#

do cargo objects have a parachute by default? 🤔

sly eagle
proven charm
#

yea i get you, was just thinking if thats vanilla arma behaviour or some mod

sly eagle
#

Vanilla. Added in APEX if I remember correctly

proven charm
#

dont know then

harsh bloom
#

I dont know much about coding but im trying my best to learn through the editor.
Im trying to do getPosATL and getDir on a Sign_Arrow_Direction_Blue_F but it always comes back as the words "[array,scalar]" with no actual data inside. Why is this?

proven charm
#

pls show your code

harsh bloom
#
Team1_Armr = []; ; Team1_Armr = [getPosALT _this, getDir _this];
#

And im putting it on the prop itselt

proven charm
#

in the init field?

harsh bloom
#

ye

#

Then im printing it in game and all it says is [array,scalar]

proven charm
#

i think you should use this without the _

harsh bloom
#

hmm

#

oh shit that works

#

but everything online said "_this"

proven charm
#

it depends where you put the code, init fields use this instead

harsh bloom
#

is there any other odd formatting like that for init fields i should know of?

proven charm
#

not sure , im not init fields expert 🙂

harsh bloom
#

pain

#

thank you so much

split ruin
#

I am using endeavourusOS (based on arch linux) to run arma 3 (very good performance btw) but I am lost to linux paths, for example the path to mpmissions folder. Any help from experienced linux user?

split ruin
#

search suggest
~/.local/share/bohemiainteractive/arma3
there is no folder bohemiainteractive at all...

proven charm
cobalt path
fleet sand
cobalt path
fleet sand
cobalt path
#

Also how would ace_interact_menu_fnc even be related to it?. Apparently it only happens with that mod. I assume that the code calls to create ACE self interaction multiple times instead of one, when closing the inventory, is my theory

errant iron
#

have you tried adding just one action when the player is first registered, and using a condition to check if they have the right headgear/goggles to display the actions?

#

For a mod, I think you'd want to use some event handler that fires whenever the player is updated (PlayerViewChanged? CBA player events? don't ask me 🙃), so you can add the action exactly once. The vanilla/ACE conditions are sort of close enough that you can reuse them in one code block too: ```sqf
private _condition = {
params ["_target"];
headgear _target in VTO_tacvis_devices
or goggles _target in VTO_tacvis_devices
};

if (isClass (configFile >> "CfgPatches" >> "ace_interact_menu")) then {
private _parent = ["TacVis", "TacVis", "", {}, _condition] call ace_interact_menu_fnc_createAction;
// ...
} else {
player addAction [
"TacVis",
// ...
toString _condition
];
};```

errant iron
#

Figured I'd try asking myself, any info on what might cause a lobby slot to break indefinitely in this manner? It's been a very frequent issue in I&A to this day, and I have no idea what triggers it.

I couldn't reproduce this in my own gamemode, at least not with light traffic, so I don't know if it's caused by a script issue or if it can occur in any JIP scenario naturally.

silent cargo
#

Is there a sure fire method of monitoring units and detecting a group change?

#

Im trying to prevent AI from being left behind in their own groups when a player leaves the group and only AI are left behind. But If I use the unitleft group event handler on the group to check for and delete the units of a group if there is no player presently in that group - It works a few times but eventually it crashes the game for some reason.

I do not want to have to add a loop to the mission and would rather it be handled by event handler

hushed turtle
#

What about UnitJoined EH?

silent cargo
#

I need to capture when the player leaves a group, because only AI will be left behind. If I used join it would only check the new group which a player has just joined

#

Sadly there are no groupchanged events to capture for units

#

If I am adding an event handler to a group how exactly does that work? Is the event handler being applied to all units of a group, and then stays with them when they leave the group, or is it only while they are presently still in the group it was applied to?

hushed turtle
#

Unit must be in a group. Meaning if it leaves it must join other one. So no real need for groupChanged EH

silent cargo
#

Yes I meant a groupchange detection applied to only a single unit instead of entire group

#

Because when a player leaves a group, creates a new group, the event handler is gone.

faint burrow
#

But If I use the unitleft group event handler on the group to check for and delete the units of a group if there is no player presently in that group - It works a few times but eventually it crashes the game for some reason.
Send your code.

silent cargo
#

It will work flawlessly but then in some random instances it causes a crash for the person leaving the group

tulip ridge
#

You can do deleteVehicle units _group

#

May need parentheses, I forget

silent cargo
#

I will try that and a few other things. Does locality change for the AI if the original owner leaves the group and they are left behind with another player?

silent cargo
#

Ok I will try that. The crash only happened frequently in MP too, almost never happened when I was testing in editor

faint burrow
#

I guess the reason of crashes is that you are doing group manipulations in the handler itself. Using spawn may help.

silent cargo
#

Okay so spawn for each unit of the group

#

I should also mention I am using the BIS Dynamic Groups feature. I do not know how stable this is

#

If in fact the crash is simply just from this system

granite sky
faint burrow
granite sky
#

In event handler code you need to be a bit careful about triggering other event handlers.

faint burrow
silent cargo
granite sky
#

That code probably shouldn't crash. It's not like it's gonna run out of stack like something horrible we did once.

#

but it's certainly a possibility

silent cargo
#

Yeah its Arma anything is possible but I also have half a clue of the depth of knowledge most of you have so I will try a couple of these suggestions

#

Also the person who crashes was almost always the other player joins existing group and then left

granite sky
#

If you have any repeatable crashes then it's worth sending the .mdmp to Dedmen.

silent cargo
#

Im going to test some new versions now

#

Thanks for the help

gloomy lily
#

is it possible to force players and all their models (clothing, armor, equipment, face) to only use a specific LOD at all times?

#

i noticed selectionNames can be used to force an LOD for one model from dedmen's example

snow viper
#

i then went back to my actual dedicated server machine to test with that again

chrome echo
#

Anyone know a best bodycam or helmet cam mod

snow viper
#

there the items and magazines are missing again

fair drum
#

are you doing any logging?

snow viper
#

i have, if you look in the original post im refering to, this is all working 100% in thorough testing, except in dedicated those addMagazines and addItems fail. Or well, in the dedicated server on my own machine it does not fail. I just have no clue anymore about any of this. Arma scripting is like a haunted house

tulip ridge
fair drum
# snow viper i have, if you look in the original post im refering to, this is all working 100...

| except in dedicated those addMagazines and addItems fail
| Or well, in the dedicated server on my own machine it does not fail

these statements contradict each other. did you mean its failing on dedicated and is fine on listen server? Or did you mean fails on a dedicated server box from a service but is fine on your own dedicated box

if I was in your position right now, you know that the top part works and you start failing at handling items. I would start my logging to see if _lo_items and _lo_magazines is populated and correct wherever this unit is local. Additionally, I would log each iteration over those arrays to verify. These commands can silently fail, and give you no information, so you have to make your own information

#
// Handle Items 
private _lo_Items= [["FirstAidKit", 1]];
_lo_Items append (getArray ( configFile >> "CfgLoadoutsBlaBer" >> _unitFac >> "loadoutRoles" >> _unitRole >> "items" ));

+diag_log "_lo_Items::Immediately After Config Lookup";
+{
+    diag_log format["_lo_Items:: %1 | %2", _x#0, _x#1];
+} forEach _lo_Items;
{
    private _itemClass = _x # 0;
    private _itemCount = _x # 1;

    for "_i" from 1 to _itemCount do {
        if (!isNull uniformContainer _unit && _unit canAddItemToUniform _itemClass) then {
            _unit addItemToUniform _itemClass;
        } else {
            if (!isNull vestContainer _unit && _unit canAddItemToVest _itemClass) then {
                _unit addItemToVest _itemClass;
            } else {
                if (!isNull backpackContainer _unit && _unit canAddItemToBackpack _itemClass) then {
            _unit addItemToBackpack _itemClass
                };
            };
        };
    };
} forEach _lo_items;

// Handle magazines
+diag_log "_li_magazines::Immediate Before Adding";
+{
+    diag_log format["_li_magazines:: %1 | %2", _x#0, _x#1];
+} forEach _li_magazines;
{ _unit addMagazines [_x#0, _x#1]; } forEach _li_magazines;
snow viper
snow viper
#

this is what ✅ looks like

snow viper
#

Something another person suggested which i feel may be true, is that , setUnitLoadout takes place after the adding of magazines and therefore empties the inventory? Then again would the radio be there in that case? (its automaticly added by ACRE)

thin fox
snow viper
#

OOoOooOOOOoooo

#

i just hit update on FASTER server manager

#

and it downloaded stuff

#

i am hoping that was the hotfix

#

i think release was 25th? i dont think ive had time to look at this since, i am hoping this is why my local machine dedicated server (just updated) is working, and my game server (last updated before 25th) does not work

#

the script i mean

thin fox
errant iron
#

didn't the hotfix only revert the change where setUnitLoadout would be cancelled if the unit was in the middle of switching weapons?

thin fox
#

well yeah, but keeping the server updated also helps haha

snow viper
#

q_q nope that wasnt it

snow viper
errant iron
#

hmm, is the function executed on the server or on your client?

snow viper
#

should be on the server, recently i was given this suggestion

init = "if (local (_this select 0)) then {[_this select 0, ""bb_fac_kla_militia"", ""lmg""] call BlaBer_fnc_setUnitLoadout;};";

in cfgVehicles

#

so that is

if (local (_this select 0)) then {[_this select 0, "bb_fac_kla_militia", "lmg"] call BlaBer_fnc_setUnitLoadout;};

errant iron
snow viper
#

it seems to be related to the fact that the script runs on init

#

i cant reproduce the issue in any other way than looking at a freshly inited unit, calling the function or running the function code in console always works no matter the server

errant iron
#

which button did you click to execute it, just Local Exec?

errant iron
#

can you try a different loadout but remoteExec it on the server? e.g. sqf [player, "...", "..."] remoteExec ["BlaBer_fnc_setUnitLoadout", 2];

#

does that reproduce the issue, or does it still work as intended?

snow viper
#

will do, sec

#

yeah that reproduces it

snow viper
errant iron
#

hmm, that suggests to me that locality is the issue there, but given that the item commands are supposed to work on remote units, it may be a race condition that only exhibits itself if there's enough latency for setUnitLoadout and addMagazines to run out of order

errant iron
snow viper
#

do you mean spawn the entire function?

errant iron
#

around where you first define _lo_Items should be fine to put that sleep in

#

that, plus the sleep

snow viper
#

OK

#

ill have to look up documentation on the wiki how to do that

#

do you have a link maybe?

errant iron
#

just replacing call with spawn should be fine for this test

snow viper
#

oh huh interesting

#

forgot to add in the sleep lol so i had to go and redo the whole thingy again, will be back soon

#

thanks for your help btw @errant iron this is more new insight than ive had for days

#

i think thats it

#

i was confused because i got wrong magazines in one of the loadouts, checking now if thats due to my own error or because of somethign odd happening with the data

snow viper
errant iron
#

if that sleep resolved it, then it's almost certainly a locality + network latency issue

snow viper
#

yeah this is odd

#

on mission init, the loadout consistently has the wrong magazines

#

its like the script is running twice now

#

once to do setUnitLoadout, once to add the items and mags

snow viper
errant iron
errant iron
#

iirc init fields execute on every connected machine, so that'd be your client + the server

snow viper
#
class bb_fac_kla_militia_rat : bb_fac_kla_ai_template
{
    faction="bb_fac_kla_militia";
    editorSubcategory = "EdSubcat_Personnel";
    scopeCurator = 2;
    scope = 2;
    side = 1;
    displayName = "Rifleman (Light AT)";
    class EventHandlers {
        init = "if (local (_this select 0)) then {[_this select 0, ""bb_fac_kla_militia"", ""rat""] spawn BlaBer_fnc_setUnitLoadout;};";
    };
};
errant iron
#

oh, you do have the local check though

snow viper
#

hold on, sombody said something the other day that might be relevant

#

admittedly i cant really comprehend this but maybe you can

errant iron
#

lol, that's the theory i was agreeing with

#

However this won't work as intended because the setMagazines etc chunk will likely run before the setUnitLoadout.

snow viper
#

is there any straight forward way to address this?

errant iron
#

hmm, instead of doing the if (local ... thing in init=, can you remove that and do the check inside the function instead? as in: ```sqf
// Your config:
init="[...] call BlaBla_fnc_setUnitLoadout;";

// fn_setUnitLoadout.sqf:
params ["_unit", ...];
if (!local _unit) exitWith {};

...```

#

you can remove the sleep too

snow viper
#

some here said that was ill advised

#

but honestly i dont know why that would be

#

i think because they said the function shouldnt be called at all unless by the server on the unit when it spawns

#

but im willing to try anything at this point

errant iron
#

the goal is to make sure the function never runs on a remote unit, because adding items to a unit that's simulated on a different computer introduces network latency that we're theorizing could cause your commands to run in the wrong order (i.e. addMagazines -> setUnitLoadout = wiped items)

errant iron
snow viper
#

the first thing that comes to mind is "because its arma"

snow viper
errant iron
#

if the local check is in the function then it probably shouldn't make a difference, but yeah call would be preferred there

snow viper
#

alright yeah i did switch it to call since i figured you would probably not put that by accident

#

still an empty inventory

errant iron
#

🥴 maybe the locality problem isn't the only issue then, cause it did work when it was spawned with the delay...

errant iron
snow viper
#

i opened up the .pbo on the server to make sure i actually properly built and uploaded the new file

#

and i did

#

so yeah the problems in the code still 🥴

errant iron
#

hmm, what about units spawned in after the mission started? do they get the wrong loadout too?

#

or is it just units that were initially placed in the editor?

snow viper
#

ah i dont know

#

i need to add the factions to zeus to check

errant iron
#

you can spawn in a unit with debug console too

#

here's one to spawn the unit on your client: sqf _pos = player getRelPos [5, 0]; _unit = group player createUnit ["bb_fac_kla_militia_rat", _pos, [], 0, "NONE"]; and another to spawn it on the server with remoteExec: ```sqf
_pos = player getRelPos [5, 0];
_grp = group player;
_args = ["bb_fac_kla_militia_rat", _pos, [], 0, "NONE"];

[_grp, _args] remoteExec ["createUnit", 2];```

snow viper
#

i did that just now

#

ahh cool

#

will try that too

snow viper
errant iron
#

very weird 🤔

snow viper
#

top command

#

bottom

#

(his launcher is also there, just landed away from his body)

#

had to shoot them to check their inv cause im not on the same team lol

#

if there is the racing thing going on, couldnt we just strongarm the problem by putting in that delay?

#

maybe 2 seconds or something before the mags and items are added?

#

these are supposed to be enemy AI anyway, no chance in hell that they would be seen so soon after spawn

errant iron
snow viper
snow viper
#

we get this log output even on the second command, that results in the empty inventory

#
_grp = group player; 
_args = ["bb_fac_kla_militia_rat", _pos, [], 0, "NONE"]; 
 
[_grp, _args] remoteExec ["createUnit", 2];```