#arma3_scripting

1 messages ยท Page 72 of 1

winter rose
#

yes and no
what do you want to achieve first ๐Ÿ˜‹

astral bone
#

2nd, this just feels wrong but I can't see any other way to do it xD

params["_points","_ratio"];
_valid_points = []
{
// ...if point can spawn a turret successfully, add to valid points... //
}forEach _points;
// ...Scrable array... //
_valid_points resize (round((count _valid_points)/_ratio));
{
// ...spawn turrets.. //
}forEach _valid_points;
winter rose
#

see selectRandom to get a random element, or BIS_fnc_arrayShuffle to shuffle an array

astral bone
#

Alright. Does the code I put look decent? Basically, going over the array twice seems wrong to me xD

shut flower
#

@jade abyss unfortunately I need some keybinds like F5 or F1, so sadly no option

jade abyss
#

Youre working with the the Eventhandler from Tonic?

south swan
#

_valid_points resize (round((count _valid_points)/_ratio)); does look very suspicious. What is it supposed to do? blobdoggoshruggoogly
Separate loops for filtering the input array and spawning stuff from intermediate array seems perfectly viable blobdoggoshruggoogly

shut flower
#

Removed it about 2 months ago

astral bone
jade abyss
#

eventhandler -> fire blablabla -> "true" when Var = true

shut flower
#

Wait, I can override fire action in fire evh?

tough abyss
#

Nope.

tough abyss
#

Thats what I posted.

#

Thats the only way to do it.

dreamy kestrel
jade abyss
#

Don't know where you posted it, but it wasn't here

shut flower
#

I forgot about setAmmo :D thanks :P

dreamy kestrel
sullen sigil
#

if (!isServer) exitWith {};

dreamy kestrel
jade abyss
#

Otherwise delete the bullet (wich is a messy way)

shut flower
#

But the weapon would still produce the shooting sound which would be a problem too

jade abyss
#

OR: Force the Weapon to the Back

shut flower
#

good Idea, will do it this way

jade abyss
#

Everytime he wants to take it back in hand -> action bla

astral bone
#

uh- how to convert to bool. Is there a thing already or

sullen sigil
#

convert what to bool

astral bone
#

anything x3

opal zephyr
#

Boolean is true or false, you cant just convert anything to it

sullen sigil
#

you need to make something return it

#

4 > 3 will return true

astral bone
#

ah so can't do soemthing to make 1 be true like other langs

sullen sigil
#

yes you can

astral bone
#

well

sullen sigil
#

_var isEqualTo 1

astral bone
#

1 true "true" -> true

sullen sigil
#

what

dreamy kestrel
south swan
#

i smell Javascript

astral bone
#

eh well

#

oh wait-

#

I uh- I meant to ask, is there a way to compare bool to non bool. As in "sdkakasdkg" == true -> false

sullen sigil
#

isEqualTo

astral bone
#

oh- right

#

am smort

dreamy kestrel
#

just wait until your bool is a nil ๐Ÿคฃ that one is always fun.

astral bone
#

oh I already got that :P

dreamy kestrel
#

๐Ÿ˜‰

astral bone
#
if(isNil "_isLow" || {!(_isLow isEqualTo true)})then{
  _isLow = false;
};```
So if nil or not true, set to false.
#

If it's already false, then eh, only being run at mission start so- shouldn't be TOO bad right? ;P

dreamy kestrel
#

what are you trying to do?

#

normalize or provide a default?

astral bone
#

userInput array- I guess normalize

dreamy kestrel
#

_isLow = [_isLow] param [0, false] ๐Ÿคทโ€โ™‚๏ธ

astral bone
#

:)

dreamy kestrel
#

or if you want to trap the type also, _isLow = [_isLow] param [0, false, [false]]

astral bone
#
opfor_static_turrets = opfor_static_turrets apply {
    private _type = _x select 1;
    private _offset = _x select 2;
    private _isLow = _x select 3;
    if(isNil "_type")then{
        _x set [1,1];
    }else{
        switch (true) do{
            case (_type == "heavy"): {_x set [1,3];};
            case (_type == "medium"): {_x set [1,2];};
            default {_x set [1,1];};
        };
    };
    if(isNil "_offset" || {count _offset < 3})then{
        _offset = [0,0,0];
    }else{
        _offset = _offset apply {if(typeName _x != "SCALAR")then{0}else{_x};};
    };
    _x set [2,_offset];
    if(isNil "_isLow" || {!(_isLow isEqualTo true)})then{
        _isLow = false;
    };
    _x set [3,_isLow];
    _x;
};
#

what I had

#

the heavy, medium and light to number-

dreamy kestrel
#

private _isLow = _x param [3, false]

#

or _x params [...] if you'd rather

#

anywho, good luck, good hunting ๐Ÿ––

astral bone
sullen sigil
#

use default

astral bone
#

Should just be able to do this right?
_x set [3,_x param [3,false,[false]]]; instead of defining islow and stuff

#

or no

astral bone
dreamy kestrel
#

private _type = _x param [1, 1]

little raptor
south swan
astral bone
#

but- huh?

dreamy kestrel
#

apply is literally an array transformation

south swan
#

okay, i see teh example above, but your wording sounded sus

little raptor
#

you use set

#

set modifies the array by reference

astral bone
#

I'm going through the array of arrays.

#

Apply, you return the value you want in the place of the current

south swan
little raptor
astral bone
#
opfor_static_turrets = [
    ["vn_o_vc_static_sgm_low_01","light",[0,0,0],true],
    ["vn_o_vc_static_mg42_high","medium"],
    ["vn_o_vc_static_pk_high","light",[0.155,-0.76,0]],
    ["vn_o_nva_navy_static_v11m","heavy"]
];
little raptor
#

yes I know. use forEach

dreamy kestrel
#

true if you are just trying to ensure some defaults in opfor_static_turrets, then just opfor_static_turrets param [...] or ... params ....

astral bone
#

Well, I do also need to conver the light medium heavy string to number

dreamy kestrel
#

yep or in that case forEach

little raptor
astral bone
#

What'd the different between apply and foreach be

little raptor
#

apply creates a new array

#

forEach just iterates it

astral bone
#

ahh ok. So, shouldn't be a big deal if only doing this once, but preformance would be better with foreach

#

But apply could work here

little raptor
#

could but there's no point blobdoggoshruggoogly

#

since set is already modifying the elements for you

#

(again set modifies the array by ref)

astral bone
#

So the forEach doesn't make a copy of the array element?

#

wait why would it-

little raptor
#

no

#

_x is a ref to the current iterated element

#

if you modify it by ref, you modify what's in the array already

#

(but = doesn't modify something by ref)

dreamy kestrel
#

๐Ÿง  hurts... just think it through. know you're goal, where you're headed, Occam's razor usually a good rule of ๐Ÿ‘ simpler is better, complexity leads to breakages.

astral bone
#

{
    private _type = _x select 1;
    private _offset = _x select 2;
    _x set [3,_x param [3,false,[false]]];
    if(isNil "_type")then{
        _x set [1,1];
    }else{
        switch (true) do{
            case (_type == "heavy"): {_x set [1,3];};
            case (_type == "medium"): {_x set [1,2];};
            default {_x set [1,1];};
        };
    };
    if(isNil "_offset" || {count _offset < 3})then{
        _offset = [0,0,0];
    }else{
        _offset = _offset apply {if(typeName _x != "SCALAR")then{0}else{_x};};
    };
    _x set [2,_offset];
}forEach opfor_static_turrets;
south swan
#

tbh, modifying inside-arrays in forEach makes my brain hurt as well notlikemeow

astral bone
#

I like how I've spent all day coding and 90% of it is just coding, not testing, so I'ma probably have a million errors when I get to testing, finally :P

astral bone
#

I'm a wizard! :O
I ran it first time and no logic errors! I mean, syntax erros and I forgot to finish an if statement to check a number to be greater then 25, but eh

#

How do I rotate around a point again? ๐Ÿ˜…

#

or rather-

#

rotate thing, then offset thing.

#

offset is -1,0,0, need to get what that is if the original object is rotated

little raptor
#

modelToWorldWorld

#

or vectorModelToWorld

#

depending on what you want

simple ore
#

Greetings all.

#

We have gained access to GPT-4 and have been using it to generate Arma code. We are trying to see if it is more valuable than GPT-3 was.

astral bone
#

what

simple ore
#

Wrong generation... sec... looking for feedback.

#
// Get all players on the server
_players = allPlayers;

// Loop through each player
{
    // Get the player's position
    _pos = getPos player;

    // Spawn a cube near the player
    _cube = "Land_CargoBox_V1_F" createVehicle (_pos vectorAdd [5, 0, 0]);

} forEach _players;
#

We were originally trying to train GPT-3 using the BIKI pull that BI provided us, but I wonder if we should shift focus. thonk

#

Simple generations look good, but I would like to try more complex prompts. Not sure what to ask it.

astral bone
#

make a whole addon

little raptor
simple ore
#

Well, we are testing.

#

So it doesn't matter.

#

We can at least gleam info from it's capacity to understand logic, even if the overall code is bad.

opal zephyr
#

ask it to create a serverside addon that detects when a civilian is killed and have it display a hint on only the killers screen telling it to cease fire

astral bone
#

irl AI?

little raptor
#

try this

#

it was generated using GPT3 afaik

#

and it's not 100% correct

simple ore
#
// Define the event handler function for when a civilian is killed
_fnc_civilianKilled = {
    params ["_victim", "_killer", "_instigator"];

    // Check if the victim is a civilian
    if (side _victim == civilian) then {
        // Check if the killer is a player
        if (isPlayer _killer) then {
            // Display a hint on the killer's screen telling them to cease fire
            hintSilent "You have killed a civilian. Cease fire immediately!";
        };
    };
};

// Register the event handler function to the "killed" event
addMissionEventHandler ["killed", _fnc_civilianKilled];
opal zephyr
#

That is missing a lot

simple ore
#

Can you format the prompt for me like this.....

#

Generate an Arma 3 sqf script to do the following:

Output:

opal zephyr
#

edit, actually its not missing as much as I thought

simple ore
#

We found this to be more successful in our testing.

#

Step by steps.

astral bone
#

AI scares me :)

opal zephyr
#

I think the code it generated is mainly missing a check to make sure it runs only on the server, as well as a remoteexec to make the hint appear on the killers screen. I might be missing more though

simple ore
#

I asked it to adjust

#
// Define the event handler function for when a civilian is killed
_fnc_civilianKilled = {
    params ["_victim", "_killer", "_instigator"];

    // Check if the victim is a civilian
    if (side _victim == civilian) then {
        // Check if the killer is a player
        if (isPlayer _killer) then {
            // Check if the code is running on the server
            if (isServer) then {
                // Display a hint on the killer's screen telling them to cease fire
                [_killer, "You have killed a civilian. Cease fire immediately!", "HintSilent"] remoteExec ["hint", 0, _killer];
            };
        };
    };
};

// Register the event handler function to the "killed" event
addMissionEventHandler ["killed", _fnc_civilianKilled];
little raptor
#

nope the remoteExec is wrong

simple ore
#

What's incorrect?

#

So I can try once more.

#

Example prompts also increase efficiency. It's a main reason why the BIKI pull was critical for our initial project.

little raptor
opal zephyr
#

also, probably better to put the isserver check on the addmissioneventhandler

granite sky
#

Even weirder, it's JIPing on the killer :P

#

Clearly has no idea what it's doing with remoteExec, which makes sense because most SQF-writing humans apparently have no idea either.

sullen sigil
#

never used remoteexec in my life, never will ๐Ÿ—ฟ

granite sky
#

It's not even using the right event, should be EntityKilled

#

Server check should logically be at the top. Kinda surprised it didn't figure that one when it's a common design pattern.

#

And the other side of the remoteExec is... wrong as well.

robust brook
#

chatGPT4 is a lot better if you havent tried that

sullen sigil
#

thats what they are using

#

probably doesnt work well for sqf because of it not being a standalone language

#

iirc it has some problems with roblox's luau too

granite sky
#

Lack of proper killer/instigator handling is weak too. I think you could just shoot the civvie with a vehicle turret to dodge this.

#

That's also a common pattern but it doesn't seem to have enough data to understand good SQF vs bad SQF.

sullen sigil
#

probably just looks at the bi forums all the time meowsweats

simple ore
#

I think A.I. will do better with Arma 4

#

Since I think that language is more common.

sullen sigil
#

because it'll be 2030 at that time and they'll have taken us all over anyway?

#

no its a new language

#

GPT-4 has document reading iirc, wonder what'd happen if you gave it the BIKI's tutorial pages (code optimisation etc) and then asked it for stuff with that in mind

robust brook
#

@simple ore ```sqf
private _civilians = allunits select {side _x isEqualTo civilian};

