#arma3_scripting

1 messages Β· Page 29 of 1

tough abyss
#

mm

#

well we can deal with that later, see what the logging says now

finite bone
#

ok

#

not working -

tough abyss
#

Hm, not sure

#

should be logging something

#

unless _art_object_name isn't an object or some other condition is wrong

worthy igloo
#

i cant get the minigun memory point for the qilin can anyone help

finite bone
sullen sigil
#

@tough abyss so the issue with AI teleporting happens regardless of whether or not I'm in the same squad as them, in SP or MP. the function is called as:

ace_player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];

if (_muzzle isEqualTo "Six12th_GravityGrenade_Muzzle") exitWith {

_projectile addEventHandler ["Deleted", {
params ["_entity"];
    
{
//_x allowDamage false;
_x setPosASL (getPosASL _x vectorAdd [0,0,0.1]);
[_x, _entity, (_x distance _entity)] call Six12th_fnc_setVelToward;
} forEach nearestObjects [_entity, ["Man"], 10];

}]

};}]``` with just the if check copy pasted for antigrav grenade at the moment but the away function where I just switch some of the object variables around so they're propelled away
#

Also happens regardless of how many entities are influenced by the grenade so it's not an issue with the number of them πŸ€”

#

Just checked, it's not a mod conflict either

hallow mortar
#

This has the allowDamage true being done immediately after the bomb is created. Is it possible this is simply arriving before the bomb actually detonates?
Also, if I'm reading this correctly, this code doesn't do any damage handling if _isLethal is passed as false (presumably allowing the bomb to be lethal), and does do damage handling if _isLethal is passed as true (presumably causing the bomb to be not lethal). So _isLethal being true means a non-lethal bomb and _isLethal being false means a lethal bomb. This isn't strictly broken code but it is counterintuitive and could cause problems later.

tough abyss
#

It was just a cleaned up version of what he already posted, wasn't trying to do major improvements

#

it likely has some issues like what you describe

hallow mortar
#

I mentioned that message because it's the latest version of the code and I assume that's what they're currently using, not because I'm trying to critique your input

tough abyss
#

Mhm, good points

#

@sullen sigil switch your if statement from if !(_islethal) to if (_islethal)

sullen sigil
#

Hm?

tough abyss
#

In this code

sullen sigil
#

Wrong person, that's not me :p

tough abyss
#

oh my bad

sullen sigil
#

@finite bone I think

tough abyss
#

getting mixed up, no sleep, apologies

sullen sigil
#

Yeah no worries man lol

tough abyss
#

@sullen sigil As for your issue, try changing the remoteExec in the setVelToward code to remoteExecCall

#

shouldn't really matter but meh

#

then again we already fixed it for locality so shouldn't be the problem

sullen sigil
#

In SP all the units should be local, right?

tough abyss
#

yup

sullen sigil
#

I'll throw a systemchat into the local one

#

Yup, it's just setvelocity on them as intended πŸ€”

#

It's not an issue with using call for the function instead of anything else, is it?

tough abyss
#

No

#

Does the issue still happen if you only use the grav or anti-grav and not both?

sullen sigil
#

The issue happens for both, anti-grav just demonstrates it better

#

Because obviously with grav they're all bunched together :p

tough abyss
#

Fair enough

#

I have a feeling it may have something to do with them being AI

#

Does the same thing happen when it does it to you?

sullen sigil
#

Nope, though it also doesn't happen to AI who are in a squad by themselves as far as I can tell now

#

Yup, split them all of into squads and it doesn't happen whatsoever now

tough abyss
#

May be something to do with their formation then, if I had to guess

sullen sigil
#

They are on careless AI πŸ€”

#

no fucking way

#

Think it was because they were on careless

#

Yup, not happening at all now

#

Is there any way to test the locality bits without having to update dedi server etc

tough abyss
#

Nothing will give you realistic results other than doing actual dedi testing

#

local MP behaves differently

sullen sigil
#

Yeah, fair

#

Oh wait I would need someone else to place AI with zeus wouldn't I

#

or just put them down on the mission file initially

tough abyss
#

Can also just spawn them serverside w/ debug console and server exec

sullen sigil
#

I have no idea how to grab debug console in dedi server

tough abyss
#

have to log in as admin

#

#login blahblahblah

sullen sigil
#

Mhm, I do that but it never shows up :p

#

I only get zeus when I login

tough abyss
#

interesting

#

can just spawn them in the mission file then

sullen sigil
#

Yeah, I'll have to do that then once I update this and my medical pbo

hallow mortar
#

Debug console availability is controlled per-mission by the Attributes:General:States section in the Editor. It's set to Editor-only by default.

sullen sigil
#

Need fancy noises now too

tough abyss
#

Very nice

dreamy kestrel
#

Unrelated question, if I want to find out whether the object is 'valid', i.e. created on a MP server, i.e. machine ID 2, that would be owner _object == 2, correct? And perhaps some other criteria involving a mix of hasInterface, isServer, or what not.

winter rose
#

if isServer && local obj

something like that

#

because owner is a server-side command iirc

astral bone
#

can I add a check box attribute to an object in zeus via mission sqf code?

#

i doubt it

tough abyss
#

If you use _this in the algorithm or filter, it's actually the full parameters that you passed to BIS_fnc_sortBy, not just the magic vars

#

So if you want to put the magic vars you passed through params, you'll need to do (_this#1) params [...];

finite bone
#

the logic works fine

copper raven
#

but mod is the proper way

astral bone
#

new question. Can you sync markers to game logic

#

it seems that's a no

copper raven
#

sync if you mean with the editor sync thing, no

astral bone
#

oh wait, what about if I make the game logic items be 'replaced' by markers-

dreamy kestrel
tough abyss
#

yup

#

no problem

finite bone
#

wait

tough abyss
#

?

chilly aspen
#

hey

#

any one knows how to make capture a point script?

#

trying to make a multiplayer scenario where if blufor stands on the opfor's base for 5 minutes the marker on the map changes to blue

#

from red

#

and the scenario will be with zeus

#

so im trying to make a button that makes the zones change

#

so i made this

#
this addAction ["changecolor", marker1 setMarkerColor "ColorRed"];
#

and it just doesn't work

tough abyss
#

Because that's invalid use of addAction

#

check the syntax, the code to run needs to be in {}

chilly aspen
#

m1 is the name of the marker

tough abyss
#

The setMarkerColor code

chilly aspen
#

what?

tough abyss
chilly aspen
#

mhm

tough abyss
#
this addAction ["changecolor", {marker1 setMarkerColor "ColorRed"}];
#

^ like that

chilly aspen
harsh vine
#

maybe you didnt change the name of the marker to marker1πŸ€·β€β™‚οΈ

chilly aspen
#

well i created just now a marker that is named marker1

#

and it says there is no marker1

#

and that it misses }

tough abyss
#

What's the code currently

chilly aspen
#

nvm

#

its just the code above

tough abyss
#

And marker2 exists?

chilly aspen
#

can create one

#

or change the variable name

tough abyss
#

well that's why your code is complaining about marker2 not existing

#

because it doesn't exist

#

lol

chilly aspen
#

well but if i have marker1

#

and try this code on marker1

stable dune
#

"marker1"

#
"MarkerOne" setMarkerColor "ColorBlack";
#

@chilly aspen ☝️

chilly aspen
#

UM

#

what does it change?

tough abyss
#

marker name in quotes

chilly aspen
#

OH

#

caps

#

ill try

#

thank you guys so much it works!

proven charm
astral bone
#

can I check if a texture exists?

#

oh wait a sec

astral bone
#

i don't have an object yet. πŸ˜…

#

_icon = (getTextRaw (configFile >> "CfgMarkers" >> _markerClass >> "icon"));

if(count _icon == 0)then{
    _icon = _markerClass;
};

I think this might work tho

#

Ok, and in theory, I can pass "" to the _markerClass and just have text if I want to have text without a marker

stable dune
stoic crescent
#

hey everyone, I have a dumb problem that I can't solve because I'm not experienced in arma3 scripting.
I want to make a super simple "kill every player that is out of a trigger zone" trigger. So I created a trigger:

type: none
activation: any player
activation type: not present
repeatable
condition: this

on activation:
hint format ["%1", thisList];
{_x setDamage 1} forEach thisList;

When I leave the trigger area I get the hint (so trigger works) but thisList is an empty array so I'm not being killed (that's my guess)
How do I fix this? Thanks in advance!

granite sky
#

Have you checked what it outputs when there's one player in the zone and one out?

simple trout
#

thisList is a list of objects in the trigger

stoic crescent
simple trout
#
private _headlessClients = entities "HeadlessClient_F"; 
private _humanPlayers = allPlayers - _headlessClients;

{_humanPlayers deleteAt (_humanPlayers find _x)} forEach thisList;
{_x setDamage 1} forEach _humanPlayers;

place this on activation, and change the activation type to present.

granite sky
#

Could simplify to allPlayers - (entities "HeadlessClient_F") - thisList

surreal epoch
#

Is there a way to give a turret of a helicopter a turret stabiliser?
I know you can give different weapons but idk what the stabiliser classifies as

stoic crescent
# simple trout ```sqf private _headlessClients = entities "HeadlessClient_F"; private _humanPl...

Didn't work.
This time thisList is not empty and contains my id (or whatever that bis_o2_somenumbers means) every time I enter the trigger area, but I'm not dying. I think that it doesn't work because trigger cannot be activated when you leave the trigger area as the only player. And if you go back and activate it you won't die either because , well, you are back in the area.
I guess I'll do something like a while loop based on your piece of code. Thanks guys

granite sky
#

not present should work with that code, assuming that it triggers when players are outside and thisList contains players who are inside.

#

Which is pretty weird behaviour, but hey, it's Arma.

#

But I wouldn't put you off the while loop solution.

stoic crescent
granite sky
#

I'm guessing that if there's one player in and one player out, thisList contains the players in the area, even if the activation type is "not present".

winter rose
#

yep, most likely

#

use BIS_fnc_listPlayers for example

hallow mortar
# surreal epoch Is there a way to give a turret of a helicopter a turret stabiliser? I know you...

Whether the turret has stabilisation is controlled by the turret's config, which can't be changed by scripting.
If it has a "pilot camera stabiliser" (that is, the ability to lock on to a point on the ground, like a targeting pod camera) then you can turn that off and on using enableDirectionStabilization - but only if that property is set up in the config. If it doesn't have one in config you can't turn it on.

ember pier
#

Again a sound related question, I try to make the radioman emit radio sounds when he is browsing the map, so I thought I could use visibleMap, however it did not work, and when I’m opening the map with the wiki line nothing happens;

if (visibleMap) then {hint β€œtest”};

winter rose
ember pier
#

Ah I have this in the player init

winter rose
#

yeah nope, this ^ code will only check if the player has the map open right at the beginning (which he won't)

ember pier
#

    params ["_mapIsOpened", "_mapIsForced"];

    if (_mapIsOpened) then
        [] spawn {
            waitUntil {
                    rto playSound3D "radio_noise.ogg"
            };
        };
}];```

Something like this? @winter rose
winter rose
#

almost

#
addMissionEventHandler ["Map", {
    params ["_mapIsOpened", "_mapIsForced"];
    if (!_mapIsOpened) exitWith {};
    rto say "radio_noise.ogg";
}];
```note that this will make `rto` say that sound **once** every time the map is opened 😬
ember pier
#

Yea I'm using quite a long sound from the SOG dlc

winter rose
ember pier
#

I don't think there is an event handler for when a player opens the support tab?

winter rose
#

that I don't know

ember pier
winter rose
#

nope

ember pier
winter rose
#
addMissionEventHandler ["Map", {
    params ["_mapIsOpened", "_mapIsForced"];
    if (_mapIsOpened) then
    {
      STRUDEL_RadioSource = rto say "radio_noise.ogg";
    }
    else // map is closed
    {
      if (not isNil "STRUDEL_RadioSource") then
      {
        deleteVehicle STRUDEL_RadioSource;
        STRUDEL_RadioSource = nil;
      };
    };
}];
winter rose
ember pier
#

It will be a hosted MP, I think I'll tell the RTO to use a scroll menu action to make some noise while calling in supports πŸ˜‚

ember pier
#

