#arma3_scripting

1 messages · Page 230 of 1

thin fox
#

did you check rpt file?

past wagon
#

I'll check rn

thin fox
#

those black boxes always hides the main problem

old owl
#

You'll need it to be like this 🙂

-private _type;
+private "_type";
past wagon
#

ah'

#

thanks

#

so any time I initialize a variable like that without defining it, it should be a string?

faint burrow
#
private _type = if (condition1) then {
    if (condition2) then { "string1" } else { "string2" }
} else { "string3" };
old owl
# past wagon so any time I initialize a variable like that without defining it, it should be ...

Yea or alternatively if you have multiple in the same scope you could also do it like this:

private ["_var1", "_var2", "_var3"];

All comes down to preference but I typically like to always initialize my variables with a value, even if it's some default like -1 or "" just to ensure error handling wise nothing is ever approached with nil.

A way you could incorporate this if you vibed with it as well could be like this:

private _type = switch true do {
    case condition1: {"string1"};
    case condition2: {"string2"};
    default {"string3"};
};

_veh = createVehicle [_type, _loc, [], 0, "CAN_COLLIDE"];

Again all sorta just comes down to convention though, so whether you wanna adopt that is entirely up to you :)

past wagon
#

thanks

tulip ridge
old owl
arctic bridge
#