civKilledFnc = {
params ["_victim", "_killer", "_instigator"];
// if (isServer) exitWith {}; - this returns true in local environment
if (isPlayer _killer) then {
["You have killed a civilian. Cease fire immediately!"] remoteExec ["hint", _killer];
};
};

_civilians apply {_x addEventHandler ["Killed", {_this call civKilledFnc}]};

granite sky
#

Won't work in MP.

robust brook
#

with ai or actual players

sullen sigil
#

mp involves multi players so what do you think thonk

granite sky
#

well, I guess if all your civvies are on the server.

robust brook
#

well if you want to run it on MP just add a onPlayerKilled function and on init add player addEventHandler ["Killed", {_this call your_function}

sullen sigil
#

dont do that

sullen sigil
simple ore
#

Well, we don't have... real access for our discord bot yet like we do GPT-3.5

robust brook
#

Frost if you need more help lmk, your answer is there ๐Ÿค”

drifting sky
#

Question: Is there any reliable way to get an AI infantry unit to fire a specific magazine from a specific muzzle at a specific target?

drifting sky
#

only works for vehicles says the wiki

robust brook
drifting sky
#

I've tried them.

robust brook
#
private _enemyObj = cursorObject;
_enemyObj doWatch player;
_enemyObj doFire player;
``` works in eden against two blufor
drifting sky
#

I'm not able to get them to fire at a specific target with a specific mag

robust brook
#

is the target another unit or object?

drifting sky
#

i'm trying to get them to fire at an invisible target.

#

with a specific ammo and mag

#

sorry, mag, and muzzle

stark fjord
#

Mind you like UGL, or do you want ai to reload lets say tracer mag and then shoot

robust brook
#

I mean couldnt you remove all their mags/guns before they fire. Then add the specific mag and gun. After they fire re-add them back. kinda hacky but only way

drifting sky
#

first, I'm trying to get them just to throw hand grenades at an invisible target, then I'll try to tackle HE underbarrel nade launchers. Then SMOKE for each of those. The invisible target doesn't need to be anything in particular, just some thing that I can use to have them fire at a precise (but arbitrary) location.

stark fjord
granite sky
#

Hmm. I found that doWatch/doTarget didn't work well because the units stand with a direction offset to the target due to weapon stance. Like you have to throw in a setDir.

simple ore
#
// Define a function to handle the player's death
onPlayerKilled = {
    params ["_victim", "_killer", "_instigator"];

    // Check if the killer is a player
    if (isPlayer _killer) then {
        // Send a message to the killer
        _killerSide = side _killer;
        if (_killerSide == west) then {
            hint "You killed a friendly unit. Please be more careful!";
        } else {
            hint "You killed a civilian. Please stop shooting non-combatants!";
        };
    };
};

// Add the function as an event handler for player deaths
player addEventHandler ["killed", {[_this select 0, _this select 1, _this select 2] call onPlayerKilled;}];

// Use remoteExec to execute the function on the server
if (isServer) then {
    ["onPlayerKilled", {[_this select 0, _this select 1, _this select 2] call onPlayerKilled;}] remoteExec ["addEventHandler", 2];
};
#

Did it do better this time? We toggled web access and told it to use the BIKI.

little raptor
#

nope meowsweats

simple ore
#

Worse?

simple ore
#

Hmmm wonder what happened.

little raptor
#

wait why is it even checking west?

simple ore
#

It decided to do that itself

#

I didn't prompt for that.

little raptor
#

it got side tracked a lot ๐Ÿ˜…

#

all it had to do was change this line:

[_killer, "You have killed a civilian. Cease fire immediately!", "HintSilent"] remoteExec ["hint", 0, _killer];

to

["You have killed a civilian. Cease fire immediately!"] remoteExec ["hint", _killer];

and it would've worked

#

oh wait no it wouldn't ๐Ÿ˜…

#

it has an extra argument for remoteExec...

#

the hintsilent shouldn't be there

#

and the _killer too...

#

fixed

simple ore
#

I'm going to try to debug it and see if it can figure out the right way as you have explained it.

#

To fix the remoteExec in this Arma 3 script, you need to use the correct syntax for the remoteExec command. According to the Bohemia Interactive Community Wiki [1], the correct syntax for remoteExec is:

remoteExec [function, target, [paramsArray, isPersistent, isScheduled]]

In the script provided, the remoteExec command is missing the paramsArray parameter. To fix this, you need to add the paramsArray parameter to the remoteExec command. Here's the corrected script:

// Define a function to handle the player's death
onPlayerKilled = {
    params ["_victim", "_killer", "_instigator"];

    // Check if the killer is a player
    if (isPlayer _killer) then {
        // Send a message to the killer
        _killerSide = side _killer;
        if (_killerSide == west) then {
            hint "You killed a friendly unit. Please be more careful!";
        } else {
            hint "You killed a civilian. Please stop shooting non-combatants!";
        };
    };
};

// Add the function as an event handler for player deaths
player addEventHandler ["killed", {[_this select 0, _this select 1, _this select 2] call onPlayerKilled;}];

// Use remoteExec to execute the function on the server
if (isServer) then {
    ["onPlayerKilled", {[_this select 0, _this select 1, _this select 2] call onPlayerKilled;}] remoteExec ["addEventHandler", 2, []];
};

In the corrected script, the paramsArray parameter is added to the remoteExec command as an empty array ([]). This tells the remoteExec command that the function being executed does not require any additional parameters.

#

I don't think it figured it out.

sullen sigil
#

does gpt-4 even have conversations like chatgpt does?

#

its not a machine learning ai

sullen sigil
#

try link specific biki pages like the tutorial ones for arma 3 and so on

brisk lagoon
#

Hey I tried to attach a flag to a vehicle, when I tried it on eden editor everything worked, but when me and my unit used the mission the flags didn't spawn at all for some reason

This ForceFlagTexture "flags\TMG.paa";```

that's what I use on the flag
manic flame
#

I highly discourage the use of chatGPT for coding in SQF, you'll encounter lots of nonsense

pulsar bluff
#

i disagree. yes nonsense but you can work through that with better prompts and a little bit of SQF knowledge

sudden yacht
#

YOU CAN USE GPT TO CODE FOR YOU?!

pulsar bluff
#

in a year or two it will likely be way better, so it makes sense to just get familiar with it

#

and a side bonus that GPT doesnt give snarky responses that you get when asking humans for help

#

is a tech in its infancy, but give it 2 years and the volume of โ€œhow do i โ€ฆโ€ in this channel will be far lower than the volume of people using GPT โ€œhow do i โ€ฆโ€

stark fjord
#

unless it learns to give snarky responses when you ask it for help ๐Ÿ™‚

novel basin
#

Hi
how can I recover the effect when a player has no more stamina (black contrast around the screen)

stark fjord
#

like reproduce it or get rid of it?

novel basin
#

I would just like to reproduce the effect that there is on the screen, yes

stark fjord
#

you would have to know the name of the, what i belive to be RscTitles class.
And then simply display it it via cutRsc.
If its not something within engine itself.
(I accidentally hit enter)

novel basin
#

thanks i will check that

novel basin
#

do you know where is the information about this titles ? on what a pbo

stark fjord
#

sadly no.

dim cave
#

Hi guys, iโ€™m looking for a way to play the sound of a distant battle in one of my missions without the use of the SOG audio module for warsounds in the distance: i want to avoid the SOG dependency in one of my missions just for a module. Is this possible by using the โ€œsay3Dโ€ script?

pulsar bluff
lethal cave
#

guys, i'm trying to drawIcon3D over camCreate effect but it's not showing the icon. any advice?

edgy dune
#

will vest work on remote units?

#

and if not, is there away to get the vest of a remote unit?

winter rose
warm sentinel
#

hey guys, im attempting to compile a script that lowers ai spottime and accuracy at night, I used the timemanager script @pulsar bluff and chat gpt helped me write and added in this script from the forums https://forums.bohemia.net/forums/topic/182390-how-to-turn-init-code-in-to-a-script/?do=findComment&comment=2877603

timemanager.sqf
https://sqfbin.com/hupasejodinuqiwexixo

#

any suggestions?

edgy dune
winter rose
#

@warm sentinel please post your code to https://sqfbin.com/ and only post links here, not a wall of code thank you!

winter rose
#

maybe the entity is not entirely initialised, IDK
vest should work

warm sentinel
winter rose
#

thankies! ๐Ÿป

#

!quote 6

lyric schoonerBOT
winter rose
#

please don't use chatGPT ๐Ÿ˜„

warm sentinel
#

for sqf that is

edgy dune
#

I thought id try a mission event handler

winter rose
#

it might need a bit of delay, if you are certain the unit has a vest and vest returns ""

#

network, etc

edgy dune
#

Okay ill try that

#

a delay of 1 second should be fine ๐Ÿ™‚

warm sentinel
#

looking at the wiki i dont think my idea will work anyways

#

can you not change ai skills during a mission?

warm hedge
#

You can, by scripting

edgy dune
#

theres a zeus module that does that

#

think its in zeus enhanced or something

#

try looking at that?

warm sentinel
#

hmm i wonder if that note on the wiki specially concerns scenarios

#

trying to make ai spot skill and accuracy less at night time, this is what i got so far, i need to figure out how to set the skill back to original during daytime. probably need to make a second configunits command, one for day and one for night. https://sqfbin.com/ehabeqidowajecuhurav

pulsar bluff
#

people are going to use GPT for all languages more and more and no amount of pleading will stop it ๐Ÿ˜ it will get better too

#

nothing wrong with learning how to use the GPT and seeing what it spits out

#

if it spits out garbage, well it didnt cost anything to use, and probably didnt mind responding to potentially embarrassing questions that could garner a witty/ridiculing response in here

warm sentinel
#

i infact havent used it for sqf since you helped me with the skip time script, im trying to combined that script with another lol

pulsar bluff
#

nice!

gaunt tendon
#

Did I accidentally joined the chatgpt discord? ๐Ÿค”

warm sentinel
#

the idea is for co10 escape mission ported to ifa3 ww2, since friendlies do not have night vision i wanted to script it to make them significantly less likely to spot or hit you at night time to essentially balance the fact you cant see very much

#

im having second thought, might just skip nightime with the original script altogether, just thought it was a cool idea, simulating ai not being able to see in the dark lol

winter rose
warm sentinel
granite sky
#

Final AI skill is combination of server skill (from difficulty settings) and mission skill (from setSkill).

warm sentinel
granite sky
#

Scripts can only affect mission skill, but that is the more important one.

#

0 mission skill is 0 skillFinal. Server skill has its strongest effect at mission skill = 0.2.

warm sentinel
#

ah okay, this has to do with the crazy looking chart that hurt my brain on the wiki ๐Ÿ˜‚

lunar goblet
#

Hello, I understand this is probably leaning a bit into modding, but I am trying to figure out what the proper start/stop conditions would be if I want to start/stop the music via a radio command (like Radio Alpha/Bravo in a trigger)

#

or some other way to do it on command instead of just having it say true and false

hallow mortar
#

If you want it to change state when a trigger activates, you can use triggerActivated your_trigger_name

#

For activation by other sources, you could have your script set a variable, which the module condition checks. e.g.

// event script
kosand_var_startMusic = true;
sleep 90;
kosand_var_startMusic = false;
// Jukebox conditions
// Start
missionNamespace getVariable ["kosand_var_startMusic",false]
// End
!(missionNamespace getVariable ["kosand_var_startMusic",false])```
#

Alternatively, skip the jukebox module and just use playMusic yourself

pliant cradle
#

Hello together,

I would like to equip all enemy units with tracer magazines in a mission port of Liberation Gamemode. The enemy units are created dynamically in the mission via script.

My thought was to avoid the extensive way of inherting each enemy class to use the "Entity created" Missioneventhandler and I just wanted to find out whether this works with script spawned AI or only with Zeus placed units?

And if the idea worked like that, a headless client shouldn't be a problem, right? The unit is created on the server, the MissionEventHandler should take effect immediately and then the unit is offloaded to the HC, right?

Thank you for your feedback.

crude magnet
#

A rather unusual request for help (actually scrap that, nothing is unusual anymore when it comes to Arma stuff)
I'm looking for a disco light script or even a simple multiple flashing lights script to give the illusion of a club atmosphere. Ideally something I can put in a objects init or run from the mission init.

anyone come across something like this? or know any code snippets i could use?

crude magnet
meager granite
#

Just make random arrays by some algorithm

hallow mortar
#

To make lights flash, just set their intensity every X ms

stark fjord
#

Then add some sparse smoke particles that sink to the ground and u r set.
Also as a side note, units have at least 3 dance animations

crude magnet
#

Yes, more what I'm looking for, I have some basic knowledge like messing around with description files, some basic commands from the init, executing scripts from triggers etc...but that's about it.

Would you be able to provide an example in context?
feed me, I'm poor ๐Ÿ˜…

crude magnet
# stark fjord Well it aint gonna be a simple "paste into init" script. But this for reference:...

Yeah checked that, This is going to be my 'fall back' as I could look into just creating this modded grenade by a script or trigger.
There are things such as the music and animations that are open to change, going to have to dig into if the length of effects can be changed.

Thanks for you help @stark fjord @meager granite & @hallow mortar

I'll have a mess around with the light point tutorial, suppose 'doing' is the best way to learn.

stark fjord
#

Also idk if old man scenario pbo has been decrypted. But in there you can also find disco at night in town next to main airfield.

hallow mortar
#

I mean, you're collecting a huge number of objects by searching through a large area. That is inherently not great for performance.

winter rose
#

as usual, depends

hallow mortar
#

You'll be fine using it for low-frequency collections, but doing it a lot is not a good idea

#

They are probably not using nearObjects "ALL"

#

Well, have you tried running the mod? If their implementation causes the same hitching, it may be your PC. If not, you need to look closer at what they're doing.

modern meteor
#

Hi, I am using the following code on a trigger in my mission. It's supposed to be an ammo box where my AI squad auto-rearms within range.

{if(_x iskindof "CAManBase") then {_x setDamage 0; _x  removeMagazines "15Rnd_9x19_GMag"; _x  removeMagazines "CUP_30Rnd_556x45_Emag_Tracer_Green"; _x  addMagazines ["15Rnd_9x19_GMag", 5]; _x  addMagazines ["CUP_30Rnd_556x45_Emag_Tracer_Green", 30];  };} foreach thisList; hint "We got new ammo!";

The trigger gets activated on BLUFOR. My problem is that only one AI in my team rearms but not the others. I guess it is the first one which gets into the triggers range. How can I adapt the code to make sure that all AI within range rearms?

winter rose
#

that or forEach units (thisList select 0) to apply it to all units in the first person's group's units

modern meteor
#

I have it on repeat with interval 2. Condition is set to: this. Shall I reduce the interval or do I need to use a different condition?

#

I will also change the forEach. 1 sec

#

This works. Thanks vey much Lou!

wet geode
#

Hi, I am writing a script and I want to see what the _transmitterClass variable is. It changes and is give by the acre_api_fnc_setCustomSignalFunc.

[{
  params ["", "", "", "_transmitterClass"];
  if (_transmitterClass == "ACRE_PRC117F") exitWith {
    [1,0]
  };
  _this call acre_sys_signal_fnc_getSignalCore
}] call acre_api_fnc_setCustomSignalFunc;
```Any suggestions
sullen sigil
#

does anybody have any bright ideas for working out if the player is within a bounding box set out by 4 coordinates? i'm completely drawing a blank here, I cannot use inArea as it only has rotation in one axis

#

I am trying to detect if the player is in an area on an aircraft carrier that has rotation in all axis -- using inArea would mean when it is upside down the area would be inside the carrier

digital hollow
#

use inArea but in model space of object aligned with the box

sullen sigil
#

you'd still need special handling for if it was upside down though as negative c is infinite vertical

#

its also not as simple as a lineintersectssurfaces in the direction of the surface as the object has no collisions ("aircraft carrier" is just to simplify it) and cannot be detected by it meowsweats

digital hollow
sullen sigil
#

yeah, but if you'd end up with it going upwards into the carrier

#

one mo i'll draw a pic

#

with the triangle being the carrier you'd just end up with this

#

so you'd need to shift the center downwards by the amount of C varying on the angle its tilted by meowsweats

digital hollow
#

not if you use model space?

sullen sigil
#

that is using model space there? inArea areas cant just be rotated upside down

digital hollow
#

not trigger, alt syntax lets you define center and sizes

sullen sigil
#

yeah so you'd need special handling to shift the point further down so that the top of the box aligns with the carrier

#

as using just straight modelspace would cause the diagram because its the same position on the model

#

oh

#

inPolygon exists

#

news to me, that saves tons of effort

#

i could've sworn i tried to find it with no success earlier

digital hollow
#

if the carrier is upside down, then its model space is also upside down.

sullen sigil
#

i know, but the trigger area is not

sullen sigil
#

either way inPolygon is exactly what I was looking for it just required a bit of digging

meager granite
#

You're not getting it, transform positions you check into carrier model space and do inArea there

#

Here is my snippet to do a check against bounding box

#

Change bounding box area to be area on your carrier entity in its model space, turn your checked position into carrier's model space position and do the check

astral bone
#
_new_turret setPosASL (AGLToASL (_turret_point modelToWorld _tur_cent)); // not offsetting right, and on the ground.
#

Issue with placing the turrets from yesterday. I should be able to fix the only spawning on the ground part, but not sure about the offset being incorrect

#

Offset is basically b/c the red x is where the model origin is. I want the yellow X to be where the turret point is

#

wait a second

#

oh still no

winter rose
#

modelToWorldVisualWorld?

astral bone
#

the wiki isn't loading for me-

#

what does that do

winter rose
#
_new_turret setPosWorld (_turret_point modelToWorldVisualWorld _tur_cent);
```should place the `_new_turret` spot-on
astral bone
#

Model center isn't the same as object pos right?

winter rose
#

both commands work with model centre

astral bone
#

oh, you did PosWorld too

#

oh I'm an idiot

#

ignore the variable setting, that was for debug thing. Buuut...

winter rose
#

whenever possible, avoid AGL ๐Ÿ˜‰

astral bone
#

yes. I wonder what's wrong. Surely it isn't "_tur_cent"

#

You know, I was also wondering why the position wasn't even seeming to change xD

winter rose
astral bone
#

uh- hmmmmm

jovial aspen
#

hello, whats the highest possible value in arma?

manic sigil
#

9

astral bone
#

that's not it...

winter rose
#

(also known as 340,282,346,638,528,859,811,704,183,484,516,925,440)

jovial aspen
#

what about for int?

winter rose
#

there are no int script-side in Real Virtuality

astral bone
#

ok, end position is 6097.5, 4416.65, and 5.0005

#

ah yes, ok, so another issue is if the turret points are deleted, it will need to handle that.

#

mission.sqm shows the spot's position as {6098.2744,5.0005002,4416.71} which, swap Y and Z, should match.

#

Wait a second, this uses model center. So it also uses Z center.

winter rose
#

โ€ฆwhy do you bother so much with sqm?

astral bone
#

oh, that was just to see what the ASL Z axis was

winter rose
#
private _selectedObjects = get3denSelected "object";
private _firstObject = _selectedObjects select 0;
getPosASL _firstObject select 2; // ASL altitude
#

or

getPosASL (get3denSelected "object" select 0) select 2; // ASL altitude
astral bone
#

the VR square has a different Z center

meager granite
#

There is model center, model placing point

#

You can get offset for placing point from getModelInfo

#

Also many entities benefit from using XY from getCenterOfMass because XY from getPosASL\ATL is same as XY from getPosWorld which results in pretty useless coordinates when entity is not top right

#

getPosWorld - PlacingPoint is what you get with setPosASL\getPosATL when entity is top right (Vector Up = [0,0,1])

#

Visualized, getPosASL is higher than getPosWorld when entity is turned over

#

Some static have centers really weird too, like vanilla mortar, getCenterOfMass is the best way again there

astral bone
#

what's the best way to invert a position? Multiply by -1?

meager granite
#

Yes, ... vectorMultiply -1

#

Or vectorDiff instead of vectorAdd depending on where used

astral bone
#

oh yea, subtraction is a thing

brisk lagoon
#

Which also didnโ€™t answer my question

#

Steam guide*

#

Not workshop

edgy dune
manic flame
#

No, i was referencing an older message. They were trying to get a script done by chatgpt and instead of manually correcting mistakes they would ask here what the issue was and then ask chatgpt to fix it. Leading to a never ending debugging loop

winter rose
brisk lagoon
#

Oh didnโ€™t know that

little raptor
# edgy dune how did u get a bounding box for the vehicle?

boundingBoxReal command gives you the bounds
you can create the lines yourself using modelToWorldWorld after getting the vertices of the BB in model coords
which are all combinations of [(x1,x2), (y1,y2), (z1,z2)] = 2 ^ 3 = 8 verts

winter rose
brisk lagoon
#

what do you mean by relative texture path?

winter rose
#

e.g "MyTexture.paa"

brisk lagoon
#

so what am I supposed to do instead?

edgy dune
crude magnet
# stark fjord Also idk if old man scenario pbo has been decrypted. But in there you can also f...

Managed to kitbash something together, rough, but it works. No scripting knowledge so I just threw different examples together lol.
_light = "#lightpoint" createVehicle getPos objectname;
_light setLightFlareSize 5;
_light setLightBrightness 1.0;
_light setLightIntensity 1000;
_light setLightColor [1, 0, 1];
_light setLightAmbient [1, 0, 1];
_light attachTo [object name, [0, 0, 0]];

sleep 2;

while {true} do {
_light setLightIntensity 3000;
sleep 0.5;
_light setLightIntensity 0;
sleep 0.5;
};

edgy dune
#

Yea

little raptor
#

I think there's a cargo bounding box defined in config

#

dunno

edgy dune
#

the mystery of arma

little raptor
#

not a mystery just need to read the docs ๐Ÿ˜…

south swan
#

and if it isn't there - just need to write the docs blobdoggoshruggoogly

#

and if it's inconsistent - just need to write a ticket and wait a year or two

edgy dune
little raptor
#

dimensions[] = { "BBox_1_1_pos", "BBox_1_2_pos" }; // Memory-point-based override of automatic bounding box
cargoBayDimensions[] = { "VTV_limit_1", "VTV_limit_2" };

edgy dune
#

that would be the thing that is carrying the other vehicle. I was saying for the vehicle that gets put inside. like how does it know that only 3-4 quadbikes can fit in the hemmit for example

south swan
#

// or
// dimensions[] = { { 0,0,0 }, { 3,2,1.5 } }; // alternatively, positions in model space (since 2.08)

edgy dune
#

ohh wait

#

I see nvm

#

Transported Vehicle config example:

hallow mortar
edgy dune
winter rose
hallow mortar
winter rose
winter rose
hallow mortar
#

This is the init field problem for setObjectTextureGlobal:

execution may happen too early and fail to broadcast over the network and to be JIP compatible.
So it may need a more advanced fix.

astral bone
#

I normally do spawn then object texture

#

ah yes, createVehicle uses AGL not ASL ๐Ÿ˜…

astral bone
astral bone
#

Yea

#

AH HA! And I have it so it's spawning a temp vehicle when initializing and normallizing the preset turret types array, and adding the center of mass X and Y, plus PosWorld Z, and adding them to the offset position array I already had.

little raptor
raw tide
#

Is there a way for arma to pull a custom texture from a link or an ftp server instead of from pbos and for everyone to see that texture? I know I could use mission file but that would get too big too fast. Or does anyone know how arma 3 units get that to work. Basically I want people to be able to upload their custom texture for example and be able to use it in game and for everyone one else to see it too without having to put those textures in pbos or mission file. Or even if someone knows what the path to logos in units would be?

novel basin
#

Hi
Do you know why I get this error when I use the 'slotItemChanged' EH?
Error Erreur mod externe : Unknown enum value: "SlotItemChanged"

#

Even if I don't have a mod I get the error

hallow mortar
#

The slotItemChanged EH is only available on dev branch until the release of Arma 3 2.14

novel basin
#

Outch :/

#

do you know where the release arrive ?

little raptor
#

late summer; ~2-3 months from now I guess

novel basin
#

oh ok

#

and, for the moment, how can i ""reproduce"" this EH ?

sharp grotto
#

run a lopp and check the slot items

little raptor
#

use the dev branch to actually use the EH

hallow mortar
#

There aren't any particularly good ways, which is why it's being added

novel basin
hallow mortar
#

Using a loop to check the items is one of the better options, but it's not fantastic for performance.
Depending on what exactly you want to track, you might be able to get away with using inventoryOpened/inventoryClosed/put/take EH

novel basin
hallow mortar
#

You could run the whole server on dev branch, but that would mean everyone connecting would also have to be on dev branch, and also stuff on dev branch isn't properly tested, so it's really not recommended

novel basin
#

when I saw this EH on the documentation of event handlers I was happy lmao it will make some scripts easier for me

#

thanks for your help Leopard and NikkoJT

novel basin
#

by the way i had another question
I'm trying to reproduce the fatigue effect (that the effect that the player has on his screen) do you think it's possible to do it with the 'PostProcessEffect'? or is there another way to do it?

tough geode
#

Maybe i'm just to stupid to find something about this but i was wondering if there is a way to use the squad logos in setObjectTextureGlobal? I can easily find the local path on a client via squadParams but i would like to use a global command for it as the squad logos should be distributed to everyone anyway.

topaz quartz
#

So I have been asking chat gpt about how to do some stuff in arma 3 and It started giving me some scripting stuff and I saw something in here about not using chat gpt for scripting. Is this accurate?

winter rose
#

it is accurate not to use chatGPT for scripting then coming here for debug

topaz quartz
still schooner
#

One issue with this code, it shoots randomly even when there is no enemy

meager granite
molten yacht
#

What would a thing look like that went "All AI on Blufor should have this one voice"

#

for each _x in blufor, set voice to no_voice...

#

I'd also take a way to just like, auto-change the voice of any AI that are wearing a certain uniform/mask...

manic sigil
granite sky
#

units west apply { [_x, "chosenvoice"] remoteExec ["setSpeaker", 0] };

manic sigil
#

Man, I always forget Apply...

granite sky
#

This is a bit spammy. Probably better to do:
{ units west apply { _x setSpeaker "chosenvoice" } } remoteExec ["call", 0]

#

Also you'd normally want to JIP that.

molten yacht
#

Cool.

shut reef
#

What's with the vehicle respawn module and not respawning helicopters that died from contact with water?
Also what's with helicopters exploding on contact with water, even if they have their damage disabled?

warm hedge
#

It might be an Engine issue

drowsy geyser
#
_hintName = (findDisplay 46) displayAddEventHandler ["KeyUp",
{ 
  params ["_control", "_key", "_shift", "_ctrl", "_alt"];
  if (_key == 57 && player == player) then
  {
    hint format ["Hello, %1!", name player];
  };
}];

How would i remove this local keyUp eventhandler in another .sqf file?

digital rover
#

you would need to store _hintName somehow, either as a global variable or storing it on the control or something.

Then you can use https://community.bistudio.com/wiki/displayRemoveEventHandler

drowsy geyser
#

okay thank you, i will try it

proven charm
drowsy geyser
#

that was just an example code ๐Ÿ˜†

proven charm
#

ok ๐Ÿ™‚

drowsy geyser
#

so i would do something like this:

_hintName = (findDisplay 46) displayAddEventHandler ["KeyUp",
{ 
    params ["_control", "_key", "_shift", "_ctrl", "_alt"];
    if (_key == 57) then
    {
        hint format ["Hello, %1!", name player];
    };
}];
missionNamespace setVariable ["hintNameKeyUp", _hintName];

and then:
_hintName = missionNamespace getVariable "hintNameKeyUp"; (findDisplay 46) displayRemoveEventHandler ["keyUp", _hintName];
would this be right?

proven charm
#

looks like to me

#

where are you putting the removeEvent code?

drowsy geyser
#

in another sqf file

proven charm
#

ok just trying to understand what your trying to do

velvet merlin
#

setMousePosition [safeZoneW - 0.1,safeZoneH - 0.1];

#

trying to put the mouse cursor out of the way

#
  1. it doesnt always work
  2. while this should not be at the edge (as i understand it), in 2d map it will move the view to SE (not in all situations; especially when you tab out tho)
#

seems i have the position wrong

stray flame
#

So ive been trying to get around a loadout save issue caused by a mod and I was thinking

#

Could I set a thing in initPlayerLocal.sqf that saves player loadout when inventory is closed?

#

Which could then be used as a reference for onPlayerRespawn.sqf to give the player their stuff back

#

The reason I've been having issues is because one of the mods I use removes player mags when in a revive state

#

Which means the player respawns without mags

tough geode
#

Wouldn't it make more sens to change the script that removes the mags in the first place?
Well if you want to do what you described there is an InventoryClosed event handler^^

stray flame
#

As of now ive had to turn off revive all together as this issue is too big

#

Its a mod that removes mags

#

And idk how id do that

#

Hm

#

I will look at it

#

As is it seems simplest to just have it activate on inventory closed. Since thats usually when players obtain new loot

tough geode
stray flame
static furnace
#

Really stupid question incoming, but I'm trying to setup a simple teleport trigger, and when typing the following on the "on activation" part:

player setPosATL [getPosATL tpExit];

It tells me there's a missing ";"
I try adding a ; right after tpExit, and it gives me the same result
Any help would be appreciated

#

Nevermind, found the issue

winter rose
static furnace
winter rose
#

yep

static furnace
#

I made a typo and typed "getPostATL

winter rose
#

well that too (that explains the ; error message
but your code remains wrong even after fixing the typo

#

@static furnace โ†‘

static furnace
#

wouldn't getPosATL take care of that though?

winter rose
#

it takes an array of numbers, not an array of arrays

#
player setPosATL getPosATL tpExit;
```you could also use `setVehiclePosition` to not place at exact position but at _available_ position```sqf
private _radius = 5;
player setVehiclePosition [tpExit, [], _radius];
static furnace
#

I've used a similar script before and it's worked fine though

winter rose
tough geode
# stray flame Project injury reaction

Well the mod just runs clearMagazineCargoGlobal in some conditions so if you want to stop it from doing you could just overwrite the functions of the mod^^ But if you don't know how to do that your solution will also work ^^

static furnace
#

you even gave me the answer derp

tough geode
#

player setPosATL (getPosATL tpExit);
Maybe like that? ^^

winter rose
south swan
#

yaay for randomly inserting square brackets in the command

static furnace
#

but there's still getPosATL

#

which works flawlessly

winter rose
#

re read what I posted please

#
// you do
player setPosATL [getPosATL tpExit]; // doesn't work
// I do
player setPosATL getPosATL tpExit; // works
```period
static furnace
#

I-

#

Apologies, I completely missed that

#

Thanks again Thumbs_up

stray flame
#

Also is there anything I could use to save the loadout just before entering the revive state?

jade acorn
#

there's a bunch of eventhandlers you could use I reckon

stray flame
#

Mainly because the one issue that can occur with saving loadout on inventory closed is that it poorly tracks mags used. One can easily use up a bunch of ammo after last closing inventory

tough geode
#

Well i don't understand Russian but they safe them to reapply them later after the revive or what ever ^^ Seems they don't want the unconscious or captured units to have the mags before the state gets reverted.

stray flame
#

It just feels like a strange issue on their part. As mods like ace doesn't do that

tough geode
stray flame
#

hm

#

hmmm, eventhandler Respawn (that I use to play a wakeup animation on respawn) is local argument

#

but InventoryClosed is global argument

#

will this perhaps cause issues if I try to make it work within initPlayerLocal.sqf

tough geode
#

If your are talking about MPRespawn it will still be triggered locally on the machine of the player respawning so that shouldn't be a problem

stray flame
#

well I tried putting

//Save loadout on closed invenotry
player addEventHandler ["InventoryClosed",{ 
player setVariable ["Saved_Loadout",getUnitLoadout player]; 
}];```
into `initPlayerLocal.sqf`



`onPlayerRespawn.sqf` has the thing to restore loadout with 
```player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);```
#

should this work?

tough geode
#

After respawning the player object has changed so you would have to get the variable from the dead unit

stray flame
#

hm.

#

Well how would this information translate over to the next?

#

the old system was using:
onPlayerKilled with onPlayerRespawn.sqf

tough geode
#
 params ["_unit", "_corpse"];
player setUnitLoadout (_corpse getVariable ["Saved_Loadout",[]]);```
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
tough geode
#