Perhaps I can try to achieve a similar effect by putting something in the support requester module, I’ll try that tomorrow

twin heron
#

I joined the discord just to ask this, haha.

I'm getting frustrated with the online documentation for a lot of the scripting, which, while useful much of the time, has a tendency of only being willing to meet you halfway if you're trying to figure out how things work.

I've been figuring things out fine, except for one thing: Zeus can see itself (or rather, its virtual entity), and as the mission I'm making is a customised Zeus sandbox for me to run ops for some friends, having a giant red and grey splotch on my screen when I'm trying to work on things will be a massive pain :P

So here's the situation: I have a virtual Zeus entity called corp and a Game Master module called corp_gm. I've been trying to run removeCuratorEditableObjects on corp so that it doesn't appear from the curator view, but to no success. So far, I've been running variations on this removeCuratorEditableObjects [[this], true]; in the corp init (using Eden), though I've also tried replacing the first this at the start of the line with corp_gm in case I was referring to the wrong object. None of this has worked, and infuriatingly, I haven't been getting any forms of error or feedback when running the mission as a test instance, regardless of what I put in there, so I have no idea what to change or where.

No amount of Googling has ever let me find a single other person who is trying to make it so Zeus can't see themselves, so I must ask for help myself. What am I doing wrong orz

tough abyss
#

@twin heron how about corp removeCuratorEditableObjects [[corp], true];

twin heron
#

In the corp init? I'll try, though I'd imagine it'd have the same results as this, no?

tough abyss
#

You would think

#

Going to try anyways for debug purposes

twin heron
#

Still visible, unfortunately.

tough abyss
#

How about the original code but with

#

Actually, no

#

Let's try this

#
[this] spawn {
(_this#0) removeCuratorEditableObjects [[_this#0], true];
};
twin heron
#

Trying now. I admit I don't know the syntax you're using here, especially this#0.

tough abyss
#

is an alias for select

#

Just shorthand

twin heron
#

Ah, okay!

#

Unfortunately it's still visible πŸ˜”

tough abyss
#
[this] spawn {
params ["_obj"];
waitUntil {!isNull _obj};
_obj removeCuratorEditableObjects [[_obj], true];
};
twin heron
#

Still no dice with this one.

tough abyss
#

Hm

twin heron
#

Really wish BI let us crack open the premade Zeus sandboxes so we could see the way they implement everything. Would make it far faster, haha.

#

I know you can decompile it through some means, but it's not the same

tough abyss
#

Indeed

#

I'll experiment with this on my machine and get back to you shortly

twin heron
#

Okay, thank you!

tough abyss
#

No problem

tough abyss
#

@twin heron This should work, in corp_gm's init

this spawn {
  private _editableCurators = [];
  waitUntil { 
    _editableCurators = (curatorEditableObjects _this) select {_x isKindOf "VirtualCurator_F"};
    count _editableCurators != 0 
  };
  _this removeCuratorEditableObjects [_editableCurators, true];
};
twin heron
#

It's beautiful.
Thank you so much.

Do you think it wasn't removing properly because the objects initialised at slightly different times so it never quite executed right?

tough abyss
#

The closest thing to working was corp_gm removeCuratorEditableObjects [[corp], true];

#

but yes, it has to do w/ initialization times

#

curators can't edit virtual curators by default, something else is adding it to the editable objects

#

so this just waits for it to appear and removes it

twin heron
#

I think ZEN automatically adds all playable entities + vehicles into the Zeus editable list - I remember a few years ago when messing around I had the same issues, though back then I used Achilles.

tough abyss
#

Well there you go, then

twin heron
#

Indeed. Just a hypothesis really, though it would explain it handily.

Thanks again, I am finally at peace!

tough abyss
#

No problem, glad I could help

kindred zephyr
#

Hello guys,

Is there any way to disable the nvgs overlay p3d so I can load custom overlays with titles?
I wish to avoid creating inherited nvgs just to change the overlay 😦

or if nightVision action can be overrode, how to do it?
It seems like using the addAction method having the shortcut as the action name doesnt work for it like it does for defaultAction

twin heron
#

or if nightVision action can be overrode, how to do it?
Are you trying to "skip over" Night Vision, or just overwrite it when it's activated?

#

I experimented with just this today and yesterday to remove FLIR without changing equipment in a mission, so I can help somewhat depending on what you need.

kindred zephyr
twin heron
#

Hmm, I haven't found a way to prevent the action from switching layers at all, but if it's something simple you want to overwrite it with, you could use a Draw3D handler?
Something like

{
    if (currentVisionMode player == 1) then
    {
        if (isNil "MyOverlay") then
        {
            "MyOverlay" cutText ["PLACEHOLDER NIGHTVISION", "BLACK", 0.001, false];
            MyOverlay = true;
        };
    }
    else
    {
        if (!isNil "MyOverlay") then
        {
            "MyOverlay" cutText ["", "PLAIN", 0.001, false];
            MyOverlay = nil;
        };
    };
}];```
kindred zephyr
twin heron
#

I think the most likely outcome would be that both take effect at once.

#

Which isn't a bad thing.

#

The end result of aforementioned experiments was finding a way to 'undo' FLIRs, so mixing a "no NVGs" script with that outcome would be a fine way to do it IMO.

kindred zephyr
twin heron
#

I don't know if you can inject code into the NV eventhandler TBH, I never got that far

#

I know that the code I use is

    while {playerside == west} do { 
        waitUntil {sleep 0.1; currentVisionMode player > 1}; 
        player action ["nvGogglesOff", player]
    }; 
};```
Which can be trivially repurposed for "ignoring" NV if you want to overload the action, but it *does* draw a few frames of NV first of course since it only checks once every 0.1 seconds.
kindred zephyr
kindred zephyr
twin heron
#

Yeah, I never figured out intercepting the actual event firing.

kindred zephyr
#

but i think i will try what you suggested with dfraw3d

#

ty

twin heron
#

No problem, sorry I couldn't help more effectively~

sturdy delta
#

so this code spawns a helicopter in the air with a crew and its own group, it has a seperate group inside of it (in this case just one rifleman), well iam trying to get the helicopter land at the helipad "land2" but it just gets close above and wont land on it 😦

_crw = createVehicleCrew _veh; 
 
_wp1 = _crw addWaypoint [getPos land1, 0]; 
_wp1 setWaypointType "TR UNLOAD"; 
 
_rfl =[getPosATL spawn2, west, []]call BIS_fnc_spawnGroup; 
"vn_b_men_army_15" createUnit [getPosATL spawn2, _rfl, "myUnit = this"]; 
myUnit moveInAny _veh; 
 
_wp2 = _rfl addWaypoint [getmarkerpos "wp1", 0];  
_wp2 setWaypointType "MOVE";  
_wp2 setWaypointBehaviour"AWARE"; 

any idea what it could be?

#

or does _wp1 setWaypointType "TR UNLOAD"; not include landing?

sturdy delta
#

thanks!

sturdy delta
#
_crw = createVehicleCrew _veh; 

_rfl =[getPosATL spawn2, west, []]call BIS_fnc_spawnGroup; 
"vn_b_men_army_15" createUnit [getPosATL spawn2, _rfl, "myUnit = this"]; 
myUnit moveInAny _veh; 
 
_wp2 = _crw addWaypoint [getmarkerpos "approach1", 0]; //_wp2 setWaypointType "TR UNLOAD";  
_wp1 = _rfl addWaypoint [getmarkerpos "wp1", 0];
_wp1 setWaypointType "SAD";


waitUntil {getpos _veh inArea [getPosATL land1, 300, 300, 500, false, -1]};

_veh land "GET OUT"; 
waitUntil {getpos _veh inArea [getPosATL land1, 2, 2, 1, false, -1]};
_rfl leaveVehicle _veh;
_wp3 = _crw addWaypoint [getPosATL spawn2, 0];
//moveOut myUnit;
waitUntil {getpos _veh inArea [getpos spawn2, 100, 100, 500, false, -1]};
deleteVehicleCrew _veh;
deleteVehicle _veh;```
made it work, if anyone cares πŸ™‚
winter rose
finite bone
#

Why does this always give constant damage to all hitpoints even with randomization present in the loop?

_vehicle = _x;
_damage = random(_max_damage);
_vichitpoints = getAllHitPointsDamage _vehicle; _vichitpoints = _vichitpoints select 0;
{
    _damage = random(_max_damage);
    _vehicle setHitPointDamage [_x, (_vehicle getHitPointDamage _x) + _damage];
} foreach _vichitpoints;
south swan
#

does randomize alright on my machine. What vehicle are you running this on?

copper raven
finite bone
#

yes

#
{
    if ((_x isKindOf "LandVehicle") or (_x isKindOf "Air")) then
    {
        _vehicle = _x;
        _damage = random(_max_damage);
        _vichitpoints = getAllHitPointsDamage _vehicle; _vichitpoints = _vichitpoints select 0;
        {
            _damage = random(_max_damage);
            _vehicle setHitPointDamage [_x, (_vehicle getHitPointDamage _x) + _damage];
        } foreach _vichitpoints;
        _vehicle setdamage (damage _vehicle + _max_damage); 
    };
} foreach _nearbyunits;
``` could it be that this => ``_vehicle setdamage (damage _vehicle + _max_damage); ``  overwrites the random damage?
copper raven
#

yes

#

why do you setDamage there anyway? the hitpoint calculation is totally pointless then, as setDamage does it's own whatever stuff on hitpoints

finite bone
#

because sometimes the hitpoints damage does not reflect the 'damaged' state of the vehicle

#

it still looks 'fresh'

copper raven
#

then set the hitpoints that "show" damage the most to max damage

#

usually its the HitHull in vanilla vehicles

finite bone
#

Gotcha

trail smelt
#

I added to my addAction the animations in order but I needed the character during the animation attachTo object "keyboard_hack" but after animation list done player stuck attachEd to keyboard any way to disable it after animation done?

Code:

this addAction ["Hack",{truck5 removeAction (_this select 2);
player attachTo [keyboard_hack, [0,-0.59,-0.9]];
player switchMove "Acts_Accessing_Computer_in";
sleep 0.8;
player switchMove "Acts_Accessing_Computer_loop";
sleep 10;
player switchMove "Acts_Accessing_Computer_Out_short";
}];
trail smelt
#

Thanks, and i tried to find keyboard animations without a weapon, do they exist or are they only with a weapon in hand?

astral bone
#

what's the difference between the init in the eden editor mission attributes and the init.sqf?

vernal mural
#

well, they are different

astral bone
#

Expressions of Eden Editor scenario attributes are called oh I didn't see that one xD

finite bone
#

How'd you apply ace damage to parachuting units?

sullen sigil
#

get the passenger of the parachute then apply normally

#

i have a question of my own now

#

is there any way to either change or hide the reticule on players' optics via scripting

late dust
#

Hello all. After much googling, searching on this server and asking others I am posting this.

I am trying to set up a system in which a person who is loaded into a medevac helicopter receives a full ACE heal after 30 seconds. I keep running into issues trying to get it to work.

No heal happens when I enter the vehicle and upon loading into the mission I see the hint pop up despite not being anywhere near the helicopter.

Any suggestions?

copper raven
late dust
#

I do not. The thisList works on triggers and the such. Should I change it to fullCrew?

copper raven
late dust
#

Sounds good, I appreciate the help. I will look at the scheduler. In the meantime does the getIn function work if you ace load a patient in? Or would I need another action there. Searching through the ace side atm but haven't found anything in particular

copper raven
#

(fires locally)

late dust
#

Looks good. Thank you for the resources bud, this has been stumping me for half of the day.

faint oasis
#

Hi, is there a way to change the owner of an unit without a bug that remove every items this unit had ? Because sometimes when i'm changing the owner of an unit like this : ```sqf
[(group (_unit)), 2] remoteExecCall ["setGroupOwner", 2, false];

sometimes the units in the group have their inventory completely cleared so is there a way to avoid that ?
faint oasis
real tartan
#

I usually do while loop, this will however stop after 10 000 iterations. I am trying to keep sleep 1 for counters inside loop. Can I rewrite this to something that will last more than 10 000 iterations ? maybe infinite for loop, keeping alive player condition ?

while { alive player } do 
{ 
  // do stuff
  sleep 1;
};
south swan
#