I was messing with the setUnitTrait function and tried to tweak the staminaDrainCoef value as listed on the wiki (https://community.bistudio.com/wiki/setUnitTrait).
After checking with getAllUnitTraits though I found it just... wasn't there? Anyone else run into this?

cosmic lichen
#

This is not on stable yet

winter rose
#

we ought to make it 5em I guess

#

yeah better

warm hedge
#

*bigger

winter rose
#

🔥 \o/ 🔥

zealous solstice
winter rose
#

at this point all I need is to make the text smaller

edgy dune
dawn shell
#

got a fpv drone scirpt to work 100% hit crash into tanks and uintis vibe codes but hey it works. i got a problem tho the drones in zeus is ai cant do waypoints so cant patrol anyway to fix that?

agile pumice
agile pumice
#

also wondering how I can cut down on "refused a packet" rpt spam

split ruin
arctic bridge
static grotto
#

hey, i am trying to get a lil script to work with the optre odst pod module, it works in eden mp/sp but as soon as it goes onto a server in a mission file it stops working. I am very new to arma scripts so i am unsure where I am going wrong.

this addAction ["Prep Reserves for Launch", {missionNamespace setVariable ["Prep Reserves for Launch", true, true];}]; - Console interact

!isNil "Prep Reserves for Launch" - Trigger linked to module

I am assuming this is the issue? missionNamespace setVariable

#

The console is set to enable simulation

tulip ridge
#
  1. Prefix your global variables
  2. Spaces in variable with setVariable probably causes issues
static grotto
#

no way dart is gonna save me again

#

dart ur actually the realest one ever

#

sorry im dense could u fix it n send it

#

i am not sure what u mean

tulip ridge
#

All global variables should have a "prefix" so you don't accidentally conflict with other mods, e.g. AF_...

Second bit is to just remove the spaces in your variable name

static grotto
#

remove spaces in "Prep Reserves for Launch" ?

tulip ridge
#

In the setVariable bit yeah, it takes a variable name, the value, and then which machines to set the variable on

#

!isNil "Prep Reserves for Launch"
Also this isn't actually checking if the variable is set true, it's just checking that it's defined

So if you did missionNamespace setVariable ["...", false] it would still trigger

static grotto
#

oh lord

#

this is what i get for googling and slapping tg lol

#

can the prefix be anything?

tulip ridge
#

Yeah, just something unique to you / the mission / the mod (depending on whatever you're doing / your preference)

I used AF for "Aluminum Foil" as an example

static grotto
#

this addAction ["Prep Reserves for Launch", {missionNamespace setVariable ["AF_PrepReservesforLaunch", true, true];}];

#

!isNil "PrepReservesforLaunch"

#

this would be good?

tulip ridge
#

setVariable is a command, you'd add the prefix to variable name, e.g.

missionNamespace setVariable ["AF_PrepReservesforLaunch", true, true]
static grotto
#

ahhhhh my bad

#

edited

#

that be good?

tulip ridge
#

And then for the trigger, you'd check:

missionNamespace getVariable ["AF_PrepReservesforLaunch", false];

Which uses the value of AF_PrepReservesforLaunch in mission namespace, and defaults to false if the value isn't defined

static grotto
#

ok

#

and final question

#

Would putting it in a comp affect it at all?

#

like it wouldnt break from being put in diff missions?

tulip ridge
#

Shouldn't, since you're not using like variable names of objects

static grotto
#

ok, thank you as per usual dart you have saved my ass 🫶

static grotto
#

it no worky

#

:(

tulip ridge
#

Define "it no worky"

static grotto
#

like

#

it doesnt work in the mission at all

warm hedge
#

How it doesn't work is the question. Error messages, or it simply does not run, or whatever

bleak mural
#

Hi, i run an event handler on each units init in my mission which reduces damage. is there a way i can modify this so that 1. I can call it from the squad leaders init to run on each individual group, or 2. simply run it through mission init where it can apply to spawned units as well as pre placed?

#

this addEventHandler ["HandleDamage", {
_unit = _this select 0;
_selection = _this select 1;
_passedDamage = _this select 2;
_source = _this select 3;
_projectile = _this select 4;
_oldDamage = 0;
_damageMultiplier = 0.05;
switch(_selection) do {
case("head") :{_oldDamage = _unit getHitPointDamage "HitHead";};
case("body") :{_oldDamage = _unit getHitPointDamage "HitBody";};
case("hands") :{_oldDamage = _unit getHitPointDamage "HitHands";};
case("legs") :{_oldDamage = _unit getHitPointDamage "HitLegs";};
case("") :{_oldDamage = damage _unit;};
default{};
};
_return = _oldDamage + ((_passedDamage - _oldDamage) *_damageMultiplier);
if (_selection == "legs" && _return > 0.1) then {_return = 0.1};
_return

}];

#

basically i want to apply it to all BLUFOR infantry

charred monolith
#

You want every unit including AI ?

#

You can use allUnits command if you want to take all unit. And use side to get only Bluefor units.

bleak mural
little raptor
#
private RedA_fnc_addHandleDamage = 
{
if (side group _this != blufor || _this getVariable ["RedA_HandleDamage_EH", -1] != -1) exitWith {};
private _EH = _this addEventHandler ["HandleDamage", { 
    _unit    = _this select 0; 
    _selection   = _this select 1; 
    _passedDamage  = _this select 2; 
    _source   = _this select 3; 
    _projectile  = _this select 4; 
    _oldDamage = 0; 
    _damageMultiplier = 0.05;
    switch(_selection) do { 
        case("head") :{_oldDamage = _unit      getHitPointDamage "HitHead";}; 
        case("body") :{_oldDamage = _unit      getHitPointDamage "HitBody";}; 
        case("hands") :{_oldDamage = _unit     getHitPointDamage "HitHands";}; 
        case("legs") :{_oldDamage = _unit      getHitPointDamage "HitLegs";}; 
        case("")  :{_oldDamage = damage _unit;}; 
        default{}; 
    }; 
    _return = _oldDamage + ((_passedDamage - _oldDamage) *_damageMultiplier); 
    if (_selection == "legs" && _return > 0.1) then {_return = 0.1}; 
    _return 

}];
_this setVariable ["RedA_HandleDamage_EH", _EH];
};

// new units
addMissionEventHandler ["EntityCreated",
{
  params ["_unit"];
  if (_unit isKindOf "CAManBase") then {_unit call RedA_fnc_addHandleDamage;};
}];

// existing units
{
  _x call RedA_fnc_addHandleDamage;
} forEach units blufor;
charred monolith
#

allUnits get only the one created at the start ?

little raptor
#

yeah

#

since he wanted blufor I replaced it with units blufor tho

charred monolith
#

Oh. didn't know that. Is that behavior the same for allPlayers ?

little raptor
#

yeah. tho not sure if it returns null for players who have not joined yet think_turtle
iirc it doesn't return anything for them (so nothing in the array)

charred monolith
#

Hm. i might need to check one of my script then. I use an allPlayers to get the players that connects in progress but I used the allUnits for testing and it seems to work when a new unit was created. I have to check. I think I used a loop so maybe when used in a loop it updates the array.

little raptor
#

here the script runs in init only

charred monolith
bleak mural
#

little off topic, but im in the editor. the flags section , Czech republic is still czech republic, not Czechia. BI Wana keep the old name?

#

just curious

little raptor
#

Czech Republic is the official name

bleak mural
versed ledge
#

Anyone have an idea how to force the lcc to backup? Trying scripted waypoints in various increments but no luck.

bleak mural
#

been away a while from editor but i cant seem to get simulation disabled on units. in picture these AI have enable dynamic simulation ticked , settings is 500 meter (testing) and i the player,and my group are 2km away,there are no enemy nearby either. whats going on?

#

what am i missing?

#

i can view them through zeus camera,their simulation is still very much enabled, they should be frozen

cosmic lichen
#

You can also use the 3den Enhanced Debug mode for DS to get some more insights

bleak mural
#

group box is selected to enable dynamic simulation. no enemy or player with in range,

#

units are "playable" and have ambient anims running on them. thats all i can think of but it used to work with these settings applied. il test without but other than that i cant understand a reason

#

ok yes its one of those two things. im guessing "playable"

cosmic lichen
#

Are you sure that only wanted units can activate DS

#

The debug mode shows you who can trigger DS

bleak mural
# cosmic lichen The debug mode shows you who can trigger DS

can confirm now its the fact that the AI units are marked as "playable". i have them as such as im using a revive script that works on playable. if i make them not player/playable they adhere to DS fine. last year im sure it wasnt like this as i used DS successfully on playable marked AI

cosmic lichen
static grotto
#

@tulip ridge

faint burrow
#

The error clearly states what the issue is.

warm hedge
#

This is not just a "no worky" but you clearly got an error message which is helpful to debug

static grotto
warm hedge
#

getVariable expects 2 elements in the right array (argument), not 3 like in the first picture

#

But from what I can see you want to use setVariable in the first bunch of addActions, since the action is not going to perform anything

faint burrow
static grotto
#

So change the addactions to setvariable. n this will still keep it as an interaction in the table?

#

and i was thinking the 2 trues was strange? i am assuming get rid of one?

warm hedge
#

That was correct, in the context of getVariable
Not correct for setVariable, it can use three arguments

static grotto
#

ok

#

thank you for taking the time to try and explain it to me

warm hedge
#

It's too soon to conclude with a thank you. You are the one to solve the issue and make sure it is

static grotto
#

im testing now, i like to say thanks as we go

#

would the trigger stay as getvariable?

warm hedge
#

As you might already guessed, setVariable sets a variable, getVariable gets a variable, in this context, true or false, that means correct, you want to use it as is

static grotto
#

thought so

#

Ok it works in SP/MP

#

uploading to server rn to see if it continues to work

cosmic lichen
#

A little tip. Don't put code in that field directly. Instead put it into an sqf file and use execVM from within the field.

#

That way you can make use of proper syntax highlighting

static grotto
#

i have no clue how to do that, is there a specific wiki page? if its not 100% required i would like to avoid overcomplicating things

cosmic lichen
#

Not required

static grotto
#

once I become more confident I will most likely start looking into optimising

real tartan
#

if lets say dificulty is Recruit, how can you disable crosshair via SQF ?

static grotto
#

yeah it still works in SP but once it goes on the server it doesn't function. The server doesnt show any errors in console, i don't get any errors in my game. Is there a possibility of a mod causing conflicts or are there any extra steps i should be taking other putting a description.ext in the file then than export mission as multiplayer?

hushed turtle
flint topaz
static grotto
#

sounds like it

flint topaz
#

What is your current script, and what’s your intended goal.

static grotto
#

so this is in a console you interact with

this addAction ["Prep Reserves for Launch", {missionNamespace setVariable ["AF_PrepReservesforLaunch", true, true];}];
this addAction ["Prep Kraken for Launch", {missionNamespace setVariable ["AF_PrepKrakenforLaunch", true, true];}];
this addAction ["Prep Krono for Launch", {missionNamespace setVariable ["AF_PrepKronoforLaunch", true, true];}];
this addAction ["Prep Styx for Launch", {missionNamespace setVariable ["AF_PrepStyxforLaunch", true, true];}];
this addAction ["Prep Dako for Launch", {missionNamespace setVariable ["AF_PrepDakoforLaunch", true, true];}];
this addAction ["Prep Raptor for Launch", {missionNamespace setVariable ["AF_PrepRaptorforLaunch", true, true];}];
this addAction ["Prep Atrocity for Launch", {missionNamespace setVariable ["AF_PrepAtrocityforLaunch", true, true];}];
this addAction ["Prep Kaiju for Launch", {missionNamespace setVariable ["AF_PrepKaijuforLaunch", true, true];}];

And there is one of these for a corresponding trigger linked to a module

missionNamespace getVariable ["AF_Prep<Squad>forLaunch", false];
#

and when done it should start the optre ODST pod script (I am not using the console as I desire a different effect)

#

@flint topaz

novel mountain
#

do you guys have script to remove HE ammo from cannon assets vehicles/statics?
removeMagazineTurret ["magazine_class_name", [0]];

is it this?
also, how the fuck do i find the class names effectively

#

i mean i know how to find assets class name but not sure about the magazines. *(asset in question SPE_FlaK_30 = its the CDLC 1944 flak)

faint burrow
static grotto
#

see the <squad>

#

place holder

#

for squad name

warm hedge
#

So you mean AF_PrepAlphaforLaunch AF_PrepBravoforLaunch so fourth?

static grotto
#

yur

warm hedge
#

format ["AF_Prep%1forLaunch",<whatever>]

static grotto
#

this addAction ["Prep Reserves for Launch", {missionNamespace setVariable ["AF_PrepReservesforLaunch", true, true];}]

missionNamespace getVariable ["AF_PrepReservesforLaunch", false];

#

so this is the line in the console and the trigget its linking to

#

e.g.

warm hedge
#

So this, what is this

faint burrow
#

Then something wrong with the module.

static grotto
#

was showing one set ig

#

just module being funky?

faint burrow
#

Maybe.
Are you sure syncing is needed for activation?

static grotto
#

yes they are dependent on a trigger to activate

#

i have a comp with everything set up

warm hedge
#

You are saying, you have N amount of actions
Each of them execute a script so corresponded droppod will drop
Am I right?

static grotto
#

yes

#

you are right

#

and it functions in the eden sp

warm hedge
#

Technically (or rather, ideally), it is not even required to use this amount of setVariable and triggers even

#

Current method actually only creates a bit more complicated tackle to do one simple thing

novel mountain
# warm hedge https://community.bistudio.com/wiki/magazines or https://community.bistudio.com/...

Wasnt clear pipeline
Found a smart way of figuring it out =
Flak in Eden, give it variable name:
flak1

Then run this in debug console:
copyToClipboard str magazinesAllTurrets flak1;

Find the ammo in clipboard = ex.
"SPE_20x_SprGr_FlaK_38"
Thats the HE i want to remove

last step =
directly in the Flak’s init field:

this removeMagazinesTurret ["SPE_20x_SprGr_FlaK_38", [0]];

Badoom, done. Dont have to fish for wiki stuff. Ty fo response tho

static grotto
#

its what made sense the most to me

warm hedge
#

The thing. You may think a trigger can only execute the script. That is wrong, addAction can do the same. Which means, the trigger is not even required

static grotto
#

oH?

warm hedge
#

In fact, {missionNamespace setVariable ["AF_PrepReservesforLaunch", true, true];} is already a script that is executed

static grotto
#

so

#

if i am understanding right

#

missionNamespace getVariable ["AF_Prep<Squad>forLaunch", false]; could go in the iinit of the module ?

warm hedge
#

I don't actually know what kind of module is in action

static grotto
#

its the OPTRE odst pod module

warm hedge
#

How it does look in Eden

warm hedge
static grotto
#

lemme launch my game rq

#

i do have a composition as well

#

it got spam protected

#

lol

warm hedge
#

Okay, I was actually wrong. I thought you are only executing a trigger to run a script

static grotto
#

nah its to run a module

warm hedge
#

I actually missed some few contexts above, apologies. But what I told is one tip

static grotto
#

so this in the module itself?

#

missionNamespace getVariable ["AF_Prep<Squad>forLaunch", false];

warm hedge
#

Init of the module likely do nothing about it

#

Make sure it does even work on the server without any triggers and actions

static grotto
#

what u mean sorry

warm hedge
#

Make sure it will happen without any of your codes and triggers, so you can be sure the module is broky or your code is

static grotto
#

how can i test the module without a trigger rq

#

sorry

warm hedge
#

Place a module. Maybe. I don't use OPTRE

faint burrow
#

I would use radio trigger for testing.

warm hedge
#

Ah, that's a better test

tight dirge
#

It has been ages since I scripted anything. What are the variables I need to look up to create a DB for a server? To recall items, stats, etc.

warm hedge
#

Do you mean profileNamespace setVariable ["whatever","whateverYourDataIs"] execute in the server?

tight dirge
#

Yes! profileNamespace and that system. I don't need my hand held, but a general flow or example would be appreciated.

warm hedge
#

It is actually up to you/the way it should work

#

setVariable to set, getVariable to get, and likely you want to distribute the fetched data into clients via remoteExec or such networking commands

tight dirge
#

Ok, I remember I workshopped some ideas with these variables and some others. Thanks for refreshing me. What is it called or what are the variables to compress the data, or is that really an needed step?

warm hedge
#

Storing a variable into profileNamespace already is a compress (sort of), is that what you ask?

tight dirge
warm hedge
#

HashMap?

tight dirge
#

Yes, is it really needed for a humble sized server? Lots of items and stats, but that data is not much more than storing class names and some numbers?

true frigate
#

Sorry boys, been a long time since I've done anything. Can anyone tell me why this isn't working?

onEachFrame {
    (driver v3) action ["LandGear", v3];
};```

Trying to get an AI pilot to deploy their landing gear and retract it on command, but for some reason it just won't do anything. 
https://community.bistudio.com/wiki/Arma_3:_Actions#LandGear
warm hedge
warm hedge
tight dirge
warm hedge
#

I think I would use HashMap for DB usage, as you can just use something like get "OurWeapons" command to fetch a data (datum, heh) you want, instead of DB select 100 or something, which you need to remember what is 100 in this context

true frigate
tight dirge
#

Thanks that makes perfect sense. Clearer and cleaner with HashMap.

While I am here, would placing an addAction in a vehicle's default scroll list be done with script here, or by config? Just to fire SQF.

true frigate
#

Interesting, I'm trying it with the exact same plane and nothing LULW
Were you piloting that, or was it AI?

warm hedge
#

Should be AI, can't remember what I've done exactly though

true frigate
#

No worries dude, it was for a stupid bit anyway. I quite literally duct taped two of em together and wanted to sync the landing gear.


v1 addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    [v3, _weapon] call BIS_fnc_fire;
}];```
old owl
# tight dirge No, I don't remember the name, but someone was recommending a way to compress th...

If you're looking for a database connection- ExtDB3 is the only public addon that exists at the moment and it's notoriously bad at performance. You'll have quicker speed caching in hashmaps on server as POLPOX suggested but if you do that I highly recommend backing up profile data as it can also be prone to corruption.

I think Deadmen was talking about implementing HTTP ability to POST and GET so that would probably be an even better alternative whenever it gets released.

tight dirge
granite sky
#

toJSON/fromJSON might be a useful tool depending on what you're trying to do.

tight dirge
turbid lodge
#

If I want someone to respawn with the kit I gave them when they first started off, how do I do that?

tulip ridge
#

Save it in initPlayerLocal, re-apply it in onPlayerRespawn

turbid lodge
sly cape
turbid lodge
#

I am confused which script do I put in

sly cape
turbid lodge
#

I see, and which scripts do I place inside each?

sly cape
turbid lodge
#

Where is the save function, in the editor?

sly cape
turbid lodge
#

So the save inventory goes to player local and the load inventory goes to onplayer respawn

#

right?

turbid lodge
#

Do I have to change anything in these scripts?

sly cape
granite sky
#

I'm not sure what the delete parameter does.

hallow mortar
#

I assume it deletes the saved loadout of that name instead of saving to it

#

but then, bis_fnc_deleteInventory exists, so 🤔

granite sky
#

Feels like less effort to use getUnitLoadout/setUnitLoadout manually than deal with those functions.

delicate hedge
#

guys anybody bumped into that problem that sometimes when you set #()ui() texture and restart mission and running same script it just dont creates display, so i cant find it by its name defined in #()ui() parameters

proven charm
#

code plz

charred monolith
delicate hedge
# proven charm code plz

private _size = missionNamespace getVariable ["CFM_displaySize", 1024];
_monitor setObjectTexture [0, format["#(rgb,%1,%1,1)ui(RscDisplayMainDisplayCFM,%2)", _size, _monitorUid]];

    private _waitStart = time;
    waitUntil {
        !(isNull (findDisplay _monitorUid)) or
        {(time - _waitStart) > WAIT_FOR_DISPLAY_TIME}
    };
    _mainDisplay = findDisplay _monitorUid;

    if (isNull _mainDisplay) exitWith {
        format["DisplayHandler.setupDisplay: ERROR: can't create main display for monitor: %1", _self] WARN
    };

    // control that renders picture of r2t display
    private _r2tDisplayCtrl = _mainDisplay ctrlCreate ["RscPicture", R2T_DISPLAY_CTRL_ID];
    private _r2tDisplayName = _monitorUid + "r2t";
    _r2tDisplayCtrl ctrlSetPosition [0, 0, 1, 1];
    _r2tDisplayCtrl ctrlSetText (format ["#(rgb,%1,%1,1)ui(RscDisplayR2TDisplayCFM,%2)", _size, _r2tDisplayName]);
    _r2tDisplayCtrl ctrlCommit 0;

    private _waitStart = time;
    waitUntil {
        !(isNull (findDisplay _r2tDisplayName)) or
        {(time - _waitStart) > WAIT_FOR_DISPLAY_TIME}
    };
    _r2tDisplay = findDisplay _r2tDisplayName;

    if (isNull _r2tDisplay) exitWith {
        format["DisplayHandler.setupDisplay: ERROR: can't create r2t display for monitor: %1", _self] WARN
    };
delicate hedge
#

_r2tDisplayName can be smth like "cfmrenderuiid0r2t"

delicate hedge
#

and _monitorUid can be "cfmrenderuiid0"

proven charm
#

it seems your waitUntil is missing or. unless its just me reading it wrong

delicate hedge
proven charm
south swan
proven charm
#

!code

wicked roostBOT
#

Please use !sqf from now on (!enforcescript soon™)

delicate hedge
#

like once upon 20 times it finaly works but most time just wont. And code is same every time. Just random

proven charm
#

so where is _r2tDisplayName created? sorry not good with r2t

#

and _monitorUid. they both fail?

delicate hedge
delicate hedge
proven charm
#

sometimes starting from editor makes arma remove previously created ctrls. but maybe not with restart

delicate hedge
versed ledge
#

So bout that back up scripting…. My question got buried instantly. Anyone have experience making a boat back up? Trying to script waypoints to back the lcc out of the lpd. And not having any luck with the ai. Can I turn them off temporarily and just make the boat follow waypoints without a driver?

proven charm
little raptor
versed ledge
#

Animating is working pretty nice compared to the ai waypoints!

astral ibex
#

Does anyone have a functional AI searchlight script

#

I need it for a mission for tomorrow

fair drum
#

Think we could get a force delete on hash map objects; force all references to be deleted? A total instant destruction?

astral ibex
#

Is there a way I can get the Arma 3 GM searchlight script used in forcerecon?

#

and how can I implement it in my own games with my friends

astral ibex
#

but most importantly what is the script

#

that is in it

#

that allowes me to convert them

sly cape
iron flax
# astral ibex but most importantly what is the script

The script is in the link I posted.
The helper object can be found in, Logic Entities>Mission Context

Just copy the script into a init.sqf, place your guard towers, place the mission helpers next to the guard towers, and that's it.

ruby spoke
#

Is there a way to return all of the controls in a display? I'm trying to make an items action system like DayZ has (By clicking an item and having an action pop up), but idk the best way to do it.

edgy dune
#

so I was thinking getSensorTargets would work on missiles, but I guess not, is there a way to get valid targets for a missile within its cone?

old owl
#

More AI slop I made which allows for flexible creation of DrawIcon3D- specifically the new 2.22 syntax available in development build hmmyes

#

-# Although currently still a WIP

tight dirge
#

What variables do I need to make a vehicle mod fire an sqf when the engine is turned on? It is my mod, I want this to be part of the base deal.

tight dirge
#

Would it be scripting or config to addAction to a vehicle action to the main scroll wheel? The goal is to add other sqf options that way as well.

tulip ridge
#

You can add user actions in config as well

tight dirge
astral ibex
#

and I still couldn't find the helper object, do I just place a helipad with a script?

iron flax
astral ibex
#

I have said it 2 times asking specifically what it was and I haven’t gotten any answers from the wiki

iron flax
#

Hang on, I'll post a pic

#

This is the helper logic, Place the helper next to the tower like in the pic.

astral ibex
#

yeye I see it now I was looking in the wrong tab

#

thx

kind hatch
#

cutText ["", "BLACK OUT"];[
[
["Flugstation Mike-26,", "<t align = 'center' shadow = '1' size = '0.7' font='PuristaBold'>%1</t>"],
["Versorgungspunkt", "<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"],
["1 Stunde Später ...", "<t align = 'center' shadow = '1' size = '1.0'>%1</t>", 15]
]
] spawn BIS_fnc_typeText; This is my trigger. What do I have to enter so that, after the text has been read aloud, it goes back to the normal image?

proven charm
#

cutText ["", "PLAIN"]

iron flax
iron flax
# kind hatch cutText ["", "BLACK OUT"];[ [ ["Flugstation Mike-26,", "<t align = 'center'...

Try this in your trigger, and see if it does what you want.


[]spawn 
{  
cutText ["", "BLACK OUT", 3];
sleep 3;
[  
 [  
  ["Flugstation Mike-26,", "<t align = 'center' shadow = '1' size = '0.7' font='PuristaBold'>%1</t>"],  
  ["Versorgungspunkt", "<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"],  
  ["1 Stunde Später ...", "<t align = 'center' shadow = '1' size = '1.0'>%1</t>", 15]  
 ]  
] spawn BIS_fnc_typeText; 
sleep 10;
cutText ["", "BLACK IN", 3];
};
split ruin
#

what is the problem with Livonia map, its awesome but has much less fps than other maps like Green Sea which is three times bigger?
too much objects, objects very detailed? can I just delete ceratin types of objects and make the map playable? 🤔

proven charm
#

trees man, delete them 😉

winter rose
#

"Livonia? nicest plains I ever visited!"

granite sky
#

Tree density didn't seem that high but maybe there's something very expensive with the models. I haven't tested it though.

#

Maybe the view models because it felt like it was only bad once you had AIs running around.

split ruin
#

in the villages goes from 120 to 40 without any ai, its always mistery for me why is like this ...

granite sky
#

Hmm. Give me a spot and I'll check.

sly cape
granite sky
#

Shouldn't be the houses because Cherno with CUP interiors is fine IIRC

sly cape
split ruin
#

most Cherno houses aren't enterable, but Green Sea have the houses enterable and have normal fps, uses CUP assets ...
maybe the textures are less detailed compared to Livonia... I don't know really
I really wish to make Livania playable so players will not have to download 14Gb for CUP Terrains Core

proven charm
#

hide houses with command and you know pretty much the lag source

#

then play without houses jk 🙂

sly cape
restive leaf
#

Just the metal sheds and a couple of industrial buildings at this point are not enterable (Ch2020)

real tartan
#

I am creating fire with module ModuleEffectsFire_F, but there is no fire sound, how to add one to position ( and later delete sound if burning object is deleted )

devout surge
#

does anyone have a script for HALO jump? I need to save the character backpack, give him a parachute and give the backpack again on landing. with a map choosing jump.

sly cape
split ruin
#

@devout surge I have halo script but without saving the backpack, the player have to take real parachute from arsenal

devout surge
tulip ridge
#

You can just spawn a parachute directly and move the player into it

devout surge
#

yeah, but my group is around 15 people, i need to make them jump easily. i dont think they can manage to jum any other way

tulip ridge
#

What does that have to do with what I said?

You can still spawn a parachute for each unit and move them into it

old owl
#
private _vehicle = createVehicle ["Steerable_Parachute_F", getPosATL player, [], 0, "NONE"];
_vehicle disableCollisionWith player;
_vehicle setDir (getDir player);
player moveInDriver _vehicle;
#

@devout surge the above does what Dart is saying, this would move them into a parachute while retaining their backpack :)

#

-# Or at least should, I haven't tested xd

devout surge
#

I have this, and needs a flagpole(or another prop), to call this function


// SOLO el jugador abre el mapa
if (!local _unit) exitWith {};

_group = group _unit;
_haloAltitude = 3000;

// --- MAPA ---
openMap true;
mapclick = false;

onMapSingleClick "
    clickpos = _pos;
    mapclick = true;
    onMapSingleClick """";
    true;
";

waitUntil {mapclick};

_haloLocation = clickpos;

cutText ["H.A.L.O. in progress...", "BLACK OUT", 1];
sleep 1;
openMap false;

// Ejecutar HALO en TODAS las máquinas (clave)
[
    units _group,
    _haloLocation,
    _haloAltitude
] remoteExec ["halo_fnc_execute", 0];
cutText ["", "BLACK IN", 2];```
split ruin
#

this need is not in the script itself btw, you still need addAction 🙂

summer narwhal
#

Hi everyone, do you have any idea why I have this in my logs?

#
22:04:09 Observer C Bravo 3-5:1 (Arnaud Spirito) REMOTE (civ_18) in cargo of C Bravo 3-5:1 (Arnaud Spirito) REMOTE (civ_18); message was repeated in last 60 sec: 4590```
still forum
# past wagon so any time I initialize a variable like that without defining it, it should be ...

No you missunderstood how private works.

There is "private" as a keyword, its a modifier for the = variable assignment.
And there is "private" as a command, that takes a string or an array of strings as argument.
The = with private keyword is faster and recommended way to do it.
Instead of an else setting the default value, just set the default value by default.

private _type = "string3";

if (condition1) then {
    if (condition2) then {
        _type = "string1";
    } else {
        _type = "string2";
    };
};
still forum
still forum
still forum
old owl
real tartan
#

linux supported ?

still forum
#

Not tried, the latest release doesn't include precompiled linux binary. I don't know if intercept core itself currently works on linux.
Looking through the code, all windows-specific code I can find is wrapped in ifdef's.
So it seems I developed for linux at one point.
The only server I have is linux so it definitely worked there, but you'd have to compile it yourself.

split ruin
#

can I limit the speed of vehicle without AI? limitSpeed limits only AI driven vehicles ... 😔
maybe damaging the engine?

faint burrow
vapid scarab
split ruin
#

@faint burrow it works perfectly, very useful command 👌

split ruin
#

@faint burrow very funny this command limits vehicles forward movement but not backwards, I bet there will be creative player driving backwards to get away from the enemy fast 😆

granite sky
#

It's possible to hard-cap them by script (setVelocity) if you need something stricter. Fiddly though, because setVelocity is local.

iron flax
#

To force the landing gear of aircraft down, use a missioneventhandler.

addMissionEventHandler ["EachFrame", { heli1D action ["LandGear",heli1];}];
split ruin
#

does anyone have attach IR grenade to player script ? meowawww

hallow mortar
split ruin
#

is player score added to side score or they are completely different ? they are ...

winter rose
#

"yes" vibes 😹

placid root
#

hey guys, did you notice a difference when the paramsarray is created in eden? in the init it is undefined. it tried waituntil { !isNil "paramsarray"} but it only worked once and is ignored the next time i preview.

#

and this is ignored completely in the description.ext respawnTemplates[] = {"MenuPosition", "Menuinventory", "Tickets"};

small perch
#

is it possible to override or add onto another mods function?
I want to add my own check to then run my own script inside of the Improved Melee System's WBK_CreateDamage function (At least I think it is a function)

cosmic lichen
#

You basically need to create a mod that places your script in the same path as the original one. You can do that by using the same pboprefix and path

small perch
#

I am not entirely sure what exactly I am looking in there. also will this still cause the original code to run?

cosmic lichen
#

You are overwriting the original code.

small perch
#

I see, I am guessing to still have the original code on top of mine I would need to manually copy everything over?

cosmic lichen
#

Yes you need to copy the original code into your file and make your additions.

small perch
#

that means if 2 mods try it only 1 will actually count

#

also I am not sure if this is actually a function or what it is called, it's created inside a preInit.sqf

proven charm
#

is there weapon holder the player cant take?

hushed turtle
#

disabling simulation on holder/crate prevents you from taking/putting items into it

proven charm
#

ok i can try that but its also attached to player

#

hmmm i tried ```_weaponModel enableSimulationGlobal false;

hallow mortar
#

I assume you've tried lockInventory

proven charm
#

no :/

#

even with lock can still take it

digital hollow
small perch
tulip ridge
#

Something like that

small perch
#

thanks! this will make me feel better about doing what I am doing.
Also in what way is this janky?

tulip ridge
#

Just because its turning code into a string and concatenating them

small perch
#

will this break stuff?

#

it seems to work just fine!

small perch
#

is there a limit to how long the string can be?

granite sky
#

Probably not one that you'd need to worry about.

faint burrow
proven charm
faint burrow
small perch
#

what should I use when working on .sqf files? notepad works but it's not perfect

proven charm
#

notepad++ 😄

faint burrow
#

VS Code.

placid root
#

nope respawnTemplates[] = {"MenuPosition", "Menuinventory", "Tickets"}; works but in sp just not like is used to in 2d

old owl
#

Notepad++ isn't terrible for editing individual files if you have an SQF extension but VS Code is crack if you're working in a project

#

Much more convenient searching across all files, etc

spiral trench
proven charm
#

does anyone have ideas how to prevent player from taking weapon from weapon holder? i tried lockInventory and disable simulation but neither seems to have any effect because the holder is attached to the player

#

without attach there isnt this problem

versed ledge
#

Is VS code the best out of the box or is there an arma plugin or anything?

faint burrow
#

AFAIK, there is no any official Arma plugin.

atomic niche
#

VS code with hemmt extension for syntax highlighting etc

#

pretty sure there was also some sqf language extension someone made but not sure which is better at it

versed ledge
#

I forget where in VS I activated it but there was some kind of generative sqf feature. It didn’t seem very good so I turned it off again, but was wondering if that worked for arma.

#

I’ll look into the hemmt extension. TY

atomic niche
#

LLM's/AI still suck at sqf, 95% of it is hallucinated

versed ledge
#

I’ve learned that the hard way! It has kind of helped me flush out ideas that I was lost on to start with but had to look up ever line pretty much and double check it/rewrite it.

proven charm
hushed turtle
atomic niche
proven charm
#

can you create simple object of weapon model and give it weapon attachments and other texture?

still forum
versed ledge
#

How do I find that? I didn’t know about it.

proven charm
#

its solved Lou thx

versed ledge
#

Thank you 🙏

winter rose
versed ledge
#

Bookmarked, will watch. Thanks!

proven charm
winter rose
proven charm
#

yeah

winter rose
#

try _weaponHolder setDamage 1?

proven charm
#

wow that actually works 🙂

#

takes the action away

winter rose
#

good to know 😅

proven charm
#

thx 😄

still forum
#

KK recently changed that you can get weapon directly from the person's body inventory, not the weapon holder on ground
#perf_prof_branch message
I'd assume his code would ignore it being locked or destroyed

But if you only want the action gone, and not actually prevent the player from taking the weapon then it wouldn't matterr

proven charm
#

i watched dedmen's video about SQF debugger. i have coded all these years without such thing 🙂 can it show variable values? somehow missed that part in the video

still forum
#

Yes. In missionNamespace and in the current scope

proven charm
#

ok 👍

small perch
#

can I put a series of checks I often put in if () inside a function so I do not have to constantly repeat them?

tulip ridge
#

Yeah

#
if (_someCondition && [...] call fnc_someFunction) then { ... };
#

Can also be good to put the function call in a lazy eval

still forum
#
if (_x && {_y && _z}) then ...
``` == ```sqf
_function = {_y && _z};
if (_x && _function) then ...
small perch
#

thanks

digital hollow
#

Also consider macro instead of function

small perch
#

is this how I would do it?

faint burrow
#

You can just leave what's in parentheses.

tulip ridge
faint burrow
#
_unit getEntityInfo 0
tulip ridge
#

Something something featherless biped

small perch
faint burrow
#

I meant exactly what I wrote.

tulip ridge
#

As in the whole file would be the _unit isKindOf "Man" && ...

#

No need for an if statement

small perch
#

ah, I see, thanks

small perch
#

does init.sqf only fire once and only for the server?

small perch
#

hmm, what kind of things should I make server only and what things should I make client only?
Currently my code is basically all EventHandlers

winter rose
#

it depends.

small perch
#

I am guessing there is no cheat sheet for this.

wheat jay
#

Does anyone have an OBJ INIT or script that makes a specific part of a vehicle e.g hitengine to be invulnerable?

I like what ACE's Advanced Car Damage does in respect to cars not detonating, but a bug allows mraps and such to be engined/turreted with very little small arms fire (pretty sure this is a bug not a feature), figured i could work around this bug by just making the engine and turret invulnerable to damage. (Id also take a mod that fixes this issue entirely instead of a workaround).

Thanks!

fair drum
#

You can use the handle damage event handler and bypass damage for specific parts.

small perch
#

is there a sqf version of sqs' goto ?

tulip ridge
#

I lied
There's scopeName and breakOut / breakTo

small perch
#

thanks

graceful kelp
#

is it known and is there a work around for setmissiletarget not triggering the target vehicles RWR

lone glade
wheat jay
#

Is it possible to reverse this script so that instead of delivering this damage to specific parts it blocks it? (Im not very good at programming and sqf):

_unit addEventHandler ["HandleDamage", {
private _unit = _this select 0;
private _hitSelection = _this select 1;

// If the part is in ["head", "face_hub"], allow damage to it, otherwise return the part's original damage with none in addition
if (!(_hitSelection in ["head", "face_hub"])) then {
    _damage = if (_hitSelection isEqualTo "") then {damage _unit} else {_unit getHit _hitSelection};
};

_damage

}];

Taken from this forum post: https://forums.bohemia.net/forums/topic/205515-handledamage-event-handler-explained/

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
wheat jay
# wheat jay Is it possible to reverse this script so that instead of delivering this damage ...
_unit addEventHandler ["HandleDamage", {
    private _unit = _this select 0;
    private _hitSelection = _this select 1;

    // If the part is in ["head", "face_hub"], allow damage to it, otherwise return the part's original damage with none in addition
    if (!(_hitSelection in ["head", "face_hub"])) then {
        _damage = if (_hitSelection isEqualTo "") then {damage _unit} else {_unit getHit _hitSelection};
    };

    _damage
}];

Apologies, as above

sly cape
wheat jay
wheat jay
little eagle
#

classname

lone glade
#

you sure ? on other similar commands I see "house" and "building" used :/

little eagle
#

"house" is a classname

#

it's a parent class of all buildings

lone glade
#

oh right forgot that.

little eagle
#

Command might not work with streamed objects though. No idea.

lone glade
#

no problems, it's for finding some buildings inside a radius.

#

I might also use it to find radiotowers or stuff like that.

small perch
#

is there a way to make a unit play an animation right after using "setUnconscious" on it?
It seems to prevent any animations from playing for a few seconds

mortal folio
#

Engineside anim triggers tend to be a bit rigid

small perch
mortal folio
small perch
#

I did already try to put delays and also tried to set the animation multiple times. my logs do say the animation changes however the unit does not actually play any animation. I am assuming that the unconsciousness forces ragdoll for a few seconds (which it does) and the ragdoll prevents animations from playing.

mortal folio
#

yeah it does

small perch
#

is there a way to forcibly disable the ragdoll so I can play an animation?

mortal folio
#

not to my knowledge, i tried that before

small perch
#

I'll just have to deal with the delay, or not use the unconsciousness, thanks anyway

mortal folio
small perch
#

I am using the "AnimStateChanged" EventHandler. there always seems to be an animation automatically playing after the ragdoll is finished (might be due to ace, not sure) so it's fine enough

keen furnace
#

I am attempting to use the setAperture command to turn my scenario extremely dark as part of a held action, in order to mimic the sun of a planet going dark.

I am using the following script: [50, "setAperture"] remoteExec ["call", 0, false];

It does not seem to work, any ideas?

hushed turtle
#
50 remoteExec ["setAperture"];
keen furnace
faint burrow
keen furnace
#

seems to have worked, now I just need to figure out the value. Thanks!

keen furnace
# faint burrow `call` accepts code, not string.

I think I get what you're saying. I haven't messed with scripting too much beyond basic stuff like showing/hiding stuff and setting off bombs to mimic explosions, calling sounds or stuff like that.

#

Now all I need to figure out is particle effects, is this tricky? I was hoping for some kind of orbital beam, then a swirling portal of some kind.

stable dune
tired spear
#

say I want to animate multiple vehicle doors at once ie

Ifrit1 animateDoor ['Door_rear', 1];
Ifrit2 animateDoor ['Door_rear', 1];

would it be possible to define Ifrit1 and Ifrit2 under a single variable name for something like..

_Ifritgroup animateDoor ['Door_rear', 1];
faint burrow
#

Yes, you can use arrays, but then you should use loops.

hallow mortar
#

No, not like that, animateDoor doesn't support that. But you can use forEach and an array of vehicles.

old owl
hoary saddle
#

hey guys, trying to change classnames of starting aircraft in KPLib. I keep getting this error.

15:10:37 Error Missing ]
15:10:37 File C:\Users\seanf\OneDrive\Documents\Arma 3 - Other Profiles\Atlas%203\mpmissions\KPLibNew.pja310\kp_liberation_config.sqf..., line 537
15:10:37 [KPLIB] [PRESETS] ----- Server starts preset initialization -----
15:10:37 [KPLIB] [PRESETS] Not found vehicles listed below are not an issue in general. It just sorts out vehicles from not loaded mods.
15:10:37 [KPLIB] [PRESETS] Only if you e.g. use a CUP preset and you get messages about missing CUP classes, then check your loaded mods.
15:10:37 Error in expression <ESETS"] call KPLIB_fnc_log;
};

switch (KP_liberation_preset_blufor) do {
case >
15:10:37 Error position: <KP_liberation_preset_blufor) do {
case >
15:10:37 Error Undefined variable in expression: kp_liberation_preset_blufor

But everything is uniform and I cant tell why its throwing this error. any ideas?

sly cape
hoary saddle
#

I appreciate the reply. Downloaded the .8 version. Without changing anything, its got me spawning in the corner of the map instead of the carrier.

sly cape
thin fox
hoary saddle
#

I just copied the contents into the mission file.

sly cape
hoary saddle
#

yes

sly cape
# hoary saddle yes

Strange, that looks right.
Make sure you're playing the right mission, I guess, and maybe try again.

thin fox
#

send rpt file

hoary saddle
thin fox
# hoary saddle

Advanced Sling Loading remove this mod, it's outdated and affects AI

wispy kestrel
#

Does anyone know if BIS_fnc_endMissionServer is working as intended still?

small perch
#

I have an array I use to store animation names for animations I want to override. the array is used only inside a function.
Should I set the array once inside the init.sqf or inside the function?

tulip ridge
#

For large arrays it can be better to define them globally, since it's only being created once. It also lets mods add their own animations if needed

small perch
#

so small arrays should be locally created inside the function. the function also adds a eventHandler which is what also uses the array, would I need to create it inside the eventhandler if it was local?

mortal folio
wind hedge
#

BIS_fnc_showInventory
☝️ That fnc no longer exists? Or has never existed?

#

I remember using "[] spawn {sleep 3; [player, cursortarget] call BIS_fnc_showInventory;};" to open up another player's inventory screen but maybe I am just crazy

winter rose
#

never existed
action/actionNow can do it, e.g player action ["Gear", vehicle player];

#

(createGearDialog eventually)

wind hedge
#

[] spawn {sleep 3; player action ["Gear", cursorTarget];};

#

Just shows me my own inventory

#

But kinda works, it mimics the addaction that appears on friendly Ai units (I can only interact with the content of their backpack basically)

#

I swear I was able to fully access another's Inventory exactly like if it was mine... but maybe it was using a mod

winter rose
#

or used action on a group member perhaps

#

try cursorObject action ["Gear", cursorObject];?

wind hedge
#

You are a godsend!

#

Wonder how well it works in MP on another player (I am trying to make an ACE Medical like menu right into the inventory screen)

past wagon
#

is it possible to have a dialog that stays open in the background when the player opens the pause menu? if not, is this the correct pattern to mimic it?

(findDisplay 46) displayAddEventHandler ["KeyDown", {

    if (inputAction "ingamePause" > 0) then {

        if (myDialogIsOpen) then {
             [] spawn {
                 //wait for pause menu to open and then close
                 waitUntil { !(isNull findDisplay 49) };
                 waitUntil { isNull findDisplay 49 };
            
                 //reopen dialog
                 call TRI_fnc_openMyDialog;
             };
        };
    };
}];
winter rose
#

this looks somewhat modded frogthinking

wind hedge
iron flax
# wind hedge

Is that inventory something you are making? It looks interesting.

restive leaf
#

Isn't it ARMStalker?

wind hedge
#

The Stalker one is bugged out and it doesn't show the uniform slot nor the weapons slots for the handgun and the launcher... The launcher can't even add scopes with the default Armstalker Inv.

tulip ridge
#

Pistols (and probably launchers) can also have secondary mags

wind hedge
tulip ridge
#

It doesn't, but they still exist so

#

¯_(ツ)_/¯

wind hedge
#

Also, I don't think there are bipods for handguns and launchers yet the vanilla inventory has slots for them, I removed them because I need as much space as possible

wind hedge
tulip ridge
#

I mean, would it not just be:
Dragged over event handler thing -> addWeaponItem

wind hedge
#

I don't even know where to start in order to get dragging items into the quick slots working 😂

#

But I will figure it out

tulip ridge
#

Kinda skimmed it, usable on a couple different controls

restive leaf
wind hedge
restive leaf
#

Seem to remember the ArmSTALKER one also had an issue with vests, but I might be misremembering...

wind hedge
restive leaf
#

Yeah, he did

#

DMed you...

wind hedge
bold rivet
#

Do commands that have global effect also have JIP, or does it only exec to clients currently connected and I have to add JIP myself?

#

setAmmoCargo for exmaple

granite sky
#

Global inventory commands all do JIP.

bold rivet
#

aight, thx

granite sky
#

This can get quite expensive in the JIP queue if you keep adding and removing items :P

bold rivet
#

nah setAmmoCargo is for how much a bobcat can resupply for exmaple

granite sky
#

Oh, that one. Not sure.

#

I've only tested inventory commands. Supply might be different.

bold rivet
#

So global effect does not automaticly mean thats its JIP compatible from what I understood

#

?

granite sky
#

There are no good general rules like that in SQF.

#

Global effect commands usually apply to JIP and if they don't it's probably not intentional. But there are a lot of commands out there.

bold rivet
#

Aight I see, I guess I'll just go test it then, thanks for the help, appricate it

pallid palm
#

i just make a script that does my reSupply kinda like my repair truck: so all of the time i use that script on a Ammo box

granite sky
#

LA/GE on that one is also quite weird and I wouldn't necessarily trust it.

pallid palm
#

what's LA/GE

granite sky
#

Local argument, global effect. Means you need to execute the command where the vehicle is local but then it applies everywhere.

pallid palm
#

oh i see

#

tbh i really most of the time remove all weapons and everything from all vehicles and choppers and stuff

granite sky
#

Where that exists though, it generally means that more info is stored locally than globally. Which doesn't make a lot of sense when it's a single number.

bold rivet
#

Just tested it, apears to be JIP compatible.
(Dedicated Server)
Placed the bobcat, set its supply thingy to 0 and left the server.
Joined back, hopped in a vehicle and tried to RRR, no options showed up

#

Either way, thank you for the quick response

pallid palm
#

i also use a resupply station trigger over a heli pad to drive vehicles and choppers on that pad

bold rivet
#

I simply added own RRR options to a bobcat and wanted to get rid of default ones, was just curious if it was JIP compatible

pallid palm
#

i see roger that m8

old owl
#

From my experience I've found the best way to think of JIP or whether something tends to be, is if it is registered by newly connected clients. That's obviously pretty "duh" since it's in the name "Join In Progress" but I've found that thinking about it like that can help. For example:

Are house windows of global objects JIP?
Yes, we know that they are because when a new client connects; previously destroyed windows will show as destroyed.
-# The above may be a simplification since it's not the windows themselves but the houses state of damage but FWIW :)

split ruin
#

where to find the orbat unit icons?

    class Delta
    {
        id = 1;
        idType = "Delta";
        size = "Squad";
        type = "Infantry";
        insignia = "a3\missions_f_epa\data\img\orbat\b_aegis_ca.paa";
        colorInsignia[] = { 0, 0, 0, 1 };
        commander = "Armstrong";
        commanderRank = "Lieutenant";
        tags[] = { "BIS", "USArmy", "Kerry", "Hutchison", "Larkin" };
        text = "%1 Specops Recon %3";
        textShort = "%1 SOF %3";
        texture = "a3\ui_f_orange\data\displays\rscdisplayorangechoice\faction_nato_ca.paa"; //<- I want to change this 
        color = "ColorWest";
        description = "Special operation group, combat recon and special tasks";
        assets[] = {
            { "B_Heli_Light_01_F", 1 },
            { "B_Heli_Light_01_armed_F", 1}
        };
        //subordinates[] = {};
    };

edit: CfgGroupIcons are working fine -> texture = "\A3\ui_f\data\map\markers\nato\b_recon.paa"; 🙂

rugged acorn
#

Hello everyone... I would like your help in a dynamic mission that I am working on. The general idea is that on mission start, the whole scripts will create the AO (place/teleport the objective(s), spawn enemies, teleport players nearby (according to some mission params etc.). One issue that I have is that in some (edge/extreme) occasions, players and/or AI spawns in a different island than the objective. This creates all kind of problems. So I would like to ask:
"How can I check if there is a sea body or a river between the spawn position and the objective? Or actually how can I check if there is a clear path to the objective from the spawn/teleport position?

Thank you all in advance!

fair drum
#

The easiest way is to create no go zones for every map that your spawn logic ignores.

rugged acorn
crimson lion
rugged acorn
fair drum
honest halo
#

hello, supernoob here, just messing with 3d editor.. Anyone able to tell me how to make a soldier sit in a chair?

lone glade
#

animation magic

split ruin
#

I am trying to add more magazines to 20 mm cannon but they are added to both miniguns 🤔

[_veh, [1, "PylonWeapon_300Rnd_20mm_shells", true]] remoteExec ["setPylonLoadout", _veh];
_veh addMagazineTurret ["PylonWeapon_300Rnd_20mm_shells", [-1]];
_veh addMagazineTurret ["PylonWeapon_300Rnd_20mm_shells", [-1]];
tough abyss
granite sky
#

Read the question :/

#

None of these functions care about point-to-point accessibility, and neither does any Arma command. If you want to calculate it in realtime then it will either be expensive or inaccurate.

#

If you can handle a tolerance of say 100m of water to cross and your typical check is 1.5km then you could reasonably do a grid A*. But 10m tolerance will be >>10x the cost.

rugged acorn
#

@granite sky thank you for your answer mate... I believe that having some expensive/heavy functions running on init is fine since this should be a one time thing or just add some suspension to avoid freezing everything down... But if I may ask, what's your idea of grids? How I should make this work? Should I separate the line that would connect the spawn position with the objective into grids and check if there is a water body in any of these grids?

granite sky
#

Depends. If you're ok ruling out any pair of points with significant water directly between them then it's pretty easy. Just check every X metres down the line with surfaceIisWater or the ASL Z value.

#

If you want to allow points where there's water between but still a valid land route then it's trickier.

past wagon
#

I have a custom .paa icon that I want to draw on the map in red, but it's only appearing in gray. Is there a way to edit the image to make it compatible with drawIcon's coloring?

((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {
    (_this select 0) drawIcon [
        getMissionPath "images\player_map_icon.paa",
        [1,0,0,1], //TRYING TO MAKE IT RED
        player,
        40,
        40,
        getDir player
    ]; 
}];
#

Even when I change the color of the image itself, it appears in gray

fair drum
#

When I've seen that, it's because I messed something up on the png side of things with alpha layers/transparency and stuff. Check that first.

past wagon
oblique imp
#

Could anyone provide an example script for obtaining a unit role in a squad?

haughty hare
#

if so: ```sqf
team setLeader leader

oblique imp
haughty hare
# oblique imp Driver role

this teleports a unit in a driver place

_soldierOne moveInDriver _tankOne;

this gives him a order to enter a vehicle so he will manually go to vehicle and get in

_soldier1 assignAsDriver _tank;
[_soldier1] orderGetIn true;
oblique imp
meager granite
#

[1,0,0,1] mean you're only using red component of your texture and if you barely had any (texture is green or blue), you'll have no greens and no blues and all the reds (which you had almost none), thus the grey

haughty hare
#

it doesnt work

glass nest
high shale
#

Would anyone happen to know what the new font is called in the game itself, i know its 'Roboto' but not sure what it is in game?

#

DW, found them.. encase anyone wanted to know they are... RobotoCondensedLight , RobotoCondensedBold , RobotoCondensed

split ruin
#

any way to apply flag patch to the vanilla Enhanced Combat Helmet, it seems it has the needed selection 🤔
something like the clan logo

this setObjectTexture["clan","usp_patches_usa\data\army\sf_oda9616_ca.paa"];
hallow mortar
#

Not with setObjectTexture. Helmets are proxies, not individual objects, and can't be targeted like that.
You could make a new variant and set its config hiddenSelectionsTextures with your new textures, but that requires a mod and isn't done with scripting.

past wagon
tulip ridge
#

Usually if it's all grey like that, it's a bad resolution (not a power of 2 x power of 2)

past wagon
winter rose
tulip ridge
#

Not sure how ImageToPaa let you make that, it's not a valid resolution for PAA

fair drum
#

If you save as paa on tex2edit or whatever without building, it bypasses those checks.

past wagon
winter rose
real tartan
#

I am running script from initPlayerLocal.sqf

// initPlayerLocal.sqf
[ player ] execVM "script.sqf";

how would I run this from initServer.sqf ? assuming keeping locality/JIP

old owl
real tartan
real tartan
faint burrow
#

Then use remoteExec.

real tartan
old owl
faint burrow
real tartan
# old owl How are you limited?

by structure of project, how files are organised and separation of client/server modules. introducing new initialisation of script was denied by project developer

hushed turtle
#

Where do you want to run this script.sqf?

#

On which machines?

real tartan
hushed turtle
#

So you need to run it everywhere, so init.sqf?

real tartan
#

run on client machine, when he joins mission, or jip to mission

hushed turtle
#

Or better run server part on server and rest of client?

old owl
#

What are you trying to run? It may be easier for us to help if we understand a larger scope of what you're wanting to execute.

hushed turtle
#

I'm a bit lost too krtecek

real tartan
#

script execute code run on server, but does require to run AddEventHandler for when player open map ( thus local to client logic ). so I need to add addMissionEventHandler Map for each client that join mission via script that is executed from initServer.sqf

faint burrow
#

It definitely makes sense to run it in initPlayerLocal.sqf.

hushed turtle
#

Why does add EH script on client have be called from server?

real tartan
faint burrow
#

Otherwise, you need to change your scripts to use remoteExecs.

old owl
#

If you need to run code on server prior to having the event handler be added to the client, it would probably be best you utilize remoteExec like Schatten mentioned earlier. A good practice (in my opinion) is to have a singular introduction remoteExec where things can be passed from server to client in one remoteExec to avoid multiple network calls and having to worry about JIP precedence.

For example:

// initPlayerLocal.sqf
["whatever arguments"] remoteExec ["TAG_fnc_requestData", 2];
// fn_requestData.sqf
// do various code stuff on server
["return arguments"] remoteExec ["TAG_fnc_receiveData", remoteExecutedOwner];
// fn_receiveData.sqf
// add your event handlers and whatever else you want on client
real tartan
old owl
errant jasper
#

[[], "script.sqf"] remoteExec ["execVM", 0, true];, and grab player inside the script, and stop the script if isDedicated is true.

old owl
#

Er actually looks like I did actually type init.sqf and that appears to be on mission started. I guess you would replace that event script with initPlayerLocal.sqf- that's my bad. Dropped an edit on #arma3_scripting message

real tartan
errant jasper
#

Boolean - if true, a unique JIP ID is generated and the remoteExec statement is added to the JIP queue from which it will be executed for every JIP

real tartan
errant jasper
#

Or rather for the player on the hosted server

real tartan
#

good point

old owl
#

If it is -2 player hosted server won't get it, which can ocasionally cause headaches

#

My advice is to do something like this for the target

[-2, 0] select hasInterface
#

Easiest solution would be Muzzleflashes method. If you have other tasks you are planning and are wishing to save network / guarentee order, the advice here would be pretty useful #arma3_scripting message but both will account for JIP

errant jasper
#

And I also don't recall if the JIP processing might happen for clients before player object is ready on clients. So may or may not need a waitUntil {player} in the script.

#

Could use a wrapper script that is RE'd, would make it easier to filter headless clients too etc..

old owl
#

A while ago I feel like I remember someone working on TypeScript for CT_WEBBROWSER but I can't find anything about it when I search the Discord. Could I be misremembering and it be some sort of other superset of JS or am I just being dumb and not finding it?

delicate hedge
#

For example i have some hashmap variable, and server broadcasts it first time. Later when i change some values in hashmap and broadcast it again does it broadcasts full hashmap (with even unchanged keys) or only the changed/new keys and values? Is it somehow optimised? Im asking because im making my own OOP system and i want to know whats better to use for network optimisation: hashmap or create dummy objects and use set/get variable

tulip ridge
#

Sends the full hashmap, server doesn't/can't know the state of the hashmap on each client

granite sky
#

There's no automatic choice there. A down side of setVariable is that each global set is a separate JIP queue entry, IIRC.

delicate hedge
granite sky
#

For the same variable, sure.

#

But if you're comparing with hashmaps then I assume you're using multiple variables.

old owl
#

We were able to put a large dent in our JIP queue by reducing ~12 public object variables per object to ~2 a few years ago but we also had thousands of objects with said data

hushed turtle
#

You could write function which takes key values pairs in array and sets them in hashmap

granite sky
#

Third option, yes. Need to send the server copy manually to JIP clients too.

#

Need to consider how often you're updating and how many entries you're going to have.

#

Just publishing mostly-redundant hashmaps is not necessarily the worst option.

old owl
delicate hedge
#

i think i will stick to dummy objects

still forum
split ruin
#

how to get the magazine classname from launcher ?
there is command only for primary weapon

_magazineClass = currentMagazine player;
split ruin
#

@exotic mesa oh, launchers are secondary items, I got it now 😆

exotic mesa
#

Yeah 😅 also got handgunMagazine because who needs consistency

hushed turtle
still forum
#

Yes. Yes.

fair drum
#

I do that as well for Network hashmaps. It's worked well so far.

#

So idk about the viability, but could we get private/internal methods and member vars for hash map objects? Only internal methods could modify the private vars?

hushed turtle
#

That would be amazing meowawww

still forum
charred monolith
#

Hi ! Is there a way to detect if a vehicle is empty ? I can't find a command for this, and the only way i've come up with detecting this is by doing a forEach on allPlayers and using getCargoIndex, which isn't ideal in my opinion.

hushed turtle
charred monolith
#

Thank you very much !

proven charm
#

i have object attached to the player, how can i get the coordinates of the object so that when i want to place the object in world its in same position? it seems simply using getposATL on the object isnt accurate especially with large objects

hushed turtle
#

Maybe player's model space position and covert it to world would be accurate?

#

I'm thinking maybe objects roration is causing inaccuracy?

proven charm
#

actually that is covered.. its the z that is wrong

#

which commands i should try?

#

so it has something to do with objects height i guess

faint burrow
#
_position = _object modelToWorldVisual (_unit getRelPos _object);

detach _object;

_object setPosASL (AGLToASL _position);

?

hushed turtle
#

What height is being returned then?

proven charm
#

havent checked height but its tall object..

#

@faint burrow no luck there

arctic bridge
#

Quick question
Other than using a CBA event to manually re-add the item, is there any way to stop someone from dropping an item in their inventory?
Or alternatively, adding mass to the player?

proven charm
arctic bridge
#

Hmm, I'll probably have to go with some kind of EH set up yeah

Basically I've got an air tank (technically a magazine) the player can equip. Problem is for that to work I need to remove it from their inventory and replace it with a dummy version that can't be touched

mortal folio
#

And make it extra robust so players cant dupe them

arctic bridge
#

Mm
I'll see what I can come up with, thanks

arctic bridge
#

Huh, that was pretty straight forward lol

mortal folio
arctic bridge
#

...
Shit lol

mortal folio
#

You could check if its a weaponholder instead, but then what if its a corpse and not just one spawned by dropping the item

#

Things to consider

#

Also technically you wouldnt need to worry about this if you just dont run deleteVehicle 🤷

#

Instead just removeitem from container

arctic bridge
#

removeItem didn't want to work so I went with delete vehicle
I'll need to play with it a bit more

#

God I love arma

split ruin
arctic bridge
#

That'll empty the whole box, I just need to remove one item

#

Maaaaybe I could record the contents, clear the box, edit the array, then refill the box?
I really don't want to though lol

arctic bridge
#

You can do that? huh

winter rose
#

since "recently" yes 🙂

#

since 2.14

arctic bridge
#

Thanks!
Arma is one of the games of all time lol

delicate hedge
#

is it possible that when many (10 for example) scripts that modify some array variable (adding elements) and broadcast it via setvar true runs in scheduled environment on server (they were spawned) can overwrite this array because of intersections in execution of scheduled environment scripts?

granite sky
#

You have scripts something like this?

private _array = _object getVariable "myArray";
_array pushBack _value;
_object setVariable ["myArray", _array, true];
#

This is actually risky code.

#

actually maybe only risky with _array = _array + [_value]

granite sky
#

Otherwise all your scripts are referencing the same array, oddly enough.

#

but in general, scheduler can break in the middle of that.

#

And therefore you might lose information.

meager granite
#

Have a separate thread that handles broadcasting so you don't broadcast older array by accident

granite sky
#

Wrap any read-modify-write stuff in isNil {} to make it unscheduled is the quick solution.

old owl
#

Honestly not sure. I want to say we've had 1 or 2 rare occasions where we ran into issues though with setVariable not running as fast as intended so data getting wonked, particularly with resize maybe.

Something to keep in mind is setVariable is only as reliable as the rest of Arma network and there's not guarantee a user will receive a specific message. The higher frequency you update, the higher chance a user misses something.

granite sky
#

Well, setVariable itself is atomic. But you need those three lines to run without another read-modify-write on the same var running halfway through.

delicate hedge
#

Ok, ill do this

#

Isnil

hushed turtle
#

It would be better to update it once, rather than multiple times at almost same time

pallid palm
delicate hedge
granite sky
#

Well, another thing is that publishing commands like setVariable true and publicVariable will all send data. It won't compress them to only one send per frame or something like that.

#

And absolutely do not publish the same variable from multiple machines, because then all bets are off.

granite sky
hushed turtle
old owl
#

Depending on how important the data is, the frequency you intend users to access and how long you want it to take; might even be better to just request it from server via remoteExec like so:

var = -1;
[getPlayerUID player] remoteExec ["TAG_fnc_updateWhatever", 2];
waitUntil {var != -1};

The above uses a number instead of an array and you'd want a timeout likely and maybe a sleep but FWIW.

granite sky
little raptor
old owl
hushed turtle
#

I was about to ask, if there is fancier way to do this.

errant jasper
#

Well publicVariable and setVariable true should be reliable communication. If you can verify that updates are lost over the network without clients dropping, and it not being a concurrency bug in own code, then that should be a bug report.

It is also interesting technical question if you setVariable true on a variable containing an array, but then modify the array, whether what exactly will be sent.. Like whether it does a full copy immediately for network sending, or whether it just grabs it later when the engine prepares packets.

little raptor
#
// you remote exec this via client, e.g [var] remoteExecCall ["TAG_fnc_askServerForVar", 2]
[_result] remoteExecCall ["TAG_fnc_giveBackResult", remoteExecutedOwner]
old owl
hushed turtle
#

LOL

old owl
hushed turtle
#

We're talking scripting. I'm like fully in it and suddenly some scam just appears 😅

little raptor
errant jasper
hushed turtle
old owl
little raptor
old owl
hushed turtle
#

It seems I would have to tell server, which function I want him to call on my machine to update the var and then run local code with it

little raptor
errant jasper
hushed turtle
#

Games are UDP, aren't they?

errant jasper
#

That is like saying IP is unreliable and sinced TCP is built on IP, TCP cannot be reliable

old owl
#

In my experience, when you've got more than a hundred players on at one time; and a lot from different regions with unreliable internet connections, data gets lost. That is all I am saying.

delicate hedge
# granite sky You'd have to be more specific about what you're doing really.

here is project code: https://github.com/VaZaR00/arma3-cfm-system/tree/no-embedded-ui-version

There i have some set functions (fn_setOperator for example) and they create some instances of "class" (my custom system) and in init of this classes there it calls DbHandler for updating Array of instances globaly like in operator class init i call ["addOperator", [_operator]] CALL_CLASS("DbHandler"); .
But fn_setOperator function is always spawned because it has to wait for fn_init function completed (so CFM_init is true).

GitHub

Contribute to VaZaR00/arma3-cfm-system development by creating an account on GitHub.

hushed turtle
little raptor
#

yeah that's a good way

#

it doesn't have to be a var name tho. it can just be a request id (incremental). the goal is simply to know what you asked the server when it responds to you

small perch
#

how can i give a "AnimDone" EventHandler I add, a custom value?
I want to give it a int that the EventHandler will pass onto a function

old owl
small perch
#

yes

old owl
#

Gotcha- so while there's no way to pass local arguments to the event handler, you can use getVariable to access variables from other namespaces like missionNamespace. If the data that you're intending to pass is a constant, you can also use preprocessor like #define in the script where you have the event handler 🙂

south swan
#

or setVariable it onto a unit/entity you're slapping and Event Handler onto

small perch
#

alright, thanks

old owl
#

Thinking a bit more about it though, the preprocessor tidbit I gave probably actually doesn't make much sense for it as at that point it could also just as easily be defined in the event handler out right.

old owl
#

Can anyone think of any harm to doing something like this in the mission.sqm?

class Item1615
{
    dataType="Marker";
    position[]=
    {
        16009.964, 50.172607, 18160.525
    };
    name="silver_1";
    text="Silver Mine";
    type="mil_triangle";
    colorName="ColorBrown";
+   wikiPage="https://wiki.domain.com/wiki/Silver";
    id=102209;
    atlOffset=0.3080368;
};

At the moment I don't intend to actually access this property in-game but we have CICD that parses the mission.sqm and it would be useful if I could add a custom property like the above.

From what I tested map works okay with it, but no idea what would happen if map markers get moved around and the file gets saved; or if there are any other potential edge cases I am not thinking of.

errant jasper
#

No harm, but would be wary of it getting lost on changes via the editor etc

proven charm
#

CICD is totally new to me so cant say much, without explanation (just read about it) 🙂

cosmic lichen
#

You can also create a hidden attribute for a marker containing that link. Then it won't get lost etc.

digital hollow
#

Or the comment entity

hallow mortar
#

The commentity, if you will

mortal folio
#

did anyone try projectile redirection before? im doing this inside of a unit's Fired EH

private _projectile = _this select 6;
_projectile setVectorUp ((_projectile modelToWorldVisual [0, 0, 0]) vectorFromTo (unitAimPositionVisual CE_CurrentTarget));
_projectile setVelocityModelSpace [0, 0, vectorMagnitude (velocity _projectile)];

where CE_CurrentTarget is the target we're aiming at - but for some odd reason on certain maps the projectile goes way above the target, inconsistently high depending on the current spot in terrain

both unitaimposition and modeltoworldvisual are AGL so this shouldn't be happening, thus i am somewhat confused

#

it works perfectly fine in VR thonk

#

this is technically the second version - my initial version set both vectorDir and vectorUp and threw the bullet towards the target in an identical way, also worked in VR; but didnt work on various maps (this was set up a while ago but as far as i recall i changed to vectorUp only since i think i realized bullets use their up direction)

#

im not sure if i should be waiting an x number of frames after the projectile is spawned, or if the engine changes its trajectory over time and have to do it every frame

mortal folio
#

okay converting to ASL worked despite my initial assumptions being that it should just convert normally since both shooter and target are on the same plane (ATL).... uh

little raptor
#

yeah adding or subtracting vectors in different coordinate frames is meaningless

#

which is why you should convert them to ASL

still forum
granite sky
mortal folio
old owl
#

Cheers for all the advice on my mission.sqm thing. Hidden attributes and comment entity are good ideas. I will say although I didn't initially care to have them accessible in-game, would be kinda sick if I did given CT_WEBBROWSER exists. Would be cool to have players be able to quickly and easily open a wiki link where they are if they are inArea or something. Not sure which approach I'll take yet but very helpful 🙂

still forum
#

Webbrowser doesn't open internet pages like wiki.
But you can give them a button to open the steam overlay browser

old owl
#

Or did I maybe use something else there? Been a while and I don't remember 😄

still forum
#

Retail has internet disabled

old owl
#

I am gonna confirm first to make sure I am not trolling you but pretty sure it works in perf in MP 👀

#

I remember getting really weird results that it wouldn't work on stable and only on perf despite it being released to stable so I used __A3_EXPERIMENTAL__ to feature flag

mortal folio
#

Tiktok of all things. Shame.

old owl
#

I got clowned on so hard for merging that to prod NGL

#

I deserve it too

still forum
old owl
radiant lark
#

This dedmen man doesnt like me anymore 😔

small perch
#

how can I set the position of a unit to move forward like a meter? I tried setPos however that seems to set it using the global position rather then the local one

#

by move forward I mean actually set it's position and not walk

sly cape
small perch
sly cape
small perch
digital hollow
#

There is a getRelPos syntax that is simple for this

versed widget
#
bob addEventHandler ["HitPart", { 
    _hitpart = _selection select 0; 
    systemChat str (_hitPart); 
}];

its been a while since i used something like this but cant remember how i used to do it, it still returns any.

little raptor
versed widget
old owl
# versed widget can you fix that for me, am kinda lost in the sauce

Take a look at this documentation of the event handler:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart_(Entity)

You'll notice in the example and list below it shows all of the arguments that can be accessed.

To access _selection like you are intending, you have to access it from the arrays inside of _this first as otherwise _selection is undefined.

To build off of what Leopard20 mentioned, either select <index> or params will work here because _this is an array of sub-arrays with your selection.

For example:

bob addEventHandler ["HitPart", { 
  {
    _x params [
      "_target", "_shooter", "_projectile", "_position", "_velocity",
      "_selection", "_ammo", "_vector", "_radius", "_surfaceType",
      "_isDirect", "_instigator"
    ]; // define local varaibles for each item inside of the array
    systemChat str _selection; // print the selection in chat
    diag_log _selection; // although diag_log would likely be better for your use case here if I had to guess
  } forEach _this; // go through each of our sub array of hit parts
}];

Since you don't appear to intend to access any of the other elements you could also do:

-    _x params [
-      "_target", "_shooter", "_projectile", "_position", "_velocity",
-      "_selection", "_ammo", "_vector", "_radius", "_surfaceType",
-      "_isDirect", "_instigator"
-    ];
+    private _selection = _x select 5;

For more information see:
https://community.bistudio.com/wiki/forEach
https://community.bistudio.com/wiki/params
https://community.bistudio.com/wiki/select
https://community.bistudio.com/wiki/diag_log

split ruin
#

how to make some mods to be client only (like JSRS)? is it working with player hosted server or dedicated only? 🤔

proven charm
#

if this isnt vehicle creation/config question you can use if(hasInterface) to run code only on clients

proven charm
#

is it not possible to put html link to createDiaryRecord?

proven charm
#

links not working , thx though

split ruin
#

seems forum died completely ... at least on my end

proven charm
#

hasnt worked for me for a while, i mean not even read only

faint burrow
proven charm
#

interesting hacks, will try this stuff 🙂

proven charm
#

well i got to the point there is button in diary now but for some reason cant click it

proven charm
#

ctrlSetFocus for the button fixes this but if you click elsewhere then the button stops working again

zealous heath
#

I am currently on my first ever attempt at making a custom faction and am having an issue, where arma does not seem to recognize my macro:

backpacks.hpp

class UNSC_Rifleman_Backpack : OPTRE_UNSC_Rucksack {
    scope = 1; scopeArsenal = 0;
    class TransportMagazines {
        MAG_XX("OPTRE_32Rnd_762x51_Mag_Tracer_Yellow", 12);
    };
};

class UNSC_AA_Backpack : OPTRE_UNSC_Rucksack {
    scope = 1; scopeArsenal = 0;
    class TransportMagazines {
        MAG_XX("OPTRE_32Rnd_762x51_Mag_Tracer_Yellow", 6);
        MAG_XX("OPTRE_M41_Twin_HEAT_G_AA", 2);
    };
};

macros.hpp

#define MAG_1(a) a
#define MAG_2(a) a, a
#define MAG_3(a) a, a, a
#define MAG_4(a) a, a, a, a
#define MAG_5(a) a, a, a, a, a
#define MAG_6(a) a, a, a, a, a, a
#define MAG_7(a) a, a, a, a, a, a, a
#define MAG_8(a) a, a, a, a, a, a, a, a
#define MAG_9(a) a, a, a, a, a, a, a, a, a
#define MAG_10(a) a, a, a, a, a, a, a, a, a, a
#define MAG_12(a) a, a, a, a, a, a, a, a, a, a, a, a

#define MAG_XX(a,b) class _xx_##a {magazine = a; count = b;}
#define WEAP_XX(a,b) class _xx_##a {weapon = a; count = b;}
#define ITEM_XX(a,b) class _xx_##a {name = a; count = b;}
#define PACK_XX(a,b) class _xx_##a {backpack = a; count = b;}
#

any help greatly appreciated

proven charm
#

nvm you have the ; in there

zealous heath
#

first thing I checked too

zealous heath
iron flax
marble flint
#

Is there is any way to make forth faction somehow or allow AI in one faction to attack each other but own group?

#

Like having Alpha 1-1 and Alpha 1-2 that will attack each other as with east setFriend [east, 0]; but soldiers in group will not attack their groupmates

winter rose
#

nope

restive leaf
#

Is a shame though... Would be nice to set a group to ENEMY where every one will attack them but they won't attack each other

small perch
#

how do I check what names mods have when checking for them in "activatedAddons"?
I in the screenshot I am checking if ace medial is on. i originally got this name from the code of the Improved Melee System mod.
Currently I want to do a similar check but for the Improved Melee System mod however I am not sure how I find the necessary name.

hallow mortar
#

CfgPatches addon name, presumably

granite sky
#

activatedAddons is weird. If you have multiple CfgPatches entries in a PBO then it seems to only list the last one, alphabetically.

#

isClass (configFile >> "CfgPatches" >> "whatever") seems to be a much better bet if you're dealing with mods that might add stuff later.

small perch
#

alright, thanks!

oblique imp
#

Looking for SQF documentation or example scripts to learn Arma 3 modding. Any good PDFs or guides out there?

proven charm
#

modding and scripting are bit different things but I take it you want to script missions

oblique imp
#

Thanks

oblique arrow
#

Hey peeps I need some guidance.
I'm creating a local object to rotate a bit and need to assign that object a varname/ make it editable by another local function but I cant get it to work.
I already tried just assigning a varname and then using that but it didnt work, I also tried assigning a it as a local variable but that didnt do anything either.
Anyone got any helpful pointers for me?

_PieLander = createVehicleLocal ["3as_StaticVehicle_CISLander", _newPos, [""], 0, "CAN_COLLIDE"];
//... other stuff ...
_PieLander setVehicleVarName "Pie_Vio_Object_Lander_Local";
//... other stuff ...
localNamespace setVariable ["Pie_Vio_Object_Lander_Local", _PieLander];

-> all no worky for what I need :(
proven charm
#

you can just make it global variable, no need for setVehicleVarName

#

PieLander = createVehicleLocal

#

then use PieLander wherever

oblique arrow
#

does global var work if vehicle is local? Interesting

proven charm
#

those are two different things.. local vehicle means it only exists in one machine

hallow mortar
#

Global variable in this case is global scope, not network global. It's still only setting the variable on this machine.

faint burrow
#

Global var != public var.

oblique arrow
#

Aaaaah ok makes sense, thank you smart people blobheart

hallow mortar
#

However, your existing use of localNamespace is basically the same thing, so it should be working provided you're correctly retrieving from localNamespace when you do your getVariable

oblique arrow
hallow mortar
#

I would expect that to work

#

Possible investigation angles:

  • something else in the script could be failing, causing the variable to not be set or causing the second function to abort for another reason
  • are you absolutely sure that the second function is running on the same machine as the object was created on
oblique arrow
#

I'll try out global var variant and go over the script again, still got a good bit of stuff to fix moving over to dedi server locality. The object is created locally on all clients so I can rotate it more fluidly without relying on network transmission so there should be no issues in terms of the 2nd function finding the object methinks

exotic gyro
lunar mountain
#

Greetings, what do onPreloadStarted/onPreloadFinished do? What is the "preload screen"?

little eagle
#

NVM, both work for me:

14:57:59 [52075,1954.96,0,"XEH: PreInit started. v2.3.0.160217. MISSIONINIT: missionName=$The_Test$, worldName=VR, isMultiplayer=false, isServer=true, isDedicated=false, hasInterface=true, didJIP=false"]
14:58:00 [52075,1955.6,0,"XEH: PreInit finished."]
14:58:00 "preload started"
14:58:00 [52077,1956.07,0,"XEH: PostInit started."]
14:58:00 [52077,1956.08,0,"CBA_VERSIONING: cba=2.3.0.160217, "]
14:58:00 [52077,1956.09,0,"XEH: PostInit finished."]
14:58:00 "preload finished"
#

XEH: PreInit is about that point when CfgFunctions preInit = 1 functions are called

#

XEH: PostInit slightly before CfgFunctions with postInit = 1. (After the player is set)

#

Pretty interesting

#

They are executed again when I use Shift Num- FLUSH:

15:00:21 "preload started"
15:00:21 "preload finished"
#

"preload screen" seems to be the loading screen

#

Also happens when you change some graphics settings (i.e. textur quality):

15:03:59 "preload started"
15:04:00 "preload finished"
tulip ridge
#

Did I accidentally forward something lol @winter rose

#

I had my phone in my pocket and seemingly accidentally forwarded a message a bunch lmao

winter rose
tulip ridge
#

Pretty good ad for YouTube's premium thing lol, sorry

#

I guess keyboard somehow changed too, I now have "/" where a comma used to be

small perch
#

does the ace mod actually change what the "HandleDamage" Eventhandler passes in it's _selection ?

#

it seems to and that feels so off. the _selection is so unhelpful without ace loaded

hushed turtle
#

Why would mod change what gets passed into EH as parameter? It sounds like something mod can't change anyway

warm hedge
#

If it is a case, that'd mean ACE changed config, not code. A Mod cannot change what it would return in SQF

hallow mortar
#

_selection in handleDamage always contains the selection that was hit. ACE doesn't (can't) change how the EH works. That's part of the engine, which is not accessible to mods.

small perch
#

I see, I guess it is slightly different due to the ace armour changes

hallow mortar
#

ACE does some stuff to the default human model config to add more parts for its advanced injuries; these new more detailed selections will be reported when they're damaged. But those selections simply don't exist without ACE loaded, so the EH is not being any more or less "helpful" - it's always just reporting what's actually happening.

small perch
#

that makes sense. is there a way without ace to determine if a human was hit in the right or left arm for example?

hallow mortar
#

Yes, there are hit selections for leftarm, rightarm, leftforearm, and rightforearm

#

Note that because of the way damage works in Arma, you may need to do additional filtering to (attempt to) find out whether it was a direct hit to the selection in question. Hits can affect multiple selections, either by projectile penetration or by "splash" damage to adjacent selections.

oblique arrow
# oblique arrow Hey peeps I need some guidance. I'm creating a local object to rotate a bit and ...

I'm back as always
I need some more help smart peeps 👉👈

So with your help the local object creation is working and I've been able to build up/re-localise a bunch of stuff based on that but I havent been able to get bis fnc attachToRel working yet.
The goal is to attach a fair few (global) helper objects to the local version of the lander but I havent been able to get it to work yet.
Anyone got any ideas perchance?

My initial try from when it was SP ist just a looping bis fnc attachToRel

private _attachToLanderArray = [Pie_Vio_Object_PlaceSatchel_Helper1,[...],pie_sfx_randomExpl_helper_8,pie_sfx_randomExpl_helper_9];
_attachToLanderArray append (getMissionLayerEntities "pie_sfx_randomExpl_helper" select 0);
{[_x, Pie_Vio_Object_Lander] call BIS_fnc_attachToRelative;} forEach _attachToLanderArray;

I also tried running that inside a waitUntil !isNull Pie_Lander loop to make sure it isnt running before the lander's been created but that didnt get me any further.
Currently trying to use attachTo directly with some setVectorDirAndUp to keep the previous position but not having any luck there either.

Anyone got any ideas what could work/what I'm likely doing wrong? Not done too much stuff like this switching between mixed local/global localities

hushed turtle
#

AttachTo is global I don't think you can attach it to local vehicle (only existing on local machine)

oblique arrow
#

I read that on the wiki a few hours ago but was hoping the hivemind has a workaround lol

small perch
hushed turtle
#

Subtract current damage to get damage added by injury

small perch
#

that does make sense, like this?
_actualDamage = _damage - (vehicle _unit getHitIndex _hitPartIndex)

hushed turtle
#

vehicle _unit doesn't make sense. HandleDamage is either added to unit or vehicle, not combination

#

HandleDamaga also fires for total damage, so it won't always be part

small perch
#

thats what the getHitIndex says to do. the onlt thing I found that could fit

hallow mortar
#

That's just an example, not the only possible way

hushed turtle
#

It says vehicle as left side argument, but really it most likely works for units too

small perch
#

i understand

#

I am finding the _selections to be odd. when I shoot a unit that is wearing civilian clothes (shorts) in the leg is always gives me leftarm
and if I shoot a unit wearing a CSAT uniform it never gives me anything with right or left in it's name but always the generic arms and legs.
while that is technically most of the way to what I am looking for I would prefer getting the actual side too

hushed turtle
#

It supposed to fire multiple times, since multiple parts get damaged by one hit

winter rose
#

hint is not a good enough debug method, systemChat or log print is ^^

azure portal
#

Does anyone know why this error is showing up? The code it's responding to is below, it's in the postInit of a unit and it's currently being tested in a singleplayer scenario loaded from the Editor

_this setUnitLoadout (getUnitLoadout (typeOf _this))
winter rose
#

_this is most likely an array, like the error says

azure portal
#

But _this in the context of a unit eventhandler is an object though isn't it?

small perch
#

changing topics. is there a way to force a unit to change animation but stay at the same spot the last animation ended at.
For instance some Improved Melee System animations end with the character lying in a offset spot. if I change the animation the character will return back to the initial position. I did try setting the character to be unconscious for 0.5 seconds before changing the animation however while it is better then teleporting back it's not perfect.

hallow mortar
#

The unit is probably the first element in that array, e.g. _unit = _this#0 or params ["_unit"]

azure portal
hallow mortar
#

If you're going to use more than one of the EH's parameters, then params is likely to be more efficient than multiple select

azure portal
#

Just using the reference to the unit so that should be alright I think

hallow mortar
#

If you're going to use the unit reference more than once in the event, then saving it to a variable is definitely more efficient than doing _this select 0 every time

azure portal
#

How much more efficient for using it twice vs using it once?

hallow mortar
#

Negligible (but it will look neater)

azure portal
#

Fair

knotty mantle
#

Hey Guys, i need a bit of help with an error here. If have the issue that the PzF3 from the bwmod wont get loaded into my vehicle. This ist my WeaponCargoVar:

[["BWA3_G36KA2_RSAS_pointer","BWA3_MG4_ZO4x30_pointer","BWA3_PzF3_Tandem_Loaded"],[2,1,2]]

then i load the vehicle using this script:

weaponCargoVar = (MissionState getOrDefault [(str _x)  + "weaponCargo", (getWeaponCargo _x)]);
if((count (weaponCargoVar select 0)) > 0) then{
    clearWeaponCargoGlobal _x;
    _vehicle = _x;
    //hint str _vehicle;
    {
        _vehicle addWeaponCargoGlobal [((weaponCargoVar select 0) select _foreachindex), ((weaponCargoVar select 1) select _foreachindex)];
    }foreach weaponCargoVar;
};

But the inventory afterwars ist just:

[["BWA3_G36KA2_RSAS_pointer","BWA3_MG4_ZO4x30_pointer"],[2,1]]

The save of the missionstate is working fine. If i take the MG4 out, it wont show up after restart. Anybody got an idea?

#

Adding the pzf manually via script works fine btw.

faint burrow
#
{
    _vehicle addWeaponCargoGlobal [_x, ((weaponCargoVar select 1) select _forEachIndex)];
} forEach (weaponCargoVar select 0);
proven charm
#

@knotty mantle _x is outside of foreach

knotty mantle
proven charm
#

ok 👍

knotty mantle
faint burrow
#

weaponCargoVar contains 2 elements -- weapons and counts. And we need to iterate over weapons (or counts).

knotty mantle
#

Yeah that makes perfect sense. Thank you very much. You just ended a longer than i like to admit error hunt 🙂

faint burrow
#

BTW, you don't need to use global var here.

knotty mantle
#

yeah i know. That was one of the troubleshooting steps so i could access it in the ingame console

small perch
#

I am not sure what the real difference between

player switchMove "anim";
and
[player, "anim"] remoteExec ["switchMove"];

are there specific uses for each or do they do the exact same thing?

mortal folio
# small perch I am not sure what the real difference between player switchMove "anim"; and [p...

as the wiki says

"This command has a global effect when executed locally to the unit and will synchronise properly for JIP. In this case the animation on the executing machine is immediate while on remote machines it will be transitional. In order for the animation to change immediately on every PC in multiplayer, use global remote execution (see Example 2). When the argument is remote, the animation change on the executing PC is only temporary."

#

in short, it's ideal to always just globally exec it, and use alt syntax

small perch
#

what do you mean by alt syntax?

mortal folio
#

i mean the alt syntax shown on the wiki

#

player switchMove ["anim"]

#

"If the animation you're trying to use with this command has no connection/interpolation to the unit's base animation (usually "AmovPercMstpSrasWrflDnon"), the move might not play using switchMove alone. In such cases you have to do this:
_unit switchMove _move; _unit playMoveNow _move;
This must run in unscheduled environment (see isNil)
Alternatively, just use the second syntax:
_unit switchMove [_move];"

small perch
#

I think I understand.

#

what does "the animation you're trying to use with this command has no connection/interpolation to the unit's base animation" mean?
is it if the animation I am playing does not naturally flow back into the default animation upon ending?

mortal folio
# small perch what does "the animation you're trying to use with this command has no connectio...

if you've ever seen those spaghetti nodes called animation state machines it's basically that - every animation in the game has some "path" to another animation, that's how they can transition to each other; for example going from standing to prone, it doesnt immediately switch to prone, there's a path from standing where it first plays the "going prone" animation, and then the prone animation, which is two steps technically - most cinematic animations do not have any path in or out of them so when you brute-force switch to them there's no way out and you get stuck in it, regardless of the inputs you make or what the engine designated as the exit/default

small perch
#

alright, and for those I use remoteExec or the alt syntax?

mortal folio
#

both

#

[player, ["anim"]] remoteExec ["switchMove"];

mortal folio
#

going solely by the wiki it doesnt seem like alt syntax is any different in terms of its multiplayer rules compared to first syntax, so doing both is still probably ideal

#

the few times i've used switchMove it always worked just fine

#

i generally dont like it cause it is stance and pos agnostic but if you're doing cinematic stuff it serves the right purpose

small perch
#

thanks

old owl
#

Also super interesting stuff on isNil being used to run code in unscheduled context. I remember John Jordan saying that here #arma3_scripting message a weekish ago and had never heard of that before. What are the benefits or reasons you would do something like this? Error handling in cases of nil values?

mortal folio
mortal folio
#

in the 1% occassion i use scheduled in my dozens of thousands of lines of code (that being exclusively just for AI behaviour) i also just use isNil within those scheduled scripts for variable assignments and anything that should be done "on time" and quickly, while running things like checks for enemies and near entities in scheduled for the AI's "thinking"

old owl
#

Ahhhh okay cheers ty. All the development I do is for an MP mission without AI, so that probably explains why I've never needed to do something like that. Although honestly probably tons of uses I could've used that, just never knew the trick existed. Makes sense in context of the command checking nil values, but hell of a hack haha.

granite sky
#

Main reason to use unscheduled is to ensure that your code isn't interrupted.

mortal folio
#

ye scheduled tends to hold your hand, especially with the nil variables part - i have one thing where i just assign a variable to an if statement without an else, which makes it nil if "if" ends up being false, and i then return that from the script, but scheduler freaks out in the false case because it doesnt like nil

granite sky
#

Otherwise in an extreme case there could be multiple frames between your playmove & switchmove here, for example.

#

nil reference behaviour should not be considered a plus for unscheduled :/

#

actually makes it hard to test code properly because it can appear to be correct when it's not.

mortal folio
#

that's true, it's a double edged sword

granite sky
#

I really want nil references to throw errors in -debug mode.

mortal folio
#

probably would be nice yeah - its both good and bad; my logic is yeah you could say "just return something, like false, or a 0 or something" but if i have explicit use cases for reading a bool or a scalar it conflicts with that, so being able to return nil and assign a variable to nil and then read it as nil is still for the "risky but you know what you're doing" use case

granite sky
#

There are generally alternatives, although sometimes you would rather just copy a nil.

old owl
#

One of the worst bugs I've ever fixed was people trying to load in and all of a sudden getting hung on loading not being able to log out. Ran into a nil after disableUserInput. Which also unfortunately took hour(s) to find due to it also being a race condition that was tangled along spawned scripts from shitty legacy code 🥲

mortal folio
#

also idk if this is true but i recall the scheduler's frequent checks for the "allotted time" allowed per script is also a significant overhead in large scheduled scripts, which is partly why i dislike it 😂

mortal folio
#

encountered that a few times myself 😢

hushed turtle
mortal folio
#

ye that's what i meant

finite bone
#

How do I use switchMove or playMoveNow on a player and keep it in that animation state preventing players from cancelling it? Like I want to handcuff players and keep them in that state.

(No mods please - pure vanilla)

little raptor
#

you can use the AnimStateChanged event handler and reset their anim using switchMove if they change it