In the onPlayerRespawn.sqf

stray flame
#

along with the old code that was in there?

#
params ["_unit", "_corpse"];
player setUnitLoadout (_corpse getVariable ["Saved_Loadout",[]]);

player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);```
tough geode
#

Nah the sqf player setUnitLoadout (player getVariable ["Saved_Loadout",[]]); isn't needed

stray flame
#

alright

#

I will try

#

as for onPlayerKilled.sqf, im guessing that isnt needed anymore?

tough geode
#

What is in onPlayerKilled.sqf ? ^^

stray flame
#
player setVariable ["Saved_Loadout",getUnitLoadout player];```
tough geode
#

Well i would keep it as this should make sure the Unit loadout gets saved the moment of death

stray flame
#

and that wont reintroduce the issues I had earlier with players respawning without mags due to the revive state?

tough geode
#

Well that depends if it's fired before the mags get removed or afterwards. But you could first try it without the onPlayerKilled and see if it works.

stray flame
#

I will try with its current configuration

#

wait..

#

should I have


//Save loadout on closed invenotry
player addEventHandler ["InventoryClosed",{ 
player setVariable ["Saved_Loadout",getUnitLoadout player]; 
}];

in initPlayerLocal.sqf?

#

I forgot if I should have it there or รญf I just forgot to remove it