10k sounds like unscheduled looping limit, but if it is in unscheduled - then it will pop error/warning at sleep πŸ€”

real tartan
#

my bad, read it wrong in wiki, in scheduled there is no limit

fair drum
#

is there a cleaner way I can write this?

units hyp_opf_sf_1 findIf {
    private _unit = _x;
    ["exfil_1", "exfil_2", "exfil_3", "exfil_4"] findIf {
        _unit distance getMarkerPos _x <= 50
    } != -1
} != -1 &&
"exfiltrate" call BIS_fnc_taskExists;
granite sky
#

Better than the double loop:

["exfil_1", "exfil_2", "exfil_3", "exfil_4"] findIf {
   units hyp_opf_sf_1 inAreaArray [markerPos _x, 50, 50] isNotEqualTo [];
} != -1
#

2d distance by default, change it if you need to.

fair drum
#

tyty

south swan
#

disregard me, i've misread the code

granite sky
#

oh, my code missed an actual condition :P

fair drum
#

its alright, got the idea

copper raven
cold pagoda
#

What would be a good way to pass an object from an addaction within an addaction without creating a variable for the object? Is there a pipeline type concept within SQF?

this addAction [  
    "Put Safety Flag on Back", {
        params ["_target", "_caller", "_actionId", "_arguments"];  
        _target attachTo [player, [0.1, 0.35, 2.9]];
        _flag = _this;
        
        [_flag] spawn {
            player addAction [
                "Detach Flag", {
                    params ["_target", "_caller", "_actionId", "_arguments", "_flag"];
                    _flag attachTo [player, [0.1, -0.35, 2.9]]; 
                    detach _flag;  
                    player removeaction _actionId;  
                }
            ];
        };  
    }  
];```
blazing zodiac
#

Can we call a function when a vanilla keybind (like binoculars) is pressed so we can avoid hardcoding keybind fixes to vanilla systems?

tepid vigil
#

Hey, I am receiving an error message that I don't understand:

private _newPosition = selectBestPlaces [(leader reconGroup) getPos [_maxDistanceToMove / 4, _directionFromTarget - 180], 50, "forest + 2*trees", 5, 5];
    private _waypoint = [(_newPosition # 0) # 0, (_newPosition # 0) # 1, 0];
    systemChat format ["Unable to see target. Moving %1 meters to %2 to get a better view", (leader reconGroup) distance _waypoint, mapGridPosition _waypoint];

Error:

23:11:52 Error in expression <get a better view", (leader reconGroup) distance _waypoint, mapGridPosition _way>
23:11:52   Error position: <distance _waypoint, mapGridPosition _way>
23:11:52   Error Type Array, expected Number
willow hound
blazing zodiac
willow hound
sullen basin
#

I wanna be able to land or park a certain vehicle in or a landing pad and then be able to use a set piece (like a console or computer you have to walk up too) to delete it, Does anyone know any scripts like that?

(Context: im using spyder addons to spawn the vehicles now i want something i can do to delete the vehicles if brought back to the same location)

#

Like a script or something set to a computer or crate

finite bone
sullen basin
#

And do you mind giving me and example of the code in use?

finite bone
#

There are wayyy better ways of doing this - so use it as a reference

if (isSerrver) then {
_deleteobj = nearestObjects [[x,y,z], ["LandVehicle", "Air"], 5]; // x,y,z is the location of ur landing pad while '5' is the scan radius.
private _object = "your_computer_or_crate" createVehicle [x, y, z];    // x,y,z is the location of ur object
[_object, ["Delete vehicle", { 
    hint "Vehicle Deleted";
    deleteVehicle _deleteobj;
    }
]] remoteExec ["addAction"];
};
sullen basin
#

Thank you so much, so do I just set this to a set piece like a console or pc

finite bone
#

put it in initServer.sqf

sullen basin
#

aight

finite bone
#

you can optimize this even better but im all tired so maybe someone else can assist you meanwhile

sullen basin
#

Was gonna see if I could put it in Init of the screen item but get some sleep, dont wanna keep you up

finite bone
#

there is another way too - like u stated by putting it in the init field

finite bone
#

typing from mobile is pretty shit but eh

sullen basin
#

Yeah it is I agree lol but its what we got

#

Thank you so much for your help though

willow hound
sullen basin
#

cool, cuz im triyng to do it with spyder addons as the spawner (and im using the OPTRE mod so that might not be able to coincide with it but will try and get it to work)

copper raven
fair drum
#

can I create a link to a diary record from a task description?

copper raven
sullen sigil
#

Does anybody have a definitive answer as to why BIS_fnc_replaceWithSimpleObject should not be used in MP games? Can I use createSimpleObject instead?

I am unclear what disabling simulation does versus simple object so presume simple object is always better for optimisation

granite sky
#

Dynamically replacing stuff with simple objects may be very heavy on network spam compared to disabling simulation.

sullen sigil
#

What if it's just upon mission start

granite sky
#

shrugs

sullen sigil
#

What's even the difference between simulation disabled and simple object for network performance? All I know is simple object only sends traffic upon position/orientation etc change

granite sky
#

I haven't read the function. I would have thought that replacing with simple objects permanently is acceptable but using them instead of simulation toggling is not.

sullen sigil
#

Yeah, that's not what I'm intending on using it for -- just using it for the sake of optimising any way possible as I'm at several thousand mission objects, a lot of which can't be local only

granite sky
#

what sort of objects are we talking about here?

sullen sigil
#

simulation = house objects effectively, mostly flat platforms

i know the wiki says theres very little difference but any difference with that many will add up

quaint oyster
#

What's the best way to make an AI heli hover without reacting to getting shot?

fair drum
#

also, just create your own simple object conversion script

#

but in general, try not using so many objects. for multiplayer missions for example, you don't need 1000 objects in a building to show that it is a barracks. just some beds and the players will understand what it is. players don't care for aesthetics as much as long as the FPS doesn't poop out, which people will have a problem with.

finite belfry
#

Not sure if this is the right place to ask but how can I add or edit the select fire modes for firearms in A3?

sharp grotto
#

So i have a CRAM placed in my mission as Anti-Air defense and sometimes it decides to shoot at infantry even tho it shouldn't.
Is there any way to "intercept" the target detection with a EH or so to detect if the target is infantry and then abort shooting?

granite sky
#

It'll probably spam though.

sharp grotto
granite sky
#

_newTarget?

sharp grotto
#

nvm there is

#

ye just saw it πŸ˜…

#

thanks, iam gonna try it

sharp grotto
#

Doesn't seem to work 😦

_group0 addEventHandler ["EnemyDetected", {
    params ["_group", "_newTarget"];
    if(isNull objectParent _newTarget) then
    {
        _group forgetTarget _newTarget;
    };
}];
open fractal
#

add debug lines

stable dune
#

Is yours group created

private _group0 = createGroup [west, true];

Or is just your varName to group group0

sharp grotto
#
_group0 = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
south swan
#

well it seems to kinda work, but not enough πŸ€”

#

when i gun that on an infantry unit it starts shooting, then forgets about the target and dumps the rest of the burst kinda in that general direction blobcloseenjoy

sharp grotto
#

For some reason the EH doesn't even fire for me

#

added some diag_logs and nothing

#
//Airspace entry denial
_gun0 = [];
_group0 = [];
_group0 = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
_group0 setVariable ["lambs_danger_enableGroupReinforce", false];
_group0 setVariable ["Vcm_Disable",true];
_gun0 = createVehicle ["B_AAA_System_01_F",[0,0,1000],[], 0, "CAN_COLLIDE"];
_gun0 setDir 295.668;
_gun0 setpos [14527.2,3819.85,49.1919];
_gun0 removeWeaponTurret  ["weapon_Cannon_Phalanx",[0]];
_gun0 addWeaponTurret     ["Gatling_30mm_Plane_CAS_01_F",[0]];
_gun0 addMagazineTurret   ["1000Rnd_Gatling_30mm_Plane_CAS_01_F",[0]];
_gun0 lock 2;
_gun0 allowCrewInImmobile true;
_gun0 addEventHandler ["Fired",{_this spawn {uiSleep 15; (_this select 0) setVehicleAmmo 1}}];
_group0 addVehicle _gun0;
private _unit = [_group0,_pos,_side,"assault",east,"Static"] call DMS_fnc_SpawnAISoldier;
_unit moveInGunner _gun0;
_unit setVariable ["lambs_danger_disableGroupAI", true];
reload _unit;
_unit setUnitPos "UP";
_unit setVariable ["DMS_AssignedVeh",_gun0];
_unit allowDamage true;
_group0 addEventHandler ["EnemyDetected", {
    params ["_group", "_newTarget"];
    diag_log format ["DEBUGGY: ENEMY DETECTED %1",_newTarget];
    if(isNull objectParent _newTarget) then
    {
        _group forgetTarget _newTarget;
        diag_log format ["DEBUGGY: _newTarget %1",_newTarget];
        diag_log "DEBUGGY: FORGOT ENEMY INFRANTRY";
    };
}];

fair drum
#

I'm having a hard time visualizing setVectorDirAndUp especially with things like doing a 30* tilt forward which says it should be [[0,0.66,-0.33],[0,0.33,0.66]]

#

why do I need to change multiple axis when all I want to do is rotate on the X axis?

tough abyss
#

Because you're working with the vectorDir and vectorUp, not axes

fair drum
#

still lost on how to get any result I want and calculating it

tough abyss
fair drum
#

do I think of up as if I'm standing up its where a string from the top my head is pointing?

tough abyss
south swan
fair drum
#

why do I get different values than what the wiki says?

//goal - pitch an object down 30 degrees

_y = 0; _p = -30; _r = 0;
private _wiki = [[0,0.66,-0.33], [0,0.33,0.66]]; //using setVectorDirAndUp
private _math = [[sin _y * cos _p, cos _y * cos _p, sin _p],[[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D];
private _function = [[[0,1,0],[0,0,1]], 0, -30, 0] call BIS_fnc_transformVectorDirAndUp;
[_wiki, _math, _function];

//returns - vector3D
[
[[0,0.66,-0.33],[0,0.33,0.66]],
[[0,0.866025,-0.5],[0,0.5,0.866025]],
[[0,0.866025,-0.5],[0,0.5,0.866025]]
]
south swan
#

Because wiki is derped and 0.33,0.66 is not 30 degrees, probably

#

it's 26.565... degrees :3

fair drum
#

gah i want to be able to figure it out from scratch without using functions but I'm not great at math

south swan
#

oof, a minute timeout for the link to biki. Or is it for two messages with link in a timeframe?

south swan
still forum
#

Which he has already been told.
But now I'm curious, why do you think that? That gets him the key associated with the action, but then what?

south swan
#

"when vanilla keybind is pressed". actionKeys to get a key to check in EH

still forum
#

Is it addUserActionEventHandler? I think that's the name

south swan
#

oh, derp

#

i'm thinking in terms of keyUp/keyDown

still forum
#

Ah now i see, he asked for a way to get the key and not a way to execute code when the key is pressed.
Well should probably move that old code over to the new eventhandlers

trail smelt
#

Hello, I'm trying to synchronize the animation with the sound and display of the intel at the right moment when testing how I can use everything beautifully, but after implementing it into the main script, it falls apart and the character is not able to properly transition into the correct animation.. see the video.
here are the scripts:

pulsar bluff
#

If you're creating an object and then converting to simple object (deleting an object and then creating another), you should just skip the "createvehicle" and go straight to "createsimpleobject"

#

with the chart above, you can see that the higher the simulation cost of the object, the more benefit from simple object state

#

a sandbag wall with "createvehicle + disable simulation" is basically as good as "createsimpleobject"

winter rose
pulsar bluff
#
  • however, that chart was created in editor. the network cost was not measured. i suspect MP is where simple objects really shine, as they have a less frequent network update too
pulsar bluff
south swan
#

and then you tick "Local only" for 100% network cost benefit

pulsar bluff
#

pretty much tick local only for everything not relevant to AI .. a sandbag wall, leave as global .. a desk + chair = local only, etc

trail smelt
sullen sigil
ember pier
#

Still trying to produce radio noise, I think I’m on to something but currently every player can activate the radio noise on the rto when opening their map

#

I have a trigger owner synced to rto

#

With the condition
if (visibleMap) and hasWeapon "vn_b_pack_prc77_01" then {rto say β€œvn_macv_radio_1”};

#

But it gives the error β€˜missing ;’

#

Condition
if (visibleMap) and (hasWeapon "vn_b_pack_prc77_01") then {rto say β€œvn_macv_radio_1"}; gives the error 'missing )’

#

Without hasWeapon every player can activate the trigger, I try to use it so only the player with a radio backpack can activate the trigger

#

Is there a way to make only the player β€˜rto’ be able to trigger the trigger condition if (visibleMap) then {rto say β€œvn_macv_radio_1”}; ?

hallow mortar
#
  • the condition of the if statement is formatted wrong. You need to enclose everything between if and then in one outer set of brackets, if (condition) then {
  • this isn't how you use triggers. The trigger condition is basically an if statement, you don't need one inside the condition. And the trigger activation statement is where the "then" stuff goes, don't put that in the condition
#

A trigger is not really the best way to do this. For example, triggers exist on all clients (or just the server but let's skip that bit for now) so visibleMap is being checked on every machine. You should use an event handler that's only added on the RTO's machine.

kindred zephyr
hallow mortar
#
// in initPlayerLocal.sqf
addMissionEventHandler ["Map",{ // when a map event happens...
  params ["_mapIsOpened","_mapIsForced"];
  if (_mapIsOpened && {player == rto}) then { // check if the map was opened or closed and we are the right player
    while {visibleMap} do {  // we know the map is now open, so as long as it remains so...
      [rto,["vn_macv_radio_1",50]] remoteExec ["say3D"]; // broadcast a positional sound
      sleep 2; // wait the duration of the sound in seconds before doing it again
    };
  };
}];```
ember pier
hallow mortar
#