#

atm I have
initPlayerLocal.sqf:

//Save loadout on closed invenotry
player addEventHandler ["InventoryClosed",{ 
player setVariable ["Saved_Loadout",getUnitLoadout player]; 
}];

onPlayerKilled.sqf:

player setVariable ["Saved_Loadout",getUnitLoadout player];

onPlayerRespawn.sqf:

params ["_unit", "_corpse"];
player setUnitLoadout (_corpse getVariable ["Saved_Loadout",[]]);
tough geode
#

Should work

winter rose
#

don't forget a TAG_ for good practice ๐Ÿ™‚

stray flame
#

what now?

little raptor
#

like HMSH_Saved_Loadout

#

e.g CBA stuff have the CBA_ prefix

stray flame
#

well I got my mags back but.

#

I added sleep to a body-removal thing

#

becouse if it retrives it from the body I wouldnt want the body to go into the shadowrealm too early

polar belfry
#

hello is there a way to make a nofly zone in my missions. I thought a zone that when players fly over temporarily spawn some SAM and AA vics to strike them and when they are out of the zone the sams and AA Vics disappear

#

if I set variables on the vics will the ones that get spawned a second or third time still despawn

stray flame
#

okay yeah the script doesnt seem to work

sharp grotto
#

can't use sleep there

stray flame
#

yeah I removed that

#

still wouldnt work as intended

tough geode
#

Try to remove the onPlayerKilled.sqf

sharp grotto
#

getUnitLoadout / setUnitLoadout has some annoying bugs

stray flame
#

well that isnt the issue im running into

tough geode
stray flame
#

here is me before going down

#

here is what I respawn with

#

It didnt save my loadout at all

#

ima see if the body removal thing was the issue

#

trying to disable that real quick

#

okay

#

I fixed it

#

Removing body thing did cause that

#

however

#

now the issue is its just the same as usual. Mags got removed when I went down and are still gone after respawn

#

had 3 mags before I last dropped my gear on the ground and got shot. Now I am back with none to spare

tough geode
#

Maybe try some logging?

player setVariable ["Saved_Loadout",getUnitLoadout player];
diag_log str getUnitLoadout player;

And see if the mags are alr missing the moment onPlayerKilled.sqf: gets fired

stray flame
tough geode
#

Yes

stray flame
#

got it

#

testing..

#

before death

#

funny enough the gear I want to have on respawn is on my body

#

so currently I want it to give me that gear and then for it to remove the body

#

yeah

#

since it puts the stuff back on the dead body

#

I think the optimal method would be for it to just give me the gear from the dead body and for it to them put that on me when I respawn. Then remove that body

tough geode
#

Wait the dead body has the gear you want?

stray flame
#

yeah

#

it apparently gives it back either when revived or turned into a corpse

tough geode
#

Just scrap the save loadout part and do in the onPlayerRespawn.sqf:

params ["_unit", "_corpse"];
player setUnitLoadout (getUnitLoadout _corpse);
stray flame
#