For what reason?

#

What? Event handlers absolutely work in MP. Who told you they didn't?

real tartan
ember pier
ember pier
hallow mortar
hallow mortar
ember pier
hallow mortar
# ember pier Well I’ll try this first, thanks for the suggestion

If as M1keSK says, sleep doesn't work in this EH, you will need to adjust as follows:

// in initPlayerLocal.sqf
addMissionEventHandler ["Map",{ // when a map event happens...
  params ["_mapIsOpened","_mapIsForced"];
  if (_mapIsOpened && {player == rto}) then { // check if the map was opened or closed and we are the right player
    [] spawn { // create a scheduled scope so we can use sleep
      while {visibleMap} do {  // we know the map is now open, so as long as it remains so...
        [rto,["vn_macv_radio_1",50]] remoteExec ["say3D"]; // broadcast a positional sound
        sleep 2; // wait the duration of the sound in seconds before doing it again
      };
    };
  };
}];```
kindred zephyr
dreamy kestrel
#

general Q: in terms of switch syntax... is this allowed?

switch (_state) do {
case 0: {};
case 1; default {};
};

generally, I know you can string together multiple cases with one CODE body in response. But note that trailing into default. Not sure if that is allowed.
Thanks...

hallow mortar
#

Why would you need to? Just don't define case 1 and 1 will fall into default anyway, that's how default works.

dreamy kestrel
sharp grotto
ember pier
blazing zodiac
# still forum Is it addUserActionEventHandler? I think that's the name

Perfect, this is definitely what I was looking for. I'm reworking a lot of the old exile code (from 2015 - 2017) on a server from when things were a lot less fleshed out in the engine. I'm already wiring up all the custom keybinds into the new Modded Keybinds system (awesome by the way) but I needed to set up a way to save the weapon fire mode when players swap to binos/rangefinders so I still needed to hook into the vanilla keybinds somehow

blazing zodiac
true frigate
#

Hey, is there a quick way of getting the classname of a weapon I've just fired? Say for example if I drop a bomb from a plane. I've looked around the config viewer, but if I'm being honest, I can't find anything and its really quite difficult for me to get my head around haha.
Thanks πŸ™‚

pastel crater
#

I know next to nothing about scripting and triggers. That being said, I'm trying to either find or make a script that will completely heal someone upon entering an area. Just walking in and voila, healing has been done. Found something on the workshop that apparently used a trigger area, but it didn't work when I tested it on the editor.

true frigate
#

Off of this, would I need to get _ammo or _magazine, sorry?

#

Nvm, just tried both, guess I should have done that first really haha, thank you! πŸ™‚

hallow mortar
#

So which one you want depends on what you want to do with the result.

brazen lagoon
#

@winter rose Just putting this in here so you or someone else can edit it into the wiki, but if you're creating modules via script DO NOT USE createAgent it does NOT work the way you expect it to

#

for some reason createUnit will (correctly) not run the init on a runtime-created module but createAgent will run it, but only on the machine where it's created, as far as I can tell?

winter rose
brazen lagoon
#

also noted, will put it there next time

#

also maybe on the page for createAgent

tulip ridge
#

I realized I previously put this in #arma3_ai but:

Is there a mod / way to set placing a backpack (like the deployable mortars) to a keybind?

frank sonnet
#

Was hoping for some good old help with some custom sounds...

Wrote these up for a custom sound, but encountering some errors.
description.ext:

class CfgSounds {
    sounds [] = {};
    
    class crash {
        name="crash";
        sound[]={"sounds\crash.ogg";
        titles[]={};
        };
};

init.sqf:

[] Spawn { 
    
    playSound "crash";
    

Everytime I attempt to load and play the scenario I get two issues:
FileC:\Users\Liam\Documents\Arma 3 - Other Profiles\Monklie\missions\Operations%3a%20Conquistatdor.126map\description.ext, line 1: '/CfgSounds.sounds': '[' encountered instead of '='
and when playing
Sound crash not found

granite sky
#
  1. You have a space between sounds and [].
  2. You have no terminating } after the crash.ogg string.
  3. Your init.sqf has no terminating } for the spawn.
blazing zodiac
#

What's the best way to dump variables to the RPT? Is there a way I could get the variable names as a string without using the preprocessor method? For instance, looping through all the variables in an array and getting the variable names

granite sky
#

I don't understand. Variables in an array don't have names, they have indices.

blazing zodiac
granite sky
#

From what?

blazing zodiac
# granite sky From what?

What I'm looking to do is loop through an array of variables and print them to the RPT in this format: <variable name> : <variable value>

granite sky
#

That sounds very much like a preprocessor task to me.

blazing zodiac
#

Just quote the variables to get their names as strings?

granite sky
#

maybe something like #define VARANDVAL(v) [#v, v]

blazing zodiac
#

Yeah, these don't seem to work in a loop unfortunately. They just print the "_x"

blazing zodiac
granite sky
#

well yeah

#

you'd have to use them when creating the array, like [VARANDVAL(_someVar1), VARANDVAL(_someVar2)]

blazing zodiac
#

At that point I might as well just make it:

[["_varOne", _varOne]]

and avoid the preprocessor altogether

granite sky
#

you can shorten it to VV though :P

blazing zodiac
#

Fair point, but not particularly descriptive

frank sonnet
blazing zodiac
# granite sky you can shorten it to VV though :P

After trying it with

[["_varOne", _varOne], ["_varTwo", _varTwo]]

I definitely agree with you, I think the preprocessor way is cleaner. That gets out of hand real quick! Anyways, thanks for the help!

blazing zodiac
#

Does anyone know of a way to put a primary weapon on your back without making you stand up from the crouched or prone position?

player action ["SwitchWeapon", player, player, 100];
// and
player action ["SwitchWeapon", player, player, -1];

Both of these make you stand up if you're crouched or prone and use them to put your primary weapon away

brazen lagoon
#

nice!

queen marten
#

How would I get the cbrn showers working

finite bone
boreal parcel
#

heyo, why would this work when our mission is unpacked, but once packed into a PBO it stops working?
[this] execVM "arsenal.sqf";

copper raven
jade acorn
#

I'm using ```sqf
player addEventHandler [
"HandleDamage",
{
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];

    private _previousDamage = [_unit getHit _selection, damage _unit] select (_selection isEqualTo "");
    private _newDamage = _damage - _previousDamage;

    (_previousDamage + ((_newDamage * 0.7) min 0.8))
}

];``` to reduce any damage I take, however I'm still being killed with one hit by Hunter HMG or any other turret. Is damage applied more than once if projectile is higher caliber than normal gun or am I missing something?

hallow mortar
#

You can be hit in multiple selections by one shot. A .50 seems like the kind of gun that would do that (although smaller guns can do it too)

jade acorn
#

how would I mitigate this? Like reduce or completely ignore the follow-up damage as long as it's from one projectile

hallow mortar
#

I believe they will (mostly) be processed in some kind of order so you can make a delay before new damage is accepted.

#

maybe combine it with a check on who the last shooter was so if two people shoot at once they still die

boreal parcel
boreal parcel
winter rose
# boreal parcel PBO Manager

yeah well, don't use that
use Eden export
also restart the server after replacing the file so it is not cached

cold quartz
#

Question: When you're playing and the AI is calling out targets, yelling I'm hit and stuff like that, does that only happen when a human player is present?

#

I suppose more relevant to scripting, is it possible to listen for and get a copy of that chat if it does happen?

boreal parcel
#

nvm found it

#

it was in the arma 3 install directory

granite sky
#

@jade acorn Isn't the problem there that the damage value can go way above 1.0?

#

oh, I guess it's still two-shot.

jade acorn
#

min 0.8 in ((_newDamage * 0.7) min 0.8) is supposed to limit the damage from single hit to 80%

granite sky
#

but yeah, multiple impacts per bullet.

#

That's interesting though because it implies that the damage on those selections isn't independent.

long bloom
#
this disableAI "PATH";  
 
this addMPEventHandler ["MPHit", {
 params ["_unit", "_causedBy", "_damage", "_instigator"];  
 
[_unit] joinSilent createGroup EAST;  
_unit allowDamage true; 
    _unit removeAllMPEventHandlers "MPHit"; 
    _unit switchMove "IMS_Die_Spec_1"; 
    _unit playMoveNow "IMS_Die_Spec_1";      
    sleep 6; 
    _unit setDir (getDir player);  
    _unit switchMove "IMS_Crawling_Away_Start"; 
     _unit playMoveNow "IMS_Crawling_Away_Start";    
    sleep 1.4; 
        _unit switchMove "IMS_Crawling_Away"; 
  _unit playMoveNow "IMS_Crawling_Away";   
    sleep 10; 
    if (alive _unit) then { 
    _unit switchMove "IMS_Crawling_Away_Stop"; 
  _unit playMoveNow "IMS_Crawling_Away_Stop";   
    _unit setDamage 1; 
    }; 
    } 
];

Can someone point out the error here? Converting from a regular event handler to MP one and it's just completely stopped working.

No shown errors just continuously shooting the target and nothing happens.

granite sky
#

Given that you have sleeps in an event handler and it's not complaining, I'm guessing that it's not firing at all.

long bloom
granite sky
#

This is with unit damage disabled? Possibly MPHit doesn't trigger on no-damage hits. Not clear from the documentation.

#

If you know the unit's locality then just use Hit.

long bloom
granite sky
#

why are you setting allowDamage true in the handler then?

#

And also:

No shown errors just continuously shooting the target and nothing happens
Shouldn't they be dying at some point?

long bloom
long bloom
granite sky
#

So what's your test case here? SP? localhost? DS+client?

#

I assume the code's in a unit init box given that it has this in it.

long bloom
#

Actually and single player.

#

Didn't work in any of the above

granite sky
#

Did a basic editor test of MPHit in init box, worked fine.

#

Maybe break your stuff down a bit.

#

Use systemChat or diag_log to tell if each step is working.

long bloom
#

Weird.

real tartan
#

trying to get right offset for center position of object in drawIcon3D depending on if it is vehicle, house or unit

// this is close to what I want to achieve
private _pos = [_object, _object modelToWorldVisual ( _object selectionPosition "Spine3" )] select ( _object isKindOf "CaManBase" );

// this shows position on the ground
private _pos = visiblePosition _object;

drawIcon3D ["icon", "color", _pos, ...];

any suggestions ? note, using render position within Draw3D event handler

real tartan
#

so I am also trying to do boundingBoxReal height / 2 for object

#
private _pos = _object modelToWorldVisual [0, 0, abs ( ( ( boundingBoxReal _object select 1 ) select 2 ) - ( ( boundingBoxReal _object select 0 ) select 2) ) / 2];
#

also looking at boundingCenter

proven charm
open hollow
proven charm
#

it's just some type of model center

astral bone
#

Is there a way to change what is display on the map for a unit/vehicle?

ember pier
#

This should be quite simple but I keep running into bracket errors;

_radiosound = rto say "vn_macv_radio_1";    //the sound of the radio
_radiostate = false;                        //the state of the radio

if (radiostate) then                        //happens when radio is on
    {
    rto addAction
        [
            "Turn off radio"
            {
                deleteVehicle _radiosound    //deletes the radio sound
            }
        ];
    _radiostate == false;                    //radiostate is updated
    }

else                                        //happens when radio is off
    {                                        
    rto addAction                            
        [
            "Turn on radio"    
            {
                _radiosound spawn {}        //spawns the radio sound
            }
        ];
    _radiostate == true;                    //radiostate is updated
    };```