so scrap the stuff in onPlayerKilled.sqf

tough geode
#

And in the InitPlayerLocal if you just want the gear of the dead unit back ^^

tough geode
#

Just call the body removal after you applied the gear on the new unit

stray flame
#

yeah so far its done it too early

#

I used to have

player addEventHandler ["Respawn",{ 
    params ["_newObject","_oldObject"];
    deleteVehicle _oldObject; 
}];```
inside of `initPlayerLocal.sqf`
#

okay I tried it

#

without body removal

#

ehh

#

I respawned without my gun

#

before

#

I mean that could sorta work for some survival themed stuff but

#

that would require me to be able to get just the gun from the ground and

#

well its not nearly as versatile as I want

tough geode
#

Well your problem is: When unit is killed and had a weapon, the weapon is placed inside "WeaponHolderSimulated" and dropped together with the unit. so you could either use the onKilled.sqf to save your weapon or search for the weapon holder containing your corpses weapon and adding it back to your new unit

stray flame
#

sounds like a dificult problem

#

any half-half solution where it only takes the firearm from when the unit was killed and the rest from the unit corpse?

#

I mean given it always respawns me now without a firearm it would atleast not have to replace anything that exists in unit inventory

tough geode
#

onPlayerKilled.sqf:

player setVariable ["Saved_Loadout",primaryWeapon player];
stray flame
#

ya?

#

done

tough geode
#

So instead of saving the full load out as before you save the weapon and readd in the onRespawn

stray flame
#

will I need to add anything extra to the onPlayerRespawn.sqf?

tough geode
#

Well you would want to also get the weapon attachments and magazine and readd them in the onPlayerRespawn

#

so yeah you would have to add stuff ^^

stray flame
#

so ```sqf
primaryWeapon

is just for the gun itself
#

it should then be

primaryWeaponItems
#

im okay if the unit looses the mag that is loaded. Its a small loss

tough geode
#

Nope primaryWeaponItems is only the attachments not the weapon ^^

stray flame
#

yeah but would I not need to do both somehow?

#
weaponAccessories```
?
#
weaponsItems```???
#
weaponState```???
#

man there are a lot of these

#

weaponState looks promising

tough geode
#

onPlayerKilled.sqf:

params ["_oldUnit", "_killer", "_respawn", "_respawnDelay"];
_primaryWeapon = [primaryWeapon player, primaryWeaponItems player, primaryWeaponMagazine player];
_secondaryWeapon = [secondaryWeapon player, secondaryWeaponMagazine player];
player setVariable ["Hmch_Saved_primWeapon",_primaryWeapon];
player setVariable ["Hmch_Saved_secWeapon",_secondaryWeapon];
stray flame
#

giving it a try

#

trying again with the edited text

tough geode
#

onPlayerRespawn.sqf:

params ["_unit", "_corpse"];
player setUnitLoadout (getUnitLoadout _corpse);
_primaryWeapon = _corpse getVariable ["Hmch_Saved_primWeapon",["",[""],[""]]];
_secondaryWeapon = _corpse getVariable ["Hmch_Saved_secWeapon",["",[""]]];
player addWeapon (_primaryWeapon select 0);
player addWeapon (_secondaryWeapon select 0);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 1);
player addPrimaryWeaponItem (_primaryWeapon select 2);
player addSecondaryWeaponItem (_secondaryWeapon select 1);
stray flame
#

alright, giving it a go

#

im guessing im replacing what was previously in onPlayerRespawn.sqf

tough geode
#

yes

stray flame
#

got it

#

well got this first thing in the mission

#

got me gun back

#

dont mind the one on the ground thats from the dead body

tough geode
#

Mhh guess should have set the default value to an empty array.(fixed)

stray flame
#

mags check, gun check, attachments check

#

just have to deal with that message

#

and then body cleanup

#

if I could use the usual body cleaning method but delay it with a few seconds it could work as usual I belive

astral bone
#

Should I be able to called hide object in postInit?
Function has postInit to 1 in description, and then does hideObjectGlobal

brisk lagoon
#

omfgggggggggggggggggggggggg i am loosing my mind, the civilian faction I made with Alive works and it appears but the OPFOR faction does not whyyyyyyyyy

#

same mod pack did not change shit

#

2 days ago it worked and now it wont appear at all

stray flame
stray flame
#

but I belive this would mess things up as it most likely removes the body before the player can get the stuff from it

#

I tried adding sleep to it but

stray flame
tough geode
#

try
onPlayerRespawn.sqf:

params ["_unit", "_corpse"];
if (isNull _corpse) exitWith {};
player setUnitLoadout (getUnitLoadout _corpse);
_primaryWeapon = _corpse getVariable ["Hmch_Saved_primWeapon",["",[""],[""]]];
_secondaryWeapon = _corpse getVariable ["Hmch_Saved_secWeapon",["",[""]]];
player addWeapon (_primaryWeapon select 0);
player addWeapon (_secondaryWeapon select 0);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 1);
player addPrimaryWeaponItem (_primaryWeapon select 2);
player addSecondaryWeaponItem (_secondaryWeapon select 1);
deleteVehicle _corpse;
stable dune
stray flame
#

got it

tough geode
stray flame
#

when I started

tough geode
stray flame
#

got this now that I respawned

#

hmmmm

tough geode
stray flame
#

if that message only appears because it believes something isnt the case at the start thats fine

tough geode
#

Try

params ["_unit", "_corpse"];
if (isNull _corpse) exitWith {};
player setUnitLoadout (getUnitLoadout _corpse);
_primaryWeapon = _corpse getVariable ["Hmch_Saved_primWeapon",["",[""],[""]]];
_secondaryWeapon = _corpse getVariable ["Hmch_Saved_secWeapon",["",[""]]];
player addWeapon (_primaryWeapon select 0);
player addWeapon (_secondaryWeapon select 0);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 1);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 2);
player addSecondaryWeaponItem ((_secondaryWeapon select 1) select 0);
deleteVehicle _corpse;
stray flame
#

onPlayerRespawn.sqf?

tough geode
#

yes

stray flame
#

roger roger

tough geode
#

The mags are also arrays as you could have gl grenades in your weapon^^

stray flame
#

ah yeah okay so now it appears to work just fine

#

I am okay if it misses out on GL and that stuff but if it fixes that too then thats amazing

#

okay yeah seems to work well. Thank you very much I now have a more robust script that I will use for a long time

#

Thank you so much for your time this was vital for getting revive to work with this mod

stray flame
#

If I want to use thisList to set the effect from a trigger on the people within it

#

how would I apply this to a remoteexec

#

like for example

#
["Music\Temp_Music.sqf"] remoteExec ["execVM",0];
winter rose
stray flame
#

thank you

faint oasis
#

Hi, is it possible to change the code when a waypoint is added to a unit when you are in the Zeus ? Because i don't understand why but when a unit is server side and is "Alone" in his group then the waypoint doesn't work. When the unit is not alone then it will work but otherwise, it's not working.

digital hollow
#

There is setWaypointStatements but it sounds like you want to fix the code in the first place, not just change it afterwards.

faint oasis
digital hollow
faint oasis
#

i wanted to know if it was possible to "replicate" the waypoints

#

so actually the waypoints are created but seems to be only on my computer and not on the server so i wanted to know if it was possible to transfer them directly to the unit owner so the server

digital hollow
#

addWaypoint is global arg global effect, so you shouldn't need to do that.
How about:

  1. What you tried.
  2. What you wanted to see.
  3. What you saw instead.
faint oasis
#

ah and actually it's why i asked if it was possible to change the "waypoint script" on the Zeus because actually the problem come from the Zeus and not from me

digital hollow
#
  1. What did you actually do? ie "I went in zeus, selected the unit, and right clicked inside a building"?
faint oasis
tepid vigil
#

Is there any way to detect unit roles, as in detect if an unit is a machinegunner, medic, etc?

digital hollow
winter rose
faint oasis
# digital hollow ok. some possibilities: 1. sometimes it just takes a while for ai to decide to d...
  1. Not really logical actually because it's working perfectly when the unit is not alone in his group. I tried to put them all on the server and i tried to move only one guy and didn't work and i tried to link him to an other guy and it worked perfectly so if it's that then i don't understand.
  2. I thought it was something like that because i'm using this command but it's not automatic and i tried 4 times to be sure so i don't think it's that and like i said when i link to an other guy then it's working.
  3. I was wrong sorry, i meant "Ground" so i'm not moving them in a building, they are outside on the road or dirt.
  4. Nope
digital hollow
astral bone
#
{
//... do stuff to normalize array, part of which is changing first position (select 0) to "NOT_A_VEHICLE" if no valid className exists...
}forEach opfor_static_turrets;
opfor_static_turrets = opfor_static_turrets select {(_x # 0) != "NOT_A_VEHICLE";};```
I feel weird making a new array to assign to the old array... Any ideas to make it better or?
faint oasis
quiet gazelle
#

do the CBA XEH_preInits of different addons run in the order of the addons being loaded?
(assuming the answer to that is yes, is that also the case in 3DEN?)

little raptor
quiet gazelle
little raptor
#

like it said it depends

#

a mod might run its XEH_preInits via CfgFunctions

astral bone
#
private _hee = "f";
_hee

Will that return "f" or

little raptor
#

ye

astral bone
#

ok so that's not my issue

little raptor
#

and combine their codes

little raptor
quiet gazelle
little raptor
#

for that you need to see how CBA runs their stuff

#

my guess is yes

#

(it probably just does configClasses, which returns configs classes in addon load order)

quiet gazelle
#

thanks, imma go look at CBA then

astral bone
#

why is the newly spawned object at level -88 :)

little raptor
#

what level??

astral bone
#

Z level

#

I think- Hope, I've got it now...

#

hahahahaha! YEES

graceful juniper
#

Anyone know a script where I can use a object like a laptop then use the scroll wheel menu to spawn in a helicopter?

#
MenuObject addAction ["Spawn MH-60M", {createVehicle [(_this select 3), (getPosATL MenuObject), [], 5, "NONE"];}, "vtx_MH60M"];

This is what I have but how do I make it spawn in on a object like a helipad?

configfile >> "CfgVehicles" >> "vtx_MH60M"
hallow mortar
#

The getPosATL menuObject in the createVehicle is defining the position at which the vehicle will spawn. So if you want to spawn it on a helipad, you just need to reference the helipad instead of menuObject (maybe using vectorAdd to give it 0.5m of vertical height just in case)

graceful juniper
hallow mortar
#

For all vehicles (regardless of whether they come from a Workshop mod or not), createVehicle uses their classname. The classname is visible when you hover over them in the Editor, or be got dynamically from an existing vehicle using typeOf. For example, the vanilla Slammer's classname is B_MBT_01_cannon_F.

graceful juniper
proper niche
#

@digital hollow Hey. Hope you don't mind the ping, and I hope this is the right channel.

I am following along with your youtube video on file-patching. When you build the PBO it is just named "main", though most mods that I have seen have their PBO names formatted as "pfd_main" for example. Is there something I am missing to have the PBOs built with that naming format, or should I just be renaming my PBOs manually after they are built?

digital hollow
#

The prefix_component pbo names are made by build scripts. Addon Builder will just make a pbo named the same as the folder by default. You can manually rename them with no issue.

proper niche
#

Ah okay, I am using PBOProject

#

thanks for the response

polar belfry
#

I have a question is there a way to make a kill logger script that saves what people kill in a txt file

granite sky
#

8/10 on a good day?

#

similar to findEmptyPosition I think.

winter rose
polar belfry
#

I have a script I tried to make

#
_killLog = "kill_log.txt";

// Add event handler to each unit
{
    private _unit = _x;
    _unit addEventHandler ["Killed", {
        params ["_unit", "_killer", "_instigator", "_useEffects"];
        
        // Check if killer is a player and instigator is a vehicle
        if (isPlayer _killer && typeName _instigator in ["Air", "Land", "Sea"]) then {
            
            // Check if instigator is destroyed by the killer or the crash/explosion
            if (!isNull _instigator && (vehicle _instigator isEqualTo _killer || damage _instigator >= 1)) then {
                private _instigatorName = displayName _instigator;
                private _killerName = name _killer;
                
                // Append the kill to the kill log file
                private _logString = format ["%1 killed %2 at %3\n", _killerName, _instigatorName, time];
                _logString call compileFinal preprocessFileLineNumbers "log.sqf";
            };
        };
    }];
} forEach allUnits;
#
private _logString = _this;
_logString = format ["[%1] %2", time, _logString];
_logString = parseSimpleArray [_logString];
_logString = format ["%1\n", _logString];
_logString = parseSimpleArray [_logString, false];
_logString = format ["%1\n", _logString];
_logString = parseSimpleArray [_logString, false];

// Append the log string to the kill log file
_logString call compileFinal preprocessFileLineNumbers "appendto.sqf";
#
private _logString = _this;

// Append the log string to the kill log file
_logString call compileFinal preprocessFileLineNumbers format ["%1\n", _killLog];
#

It's for a plane mission and I had to take precautions cause AI likes to eject at slightly getting brushed from cannon fire

stable dune
# polar belfry I have a script I tried to make

Your current script check if your unit isPlayer, so it wont affect to AI.
If you want attach eventHandler to object, your should add that to object, not for units.
To eject , you can use forEach crew YouPlaneVarName

polar belfry
#

So it's a kill logger for Player to Player kills?

winter rose
#

typeName _instigator in ["Air", "Land", "Sea"] what

stable dune
polar belfry
#

Used it a bit

#

I couldn't get over an issue

winter rose
polar belfry
#

I wish AI wouldn't eject with the slightest touch of damage

polar belfry
#

Is there a way to make it global?

#

So all AI pilots in mission don't eject?

winter rose
#

yes - apply it on all vehicles

polar belfry
#

Ok will do

#

Sorry for any dumb questions

#

Last question is there a way to attach mobility kills to players? Eg plane crashes in water after losing control after player mortally wounds it

#

I want them to show in the statistics tab of the map

stark fjord
#

Ugh. You could check damage inflicted and add score via script

agile flower
#

quick and daft question

#

how do i stitch two values into a string in sqf?

#

trying to get minutes from date in a MM format

#

here's where I'm at:

#
if (date select 4 <= 9) then{
_mins = ????
}
else
{
_mins = date select 4
};```
#

I want to prefix a "0" to date select 4 if it is less than or equal to 9

warm hedge
#

01 02 03... 09 10 you mean?

agile flower
#

yes

warm hedge
#
private _min = str (date#4);
if (count _min == 1) then {_min = "0" + _min};
_min```I'd say I would write like this
agile flower
#

lovely

#

cheers

polar belfry
frigid oracle
#

is there an alternative to using remoteExec?

agile flower
frigid oracle
#

my mod is entirely client side but I need to raise an event to the server to creative a weapon holder and add something to it so all players can see the same item on the ground.

#

i remember hearing remoteexec should be avoided? Cause possible exploits? but i cant remember the details from awhile ago.

agile flower
agile flower
frigid oracle
#

So what does used accurately mean in this case?

agile flower
#

Only remoteExec stuff where stuff needs to be Executed Remotely

winter rose
#

if you can make the server obtain/process the information instead of the client sending it, do things server-side
if only a client can send an info (e.g local information like something on player's screen) then make the client send that info to the server for it to process

drifting copper
#

Getting back into mission mmaking after a few years. Running a trigger on spawn to carrier deck and used to use trigger with condition call{this && (player in thisList)} & activation player setPosASL [56.770, 1569.65, 18.229]; but it now seems to toss me way far from the point? I fetched grid from object, yet it places me a few km away from the defined grid. Can someone advice? Mentioned method used to work no issues in the past so a bit lost

winter rose
hallow mortar
#

eh, I could see a carrier being pretty close to the map edge

drifting copper
winter rose
#

either that or you have something else somewhere interfering
but try that on an empty terrain, you'll see it works

drifting copper
winter rose
#

try setPosATL eventually

hallow mortar
#

An ASL/ATL mixup, while wrong, wouldn't produce the symptoms described, though ๐Ÿค” it would result in wrong elevation but the horizontal position shouldn't be affected

winter rose
#

yep

drifting copper
#

ye ASL places me at the right height, just a good 13km of on the X axis

hallow mortar
#

Z is usually height :U

drifting copper
hallow mortar
#

Are you getting this position from the Eden carrier object?
Carriers aren't actually one single object, they're a set of section objects. The Eden object is probably some kind of placeholder and may be being removed. Have you tried with a different (smaller) object?

drifting copper
winter rose
#

place yourself where you want to
start the preview
Debug Console: getPosASL player
that's your ASL position

winter rose
#

are you trying to use grid map numbers?

hallow mortar
#

I don't think the Eden bottom left readout displays grid numbers

winter rose
#

I did read bottom-left as map 015423 location ๐Ÿ˜ฌ
bottom-left is terrain ASL position, not "object intersection" position

#

hence the offset, depending on the camera's angle ๐Ÿ™ƒ

winter rose
drifting copper
#

Hence why I am slamming my heado n keyboard right now ๐Ÿคฃ

#

So I just scripted a VIED that has a random chance of detonating on trigger, no issue
Scripted a random chance "flame out" for a fast mover, no issue

A bloody basic TP trigger sends me spinning. Though works now after a arma restar. FMl. Though thanks for the input @winter rose & @hallow mortar! No script change. Literally just a game restart.............

drifting sky
#

Is there a way to make an ai man aim precisely at a position? Or to just turn precisely toward a position? lookat and dowatch seem to cause the ai to rotate until they are within 30 degrees the direction they're meant to look. I'm looking for something closer than that.

pulsar bluff
#

youd have to check weapon direction vector instead of direction

somber radish
#

Maybe it is useful for you blobdoggoshruggoogly

gaunt tendon
drifting sky
#
    params ["_unit","_mag_types","_weapon", "_loaded_mags"];
    private _magazine = "";
    private _muzzle = "";
    private _reload = true;
.... snip ....
    [_magazine, _muzzle, _reload];    
    
};```
Can anybody tell me why the return from this function is always undefined?  _magazine, _muzzle, and _reload are all defined.
granite sky
#

The answer will be in the snip.

edgy dune
#

when a units locality changes, does the init EH run again?

drifting sky
#

by the end of the function, _magazine, _muzzle and _reload all have defined values, so why is the array returned undefined?

granite sky
#

Probably because it's not getting to the end of the function. Either that or you're misinterpreting the calling code.

drifting sky
#

Even when I comment out everything else in the function, it still says the value returned from this function is undefined

granite sky
#

calling code then.

drifting sky
#

i.e., when everything that is "snipped" is commented out

#

_mag_info = ([_unit, NADE_LAUNCHER_MAGS, primaryweapon _unit, primaryWeaponMagazine _unit] call func_has_mag);

all the arguments to the function are defined

#

but "_mag_info" is undefined

granite sky
#

Is func_has_mag defined at that point?

drifting sky
#

yeah it's defined... the function is being called, I've confirmed that with hint inside the function. Plus all of the values in the returned array are also defined at the end of the function.

#

Is there some kind of trick about returning arrays from a function?

granite sky
#

No.

drifting sky
#

any theories what might be wrong?

gaunt tendon
winter rose
gaunt tendon
#

From
[_magazine, _muzzle, _reload];

winter rose
#

yep, still no / useless

#
private _array = call { [1, 2, 3]; }; // _array is [1, 2, 3]
winter rose
polar belfry
#

hello

#

I got dynamic spawning set up with TMF and put the "allowCrewInImmobile" since the wave spawner tmf has just copies the units and spawns them where the units were in map so now they don't eject now is the tracker time. is there a way to write kills on my players. At start I thought a script that if they do more than 40% damage the enemy plane dies but that would not grant them the kill right?

#

The reason I want to record almost all the kills it's for the rp element of the server and the plane shop I run in the server (like the one in ace combat games)

#

I thought either a score system like they kill a mig-29 and they get 100 points or a system where I do the math post op

#

sorry for the long text

winter rose
#

โ€ฆwhat is your question?

polar belfry
#

which is easier to implement?

winter rose
#

you can kill with setDamage's alt syntax to set the killer

polar belfry
#

so with set damage with killer as player then that player will get a score with addscore?

winter rose
#

as if he killed them yes

drifting sky
#

Can secondaryWeaponMagazine ever return an array containing magazines that aren't actually loaded into the secondary weapon?

winter rose
drifting sky
#

I think it is solved, but I'm not sure what the problem actually was.

winter rose
#

ok, you pass

drifting sky
#

can a mag be loaded but for some reason unable to fire for reasons related to the state of the mag or the weapon?

winter rose
#

โ€ฆI am going to end up asking: why

#

(maybe an empty mag is still counted)

polar belfry
#

For my script whenever you are free how will I set the condition of activation on the trigger

#

So when a player does x damage it suns the set damage thing

winter rose
#

that's not how it goes, you need to use an event handler on spawned enemies, see the framework's documentation

polar belfry
#

Ok

polar belfry
#

So I'll do

this addEventHandler ["Killed", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
}]; ```
#