winter rose
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
winter rose
#

also you are missing commas.

astral bone
# winter rose not without modding it.

darn- oh also, I had a realization. If it's just for a fun self project, can I use and modify to make new icons from the game's resources? πŸ˜…
I took the civilian plane map icon and messed with it a little- but then I realize now- am I allowed to do this? xD

#

i feel like i am not and i might wanna delete the icon now-
Although it's just for personal use, not like ima use it in a mod pack or something-

winter rose
#

IDK, but I would think so as long as it remains in Arma

astral bone
#

I am also curious if I could add metadata to the paa file. Something to say "Hey, this is not original, just modified"

#

but anyway yea, I made a taxi icon thing :P

winter rose
# ember pier This should be quite simple but I keep running into bracket errors; ```sqf _radi...
private _radioSound = rto say "vn_macv_radio_1";    // the sound of the radio
private _radioState = false;                        // the state of the radio

if (radiostate) then                        // happens when radio is on
{
    rto addAction ["Turn off radio",
        {
            deleteVehicle _radioSound;        // deletes the radio sound - _radioSound does not exist here
        }
    ];
    _radioState == false;                    // radiostate is updated
}
else                                        // happens when radio is off
{
    rto addAction ["Turn on radio",
        {
            _radioSound spawn {};            // spawns the radio sound - _radioSound does not exist here - also DOES NOTHING
        }
    ];
    _radioState == true;                    // radiostate is updated
};
ember pier
#

Ah I thought script within addAction didn't need the ;

winter rose
#

comma ,

south swan
#

; on the last instruction of the script isn't strictly necessary, but is probably a good practice in multiline scripts anyways πŸ€·β€β™‚οΈ

astral bone
#

sometimes ; confuse me. xD

#

hmm- it seems I did not do the icon correctly.

ember pier
astral bone
#

oh and the game crashed xD

#

mission resources are \image\map_icon.paa or image\map_icon.paa?

ember pier
winter rose
#

an underscore-prefixed variable is local to its script anyway

astral bone
#

oh my- something is spamming the log file with "Some of the magazines weren't stored in soldier Vest or Uniform?"

#

Huh- is there a way to check is a texture was able to be loaded?

#

or rather, is there a way to load a texture, then resuse what was loaded. I ask b/c every draw frame it was trying to load the texture, and since it wasn't there, every draw frame, it was sending "Cannot load texture" into the log file

hallow mortar
astral bone
#

fileExists oh?

still forum
#

fileExists got you bro

ember pier
winter rose
#

and, as I commented, your code won't do what you want it to do

astral bone
ember pier
astral bone
#

I may have run into an issue-

#
_color = [1,2,3];
if(count _color < 3)then{
    _color = [1,1,1,1]
};

if(count _color == 3)then{
    reverse _color;
    _color pushBack 1;
    reverse _color;
};
_color;
hallow mortar
#

What is the issue?

astral bone
#

one sec sorry

#

It seems pushBack and reverse aren't being done how/when I want

#

Altho, probably a better way to do what I want-

#

What's the best way to add a value to the end of a table? :P

#

oh wait no im dumb

#

sometimes i like to think im smart 🀀

winter rose
#

don't worry, take a break, have a drink, write what you want to do in human language then write code
other people are as dumb, they are just persistent πŸ˜‰

south swan
#

and take breaks (and drinks) when you don't see us

astral bone
#

i just didn't realize ya could do array set [3,1] xD

south swan
#

O_o

#

the original code seems to insert the value into the beginning, though?

astral bone
#

unless this thing is bein weird, I mean

winter rose
#

or _arr pushBack 1; too?

#

no need to reverse

astral bone
#

I thought it wasn't possible to add to the end easily

#

it was meant to be making a rgb value into a rgba value

south swan
#

pushBack

winter rose
south swan
#

adding to the front is a bit harder, though :3

astral bone
#

123 should become 321, push back with a 1, then reverse again

#

123 -> 321 -> 1321 -> 1231

south swan
#

back is the last element. First element is start

astral bone
#

oh

south swan
#

[1,2,3] pushBack 1 gives [1,2,3,1]

hallow mortar
#

What you're actually doing is:
123 -> 321 -> 3211 > 1123

astral bone
#

right, im even more dumb :P

winter rose
#

dumber*

astral bone
#

exactly

stoic crescent
#

ouch, that's like hitting someone who's already done πŸ˜„

winter rose
#

I admit to shooting at the ambulance your Honour

astral bone
#

awww i can't post images :(

#

wanted to show how horrible my map looks now after I'm done with my debugging xD

south swan
#

preview for image links work, though. You can post is somewhere else (even in DM with some annoying Discord bot) and send the link here, it should show aviator

astral bone
#

I was doing that with gyazo links. but I just tried and got timed out xD

hallow mortar
#

that's what you get for using gyazo

astral bone
#

it is a little weird to me though that ya can't post images. If you're script is doing something weird in game, ya can't show what it is

astral bone
#

several people are typing

hallow mortar
#

It's to stop the meme overflow (and to get people to post code instead of pictures of code). If it's something important there are ways to send images and video, it just takes a little more work.

astral bone
#

yea, but now the gyazo link doesn't work.

astral bone
#

yes, that is it. I tried posting and it timed me out πŸ˜…

#

anyway! So yea, tons of symbols and multicolored and stuff xD

#

[player,"loc_hospital","Test",.1,[1,0.5,0],24,24,true] would give a marker that is like a map/location marker. Puts it at the given object's location, sets the icon to be loc_hospital, text is "Test", and then it's the map zoom you can see it at. Zooming out past .1, it's not drawn. Then there's the color, size x and y, and if the object is "active" or not. Active meaning if it should follow the object's position and rotation

#

Makes a procedural texture, checks if icon is a blank string. if yes, use the procedural texture, if not, it does ([<input>] call BIS_fnc_textureVehicleIcon) call BIS_fnc_textureMarker; and then checks if the file exists. if no, set the color to be pink. Otherwise, use the new texture.
Then, the drawIcon thing uses the color, thus the generated texture is white.

#

do EventHandlers persist between eden editor and single player testing?

#

ah ok, appears that's a no. Yay :P

#

i have realized I was making a new drawing event for each and every icon I made xD

#

Instead I want to check if the icon array is made yet. If not, make the array and the event. Then, add the icon tot he array. If it is made, JUST add the icon to the array

stoic crescent
#

guys I have a question. I'm trying to do something like this in mp:
if (bluefor detects any player from the group) then {do stuff}

so I went to my initServer.sqf and wrote this:

    // this works
        private _plrs = allPlayers - (entities "HeadlessClient_F");
        
    // this doesn't work
    if {(blufor knowsAbout _x) > 0} then {
        hint Str(_x);
        chinookGroup_1 setCurrentWaypoint [chinookGroup_1, 2];
    } forEach _plrs;
astral bone
#

I imagine you'd need to remote execute the hint?

#

oh and the current waypoint

#

weird, setCurrentWaypoint is local-

#

But yea, I'd try to do a remoteExec

#

unless it also doesn't work in single player, in which case- haha- no clue sorry πŸ˜…

winter rose
#

also… no need to repeat the same setCurrentWaypoint operation for each players?

stoic crescent
#

but npcs still don't go to the waypoint

winter rose
#

well, that's because the check is done once

stoic crescent
#

it's in a while loop

winter rose
#

first news

real tartan
#

how to do counter in event handler that runs every frame ?

addMissionEventHandler ["EachFrame", {
    if ( condition) then 
    {
         // if condition is true for 5 seconds, do stuff 
    }:
}];
south swan
#

a) save the previous state of condition
b) if previous is false and current is true - save the time (rising)
c) if the condition is still true when time = saved_time + 5 - do the stuff
πŸ€·β€β™‚οΈ

winter rose
stoic crescent
# winter rose so, your smallest repro code?
while { true } do
{ 
        private _plrs = allPlayers - (entities "HeadlessClient_F");
    
    {if ((blufor knowsAbout _x) > 0) then {
        chinookGroup_1 setCurrentWaypoint [chinookGroup_1, 2];
    }} forEach _plrs;
};

waypoint 2 is "get in" waypoint. Waypoint 1 is "dismissed" if that matters πŸ€·β€β™‚οΈ

#

and I'm not sure how it will work if I will remove "forEach" loop, because I want this waypoint stuff to happen if any of the players were detected

copper raven
winter rose
south swan
#
if (_plrs findIf {blufor knowsAbout _x > 0} > -1) then { // if at least one player is detected
  chinookGroup_1 setCurrentWaypoint [chinookGroup_1, 2];
};```
astral bone
#

can drawIcon use any paa file or does it need to be marked with something or

arctic flax
#

Dont know if this is the right channel but, I got arma 3 working splitscreen with goldberg+nucleuscoop but no mods or dlc load, current launch options are ("-noPause -noPauseAudio -window -noLauncher") and ive tried -mod=@RHS (example) and it doesnt show up in game.

#

I got steam scenarios working by getting the pbo and extracting the folder into the editor.

#

If anyone knows how mods are loaded and if I can get mods/dlc loading without steam or launcher please tell me. EDIT:Know how to load mods via launcher, want a more technical explanation of how mods are loaded.

stoic crescent
stable dune
real tartan
# copper raven make a timer with `diag_deltaTime`
addMissionEventHandler ["EachFrame", {
    private _timer = missionNameSpace getVariable ["MY_timer", 0];
    if ( condition ) then 
    {
        _timer = _timer + diag_deltaTime;
        missionNamespace setVariable ["MY_timer", _timer];
        if ( _timer > 5 ) then 
        {
            // do stuff if condition is true for 5 seconds
        };
    }
    else 
    {
        missionNamespace setVariable ["MY_timer", 0];
    };
}];

can I do better ?

copper raven
#

if ( condition) then {
what condition?

real tartan
copper raven
#

yeah it looks fine, but no need for the set/getVariable

#

in some init script do MY_timer = 0; and simply use that in your frame handler

real tartan
#

small typo, 1st declaration should be private _timer = missionNameSpace getVariable ["MY_timer", 0];

#

getVariable instead of setVariable

#

need to store timer outside of loop (iteration of event) somehow

copper raven
#

huh?

real tartan
#

if I do private _timer = 0; at start of event, it will reset counter every time event runs

copper raven
#

you don't need to use any local variables here

#

put MY_timer = 0; in an init script, and use that in the EH

#

i.e., MY_timer over missionNameSpace getVariable ["MY_timer", 0];

real tartan
#

can I do counter via something more local to player ? want to have different delay per player

copper raven
#

more local?

hallow mortar
#

It will be player-specific, that's a global (scope) variable, not a global (network) variable

real tartan
south swan
#
MY_timer = 0;
MY_delay = 5;

addMissionEventHandler ["EachFrame", {
    if ( condition ) then 
    {
        MY_timer = MY_timer + diag_deltaTime;
        if ( MY_timer > MY_delay ) then 
        {
            // do stuff if condition is true for 5 seconds
        };
    }
    else 
    {
        MY_timer = 0;
    };
}];``` ![blobdoggoshruggoogly](https://cdn.discordapp.com/emojis/748124048025714758.webp?size=128 "blobdoggoshruggoogly")
stoic crescent
copper raven
astral bone
#

fileExists seems to dislike absolute paths- and it seems I need an absolute path for mission icons to work so horray

copper raven
#

mission icons to work so horray
wat? why do you need absolute path for that?

#

mission icons should be in your mission (root)(sub)directory, which you would navigate with a relative path

astral bone
#

It doesn't wanna work with drawIcon

#

I tell it to drawIcon with "Images\aaaa.paa" and it does a pink box. I do it with full path, it works fine.

copper raven
astral bone
#

yes

#

but then I can't check if it exists first so weeeee

copper raven
#

check the relative path?

#

wut?

open fractal
#

that was nonsensical

astral bone
#

I give it relative path. How would it know if it needs to give the rest of the path or not

copper raven
#
private _myPath = "...";
if fileExists _myPath then {
  drawIcon [getMissionPath _myPath, ...
}
#

can't you just do this?

astral bone
#

not if I want to use other icons as well

copper raven
#

well obviously

astral bone
#

icons added by another addon

#

I guess I'd need to do a path thing-

copper raven
#

for them you don't need getMissionPath anymore

astral bone
#

yes, but how would I know if I need it unless I tell it with another parameter?

copper raven
#

store two paths then, virtual and absolute

#

that you then check, and draw if they exist

#

but i don't get it, why would you need to check if they exist?

#

just check if a mod is loaded

astral bone
#

it's drawing on the map. So it'd fill the log file if it didn't exist

copper raven
#

and if it is, add it's paths

astral bone
#

it's not just for a mod tho 😭 supposed to be user friendly, basically xD

#

"Call this function and it will make an icon for ya"

#

what if-

#

What if I make it accept a string and a table for the icon?

#

string is just what it's doing now. But if a table, it will check if 2nd spot exists. If it does, set the icon to be first spot plus second spot

hallow mortar
#

Just so we're clear, when you say table, do you mean array?

stable dune
astral bone
#

after almost 10 years, everything is still a table to me xD

open fractal
#

can you allow for both an absolute path and a relative path and check if the string contains a :?

#

if it's a relative path you can check if the file exists and add the mission path

astral bone
#

Yea, similar thing to what I'm planning on doing

night sundial
#

is there a way to access the cursor via script?

astral bone
#

access in what way

night sundial
#

the weapon cursor. just access it in any way

open fractal
#

access?

copper raven
#

weaponDirection?

stoic crescent
#

Thanks everyone. The problem was in the "dismissed" waypoint. For some reason NPC's don't want to change waypoint from dismissed to any other πŸ€·β€β™‚οΈ

digital sphinx
#

Hey everyone. Is it possible to create own commands? For example, I have this following code:
titleCut ["","White In",0.2]; playSound "OMCameraPhoto";
numberOfPhotos = numberOfPhotos +1;
hint format["You have %1 photos",numberOfPhotos];

Can I make this something simple like "takePhoto"

stoic crescent
digital sphinx
#

Can I do it through Eden editor?

hallow mortar
ember pier
#

So I changed to 'say3D' because it returns an object contrary to 'say', which should be compatible with 'spawn' and 'deleteVehicle'

private _radioSound = rto say3D "vn_macv_radio_1";
private _radioState = false;

if (_radioState) then
{
    rto addAction ["Turn off radio",
        {
            deleteVehicle _radioSound;
        }
    ];
    _radioState == false;
}
else
{
    rto addAction ["Turn on radio",
        {
            _radioSound spawn {};
        }
    ];
    _radioState == true;
};```
However it still returns a variable error with _radioSound
ember pier
stable dune
# ember pier From the comments of Lou I understand that _radioSound is not recognized within ...

One way to do radio is use setVariable, if you want play and stop when you want

_target = rto;
_target setVariable ["music","stop"];
_target addAction ["Play music",
    {
        params ["_target", "_caller", "_actionId"];
        [_target] spawn {
            params ["_target"];
            _time = 100;
            _pos = getPos _target;
            _mySoundSource = "#particlesource" createVehicle _pos;
            _target setVariable ["source",_mySoundSource];
            _target setVariable ["music","playing"];
            [_mySoundSource, ["vn_macv_radio_1",500,1]] remoteExec ["say3D"];
             sleep _time;
            deleteVehicle _mySoundSource;
            _target setVariable ["music","stop"];
        };
    },nil,1.5,true,true,"",    "_target getVariable 'music' == 'stop'", 4,false,"",""];



_target addAction ["Stop music",
{
params ["_target", "_caller", "_actionId"];
_mySoundSource = _target getVariable "source";
deleteVehicle _mySoundSource;
_target setVariable ["music","stop"];
},nil,1.5,true,true,"",    "
_target getVariable 'music' == 'playing'", 4,false,"",""];
hoary saddle
#

Is there a way to assign an inventory crate to a player and restrict everyone else? Im not good with scripting

frail vault
#

is it possible to make a script to give a specific UAV drone a mine detector functionality?

ember pier
#
strdl_radioSound = rto say3D "vn_macv_radio_1";
if !(alive strdl_radioSound) then
{
    rto addAction ["Turn on radio",
        {
            strdl_radioSound spawn {};
        }
    ];
}
else
{
    if (alive strdl_radioSound) then
    {
        rto addAction ["Turn off radio",
            {
                deleteVehicle strdl_radioSound;
            }
        ];
    }
};```
This is what I have now, however: sound is playing on start, and when turned off it can't be turned on anymore
granite sky
#

@frail vault What, like if the drone goes near a mine then it reveals it to a side?

frail vault
granite sky
#

Sounds more like a config editing thing.

stoic crescent
gaunt tendon
#

anyone know how to hide/disable the contact HUD compass?

brazen lagoon
#

can you pass an argument into a select {} expression?

gaunt tendon
brazen lagoon
#

hmm

gaunt tendon
#

how to disable/hid this?

#

preferably a scripting method

copper raven
brazen lagoon
#

say you want to select all classnames with some config value above a dynamically chosen value

copper raven
brazen lagoon
#

oh do they

#

cool

drowsy geyser
gaunt tendon
#

I tested that, kinda works but t disables other stuff too

showHUD [FALSE, true, true, true, true, true, true, true, true];

with this I can get rid of that HUD compass, but also disables HUD GPS/MAP L&R panels

#

I just need the IDD so I can disable it...

#

shouldn't it be listed here?

hallow mortar
#

I am strongly suspicious that that is part of a mod or custom game mode and not one of the vanilla HUD elements

sullen sigil
#

Is there a way to stop a player from swimming while they're underwater? I.E make them walk on the ocean floor

#

My presumption is no however I am often wrong

finite bone
#

maybe experiment with mass of the player?

jade tendon
#

is there any script for spawning "building supplies"?

jade acorn
#

what are "building supplies"

jade tendon
#

H-Barriers, Sandbags walls, Sandbag Bunkers, Camo Nets etc

shut gate
#

Hi, does anyone know of a reliable manner in which a scripted flight path can be played in multiplayer, that doesn't break the entire mission?

I attempted to use unitCapture/unitPlay to do a cinematic intro with two helicopters for a Zeus mission. Unfortunately, there were lots of stuttering and desync issues and even a complete inability to exit the helicopter, soft locking the players.

My method was to initiate the unitPlay inside of the helicopter init with this:

[_this, flightdata] spawn bis_fnc_unitPlay;

I was then hitting OK with it set to global exec in the Zeus interface. I would not be surprised if this approach is wholly wrong somehow. flightdata would be the pasted data from the unitCapture but it's far too long to post here.

This works flawlessly in the editor but on a dedicated server the above desync/soft locking issues happened. I would just like to know if this is the nature of the function or if there's a better alternative. Thanks :) I am super novice regarding anything SQF and arma scripting btw.

winter rose
#

initiate the unitPlay inside of the helicopter init with this
don't do that - otherwise all the machines are trying to do this, creating the stutter
only the server should run that

#

try

if (isServer) then { [_this, flightdata] spawn bis_fnc_unitPlay; }; // _this, or β†’this←?
```@shut gate
shut gate
#

would you say this can be run via the execute code module in the zeus interface, or should i put it in a sqf file? would it make a difference?

#

thank you by the way I will test asap

winter rose
shut gate
#

thank you regardless

ember pier
# ember pier ```sqf strdl_radioSound = rto say3D "vn_macv_radio_1"; if !(alive strdl_radioSou...
strdl_radioOff = true;
rto addAction
[
    "Turn on radio",
    {
        strdl_radioSound = rto say3D selectRandom //random sound for variation
            [
            "vn_macv_radio_1",
            "vn_macv_radio_2",
            "vn_macv_radio_3",
            "vn_macv_radio_4",
            "vn_macv_radio_5",
            "vn_macv_radio_6",
            "vn_macv_radio_7",
            "vn_macv_radio_8",
            "vn_macv_radio_9"
            ];
        strdl_radioOff = false; //updates radio state
    },
    nil,
    1.5,
    false, //prevents action always on mouse
    true,
    "",
    "(strdl_radioOff)", //condition for action to show
    50,
    false,
    "",
    ""
];
rto addAction
[
    "Turn off radio",
    {
        deleteVehicle strdl_radioSound;
        strdl_radioOff = true;
    },
    nil,
    1.5,
    false,
    true,
    "",
    "!(strdl_radioOff)",
    50,
    false,
    "",
    ""
];```
After a good night of sleep I managed to figure something out πŸ˜…
#

It works but I'm curious if it could be more compact, or otherwise improved

pulsar bluff
scenic shard
#

how can I get a list of all groups from a specific side that is within X meters of a another group?

I could loop through allGroups, but that feels very inefficient so there must be some better way.

gaunt tendon
scenic shard
#

ah alright, thank you both!

tough abyss
#

Hello, i have some question of Arma III Multi Player server, I try to the Trigger event get be attribute to the Arma III Multi Player host server but can't setting of i wanted, So how possiable server forcitiy getting Trigger event active authority?

kindred zephyr
fair drum
tough abyss
#

If a user other than the host touches a trigger on the server, it does not work

fair drum
tough abyss
#

No, I want the server host to work, but I want the users who connect to the server to work when they touch the trigger However, I'm making an SQF file, but I don't know how to make an SQF file script

tough abyss
#

I've been referring to that wiki, but it's not working properly, so I'm here to get script advice I made initServer.sqf and initPlayerServer.sqf related to the server, but it didn't work properly, so can I see an example of that?

kindred zephyr
# tough abyss No, I want the server host to work, but I want the users who connect to the serv...

By any chance, is the checkbox in the trigger attributes called "Server Only" ticked?
If it is, that might be your issue, other than that, I can think that:

a) your trigger is not repeatable

b) your activation parameters are not correctly set-up

of

c) your code is not MP compatible

For any doubt regarding triggers you can check this link to the wiki itself

https://community.bistudio.com/wiki/Eden_Editor:_Trigger

tough abyss
#

Triggers are checked for server only and repeat is also checked However, I created init.sqf with the SQF file to be applied to the trigger, but it didn't work properly, so I'm fixing the script But it's not working properly

To list the problems,

  1. Trigger does not recognize you
  2. SQF files are being produced to properly recognize the user
    I don't know if I'm making it properly

This is the script code inside the SQF file that I'm currently making ↓↓↓

{
    updatingPlayerConnected = false;
    playerConnected = addMissionEventHandler ["PlayerConnected",
    {
        _this spawn
        {
            params ["_unit", "_id", "_uid", "_name"];
            waitUntil {!(allPlayers select {getPlayerUID _x isEqualTo _playerUID} isEqualTo [])};
            _playerObject = allPlayers select {getPlayerUID _x isEqualTo _playerUID} select 0;
            waitUntil {!updatingPlayerConnected};
            updatingPlayerConnected = true;
            _globalServerVariable = missionNamespace getVariable ["globalServerVariable",[]];
            _globalServerVariable pushBack [_playerID,_playerUID,_playerName,_playerObject];
            missionNamespace setVariable ["globalServerVariable",_globalServerVariable];
            updatingPlayerConnected = false;
        };
    }];
};


\\\\\\\\\\\\\\\\\


addMissionEventHandler ["HandleDisconnect",{
    params ["_unit", "_id", "_uid", "_name"];
    _unit = _this select 0;
    deleteVehicle _unit;
}];
valid abyss
#

is there any way to open a crate and have the crate locally load gear?

south swan
valid abyss
#

thanks

lavish stream
hollow plaza
#

Hey, here's a smaller/snipped version of a script I have which should simply add a marker on all units, but it throws the error "Error Type Any, expected Number". I'm presuming the eventHandler doesn't like being used with the _x variable, but how would I go around/fix this issue.

 drawIcon3D ["\A3\ui_f\data\map\groupicons\selector_selectedEnemy_ca.paa", [1,0,0,1], [getPosATL _x select 0, getPosATL _x select 1, (getPosATL _x select 2) + 1.3], 1, 1, 45];  
}];  
} forEach allUnits;```
south swan
#

_x isn't defined inside the EH

#

you either need to move {} forEach loop inside the EH, or you need to pass the _x variable into the EH via its argument

hollow plaza
#

I presumed as much, but currently I just can't put my finger on how to do so, as EHs are a completely new thing to me.

lavish stream
#
addMissionEventHandler ["Draw3D", {
    {
        drawIcon3D ["\A3\ui_f\data\map\groupicons\selector_selectedEnemy_ca.paa", [1,0,0,1], [getPosATL _x select 0, getPosATL _x select 1, (getPosATL _x select 2) + 1.3], 1, 1, 45];
    } forEach allUnits;
}];
hollow plaza
south swan
#
// or

{ addMissionEventHandler ["Draw3D", {
 private _x = _thisArgs#0;  
 drawIcon3D ["\A3\ui_f\data\map\groupicons\selector_selectedEnemy_ca.paa", [1,0,0,1], [getPosATL _x select 0, getPosATL _x select 1, (getPosATL _x select 2) + 1.3], 1, 1, 45];  
}, [_x]];  
} forEach allUnits;```
hollow plaza
copper raven
digital sphinx
#

I have this piece of code:

    if (!(newTicker in tickerNews) and newTicker != "") then { tickerNews = tickerNews + [newTicker]; };
}; ```

In another function, I want to define a new `newTicker` each time a task is succeeded. However, I want to do this dynamically based on the task/trigger names instead of manually adding it. Is it possible to do something similar? Can I make up my own config file which maps strings to other strings then use it here? (Sorry I am very new to all this)
#

This is literally my second day in dabbling Arma 3 scripts so please explain to me like I am an idiot πŸ™‚

#

or should I use HashMap for this as I already know the task names?

stoic crescent
#

Can anyone explain why pushing all blufor groups in array leads to array length bigger than actual count of blufor groups in editor? God I'm getting stuck on such simple stuff and it drives me insane.

  private _entireWestSide = []; 
  { 
   if (side _x isEqualTo blufor) then { 
    _entireWestSide pushBack _x 
   } 
  } forEach allGroups;
copyToClipboard Str(_entireWestSide);

so I paste the result in some txt file and get this result:

[B Alpha 2-4,B Alpha 1-2,B Alpha 1-3,B Alpha 1-4,B Alpha 1-5,B Alpha 1-6,B Alpha 2-1,B Alpha 2-2,B Alpha 2-3,B Alpha 1-1,B Alpha 2-5]

but the actual amount of groups in editor is 9

#

it's not even 9, it's actually 4 because radar and defenders AA's are grouped as well

hallow mortar
#

It's possible there is one extra group which is the side HQ unit - an invisible rifleman created at [0,0,0] for the game's internal use.
It's also plausible that some groups were created for the turret AI and not actually deleted when you regrouped them.

tough abyss
#

Well, and for another thing, you could simplify it down to a simple array select:

private _entireWestSide = allGroups select {side _x isEqualTo blufor};
copyToClipboard str _entireWestSide;
hallow mortar
#

Don't forget you can inspect the mission.sqm in a text editor to see all the groups the game thinks actually exist at mission start. (Any group which is not present in mission.sqm but appears when the mission is played, is one that's created post-start by a mod or script)

#

You can also use units to see what all those groups actually contain

real tartan
#

can I play sound that is probably not defined with class, but exist in game and I know path ?
for example, want to play "A3\Sounds_F\arsenal\weapons_static\Missile_Launcher\Locking_Titan.wss" with playSound command

#

to be local to player only

hallow mortar
real tartan
#

I was already checking playSound3D in mean time, and since 2.06, there is last param

local: Boolean - (Optional, default false) If true the sound will not be broadcast over network
#

so I will use that probably

jade acorn
#

when I disable simulation of ModuleSmoke_F the smoke stops to generate (what I want to achieve), however sound from the smoke grenade is still emitted. Can I somehow mute the emitted sound or destroy the emitter without deleting the grenade or module itself (and placing new one later)?

stoic crescent
hallow mortar
#

Yes, UAVs all have their own groups that aren't normally visible in the Editor (every unit is in a group and UAV AIs are units). You can make them appear by giving them waypoints.

willow hound
jade acorn
#

I did that and module itself doesn't have any sound parameter as it spawns a grenade that produces the smoke grenade sound. disabling simulation on the module disables creating smoke particles from the grenade but not the sound

willow hound
cold mica
#

is there a way to make the default value of a param the value of another param?

For example

params ["_element1", ["_element2", str _element1]];

Above example is what I want to do but it is incorrect.

hallow mortar
#

using {str _element1} might do it. If not, you can pretty easily do this outside of the params itself:

params ["_element1", ["_element2", objNull]];
if (isNull _element2) then {
  _element2 = str _element1;
};```
cold mica
#

yeah, I did that workaround. Just curious if there was a cleaner way. Thx

night sundial
opal zephyr
#

Could anyone help my figure out why this script is running on mission start instead of when I activate it?
player addAction ["Load Objects", call J3FF_fnc_LoadObjects, nil, 999, false, true];

#

The call seems to be happening on the mission loading in and then wont call any time I try and activate it

#

problem solved, needed to add {} surrounding the script bit

jade tendon
#

How can i alter this to include editor placed roads?

private _roads = [worldSize/2,worldSize/2] nearRoads worldSize;
hoary saddle
south swan
#

"Local Effect" means the change only happen on the client (or server) where you run that specific script on.
"Global Effect" means the change would be replicated on all machines (client and server) in the mission automagically.
If you use local effect inventory commands (like https://community.bistudio.com/wiki/addItemCargo) on client, the items added would only be present on this specific client. And no other machine (client or server) would be able to (directly) interact with them (to see them in the inventory or take them away).

pulsar rose
#

Can i run arma 3 in this system?
CPU: Intel(R) Core(TM) 13-6100 CPU @ 3.70GHz
RAM: 3971 megabytes
GPU: Intel(R) HD Graphics 530
GPU RAM: 1985 megabytes
OS: Windows 10 (10.0.0) 64bit
Threads: 4 logical processors
Version: 65786

south swan
#

even has the same typo

tough abyss
#

not scripting related, either

south swan
#

and googling that same configuration word-to-word including the typo gives at least two instances of the same question on different websites. In Persian if i believe google translate. blobcloseenjoy

#

is this some kind of meme?

south swan
#

go to #arma3_questions, please, the answer to your question is literally less than a screen away from the bottom now

digital sphinx
#

Anybody has experience with using scripts of TPW mods in a singleplayer mission? Whenever I try to execvm tpw_core.sqf I get undefined variable in expression _x in several places.

For example first line of this piece of code:

            {
            tpw_core_hats set [_i, -1];
            };
        } foreach tpw_core_blacklist;```

Any ideas what could be the problem?
hallow mortar
#

Is there a { before that line? One is required for that forEach to be complete, which is what makes _x work.

Otherwise I might suspect that tpw_core_blacklist has not been defined; you would probably have to consult the mod's documentation to find out what that's supposed to be.

#

If tpw_core_blacklist needs to be user-defined it's a little odd that they didn't make a fallback for if the user didn't do that, instead of letting it just script error, but hey ho

digital sphinx
#

Aah, it might be about the parameters I am using to call it, I will test now

#

Yes, it is user defined through parameters and I wasn't putting anything. Thank you!

#

That solved this problem and now I have a new one XD

hallow mortar
#

As is tradition

stable dune
#

Hi
Is there command to check if explosion has done damage via

this addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
}];

I know, i have already explosion EH, but if i want add like specific gun (_projectile == "big gun ammo") EH, do i thought if i could attach these both in same EH / check these in one

hoary saddle
south swan
#

define "go off"

#

code runs on a machine you run it on. And code with local effect only changes game world state on machine it runs on.

magic sundial
#

I have this set to an eventhandler for 'man', when he gets hit, it runs this script. my problem is that when he gets hit, it's not checking the damage but if the unit dies then it works. Really confused as to why

if (_dammage > 0) then {
    
    hint "Ouch! Ive stopped";
    man allowDamage false;
    man setDamage 0;
    man disableAI "PATH";
    sleep 20;
    hint "I'm moving again";
    man allowDamage true;
    man enableAI "PATH";
};```
winter rose
magic sundial
#

i seee thank you ill fix that, but still the first hint shjould still show everytime the man is hit, but it doesnt, only when the unit dies

digital sphinx
#

I am trying to use TPW scripts for a SP mission and this part of the code seems to be not working as intended:

        {
        if (isClass ((_cfg select _i) ) ) then 
            {
            _cfgName = configName (_cfg select _i);
            if ( (_cfgName isKindOf "camanbase") && {getNumber ((_cfg select _i) >> "scope") == 2} && {[_str,str _cfgname] call BIS_fnc_inString}) then 
                {
                tpw_core_civs set [count tpw_core_civs,_cfgname];
                };
            };
        };        ```
I tracked down the problem until `tpw_core_civs ` and it seems it doesn't change at all here. What could be the problem?
magic sundial
magic sundial
#
execVM "hitStun.sqf"; 
}];```
#

Did this because i thought i could add sleep in

south swan
#

singleplayer or multiplayer?

magic sundial
#

Just to remove ai pathing for a little time and make them invincible

#

coop

#

so multiplayer

south swan
#

where is the eventhandler added?

#

on the same client/server where the man is at?

magic sundial
#

on the object init

#

via editor

#

guessing clientside

south swan
#

is the same object assigned man variable name?

magic sundial
#

yep

south swan
#

seems to work on my machine. If poor bastard isn't killed instantly - he gets healed and immune to damage πŸ€” What's your result and what are you expecting?

magic sundial
#

my result is that when i hit the guy, it doesnt trigger the if statement

#

only when i kill the guy

south swan
#

O_o

magic sundial
#

so im suuper confused cos like theres no reason for it to not work

south swan
#

"hit the guy" as in "bullet to the knee"?

magic sundial
#

yea

#

bullet anywhere but head

#

cos usually head just kills

#

like any wounding shot

#

i do have mods on, not sure if thats impacting it

#

tried this ```private _dammage = getDammage man;
if (_dammage > 0) then {

hint "Ouch! Ive stopped";
man setDamage 0;

};``` and still same effect

#

like im confident there are no errors in this

#

idk if bug or something

south swan
#

maybe add some systemChats inside the EH body and script file. See if EH get executed at all. See if file gets executed at all. See if damage on the unit actually changes. Or maybe even use diag_log instead of systemChat if you test the stuff on the dedicated server πŸ€”

magic sundial
#

Yea ok so the EH is working properly

#

Just not the contents of the script???

#

script gets called

#

Something with the If statement or how _dammage is setup

south swan
#

πŸ€·β€β™‚οΈ change it to if (true) then { and see if the rest gets called

magic sundial
#

yep ok that works

#

so something to do with getDammage as a getter?????

warm hedge
#

Are you sure that the man is the object?

south swan
#

and not group

magic sundial
#

cant send a screenshot proof but yes

warm hedge
magic sundial
magic sundial
#

i think you're right i did man wrong somehow

#

but it worked for you @south swan ?

south swan
#

literally copied from the chat into file/mission and run like that

magic sundial
#

yea idk

hallow mortar
#

Don't forget you can use a handleDamage EH rather than hit to nullify incoming damage, preventing the unit from being accidentally killed instead of stunned

#

It might be worth trying a different variable name for your unit. man is a pretty generic name and it's possible some other script is also using and overwriting it.

magic sundial
#

ill look into handleDamage, thank you for that

magic sundial
stable dune
magic sundial
#

Yes

#

ace medical clash?

stable dune
#

Then you need use ace damage

#

That could be one, not sure, but some times ace does things what you do not know

south swan
#

ACE Medical does indeed override all vanilla damage with 0. Not sure about interaction with vanilla "Hit" EH, but it's likely to conflict

stable dune
#

But that should work because i use ace and i have in script

(getdammage (driver bombcar1)) >0.5)

And that works

magic sundial
#

Mmm im readin on a Ace medical handleDamage

#

but it seems even they use it

#
player setVariable ["ace_medical_allowDamage", true];
    
// set damage head
player spawn {
    _damageHead = (player getHitPointDamage "HitHead") + (player_damage select 0);
    [player, _damageHead, "head" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};
    
// set damage body
player spawn {
    _damageBody = (player getHitPointDamage "HitBody") + (player_damage select 1);
    [player, _damageBody, "body" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};
    
// set damage right arm
player spawn {
    _damageRArm = (player getHitPointDamage "HitRightArm") + (player_damage select 2);
    [player, _damageRArm, "hand_r" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};

// set damage left arm
player spawn {
    _damageLArm = (player getHitPointDamage "HitLeftArm") + (player_damage select 3);
    [player, _damageLArm, "hand_l" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};

// set damage right leg
player spawn {
    _damageRLeg = (player getHitPointDamage "HitRightLeg") + (player_damage select 4);
    [player, _damageRLeg, "leg_r" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};

// set damage left leg
player spawn {
    _damageLLeg = (player getHitPointDamage "HitLeftLeg") + (player_damage select 5);
    [player, _damageLLeg, "leg_l" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};``` this for example