For each vehicle

#

I'll modify it when I get home cause I'm on the phone

#

I found the tmf event handler as well

#
    private _groups = _this select 1;
    {
        _x setBehaviour "AWARE"; 
        _x setCombatMode "RED"; 
        _x setSpeedMode "FULL";
    } forEach _groups;
}] call tmf_ai_fnc_addWaveHandler; ```
#

Looks like I can put it in the spawner and it will apply to all

drifting sky
#

I'm having difficulty getting an ai unit to select his rpg and fire a mag from it. He seems a lot of the time to get stuck in a loop where he stands up, gets his rpg out, puts it away, and goes prone again. Doing that over and over. Anybody know a way to correct this?

manic sigil
naive needle
#

Is there a way to get a player object from the remoteExecutedOwner ?

little raptor
little raptor
little raptor
#

Or the unit's init EH defined in its config?

naive needle
little raptor
little raptor
#

Check the wiki

pliant cradle
#

Hi together, just a short basic question as a non programmer because I actual cannot refind an article in BI Wiki about Loadorder between Mods, Scripts and so on.

I want to change the Loadout (change mags to Tracermags for example) of a faction which comes / loaded by Mod.
The units will be spawned while mission by script and do not exist at beginning.

Normal way is to inheritant and include changes in a own Mod, I do understand.
But I wanna ask if there is annother and maybe easier way?
First tries:

  1. used MissionEventHandler "Entitycreated", Loadout is called (own Debug systemchat hint is shown at the end of the Loadout Script) but Units stays by their origin Mags
  2. used CBA_fnc_addClassEventhandler but same result as in 1.

So my basic question: Do you have any ideas for me?

naive needle
# little raptor ClientOwner or something like that iirc

I'm trying to get it on the server. So basically I send a remoteexec to the server and then trying to get the player object through remoteExecutedOwner. clientOwner btw only gives you the Machine Network ID which is a different ID to the ID you need for getUserInfo

#

Of course I can send the netID from the player or the PlayerID to the server but I thought it would be possible with the Machine Network ID from the remoteExecutedOwner to get the player object

little raptor
naive needle
#

yea I thought the same, but that way is meh

#

I will just send the netID with the call I guess

#

ty anyway

quiet gazelle
little raptor
#

Using EHs will slow things down (unless you're making a mission and can't do config patch)

quiet gazelle
#

are there any data types that are not passed by reference?

little raptor
#

No

manic sigil
#

I mean, I can think of a couple options, but what would best-practice be?

chrome hinge
#

How i can pick soldiers from a group and move them to driver, commander and gunner on a vehicle?

#

Im using a respawn system that respawns both vehicle and the crew, but crews variablenames dont seem to persist trough respawn so i cant use them directly

#

and when i use moveinany the crew sometimes bounces to cargo positions

manic sigil
chrome hinge
#

oh and these are AI soldiers im talking about

manic sigil
#

... is it necessary to respawn the crew then, rather than generate new ones?

chrome hinge
#

the way it is now is because im usign mgi advanced module ai respawn that respawns all the ai. I started this way because i thought it might be easier. Afaik the groups can be blocked form spawning too so maybe creating new crew would be good idea.

#

ill try that out next

#

thanks!

manic sigil
#

Just sounds like a lot of effort for an unclear reward - doable, but is it worth it, sort of thing.

polar belfry
#

hello I did all the stuff needed but how do I make the trigger that if a player strikes a vehicle and do x amount of damage the vehicle dies crediting the player for the kill

winter rose
#

use an event handler, not a trigger

winter rose
polar belfry
#

oh how would one normal one be cause the only thing it needs is to incorporate it within their EH by what I've found

#

so you can call the normal one in the one they have and it will be applied

winter rose
#

a "normal one"?

wary sandal
#

does anyone know how 3CB vehicles work? those are vehicles ported from arma 2

#

I'd like to make this artillery piece fire, with or without crewmen in it, doesn't matter

polar belfry
#

like one that you could make for a plane if there was not TMF there

winter rose
winter rose
polar belfry
#

I adapt it

winter rose
polar belfry
#

thanks

#

if I put in _killer the player variable will it register the player that killed it or pass it to all players

sullen sigil
#

question unclear please rephrase

polar belfry
#
    params ["_unit", "_killer", "_instigator", "_useEffects"];
}];```
if instead of _killer I put player
```this addEventHandler ["Killed", {
    params ["_unit", "player", "_instigator", "_useEffects"];
}];```

will it register the kill to the player that killed the enemy or will it give the kill to all my players
proven charm
#

it will trigger when *this * dies

polar belfry
#

fixed it

#

sorry

winter rose
#

no it won't, that's not how it works

#

these are arguments provided to the event
and btw I realise now you should not use "Killed" but most likely "HandleDamage" event

polar belfry
#

oh

winter rose
# polar belfry oh
_enemy addEventHandler ["HandleDamage", {
  params ["_unit", "", "", "_source", "", "", "_instigator"];
  if (not alive _x || { canMove _unit }) exitWith {};
  _unit removeEventHandler [_thisEvent, _thisEventHandler];
  _unit setDamage [1, true, _source, _instigator];
}];
```this event must be added **on the server**
manic flame
#

does execVM run in a global state?

#

I want to add both diarySubjects and diaryRecords to players through a file called "briefing.sqf", so Im considering just running the code with execVM.

but i dont know if it would work for newly joined players.

proven charm
#

you can run code in init.sqf or initPlayerLocal.sqf for clients that start the mission

#

in init.sqf you would have to do hasInterface check

sharp grotto
#

Iam stupid, how can i save a hashmap to profile namespace and retrieve it again ?
Wasted enough time so i just gotta ask since iam unable to find my issue ๐Ÿ˜„

warm hedge
#
profileNamespace setVariable ["whateverTheName",createHashMap];  //save
profileNamespace getVariable "whateverTheName";  //load```
sharp grotto
#

_hashMap = profileNamespace getVariable "whateverTheName";
And _hashmap will be a hashmap ?

warm hedge
#

Yes

sharp grotto
#

Thanks alot, i tried sh*t like that. meowsweats
Shouldn't code when tired

 RW_COMMANDER_DoorNameIndex = createHashMapFromArray (profileNamespace getVariable ["CW_COMMANDERTOOGLEANAMES", []]); 
polar belfry
# winter rose ```sqf _enemy addEventHandler ["HandleDamage", { params ["_unit", "", "", "_so...

what's _x doing?
By what I understand for the script checks if unit is dead or unable to move so it will not run if those things are true
If false it will set damage to 1 killing the unit and granting the kill
I did a small modification

  if (not alive _unit || { canMove _unit }) exitWith {};
  if (not canfire _unit) exitWith {};
  _unit removeEventHandler [_thisEvent, _thisEventHandler];
  _unit setDamage [1, true, _source, _instigator];
}];```
#

if ((damage _unit) < 0.4) exitWith {};
this should make it so the thing work if damage over 40%

polar belfry
#

ok

winter rose
#

you could also do a canFire check if you will

polar belfry
#

I see

#
_enemy addEventHandler ["HandleDamage", {  params ["_unit", "", "", "_source", "", "", "_instigator"];
  if (not alive _unit || { canMove _unit }) exitWith {};
  if (not canfire _unit) exitWith {};
  _unit removeEventHandler [_thisEvent, _thisEventHandler];
  _unit setDamage [1, true, _source, _instigator];
}];```
#

you mean something like this?

winter rose
#

yep

#

wait

#
_enemy addEventHandler ["HandleDamage", {
  params ["_unit", "", "", "_source", "", "", "_instigator"];
  if (not alive _unit) exitWith {};
  if (canMove _unit && { canfire _unit }) exitWith {};
  _unit removeEventHandler [_thisEvent, _thisEventHandler];
  _unit setDamage [1, true, _source, _instigator];
}];
polar belfry
#

oh both checks to see if unit gets downed by missile impact as well

winter rose
#

as in "if it can still fight, leave it be"

polar belfry
#

yea

#

so _enemy must be declared by me right?

#

like a variable

winter rose
#

well yeah, target the object you want with it

winter rose
polar belfry
#

yea

#

I will run my tests

boreal parcel
#

heyo, im trying to make the engine of certain vehicles indestructible but it doesnt seem to be working. Any Idea why? im using ACE as well btw, maybe hitpoints are named different?

this addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit"];
    if (_selection isEqualTo "hit_engine") then {
        _damage = 0;
    };

    _damage
}];
winter rose
boreal parcel
#

that was a single shot printed with systemChat (str _selection);

winter rose
jaunty nest
#

is anyone familiar with the arma 3 vanilla high command

#

am looking for a script (or any way at all) to disable enemy markers while using high command

boreal parcel
proven charm
winter rose
boreal parcel