south swan
#

player_damage is not damage player, though

magic sundial
#

yea thats fair

#

trying without ace

finite bone
#
_bodyPart = ["Head", "RightLeg", "LeftArm", "Body", "LeftLeg", "RightArm"] selectRandomWeighted [0.47,0.69,0.59,0.55,0.61,0.58];
_dmgType = selectRandom ["backblast", "bullet", "explosive", "grenade", "burning", "falling"];
[player, _damage_you_need, _bodyPart, _dmgType ] remoteExec ["ace_medical_fnc_addDamageToUnit", player];```
#

this way you avoid locality issues

magic sundial
#

Wow, thank you

south swan
#

now that i actually think, damage/getDammage are pretty goddamn sure to get screwed by the ACE Medical

magic sundial
#

Yea ngl the more i think about it and read into it i think you're righ

finite bone
#

what is it are you trying to achieve exactly?

south swan
magic sundial
#

When an object health gets too low, they will not take damage, reset their health and disable PATH for like 20 seconds or so, then enable damage and enable PATH

#

So like they're stunned

#

like monster chasing after you, you shoot, instead of kill it stops for a bit

#

so you can run away before it comes and gets you agaion

#

ok even disabling ace didnt work, still the same issue

finite bone
#
_object addEventHandler ["Hit", {
    _unit=_this#0;
    _obj_current_health = damage _unit;
    if (_obj_current_health < 0.2) then 
    {
        _unit allowDamage false;
        _unit setDamage 0;
        _unit disableAI "PATH";
        sleep 20;
        _unit allowDamage true;
        _unit enableAI "PATH";
    };
}];
magic sundial
#

man setDamsage 0; this is all im running in the sqf now

#

Obvs setDammage 0;

magic sundial
finite bone
magic sundial
#

according to Lou who mentioned it previously

#

Because what you wrote was essentially what i originally had before i gutted everything to try and debug

finite bone
#
_object addEventHandler ["Hit", {
    _unit=_this#0;
    if (damage _unit < 0.2) then 
    {
        _unit spawn {
            params ["_unit"];
            _unit allowDamage false;
            _unit setDamage 0;
            _unit disableAI "PATH";
            sleep 20;
            _unit allowDamage true;
            _unit enableAI "PATH";
        };
    };
}];
finite bone
magic sundial
#

Riiiiight

#

Testing it now, first test worked

#

nvm, still being damaged through the 20s grace period

finite bone
#

you'll probably need to add in another check to see if it already has a spawn running

south swan
#

if ACE Medical is still in use - it can disregard vanilla setDamage πŸ€·β€β™‚οΈ

magic sundial
#

im not using Ace for the moment

#

original probelm persisted even with it not enabled

#

im having trouble adding another check to spawn, im pretty new sorry

finite bone
#

Consider this example ```sqf
_hp_curr_object = damage _unit;
_object setVariable ["object_dmg_total", 0];
_object setVariable ["object_dmg_increase", _hp_curr_object];
_object removeAllEventHandlers "hit";
_object addEventHandler ["Hit", {
_unit=_this#0;
_object_curr_dmg = (_unit getVariable "object_dmg_total") + (_unit getVariable "object_dmg_increase");
_unit setVariable ["object_dmg_total", _object_curr_dmg];
if ((_unit getVariable "object_dmg_total") > 0.8) then
{
_unit spawn {
params ["_unit"];
_unit setDamage 0;
_unit disableAI "PATH";
waitUntil { diag_tickTime > 20 + diag_tickTime};
_unit enableAI "PATH";
};
};
}];
_object removeAllEventHandlers "Handledamage";
_object addEventHandler ["Handledamage", {0}];

magic sundial
#

ohh add a check to see if its in a handler

#

ill give this a go

finite bone
#

wait

#

before u try this

#

understand what it does

magic sundial
#

ok

#

so removing prior handlers

south swan
#

_unit setVariable ["object_dmg_total", _object_curr_dmg]; doesn't need a second set of "

magic sundial
#

then its

finite bone
#

this will prevent the object from getting any damage until the damage threshold has reached and then kill the unit if so

magic sundial
#

gimme a sec while i formulate an answer

#

Yea its setting damage to 1 if it goes over

#

but 1 is dead isnt it?

#

Like this is checking if theres overkill then reducing it to 1?

#

Thats my understanding of it

#

Ohh so you modified the threshold now

#

To being the desired health

#

This seems a lot more robust

#

too

#

Only thing i dont understand is the handle damage EH

#

oh wait thats literally the EH

#

nvm

finite bone
#

modified it with sleep waitUntil

magic sundial
#

i seeee, diag_tickTime is a timestamp

tough abyss
#

If the goal is to override damage I'm not sure why the Hit EH is being used instead of HandleDamage

finite bone
#

a slightly better code i guess - dont know if waitUntil can run inside EH unlike sleep which requires spawn

tough abyss
#

waitUntil requires a scheduled environment, just like sleep

#

anything that suspends the execution environment needs to be scheduled

finite bone
#

then off to spawn we go LUL

magic sundial
#

haha

magic sundial
finite bone
#

but true handle damage can be used in more robust way

tough abyss
#

I would go for HandleDamage instead

#

if it wasn't working before, it's not because HandleDamage won't work for this - something else was wrong.

#

Overriding the damage value w/ the Hit EH is an easy way to end up with weird behavior

magic sundial
#

I think its what we're exploring now

#

I do have to sleep right now but i want to say thank you to everyone who jumped in on this, i really really appreciate it and actually learnt a few things

#

such an amazing community

#

Will try again soon and maybe rethink on how to do the problem in the first place

finite bone
#

oh while you are here @tough abyss - the article problem still persists kmao

tough abyss
#

ah I see

finite bone
#
if (_enable_diary) then 
        {
            if (!_tempvar && {_sides isEqualTo []} && {_groups isEqualTo []} && {_players isEqualTo []}) exitWith {
                ["ERROR - Select a side/group/unit"] call zen_common_fnc_showMessage;
            };
             // waitUntil { not isNull player };
            // if (((side player) in _sides) || ((group player) in _groups) || (player in _players)) then 
            {
                // if !(local _x) then { continue };
                _x createDiaryRecord
                [
                    "diary",
                    [
                        _diary_title,
                        format ["<execute expression='
                        [] spawn 
                        {
                            disableSerialization;
                            [
                                [
                                    [""title"", ""%1""], 
                                    [""meta"",[""%2"",""%3"",""%4""]],
                                    [""textbold"",""%5""],
                                    [""image"",[""%6"",""%7""]],
                                    [""text"",""%8""],
                                    [""textlocked"",[""%9"",""%10""]],
                                    [""author"",[""%11"",""%12""]]
                                ],findDisplay 46,true
                            ] call bis_fnc_showAANArticle;
                        }
                        '>""AAN Article""</execute>", _title, _editor, _new_date, _timezone, _subhead, _main_img, _main_img_desc, _body, _body_locked, _lock_msg, _editor_img, _editor_info]
                    ]
                ];
            // };
            } forEach ((call CBA_fnc_players) select {(side _x) in _sides || {(group _x) in _groups} || {_x in _players}});
``` this does not seem to work and returns the 'empty' diary record thread.... 
essentially im trying to make this diary record only for players/groups/side
tough abyss
#

I see

#

firstly, you'll want to format your if statement differently if you want short-circuit eval to be most efficient

#
if (!_tempvar && {_sides isEqualTo [] && {_groups isEqualTo [] && {_players isEqualTo []}}}) 

^ like so

#

notice each consecutive condition after the first is nested in the previous {}

still forum
#

isEqualTo is cheap, lazy eval might make that more expensive

tough abyss
#

yeah good point

#

if you're going to do lazy eval in general, though, the way I presented is usually the most efficient iirc

#

now, as for why it's not working...

#

I'm going to assume you have _enable_diary and _tempvar set to true for this testing, yes?

finite bone
#

enable diary yes, tempvar is false - essentially yes the variables defined work as expected (with the initial if statement going through)

tough abyss
#

well, I guess _tempvar doesn't matter as long as the sides, groups, and players aren't empty

#

yeah alright

#

Does it work as expected without the forEach? I seem to remember it working fine when it was on its own.

finite bone
#

yes when i run it as player createDiaryRecord locally it works fine

#

oh and its running on if (!hasinterface) exitwith {};

#

should i perhaps run it in server with remoteexec sqf?

south swan
#

trying to create a diary record for remote player with _x createDiaryRecord still sounds iffy

tough abyss
#

yeah createDiaryRecord has local argument

#

this is something you'd want to run serverside

#

so really your check should be if (!isServer) exitwith {};

#

and then do some remoteExecs for each player

#

like I expressed last time, it would probably be a good idea to have that entire "createDiaryRecord" code chunk in a function called fnc_createRecord or something similar

#

then define that in cfgFunctions and remoteExec that for each player

finite bone
#

i did try that too with #include path to your functions.hpp

tough abyss
#

I remember you trying it with an #include but I don't recall writing an hpp

#

either way it'd be best to not beat around the bush and just put it in a cfgFunctions proper

#

having a .hpp is unnecessary

#

either that, or, you can just go the somewhat gross route of remoteExec'ing the entire block as a call

#

but that's not exactly network-friendly and is unnecessarily gross

#
class CfgFunctions
{
    class ELP
    {
        class functions
        {
            tag = "ELP";
            file = "\PBOName\functions";
            class createRecord {};
        }
    }
}

can be as simple as this in a config.cpp, would just need to replace PBOName accordingly

#

then can call the function as ELP_fnc_createRecord from the functions dir in the PBO

#

file as \PBOName\functions\fn_createRecord.sqf

finite bone
#

ah great

kindred zephyr
# hoary saddle Does it just go off the first person that accesses that inventory to assign it l...

it depends in the grand picture of what you are trying to achieve, filling them locally will just fill them when the command is executed for them, if you want to constantly add stuff for example, when you open or close the box, you can probably use event handlers for those. Now, if the purpose if to fill the box arbitrarily for everyone at the same time but only let them have their own inventory for example, you remote execute the function which you will prepare to fill them all, everyone will see the inventory which will be local to each and wont sync to a player. Alternatively, a "local only" box will only show inventory relevant to the player using it, as it doesnt syncs over the network

finite bone
#

the sqf is being executed proper but the display is not

finite bone
#

for ref

tender fossil
#

Note: Arma 2 OA! What does actually happen if I use callExtension in scheduled context? Does the game jump into unscheduled context because it's calling an extension or can it handle the extension call in scheduled context? (My extension is already working but it's causing heavy lags for players and on server despite of being executed in scheduled context, so that made me wonder about it)

south swan
#

This command is blocking, meaning that the game will wait for the extension to return before continuing.
makes me think it overrides the scheduler totally and can cause waits longer than the maximum allowed script time allowance πŸ€”