#arma3_scripting

1 messages · Page 41 of 1

tough abyss
#

Been looking at some older posts where some people have said no, but some have said yes but havent provided with any details about how to do it

boreal parcel
#

I assign getPosATL to a variable, I want to check later on and make sure that it isnt [0, 0, 0]. How should I go about that?

I was thinking simple,

if (_getPosVariable isEqualTo [0,0,0]) then {}
gaunt tendon
#

anyone know the class name of the UI gps?

winter rose
#

the classname?

gaunt tendon
#

yea, is it not like RscMapControl?

#

is it RscDisplayStrategicMap by any chance?

warm hedge
#

StrategicMap is diff thing

#

What's your goal? Do you want to modify it a bit?

gaunt tendon
#

is it possible to make with ctrlcreate?

warm hedge
#

I do believe I've seen the config somewhere, let me see...

gaunt tendon
#

ty : D

#

none of these seem to work MiniMap, CA_MiniMap, BackgroundMap ...

warm hedge
#

Yep RscCustomInfoMiniMap

#

You need to make a script for it to make it work, though

gaunt tendon
#

ty, Ill take a look at RscMiniMap.sqf

warm hedge
#

No it is a 0KB

gaunt tendon
#

damn...

warm hedge
#

It is probably hardcoded into the engine

fleet sand
#

Hi guys i have a question has anybody play with BIS_fnc_kbTell function in multiplayer. I tested this on hosted multiplayer and audio cuts off if the host isnt the one who executes it ?

thin pendant
#

Hello, I have no idea how to script at all but I am trying to configure the bullet damage of a certain set of ammo. What can I do and how can I apply less damage to the given ammo?

warm hedge
#

In terms of scripting or configuring?

thin pendant
#

I suppose configuring then

warm hedge
#

Well if you don't know what those mean, scripting is something a mission can, configuring is a Mod can

#

There's some difference, some “core” things can only be edited in config

thin pendant
#

Well I'm guessing I'd have to configure it in using a mod, it already is in a mod does that mean I can just configure it without creating another?

warm hedge
#

A Mod can be modified by an another Mod - let's proceed in #arma3_config

thin pendant
#

alright ty

wanton swallow
#

Is it possible to disable rotation of player with mouse?

#

In my case when player is in unconscious state i need to prevent body rotation.

wanton swallow
deep dew
#

how to use script delete mine in trigger section ?

stable dune
copper raven
#

inAreaArray pls

deep dew
#

but is not working.

copper raven
granite sky
#

(pasted in from somewhere else, invisible character that freaks out the SQF parser)

stable dune
# deep dew how to fix it ??

If you are not using variablename trigger1 on trigger.
Then (change inArea -> inAreaArray and change trigger1 ThisTrigger)

{
        deleteVehicle _x
} forEach (allMines select { _x inAreaArray ThisTrigger });
granite sky
#

allMines inAreaArray thisTrigger

stable dune
#

Does that same?

copper raven
#
{
        deleteVehicle _x
} forEach (allMines inAreaArray thisTrigger);

this one is with the boms removed

stable dune
#

Thought allmines is all mines , my bad

south swan
#

allMines is all mines. allMines inAreaArray thisTrigger is equivalent to allMines select { _x inArea ThisTrigger }, except faster because no looping in SQF

copper raven
#

inArea*

south swan
#

thanks

stable dune
deep dew
#

@stable dune @copper raven @south swan @granite sky Oh is working, thank you so much.

#

😮

#

ahh... I have 1 question.
Now i can spawn trap in area but I can't deactive a trap. how to deactive mine ???

#

i have toolkit in my backpack but is not working.

stable dune
# deep dew ahh... I have 1 question. Now i can spawn trap in area but I can't deactive a tr...

Disarming
To disarm an explosive, you have to be an Explosives expert or an Engineer, have a Toolkit and know the location of the explosive.
Crawl [Z] to the explosive.
Select Disarma3 fm ico off.png from the action menu.
WARNING: if you don't approach the explosive carefully in a prone position, it will detonate.

Disarming a mine underwater doesn't require being in a prone position.

https://community.bistudio.com/wiki/Arma_3:_Field_Manual_-_Weapons_Advanced

deep dew
#

yeah, now i to be an Engineer, have a toolkit and know the location of the mine, but is not working

#

is bug ??

warm hedge
#

Not a bug

deep dew
#

ah is not working

#

you can download my mission for see something.

stable dune
# deep dew

Did you just test Put mine -> active Mine , after this check does your menu get updated and give option to deactive mine

hallow mortar
#

Don't you have to spot the mine (T?) before you can disarm it?

little raptor
#

Yes

sullen sigil
#

Just to validate, && and || are not lazy eval in of themselves, but require the curly parentheses and such?

south swan
#

yes

sullen sigil
#

good to know, thought || was lazy eval by default and OR wasn't meowsweats

#

next question
if I have a bunch of &&, do I need {} around each of the conditions, or do I need tons of {}? For example

a && {b} && {c}
//versus
a && {{b} && {c}}```
#

Want it when all conditions are true to be true and such

south swan
sullen sigil
#

It only uses two condition example for && so I'm confused as to how the rest of it works

south swan
#

a && {b && {c}} looks like it'd be a bit faster than a && {b} && {c} as it seems it'd drop the {b && {c}} part in one go instead of dropping {b} and then dropping {c}

#

boolean && code, The code is not evaluated if boolean is false.

sullen sigil
#

Gotcha, so in terms of actual performance versus the headache of trying to do {}ception with 6 conditions is probably not worth it?

south swan
#

🤷‍♂️ i doubt the impact of having extra && dropping its bit of code would be really noticeable with any non-trivial conditions. On the other hand, running the code seems to create extra scope or something, leading to _x >= 0.35 && {_x <= 0.65} being like 10% slower than non-lazy variant on my machine

#

long story short: if it's in performance-critical path of your code - just measure different variants and use the one that's proven faster. If it's not performance-critical - go by your own definition of readability (i'd personally prefer a && {b} && {c} for non-trivial amounts of code)

sullen sigil
#

It's just

if ((KJW_Imposters_Setting_MilitaryUniformsEnabled) &&
    ((_playerUniform != "") && (_playerUniform in (parseSimpleArray KJW_Imposters_Setting_MilitaryUniforms))) &&
    ((_playerVest != "") && (_playerVest in (parseSimpleArray KJW_Imposters_Setting_MilitaryVests))) &&
    ((_playerHelmet != "") && (_playerHelmet in (parseSimpleArray KJW_Imposters_Setting_MilitaryHelmets)))
) exitWith {false};``` so `{}` is probably fine in that case rather than trying to stack them shit tons
copper raven
#

to answer your question, it's best to nest them, because you evaluate less then

#

if you have a && {b} && {c} && {d} and a is false, the other two && are still called (the right argument is not evaluated though)

#

but if you have a && {b && {c && {d}} and a is false, then no other calls to && happen, which is better

#

the latter is as close to "short circuit" as it gets in SQF

sullen sigil
#

Can you not lazy eval code? What if it's a function call?

copper raven
#

huh?

sullen sigil
#

Why is it not valid if it returns a bool?

copper raven
#

{b} && {c}

#

there is no such syntax

sullen sigil
#

Oh, wiki page on code optimisation said a && {b || {c}} so assumed it applied for && too

copper raven
#

b is not code there

sullen sigil
#

Both the bits of code return a bool

copper raven
#

a && {{b} && {c}} is what you wrote, not valid, on the wiki page it's
a && {b && {c}} which is fine

sullen sigil
#

oh right

#

So probably best to mess with it and see what happens r.e speed?

copper raven
#

no, just always nest

#

it's the best

#

unless your cond is cheap, fx., var && var

#

at that point doing var && {var} on average would be worse, but this is super micro things that don't really matter

sullen sigil
#

If it's just != and small array searches probably fine right?

copper raven
#

it depends on the operands

proven charm
#

it's good for optimizing bottlenecks

copper raven
#

like i said, if it's just a variable, and you have a single logical operator only, then not lazy evaluating is fine

#

in any other case, use lazy eval

sullen sigil
#

Gotchu, will lazy eval it then

#

so I'd need
a && {b && {c && {d && {e}}}} etc right?

copper raven
#

yes

sullen sigil
#

roger doger thanks

copper raven
#

_myBool && _myBool
_myBool && {player distance _blabla > 4}
player distance _blabla > 4 && { player inArea _blah }
etc

#

and also do cheap conditions first, lazy eval the expensive ones

sullen sigil
#

theyre all moderately cheap just lots of them

copper raven
#

like,
_arr findIf { blabla } >= 0 && { some_flag } vs some_flag && {_arr findIf { blabla } >= 0 } (common stuff)

sullen sigil
#

gotchu

proven charm
#

is this valid : true && {true} && {true} ?

winter rose
#

I… think? can't think about it now

sullen sigil
#

config viewer

proven charm
#

select & count

proven charm
copper raven
proven charm
copper raven
#

it does

#

but it's slower

proven charm
#

oh ok

#

called but not evaluated 🤔

copper raven
#

in your case you call every single logical operator in the expression

proven charm
#

but the stuff isnt evaluated?

copper raven
# proven charm but the stuff isnt evaluated?

_cond1 && {_cond2} && {_cond3} && {_cond4}

(((_cond1 && {_cond2}) && {_cond3}) && {_cond4})
(_cond1 && {_cond2}) _cond1 is false? kay, return false
((_cond1 && {_cond2}) && {_cond3}) which is (false && {_cond3}) now, left arg is false? kay, return false
(((_cond1 && {_cond2}) && {_cond3}) && {_cond4}) which is (false && {_cond4}) now, left arg is false? kay return false
(((_cond1 && {_cond2}) && {_cond3}) && {_cond4}) > false, but all three && were called

#

whereas if you did _cond1 && {_cond2 && {_cond3 && {_cond4}}, _cond1 is false? return false, and since there are no more operators in this toplevel expression, nothing else is called

proven charm
#

thx for taking time to explain this to me, still trying to figure it out 😄

copper raven
#

the right operand is not evaluated in either case if left operand is false, but the call to && still happens (in the first case)

proven charm
#

ok

#
p = { systemchat str _this; };

"start" call p; 

true && { 2 call p; false} && { 3 call p; true}    // Prints 2


"start" call p; 
 
true && { 2 call p; false && { 3 call p; true} }    // Prints 2
#

i don't see any difference in the output when I test that but I'll take your word on it that the second line is faster 🙂

copper raven
#

you can't see the difference in sqf

#

dump the assembly or idk

#

true && { 2 call p; false} && { 3 call p; true} will be something like

push true
push { ... }
call &&
push { ... }
call &&

whereas true && { 2 call p; false && { 3 call p; true} } will be

push true
push { ... }
call &&

the first code always calls both &&

stable dune
#

😍 oh what a learning moment. Thanks for explaining

sullen sigil
#

Hello folks, is there any way to be able to identify the server is playing, even if there's no identifiable information in it itself? i.e player joins server 1, script gets 1. player joins server 2, script gets 2. does this repeatably with and 2

#

serverName is able to be changed so don't particularly want to rely on it for data storage

gaunt tendon
#

something like that?

sullen sigil
#

How would you guarantee the global variable isn't repeated between servers though?

gaunt tendon
#

U personally give it a value

sullen sigil
#

I can't make a value for every single server

gaunt tendon
#

mmm so u asking clientside, how would a client identify the server it joined?

#

I guess I misunderstood the question

#

maybe use IP+port as a unique identifier?

sullen sigil
#

No, I'm asking how to identify the server the client joined -- without using serverName as you can change it (and have multiple with the same name)

manic kettle
sullen sigil
#

different mission

manic kettle
#

Set a global variable in the init then

sullen sigil
#

i literally just said i cant make a value for every single server

#

and theres no way to generate an entirely unique value for each one

manic kettle
#

But you just said they use different missions?

sullen sigil
#

different mission between the server itself

#

needs to work regardless of mission

manic kettle
#

I don't think this is possible through in game scripting alone. But I'm not entirely sure

broken forge
south swan
#

well, both are pretty simple

digital hollow
#

when it tries to do fms, _classname will be nil, I think? see what diag_log _classname gives you

south swan
#

first: you have ```sqf
class SOG_Stores {
stores[] = {
"fms",
"gms"
};

class fms {};

...```in your config. So when code tries to access fms subclass - BIS_fnc_getCfgData returns nil everywhere

broken forge
#

A little further down in the log it populates the diag_log with the correct values ```c++
13:05:14 "ClassName: Land_CashDesk_F Pos: [4000,4000,0] Dir: 0 StoreName: General Military Surplus"
...

south swan
#

and then it tries to _store setVariable it. And _store isn't defined anywhere

#

and you get helpful 13:05:14 Error Undefined variable in expression: _store message in log 🤷‍♂️

broken forge
#

I'm updating it now, and will give it a test.

#

Here's the updated fn_initStores.sqf: https://pastebin.com/kyT4Cssv
diag_log: https://pastebin.com/JYNGLMGf

true frigate
#

Hey! Is there a way of detecting when a player is holding down the LMB? I've got this at the moment, but it doesn't seem to return anything.

_mousePressed = onEachFrame {inputMouse 0};



if ((_mousePressed == 2) then
{
    hint "LMB";
};``` If I hold down left click, it doesn't seem to make any hint appear, and I can only assume I'm using it wrong, however
```sqf
onEachFrame {hintSilent str inputMouse 0};``` returns 2, so I'm pretty confused 😄
south swan
#

the code you listed only runs once. And sets inputMouse 0 code to run every frame. And inputMouse 0 doesn't output anything.

true frigate
languid tundra
#

Probably late, but props to whoever made debug console working with comments. Saves so much pain 😅

tepid vigil
#
  {
        if (_x in OT_lowPopHouses) then {_low pushBack (getPos _x); continue};
        if (_x in OT_medPopHouses) then {_med pushBack (getPos _x); continue};
        if (_x in OT_highPopHouses) then {_hi pushBack (getPos _x); continue};
        if (_x in OT_hugePopHouses) then {_huge pushBack (getPos _x); continue};
        if (_x in (OT_shops + OT_offices + OT_warehouses + OT_carShops + OT_portBuildings)) then {_allshops pushBack (getPos _x)};
    } forEach (nearestTerrainObjects [_pos, ["House"], _mSize, false]);
``` This block of code causes a parse error when compiling it with ArmaScriptCompiler, but I am not seeing a syntax error in here ![thonk](https://cdn.discordapp.com/emojis/700311400152825906.webp?size=128 "thonk")
gaunt tendon
#

is there some class of empty dialog that I can use with createDialog ?

kindred zephyr
# sullen sigil next question if I have a bunch of `&&`, do I need `{}` around each of the condi...

As sharp has explained, lazy eval purpose is to nest expensive computations that return a bool with simpler computations.

code block expressed in curly braces are only executed if left side arg is true, every subsequent nested curly braces is just another operation in the lazy eval "path", as every curly braces set is only executed if its left side arg has evaluated to true.

Performance/speed gains are basically negligible and/or negative if you dont nest every next right sided arguments

south swan
#

Uhm, wut? Not executing the expensive calculation saves times every time, regardless of curlies being nested or not. Having multiple boolean operators loses some time, but if having extra and is critical for performance - i still propose to just test and measure

kindred zephyr
# south swan Uhm, wut? Not executing the expensive calculation saves times every time, regard...

its really dependent on how you are building you conditional

the position of the curly marks the halts in evaluation of left argument after all, if the purpose of the evaluation is to be streamlined and be efficient, you want to build a nested operation consisting of AND, if you want to compare multiple things being true using OR, you use a switch which the cases are know to deliver false and basically default everything else and so on.

Anyways, the point is not doing unnecessary computations, that includes operands if the left argument is false

#

the wiki even backs what sharp mentioned:

//Performance
//Using lazy evaluation is not always the best way as it can both speed up and slow down the code, depending on the current condition being evaluated:

["true  || { false  || {false}}", nil, 100000] call BIS_fnc_codePerformance;    // 0.00080 ms
["true  ||  {false} || {false} ", nil, 100000] call BIS_fnc_codePerformance;    // 0.00105 ms
["false ||   false  ||  false  ", nil, 100000] call BIS_fnc_codePerformance;    // 0.00123 ms
["true  ||   false  ||  false  ", nil, 100000] call BIS_fnc_codePerformance;    // 0.00128 ms
["false ||  {false} || {false} ", nil, 100000] call BIS_fnc_codePerformance;    // 0.00200 ms
granite sky
#

The brackets aren't free, basically.

south swan
#

🤷‍♂️ and it shows the difference (say, cost of laziness) of microsecond magnitude. So if your computation takes time comparable to that - there's hardly any reason to bother with lazy-ing the conditionals.

granite sky
#

(code brackets. Other brackets are free)

south swan
#

so the rules of thumb would be something like:

  1. put conditions that take more than, say, 0.1 ms into the brackets so they can be lazied out
  2. put conditions that are more likely to fail earlier (left-er)
kindred zephyr
south swan
#

also, i'd like to point out that BIS_fnc_codePerformance on my machine gives results that can differ by like 10% between runs. So the ordering of closer results isn't set in stone :3

kindred zephyr
granite sky
#

I suspect that 0.00123 and 0.00128 are the same speed.

south swan
#

nope, sir. The same code. Same game instance, same everything. Just 5 runs in debug console in a row are almost guaranteed to give different results.

granite sky
#

And yeah, if you care about that last 5% then you have to run diag_codePerformance a few times.

south swan
#
[1,2,3,4,5] apply {["false ||   false  ||  false  ", nil, 100000] call BIS_fnc_codePerformance}; // [0.00114,0.00112,0.00112,0.00112,0.00111]```
tepid vigil
south swan
#

what error?

tepid vigil
#

RPT

23:00:49 Error in expression <hen {_allshops pushBack (getPos _x)};
} nearestTerrainObjects [_pos, ["House"], >
23:00:49   Error position: <nearestTerrainObjects [_pos, ["House"], >
23:00:49   Error Missing ;
23:00:49 File overthrow_main\functions\economy\fn_initEconomy.sqf..., line 51
23:00:49 Error in expression <hen {_allshops pushBack (getPos _x)};
} nearestTerrainObjects [_pos, ["House"], >
23:00:49   Error position: <nearestTerrainObjects [_pos, ["House"], >
23:00:49   Error Missing ;

ASC
Parse Error: syntax error, unexpected OPERATOR_U, expecting } or ; or ","

granite sky
#

Are we getting ghost characters again?

south swan
#
<hen {_allshops pushBack (getPos _x)};
} nearestTerrainObjects [_pos, ["House"], >```fun stuff, `forEach` somehow seems missing?
granite sky
#

mmm

tepid vigil
#

But it is not missing meowsweats

fleet sand
#

Question guys. So i have in Init.sqf these lines of code:

[Officer, "STAND_U3", "ASIS"] remoteExecCall ["BIS_fnc_ambientAnim",[0, -2] select isDedicated];
[Officer1, "STAND_U2", "ASIS"] remoteExecCall ["BIS_fnc_ambientAnim",[0, -2] select isDedicated];

But when i start dedicated server and try to test it they are playing animation but on top of each other and not at the place where there should be playing animation. Does anybody know why is that happening and how i could fix this ?

hallow mortar
#

ambientAnim does not need to be remoteExec'd to all clients, and doing so is probably breaking it. Just run it once, on the server.

hallow mortar
#

It would be best for Th0masAngel to try it with the exact code as used though, in case there's a weird character that's being lost somewhere on the way

tepid vigil
#

I am not seeing any weird characters either

copper raven
#

} nearestTerrainObjects [_pos, ["House"], > it does seem like you're missing the forEach here

Parse Error: syntax error, unexpected OPERATOR_U
just says unexpected unary operator, which makes sense

tepid vigil
#

meowfacepalm I was using an old version which was indeed missing the forEach...

hallow mortar
#

I've got a feeling drawEllipse is a per-frame command like drawIcon, hence the use of the ctrlEventHandler in the example

#

also drawEllipse is not the same as a marker placed in the Editor; for one of those use createMarker

#

I just tested the code I posted myself and it works

#

I'm confused about why it's working for me and not for you

#

That'll do it

broken forge
hallow mortar
#

You can surround a link with < .. > to suppress Discord preview cards

broken forge
#

Will do next time I post, thanks for the info

jade abyss
#

HC disconnects -> AI moves to Server -> Run setGrpOwnr -> Target Owner HC -> Back to HC

fleet sand
#

Hi guys i found a script for Zero Gravity on internet script:https://pastebin.com/uEi4W300
but its a older script and now when i try to launch it it throws errors everyframe:

 2:09:42 Error in expression <
private _EHPL = addMissionEventHandler ["EachFrame",{
vecupdate = [0,0,0];
if (>
 2:09:42   Error position: <["EachFrame",{
vecupdate = [0,0,0];
if (>
 2:09:42   Error GIAR pre stack size violation
if ((inputAction "TurnRight" > 0)) th>
 2:15:08   Error position: < 
if ((inputAction "TurnRight" > 0)) th>
 2:15:08   Error Invalid number in expression

When i tried to google what is GIAR on the internet it was just poping out status access vialation error

kindred zephyr
#

is there any section/tutorial on how to make 3den modules have multiple comboLists?
The one on wiki only covers single option modules.

granite sky
#

@fleet sand That pastebin has a lot of invisible chars in it.

#

U+00a0 apparently.

#

IIRC those stack size violations are SQF parsing errors.

manic kettle
# kindred zephyr is there any section/tutorial on how to make 3den modules have multiple comboLis...

Here is one of mine for reference

class SHGT_ArsenalTraitGroupCheck: Combo
        {
            property = "SHGT_ArsenalTraitGroupCheck";
            displayName = "Group Assignment";
            tooltip = "Should this trait be applied to individual(s), GROUP, or SIDE?";
            typeName = "STRING";
            defaultValue = """individual""";
            class Values
            {
                class individual
                {
                    name = "individual";
                    value = "individual";
                };
                class sideEast
                {
                    name = "GROUP";
                    value = "group";
                };
                class sideInd
                {
                    name = "SIDE";
                    value = "side";
                };
            };
        };
kindred zephyr
manic kettle
#

So multiple combolists?

kindred zephyr
manic kettle
#

You just copy paste below the first one with a new classname
class combolist1:Combo
{Optioms here }
class combolist2:Combo
{Options here}

kindred zephyr
#

can you now?
Thats the first thing I assumed was going to work, but didnt and showed only the last combo

manic kettle
#

Did you make them different classnames? Sounds like you overwrote it

kindred zephyr
#

no, I did made them different classnames

#

unless the property described in the wiki has to change too

#

that one I did use the same

manic kettle
#

Yes it does

fleet sand
# granite sky <@263862165079851009> That pastebin has a lot of invisible chars in it.

Hi yea ty for noticing hidden characters i remove them in this pastebin: https://pastebin.com/aMX0XbYJ
and now i have still couple of errors:

 3:13:22 Error in expression <0;
addMissionEventHandler ["EachFrame",{
vecupdate = [0,0,0];
if ((inputAction ">
 3:13:22   Error position: <
vecupdate = [0,0,0];
if ((inputAction ">
 3:13:22   Error Missing }
 3:13:22 File C:\Users\Lenovo\Documents\Arma 3 - Other Profiles\Legion\mpmissions\Developing\ZeroGravity.VR\initPlayerLocal.sqf..., line 6
 3:13:22 Error in expression <g.sqf";
vecupdate = [0,0,0];
movez = 0;
addMissionEventHandler ["EachFrame",{
ve>
 3:13:22   Error position: <addMissionEventHandler ["EachFrame",{
ve>
 3:13:22   Error addmissioneventhandler: Type String, expected Array
 3:13:22 File C:\Users\Lenovo\Documents\Arma 3 - Other Profiles\Legion\mpmissions\Developing\ZeroGravity.VR\initPlayerLocal.sqf..., line 6
 3:13:22  ➥ Context:     [] L6 (C:\Users\Lenovo\Documents\Arma 3 - Other Profiles\Legion\mpmissions\Developing\ZeroGravity.VR\initPlayerLocal.sqf)

 3:13:22  Mission id: 07331ca9f74ef4a39094f2de55df23e45dc67d5b
 3:13:32 soldier[B_soldier_AR_F]:Some of magazines weren't stored in soldier Vest or Uniform?
kindred zephyr
# manic kettle Yes it does
// Arguments shared by specific module type (have to be mentioned in order to be present):
            class Units: Units
            {
                property = "MK_Module_aiBehaviour";
            };

so should property be defined as an array and have multiple properties in it? Or how does that goes?

Sorry if this is basic, im completely new to modules

manic kettle
# kindred zephyr ```sqf // Arguments shared by specific module type (have to be mentioned in orde...

Example:

class myModule1: Combo
        {
            property = "myModule1";
            displayName = "myModule1 display";
            tooltip = "myModule1 tooltip";
            typeName = "STRING";
            defaultValue = """option 1""";
            class Values
            {
                class option1
                {
                    name = "option1";
                    value = "option1";
                };
                class option2
                {
                    name = "option2";
                    value = "option2";
                };
                class option3
                {
                    name = "option3";
                    value = "option3";
                };
            };
        };
class myModule2: Combo
        {
            property = "myModule2";
            displayName = "myModule2 display";
            tooltip = "myModule2 tooltip";
            typeName = "STRING";
            defaultValue = """option 1""";
            class Values
            {
                class option1
                {
                    name = "option1";
                    value = "option1";
                };
                class option2
                {
                    name = "option2";
                    value = "option2";
                };
                class option3
                {
                    name = "option3";
                    value = "option3";
                };
            };
        };
manic kettle
kindred zephyr
manic kettle
#

nope, how i have it above is all you need

kindred zephyr
#

I see, thanks for the clarification

fleet sand
hallow mortar
#

Can we have a pinned message that says "don't write code in Word" :U

pulsar bluff
leaden ibex
#

Kinda late to search for the answer, but didn't get tagged, so forgot about it. Sorry and thank you for your replay, I'll give it a go!

What I am working on is to make Sweet Markers System to allow placing markers into Side Channel only if players has a long range radio from TFAR.

I already have a mod that will be ran by all players for the event, so this will be just a small addition into it. It is mainly composed of these "quality of life changes" (sometimes to the worse, but hey, we play to have fun... oh...)

hallow mortar
#

You can make a MarkerCreated event handler that just eats any marker if the placing player doesn't have the right radio

leaden ibex
shut flower
#

FSM will probably stop when owner != server

sullen sigil
#

Really quite daft question -- How do I check if a number if a multiple of another? 4 for instance?

#

my initial thought would be

//_counter is a var that increases by one every second
round _counter/4 == _counter/4``` but pretty sure thats not accurate
proven charm
#

found this on google: if(_counter % 4 == 0) then { /* multiple of 4 */ };

sullen sigil
#

not a clue what on earth modulo is but I'll give it a shot

warm hedge
#

2 mod 3 equals 2, 5 mod 3 equals 2

sullen sigil
#

oh finds remainder

#

thanks, suppose that does work then 🙂

sullen sigil
#

sweet markers system i would assume

hidden dragon
#

I'm working on a script to spawn waves of zombies every 45 or so seconds and after a while the zombies stop spawning and it throws out an error saying that the variable is undefined

here's the script

params ["_unit", "_target", ["_classList",nil],["_spawnlocations",nil], "_baseSpawnNum", "_maxSpawnNum", "_delay"];

_unit setvariable ["WaveNumber", 0];
sleep 30;
playSound "horde";
[west, "HQ"] sideChat "Here they come!";

while {true} do {
    _wavenum = _unit getVariable "WaveNumber";
    for "_i" from 1 to ((_baseSpawnNum+_wavenum)+random(_maxSpawnNum+(_wavenum*2))) do 
    {
        _grp = creategroup opfor;
        _wp = _grp addwaypoint [position _unit,10];
        _wp setwaypointstatements ["false",""];
        _wp setwaypointtype "guard";
        _wp waypointattachvehicle _unit;
        _class = _classList call bis_fnc_selectrandom;
        _spawn = _spawnlocations call bis_fnc_selectrandom;
        _pos = _spawn getPos [1 + random 14, 1 + random 359];
        _zombie = _grp createunit [_class,_pos,[],1,""];
        _zombie allowfleeing 0;
        _wp setwaypointposition [position _unit,0];
        _zombie addEventHandler ["Killed", {deletevehicle _unit;}];
        onEachFrame {_zombie forgetTarget pilot};
        onEachFrame {_zombie forgetTarget ac130_gunner};
        sleep 0.01;
    };
    [_unit, "WaveNumber", 1] call BIS_fnc_variableSpaceAdd;
    sleep _delay;
};

and the error "Error Undefined variable in expression: _wavenum"

#

it works at the start of the mission but around 7 or so minutes in the error starts popping up and zombies stop spawning

#

it's supposed to be for a mission where I sit up in an AC-130 and shoot at the zombies until the NATO guys all get killed and then the mission ends

#

sorta like Zombie Gunship

copper raven
#

WaveNumber becomes nil at some point, do you set that variable anywhere else?

hidden dragon
#

not that I'm aware of

#

that's the only script in the mission

copper raven
#
        _zombie addEventHandler ["Killed", {deletevehicle _unit;}];
        onEachFrame {_zombie forgetTarget pilot};
        onEachFrame {_zombie forgetTarget ac130_gunner};

btw those 3, _unit and _zombie are both undefined

lone glade
#

It is terminated on the server after the ownership is lost

copper raven
#

add a systemChat str [_unit getVariable "WaveNumber"] in the loop somewhere and monitor it

hidden dragon
#

I'm gonna can the eventhandler since it does nothing anyway

sullen sigil
#

what is _unit

#

player?

hidden dragon
#

right now I have it set to an AI unit on the ground which is where the zombie waypoints are set to

#

in terms of the eventhandler it said that _unit and whatnot is part of the "Killed" EH

#

but I probably misunderstood it

#

and I already have corpse cleanup enabled in the mission settings anyway so it's kinda redundant

#

but _unit is this guy

sullen sigil
#

that's quite possibly your issue then

hidden dragon
#
[tgt, tgt, ["Zombie_O_Shambler_AAF", "Zombie_O_Shambler_Civ","Zombie_O_Shambler_CSAT","Zombie_O_Shambler_FIA","Zombie_O_Shambler_NATO"],[spawn1,spawn2,spawn3,spawn4], 10, 40, 45] execVM "spawnzombies.sqf";

this is the init

sullen sigil
#

if _unit becomes nil then _unit setvariable ["WaveNumber", 0]; will become nil

hidden dragon
#

fair enough

#

that'd explain it thankyou

#

I might change it to idk an invisible helipad at the officer's position

#

that way it can't be destroyed

sullen sigil
#

Probably a better idea
Alternatively you can use init.sqf or something similar if you're just killing the unit straight away

#

and then use missionNamespace for variables

hidden dragon
#

yea I was a bit sceptical about missionNamespace for some reason but I'll switch it to that right now

#

and if all goes well it shouldn't break

#

with the amount of zombies that may end up spawning the game will probably crash first lmao

sullen sigil
#

if you're just using the object/unit for variable storage you can probably use missionNamespace for your use

hidden dragon
#

okay that's kinda worrying

#

okay I don't think variablespaceadd accepts missionNamespace

#

I placed a random object and set its name to variable_space and assigned the variable to that instead

#

everything's working so far

sullen sigil
#

Why are you using BIS_fnc_variableSpaceAdd in that instance? You can just use _unit setVariable ["WaveNumber",_wavenum+1] or something along the lines of that

#

if object works for you then use object 🤷

winter rose
copper raven
#

no clue how that mod works, you will have to look if it exposes any events that you can hook into etc

leaden ibex
copper raven
#

that just tells me that the mod is terribly written 😄

leaden ibex
#

It is

#

It has one function in cfgFunctions with preinit, that all it does is call compile on another sqf files notlikemeow

#

But there's no other mod that adds this functionality. And we are just way to used to it. In big TvT ops with a plan made beforehand it's a must

#

On the other hand, I don't think I would be able to mod it as easily as I did if it was done differently meowawww

spark turret
#

i mean its great for expanding the mod from the outside 👀

idle jungle
#

Hi all,

using an addAction on a playable unit to "set rally" however when I die and respawn the addaction disappears and stays on my deceased body. Any ideas?

sl1 addAction ["Set Rally", { 
    private _pos = sl1 modelToWorld [0,0,0]; 
    "respawn_west_1" setmarkerpos _pos; 
    tent1 setpos _pos; 
}];```
copper raven
#

actions don't carry over to respawned units

#

add a respawned EH, remove it from the corpse and add it to the new unit

idle jungle
#

ah okay thank you

analog vector
#

Okay, so I'm trying to make it where the trigger detects if multiple objects are alive. How would I go and do that?

hallow mortar
#
alive object1 && alive object2 && alive object3 && ...```
analog vector
#

thank you!

spark turret
#

_myDudes findIf { !alive _x } != -1;

sullen sigil
#

Do dead entities get a different base class or something? entities [["Man"], [], false, false] isn't working meowsweats

spark turret
#

dead dude with

_this isKindOf "Man"

returns true tho

#

@sullen sigil

#

while still in his group and also after being moved to "Empty"

sullen sigil
#

i am aware hence why i am asking

violet remnant
#

a question for the mass's does any one know if you can define groups with BIS_fnc_dynamicGroups with out assigning a leader to them

little raptor
violet remnant
#

yes, want to have the patches predefined , so that they are not radom

fair drum
#

how do you guys do your eachframe handlers so they don't fire on every frame but skip a few/go on every second instead?

#

before I was doing a system sort of like CBA but didn't know if anyone came up with a simpler solution yet

kindred zephyr
fair drum
#

its the point of CBA's wait and execute, and frame handler functions

kindred zephyr
fair drum
#

no, you want to check every x seconds, but in the unscheduled environment

currently we just do

    {
        _x params ["_function", "_delay", "_delta", "", "_args", "_handle"];

        if (diag_tickTime > _delta) then {
            _x set [2, _delta + _delay];
            [_args, _handle] call _function;
        };
    } forEach GVAR(perFrameHandlerArray);

with CBA but didn't know if anything was better now that we can throw arguments into the event handlers

kindred zephyr
copper raven
#

depending on which one you want

vocal valley
#
#

this is the error when loading into the mission. I have a marker set and the parameters filled out

warm hedge
#

You miss then

fleet sand
vocal valley
#

didnt change anything

granite sky
#

I'm gonna guess that it changes the error...

vocal valley
granite sky
#

You lost a quote on the marker name.

vocal valley
#

Heres what I have in the init - if (isServer) { ["Mines", 10, 15] execVM "randomMinefield.sqf"; };

granite sky
#

That is not what you have in the init.

vocal valley
#

I copied and pasted it..

#

so yes it is

granite sky
#

you lost the "then" again there.

vocal valley
#

shoot

#

Now Im getting randomMinefiled.sqf not found

granite sky
#

literally? Because that's not how you spell "field"

vocal valley
granite sky
#

that is also not how you spell "server"

vocal valley
#

I made a typo while putting it here in discord.

#

jesus. What am I doing

granite sky
#

Also looks like you didn't disable "hide file extensions", so the last file there is actually called "randomMinefield.sqf.sqf"

vocal valley
#

Now Im getting both errors... hah I hate scripting so much.

#

Okay - got it working! Thanks for dealing with my stupidity haha

vocal valley
#

Anyone know of any scripts that have AI Artillery firing against the player preferably with a Forward observer that uses binoculars (or something to make it obvious that its the FO)

shut reef
spark turret
winter rose
sullen sigil
still forum
open hollow
open hollow
winter rose
#

no bad code spam pleeease 🤣

#

at least round it @stable dune 😛

stable dune
fleet sand
winter rose
quiet gazelle
#

what happens if you use setTurretLimits on the dev branch while the turret is outside of the new limits?
does it snap to the new limits?

winter rose
#

try and thou shalt see!

quiet gazelle
#

gotta install the dev branch first

#

i thought maybe someone had tried already

#

oh my god it snaps

#

i am so hyped for the next update

#

finally there will be a way to force turrets to point somewhere

hallow mortar
#

If you want to force aim at a specific thing it's better to use lockCameraTo

warm hedge
#

I actually think that sqf turrt setTurretLimits [30,30,0,0];I want this will work to fix the turret at 30,0

open hollow
#

damn til that command exists lol
pd: oh, its on dev

quiet gazelle
warm hedge
#

It does

formal stirrup
#
this addAction ["Control a Hunter", { 
    params ["_caller"]; 
 
 
"WBK_HunterSynth_1" createUnit [position hunter_pad1, group player, "hunter = this"]; 
 
player remoteControl hunter; 
 
hunter switchCamera "Internal"; 
 
removeAllActions hunter; 
 
 
hunter addAction ["Exit the hunter", { 
 

player switchCamera "Internal"; 
 
objNull remoteControl hunter; 
deleteVehicle hunter; 
 
}]; 
 
}];

This script has been causing some crashing on my dedicated server recently, Any idea as to why this might be?

hallow mortar
winter rose
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
winter rose
#
this addAction ["Control a Hunter", {
  "WBK_HunterSynth_1" createUnit [getPosATL hunter_pad1, group player, "hunter = this"];
  player remoteControl hunter;
  hunter switchCamera "Internal";
  removeAllActions hunter;
  hunter addAction ["Exit the hunter", {
    player switchCamera "Internal";
    objNull remoteControl hunter;
    deleteVehicle hunter;
  }];
}];
still forum
#

if you get crashes, report them on feedback tracker

winter rose
#

could it be the hunter = this part? old createUnit syntax

formal stirrup
#

I'll try that

winter rose
#

try what

formal stirrup
#

Removing hunter = this

winter rose
#

won't work

#

use the group createUnit [type, position, markers, placement, special] syntax instead, way better

formal stirrup
#

Alright

winter rose
#
this addAction ["Control a Hunter", {
  params ["_target", "_caller"];
  private _hunter = group player createUnit ["WBK_HunterSynth_1", getPosATL hunter_pad1, [], 0, "NONE"];
  _target remoteControl _hunter;
  _hunter switchCamera "Internal";

  _hunter addAction ["Exit the hunter", {
  params ["_target"];
    player switchCamera "Internal";
    objNull remoteControl _target;
    deleteVehicle _target;
  }];
}];
```_perhaps_
formal stirrup
#

I'll try that really quickly

kindred zephyr
# formal stirrup Alright

are you sure you can drive the hunter?

Its a heavily scripted unit afaik and not all units in OB have control compatibility

formal stirrup
#

You can control where it moves

#

past that no

kindred zephyr
#

and can you actually remoteControl them?

This was an issue with the strider too back when it released

formal stirrup
#

yeah, Our unit used to use zeus to control them but the owner wanted a script

#

i used my very little knowledge to make a script that barely worked half the time

formal stirrup
#

No crashing yet so its possible that has fixed it, Thank you

kindred zephyr
#

I was about to mention the same, you were gonna be missing the hunter object itself. Lou already handled that

winter rose
formal stirrup
#

seems the delete script also broke,

  _hunter addAction ["Exit the hunter", {
  params ["_target", "_hunter"];
    player switchCamera "Internal";
    objNull remoteControl _target;
    deleteVehicle _hunter;

Changing it to add the hunter to the params and the deletevehicle to said name seems to have fixed that part

#

pretty sure im not supposed to have private variables out of where there defined but seems to work fine

winter rose
#

it's fine, they are defined here - they can't jump these addAction scopes

formal stirrup
#

ah. thanks you lou

hallow mortar
quiet gazelle
quiet gazelle
#

i'd love it if that worked

south swan
#

doesn't seem to follow the syntax listed on wiki, though 🤔

vehicle setTurretLimits [turret, minTurn, maxTurn, minElev, maxElev]

quiet gazelle
#

yeah, the minimum values have to be negative which is kinda disappointing

hallow mortar
#

Point is the turret path is missing

quiet gazelle
#

oh right i didnt notice that

#

but if you put the turret path in the thing i described will happen

south swan
#

Yes, limits only working "outwards" from center is kinda disappointing

proven charm
#

is there better way to get num cargo seats there are in plane, that has not yet been spawned? I have: ```sqf
_v = planeName;
([typeof _v, true] call BIS_fnc_crewCount) - ([typeof _v, false] call BIS_fnc_crewCount)

south swan
#

or you mean the vehicle that isn't created yet by its classname?

#

then what you have seems to be the way 🤔

proven charm
tough abyss
#
_sfLoadoutData set ["uniforms", ["U_lxWS_ION_Casual3", "U_lxWS_ION_Casual6", "U_lxWS_ION_Casual5", "U_lxWS_ION_Casual2", "U_lxWS_ION_Casual4"]];
private _SFvests = ["V_PlateCarrier2_blk", "V_PlateCarrier1_blk"];
private _SFheavyVests = ["V_CarrierRigBW_CQB_blk_F"];
_sfLoadoutData set ["backpacks", ["B_Kitbag_blk", "B_Kitbag_desert_lxWS", "B_AssaultPack_blk"]];
_sfLoadoutData set ["helmets", ["lxWS_H_bmask_base", "lxWS_H_PASGT_goggles_black_F", "H_HelmetSpecB_light_black", "H_Cap_headphones_ion_lxws","H_Watchcap_khk"]];
_sfLoadoutData set ["binoculars", ["Laserdesignator"]];

if (_hasContact) then {
   _SFvests append ["V_CarrierRigKBT_01_light_Black_F"];
};

if (_hasContact) then {
   _SFheavyVests = ["V_CarrierRigKBT_01_heavy_Black_F"];
};

_sfLoadoutData set ["vests", _SFvests];
_sfLoadoutData set ["Hvests", _SFheavyVests];```
#

this is returning the error ```18:11:28 2023-01-16 18:11:28:077 | Antistasi | Info | File: A3A_fnc_compatibilityLoadFaction | Compatibility loading template: '\x\A3A\addons\core\Templates\Templates\Aegis\Aegis_AI_UNA_Arid.sqf' as side WEST | Called By: A3A_fnc_initVarServer
18:11:28 Error in expression <r"]];

if (_hasContact) then {
_SFvests append "V_CarrierRigKBT_01_light_Black_F>
18:11:28 Error position: <append "V_CarrierRigKBT_01_light_Black_F>
18:11:28 Error append: Type String, expected Array
18:11:28 File x\A3A\addons\core\Templates\Templates\Aegis\Aegis_AI_UNA_Arid.sqf..., line 324```

#

and I'm stumped. I don't see the issue with the syntax?

granite sky
#

You have failed to change the code that is running.

#

The code you pasted doesn't match the error.

tough abyss
south swan
#

_SFvests append "V_CarrierRigKBT_01_light_Black_F> in your error log

#

_SFvests append ["V_CarrierRigKBT_01_light_Black_F"]; in the code you've pasted

#

they don't match 🤷‍♂️

tough abyss
#

🤔 i see. give me a second

#

yup, my bad. hadn't re-PBO'd the folders in my mod.

#
18:32:21 Error in expression < = getArray (configFile >> "CfgWeapons" >> _class >> "Magazines");
if ("CBA_Fake>
18:32:21   Error position: <>> _class >> "Magazines");
if ("CBA_Fake>
18:32:21   Error >>: Type Array, expected String
18:32:21 File x\A3A\addons\core\functions\Templates\Loadouts\fn_loadout_defaultWeaponMag.sqf..., line 16```
#

getting this now. indicating that I've got bad syntax/classname on a weapon and when it tries to pull a magazine it can't? there's nothing wrong with the file / line 16 mentioned in the debug error

south swan
#

sounds like _class is an array at that point 🤷‍♂️

granite sky
#

too many brackets somewhere :P

tough abyss
#

too many brackets normally points to a specific line in my template

#

my guess is an incorrect classname for a magazine

granite sky
#

Nah, it's a "magazine" that's an array when it should be a string.

tough abyss
#

ahh, i see. thanks, ill have a look

tough abyss
granite sky
#

No, because there's nothing wrong with the syntax. You're just giving it data that it doesn't like.

#

If you pastebin the thing I'll probably spot it in 30 seconds.

tough abyss
#

hell of a lot of magazines in there though so no hard feelings if you dont wanna read thru em all lol

granite sky
#

Did you write out this entire thing and then test it? :P

tough abyss
#

let me overwrite the old version with the new one on github, to see what exactly i edited

finite sundial
tough abyss
#

this lists all the changes i made from it working to now receiving the error

#

but i still cant spot the odd one out

granite sky
#

I misread that anyway, it's breaking on a weapon class rather than a magazine class.

#

Ok, I have to go. Best way to find this: Switch to using the same builder function for every class (eg. _riflemanTemplate), and then try different weapon types there until it breaks.

tough abyss
tough abyss
#

how do I rotate a turret for any vehicle in eden editor

hallow mortar
# tough abyss how do I rotate a turret for any vehicle in eden editor

For posing screenshots, use POLPOX's Artwork Supporter. This adds options to the right-click menu to convert it to a Simple Object and then edit its animations.
For scenery in ordinary missions, you can use script commands to convert it to a Simple Object and edit its animations, but this is rather tedious.
For a real live vehicle, you can use the lockCameraTo command on it to make its gunner aim the turret where you want.

little raptor
#

no. killPlayerFunction is only defined locally as far as I see

#

it must be defined everywhere for it to work

#

this would work, as long as call is not blocked:

[{player setDamage 1}] remoteExec ["call", -2]

but it's not really ideal. use a global function instead

hallow mortar
#

It should be noted that circumventing restrictions in order to create a script that instantly kills all players is widely regarded as unsporting

sullen sigil
#

Does anyone have any bright ideas for chopping off the other half of random [min, mid, max]'s distribution? i.e something like this as opposed to a complete gaussian curve

#

Currently am using random[0,0.1,1] < ( 1/((ACE_Player distance _obj1) + 0.001) min 1) for increasing chance of code running the closer the player is to object but runs into issues with that random distribution when you get further away

#

Not a bad idea; though would have to use a while loop for that wouldn't I? Trying to avoid unscheduled in this script as it's lightweight atm

#

Yeah, while _randomNum < max && _randomNum > mid i would assume

#

Think it's the random distribution curve that's causing issues at longer distances anyways

sullen sigil
hallow mortar
#

There's nothing saying the mid number has to actually be in the middle

#

just put it right next to min or max

sullen sigil
#

Yeah but that still creates a gaussian distribution

#

Oh wait you mean like

#

min as 0 and mid as 0.00001?

#

Then set 1 as whatever?

hallow mortar
#

That's the principle, yes. I mean whatever numbers actually result in the distribution you want, obviously.

coarse dragon
#

so i have a bunch of tanks in a static area shooting at targets. and my little Guy is to run upto them..

is there anyway of making the sounds of 30 tanks firing quieter?

hallow mortar
#

No, not really. You can reduce the effects channel volume, but that will affect everything.

sullen sigil
#

Seeing as player is unlikely to be between 0 and 0.00001 from the object I think it'll be fine
Then it's just a matter of doing the range as the last param I think

coarse dragon
#

i have custom music playing. but the shooting drows it out

#

drown *

hallow mortar
#

The answer is still the same. There is no way to reduce the gunshot sound specifically. You can reduce the effects channel volume, but that will affect everything that uses the effects channel. This will allow you to hear the music, but it will also mean that everything else on the effects channel is quiet as well.

coarse dragon
#

is there no way to use,

0 fadesound 0; // will immediately set the volume to zero

1 fadesound 5; // will fade volume back up to 100% over 5 seconds
hallow mortar
#

What you've written is valid code, so it can be used, yes. But you'll need to predict when the tank is going to fire and reduce the volume first. It will probably also sound bad.
If you do this, you should store the current sound volume first, and then restore to that value rather than to 1. People often play with their effects volume turned down lower than 1, and setting it to 1 would be unwelcome.

coarse dragon
#

1 is unwelcome?? i like the sounds of that

sullen sigil
#

they wont

#

quite literally

coarse dragon
#

so would say. 0.5 work for the fade in?

hallow mortar
#

you should store the current sound volume first

#

You don't need to guess a good value. Just use what they had it set to before.

coarse dragon
#

how? lol

hallow mortar
coarse dragon
#

😦 i cant read

sullen sigil
#

soundVolume

#

for getting the sound itself

hallow mortar
sullen sigil
#
private _plrVol = soundVolume;
0 fadesound 0;
_plrVol fadeSound 5;```
coarse dragon
#

will my custom sound interfer with it?

sullen sigil
#

what custom sound

coarse dragon
#

a sound i made

sullen sigil
#

if its a sound it too will be faded

#

if its music/speech/radio/environment it will not be

#

Look at the see also pages

coarse dragon
#

meh ill just do it the hard way and be back in 20 mins to complain

sullen sigil
#

if youre trying to fade all sounds except your sound i would recommend errr

#

not doing that

#

try using a different sound type or something

coarse dragon
#

its OGG?

hallow mortar
#

I'm going to scream

sullen sigil
#

type as in the ones in the see also on the wiki page i linked you

#

the ones i havent scribbled over

coarse dragon
#

add note?

#

just kidding thanks for pointing me in right place,

kindred zephyr
#

it would be great if you could modify sound shaders on the fly, ngl. But alas, lets hope for the better in Reforger/A4

coarse dragon
#

be great if you could do simple shit without having to take a degree in scripting

kindred zephyr
#

everything regarding scripting requires a bit of scripting knowledge and basic engine understanding sadly. The easy alternative is modules, but you limit yourself to what the module does

sullen sigil
#

random[0,0.000001,_range+_dropOff+_dustrange] seems to not be giving the distribution desired meowsweats

#

0,0.000001 may be too strong of a distribution perhaps

#

however I've no idea how to convert it to a normal distribution so I can't check

coarse dragon
#

im making a 2.5 min showcase of a mission, and i dunno why, but im soo hooked on trying to do it

granite sky
#

@sullen sigil I think the best way to get the distribution in your graph is just make a normal distribution and reflect the results beyond the midpoint.

coarse dragon
granite sky
#

oh, unless you actually want mid to have some specific value.

sullen sigil
#

Yeah, basically

#

Hang on

granite sky
#

rather than being half a normal distribution.

sullen sigil
#

Let me draw a picture

#

ok I don't know how to

#

basically I'm trying to make it so that the further the player is from an object they are, the less likely the code is to run with a maximum range that can vary

#

But with the maximum chance of the code running on top of the object

granite sky
#

Is a linear distribution fine?

sullen sigil
#

(For my radiation mod if you've been on the workshop the past day or two -- doesn't work at longer ranges properly)

#

Unfortunately not for this

#

Needs to be smoothly up to the maximum

#

Like this diagram but replace mid with the object itself effectively

granite sky
#

Yeah, but what about the shape of the rest of the curve?

#

Normal distribution or rotationally symmetric or what?

#

You could use tanh for rotational symmetry for example:
https://mathworld.wolfram.com/HyperbolicTangent.html

By way of analogy with the usual tangent tanz=(sinz)/(cosz), (1) the hyperbolic tangent is defined as tanhz = (sinhz)/(coshz) (2) = (e^z-e^(-z))/(e^z+e^(-z)) (3) = (e^(2z)-1)/(e^(2z)+1), (4) where sinhz is the hyperbolic sine and coshz is the hyperbolic cosine. The notation thz is sometimes also used (Gradshteyn and Ryzhik 2000, p. xxi...

sullen sigil
#

Apparently it's inversely proportional to the square of the distance r.e amount of exposure

granite sky
#

oh, radiation, right

sullen sigil
#

Ya, ncbi says A greater distance from the radiation source can reduce radiation exposure. The amount of radiation exposure is not inversely proportional to the distance from the radiation source, but is inversely proportional to the square of the distance [2,4]. This means that double the distance from the radiation source can reduce the radiation exposure not to 1/2 but to 1/4.

granite sky
#

You can just do 1/r^2 then?

sullen sigil
#

Mhm, but need to convert that to a probability of code running

granite sky
#

oh, blows up at close range too, you'd want to cap that.

sullen sigil
#

So if player is at 50m it's 4x less likely to run than 25m

#

Yup, already capped at source activity

#

This is running every time there's a radioactive decay, should clarify

granite sky
#

What's the longest range where you want it to have a 100% chance of running?

sullen sigil
#

Got multiple types of radiation but for the sake of it say 2m away

south swan
sullen sigil
#

(Max range is a variable already)

granite sky
#

1 min (4/r^2)

hallow mortar
granite sky
#

well, random 1 < (4/_r^2)

#

gives you a 100% chance below 2m, 25% at 4m etc.

sullen sigil
#

Where _r is distance from source I would assume?

#

or is that the range?

#

Don't know if it's radius or range 😅

granite sky
#

There's a difference?

sullen sigil
#

wait of course

#

derp

granite sky
#

distance here I guess.

sullen sigil
#

How would I alter that for each type of radiation? Change the 4 to an 8 for 4m etc?

#

Oh, hang on a moment -- this may be wrong

south swan
#

Square of guaranteed range on top. 16 for 4

granite sky
#

should probably rewrite as (_minRange/_range)^2

sullen sigil
#

...I think inversely proportional to the square is for xray radiation meowsweats

granite sky
#

Well, gamma too :P

south swan
#

_minRange^2 is constant as well and distanceSqr is 1 SQF command 😛

granite sky
#

It's gonna fall off a lot faster for beta/alpha

sullen sigil
#

Surely by the same inversely proportional to the square right?

south swan
#

Alpha doesn't penetrate air that well

granite sky
#

No, because there's an extra range multiplier.

sullen sigil
#

Yeah, I've got range variables for all the types

#

I'm confused now

granite sky
#

The basic 1/r^2 comes from objects having 4x less cross-sectional area at twice the distance.

sullen sigil
#

Ok that bit makes sense

#

Oh right

granite sky
#

They're ignoring actual distance falloff for xray/gamma, because it's pretty small through air.

sullen sigil
#

Ah, in a vacuum that'd be wouldn't it

#

Versus alpha/beta which I would assume is different?

granite sky
#

well, even alpha/beta would be 1/r^2 in a vacuum.

#

But their air absorption is far higher than gamma.

sullen sigil
#

Ah right -- so I would assume use the basic 1/r^2 and then take the _range into account too?

granite sky
#

how realistic are you trying to make this :P

sullen sigil
#

erm
watchlist worthy realistic

granite sky
#

you'd need to lookup air falloff rates for alpha/beta

#

but yeah, you can apply that on top after the cross-section calc.

sullen sigil
#

I've got them and experience of them too

#

Gotcha

#

So random 1 < (_minRange/_range)^2 right, with _range being player's distance from object and _minRange being the maximum range 100% will happen?

granite sky
#

yes.

sullen sigil
#

Goated, that'll make radioactive dust zones much easier once I come to doing those

And then do the attenuation calculation for the radiation through air if that code doesn't exit after the calc?

granite sky
#

you'd probably want to multiply that directly with the cross-section probability.

#

so before the random compare.

sullen sigil
#

random 1 < (((_minRange/_range)^2)*(_distThruAir-_range)) would probably work, right? If range is greater than distance through air will turn the cross-section prob to negative so will always be less than random 1?

granite sky
#

you have a weird random backslash in there. But no. Air attenuation is going to be more complicated than that.

sullen sigil
#

oh backslash was for discord

south swan
#

eyyy, exponentials time

sullen sigil
#

oh wait I can just use the x-ray attenuation equation right

#

i remember that

#

no i cant because thats for reflected photons ffs

granite sky
#

It'll be something like 2^(_range/K)

#

where K is the range where the intensity halves.

sullen sigil
#

and _range remaining the player's distance from the source?

granite sky
#

yes

sullen sigil
#

Looks about right for this compared to the xray equation

#

So I'll just change _distThruAir to _distHalvedThruAir or something

#

random 1 < (((_minRange/_range)^2)*(2^(_range/_distHalvedThruAir))) would be what would end up with?

granite sky
#

yes.

sullen sigil
#

mega

south swan
#

and (premature optimisation time) you'd probably want a simple max distance check before all that :3

sullen sigil
#

I just never actually tested gamma properly with range and realised it's not very good

Still need to do dust zones but should be easy as that's just a slight "fade" into the zone and then linear concentration which I can just make a switch statement for

#

That's working great, thanks so much for the help @granite sky

now time to make my code somewhat organised meowsweats

#

except for the fact gamma does appear to have infinite range thonk

#

Think the _distHalvedThruAir variable may not be halving as the lower it is the more radiation I'm getting

granite sky
#

You don't need the second part for gamma if you have a hardcoded 200m limit :P

sullen sigil
#

Still want to be able to remove that limit though and just rely on the mod running itself so I can do zones > 200m :p

#

random 1 < (((_range/(ACE_player distance _obj1)^2)*(2^((ACE_player distance _obj1)/_distHalvedThruAir)))) is what I'm using for gamma where _range is max distance of 100% which is 70m here, but increasing disthalved is counting more often than decreasing it

#

with a distance halved of 0.05 meowsweats

#

Then nothing with 500

#

Yeah so seems to be inversely proportional r.e disthalved

#

Doubling halves so inversely proportional yes

#

no it doesnt halving the disthalved increases activity by a factor of 4 this is so confusing meowsweats

#
_range = 20;
_obj1 = pablito;
_distHalvedThruAir = 1;

(((_range/(ACE_player distance _obj1)^2)*(2^((ACE_player distance _obj1)/_distHalvedThruAir))))``` Returns 240 at 10m, but changing disthalved to 2 returns 6 ![meowsweats](https://cdn.discordapp.com/emojis/707626030613135390.webp?size=128 "meowsweats") Similar changes happen regardless of `_range`
sullen sigil
#

squared was in the wrong place, needed to be after i think lol no thats also wrong wtf im so confused

granite sky
#

@sullen sigil Oh yeah, the calculation should have been inverted.

sullen sigil
#

1/calc? meowsweats

granite sky
#

replace the * in the middle with a / :P

sullen sigil
#

I've been running it like that for a short while and still getting odd behaviour

#

but let me try change in the mod & see

#

oh

#

works 😄

#

thanks 🙂

#

just had to test in the mod not debug console values

#

It is however not really working too great for gamma in terms of actual range still -- drops off wayyy to quickly even when I have halved as 2000

granite sky
#

What about if you set it to 1 million or so

sullen sigil
#

Ah, think I'm misunderstanding the variables now -- the previous max range one now seems to be max range in total if nothing gets halved etc

#

Setting range to 2000 with distancehalved as like 5 works

granite sky
#

uh

#

Note that you're not squaring the range there, so that means sqrt(2000) = 44m is the point where the first part evaluates to 1.0

sullen sigil
#

It's confusing as _range was already a variable and was maximum range of the radiation lol
but seems to still be maximum range but it's now relying on distancehalved, which is good

granite sky
#

It's not a maximum range, it's just a scale point.

#

5m for gamma is aphysical and you're just fudging things :P

sullen sigil
#

What I have now works it's just not what I expected to have xD

hushed bobcat
#

I'm trying to add magazines into this loot crate with the weapons, any idea on how to do it? I tried some things but only got errors

lavish stream
#

What is the error?

hushed bobcat
#

Not using ammo but basically doing the same thing. I get error on line 2 missing ]

lavish stream
#
private _randomGun = selectRandom [
    "arifle_MX_F",
    "arifle_MX_GL_F",
    "arifle_AK12_F"
];
crate1 addWeaponCargoGlobal [_randomGun, 1];

Does this work?

hushed bobcat
#

yep it does

#

I fixed the error on mine, I miss " on line 2. But now nothing spawns in the crate but without error

#

Like this there are no errors but nothing appears in the crate

lavish stream
#

So don't use that, use the one i gave you.

hushed bobcat
#

but that only adds weapons, I need to add weapon with ammo

lavish stream
#

🤔 yours doesn't add ammo either?

hushed bobcat
#

nope just weapons

lavish stream
#

And what I gave you is a drastically improved version of what you have now.

hushed bobcat
#

I appreciate it but I need to find a way to add the weapon with magazines

hallow mortar
hushed bobcat
#

these should be arrays with proper ammo and it doesn't work

granite sky
#

You're expecting addWeaponCargo to understand a ["weapon", "magazine"] array? It doesn't.

kindred zephyr
# hushed bobcat How can I fix it then?

there is one separate command for magazines (addMagazineCargo). A loot system this early might be complex to make, maybe reconsider and try undestanding what each command does and then add to a single box until you wrap around the concept of cargo in a container

hallow mortar
copper raven
velvet merlin
#

was there any way to make AI never leave a vehicle no matter what?

#

there is allowCrewInImmobile, and setUnloadInCombat - but thats it, right?

#

like disablAI has no influence

warm hedge
#

No matter what, like which situation?

velvet merlin
#
{
    ger_tank_841 setHitPointDamage [_x,1];
} forEach ["hitFuel","hitRTrack","HitSkirt_Right_1","HitSkirt_Right_2","HitSkirt_Right_4"];

ger_tank_841 setVehicleLock "locked";
ger_tank_841 setFuel 0;
ger_tank_841 allowCrewInImmobile true;```
#

this works locally, but on a DS it does not

#

probably its related to dynamic sim / simulation switching on-off for the tank and crew

ivory lake
#

vehicle allowCrewInImmobile [brokenWheels, upsideDown]

#

they'll still leave when hull damage is too high tho

winter rose
#

lock the vehicle

ivory lake
#

oh yeah I think that works, it has to be a full vehicle lock though, lockTurret etc I think they don't care about

velvet merlin
velvet merlin
copper raven
velvet merlin
#

ok. so what does @winter rose mean than???

copper raven
#

🤔

low isle
#

Hi!
I'm not a script writer but have an idea - logistics and spare parts for vehicle repairing. From what I know (and believe me- I know, that's my job in the army...) it's one of the things that makes everything a little more complicate. and I think Arma need this logistic challenge as well...
What do you think? is it complicate to make?

still forum
#

Well ACE mod does it with spare wheels or spare tracks for tanks to repair

lime frigate
#

I have the following script for spawning a heli, its crew, and a squad of soldiers as passengers.

It goes to the correct location and deposits the soldiers before going to waypoint _wp2 as expected, however, it doesn't delete the crew, even though it does put through the hint.

Ideally I'm trying to delete both the heli and it's crew once it arrives at _wp2.

I've tried a variety of other lines but no matter what it seems to do nothing.

Any help is appreciated 🙂


params ["_pos","_side"];

        _crew1 = [];
        _airframe1 = [];
        _mygroup = [];

        _crew1 = creategroup EAST; 

        _airframe1 = [(getMarkerPos "RedSupportCorridor"), 140, "O_Heli_Transport_04_bench_F", _crew1] call BIS_fnc_spawnVehicle;

        _wp1 = _crew1 addWaypoint [_pos, 0];
        _wp1 setWaypointType "TR UNLOAD";
        _wp1 setWaypointSpeed "FULL";
        _wp1 setwaypointstatements ["true", "this land 'land'"];

        _wp2 = _crew1 addWaypoint [(getMarkerPos "RedSupportCorridor"), 0];
        _wp2 setWaypointType "MOVE";
        _wp2 setWaypointSpeed "FULL";
        _wp2 setWaypointStatements ["true", "deleteVehicleCrew _airframe1; hint 'red del';"];

        _mygroup = [(getMarkerPos "RedSupportCorridor"), EAST, ["O_Soldier_SL_F","O_Soldier_F","O_Soldier_LAT_F","O_soldier_M_F","O_Soldier_TL_F","O_Soldier_AR_F","O_Soldier_A_F","O_medic_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
        [_mygroup, _pos, 75] call BIS_fnc_taskPatrol;
        waitUntil{ waypoints _mygroup findIf { waypointType _x == "CYCLE" } > -1 };
        {_x setWaypointSpeed "NORMAL";}forEach waypoints _mygroup;

        sleep .5;
        _mygroup = _mygroup;
        { _x assignAsCargo (_airframe1 select 0); _x moveIncargo (_airframe1 select 0);} foreach units _mygroup;
south swan
#

_airframe1 isn't likely to be available inside the waypoint statement. It's a separate script that doesn't inherit local/private variables

lime frigate
#

ah fair, so perhaps something like this?

_wp2 setWaypointStatements ["true", "deleteVehicle (vehicle this); {deleteVehicle _x} forEach units group this;"];
south swan
#

private _veh = vehicle this; deleteVehicleCrew _veh; deleteVehicle _veh; may also work

lime frigate
copper raven
#

it shouldn't be needed

lime frigate
# copper raven it shouldn't be needed

I was running into this issue elsewhere in my scenario and so added it to be safe, likely isn't needed in this context but figured better safe than sorry

https://forums.bohemia.net/forums/topic/231853-bis_fnc_taskpatrol-issue/?do=findComment&comment=3424798

copper raven
#

it doesn't schedule any new scripts in there, it runs from start to finish

coarse dragon
#

so the effect volume seems to be tied with my custom music 😦

#

and it doesnt appear in the trigger effects music section

hallow mortar
#

You have probably defined your music as a sound rather than as music

#

Arma does not automatically know whether a sound file is sound or music - it doesn't analyse the contents of the file. You tell it, when you use CfgSounds or CfgMusic to define the sound.

coarse dragon
#

so i just need to rename the important bits to cfgmusic?

hallow mortar
#

You need to look up CfgMusic on the wiki, because the format may be different to CfgSounds

#

You will also need to use e.g. playMusic rather than playSound to......play the music

coarse dragon
#

my lord

#

something was easy to me for once

#

thanks for the help

sullen sigil
#

Is the best place to ask for help with module making here or should I be trying #arma3_config instead

#

Got an issue with the config side of it causing a textbox to not show up but think the script also doesn't work

sullen sigil
#

no i mean module making

manic kettle
#

Modules are a part of mod making... just ask

sullen sigil
#

it has been solved now

cedar cape
#

how do i make it so if the players on my server are dressed up in civillian clothes they wont get shot at straight away unless they pull a gun

#

i have found a script but its from 2015 and i doubt it still works

spark turret
#

Probably have to use setCaptive or change side

sullen sigil
#

but if you want it in a script version you can have a trigger with the condition field the condition you want

#

then activation/deactivation setcaptive true/false

cedar cape
#

found it

sullen sigil
#

KJW's Imposters on the workshop then 🙂

cedar cape
#

ill take a look at it

#

what makes you hostile

#

apart from equiping a gun

#

it wouldnt make much sense if i had full military gear but they dont shoot because i dont have a gun equiped

#

and does it work with modded items, 3CB, USP, RHS etc etc

sullen sigil
#

CBA settings will let you set exceptions aside from the default ones, but:
gun in your hands, primary weapon equipped, secondary primary weapon equipped (my mod), launcher equipped, helmet with ballistic protection, vest with ballistic protection, backpack that isnt civilian, night vision, uniform and facewear

#

there is a compat for all of those but only 3cb adds civilian clothing, the others are for face coverings for balaclava system

#

generally just common sense rules

cedar cape
sullen sigil
#

Yup, everything is military gear by default until otherwise specified; relying on people properly inheriting from vanilla base classes for civilian wear. Balaclavas are the same, all balaclavas/face coverings should keep you unwanted

cedar cape
#

i see

sullen sigil
#

read mod description

cedar cape
#

i have to make the compats?

#

also, i dont think that any of the mods we use have the "KJW_Imposters_Exception = 1" in their config

#

will they still work

sullen sigil
#

no, the compats are already in the mod.

cedar cape
#

ohhhh

#

i see

storm arch
#

Does anyone know if you can limit a fuel tanks full amount. For example is it possible to make the fuel tank of a vehicles 50% less but show it as a full tank still?

kindred zephyr
storm arch
#

Alrighty Ty

digital hollow
#

If it really matters you could do perframe calculations on rpm and reduce the fuel percentage by the amount that should have been consumed.

dreamy kestrel
#

HASHMAP keys are case sensitive, i.e. when they are STRING (?)
as compared/contrasted with allVariables _object

hallow mortar
agile cargo
#

How do I pack a mission into an addon .pbo?

hallow mortar
#

Not with scripting, I'll tell you that

agile cargo
#

I know RHS did that, but I can't find where they put it

agile cargo
hallow mortar
agile cargo
#

nvmd, found it

low isle
kindred zephyr
velvet flicker
#

I've run into an issue trying to add another condition in the conditional statement provided in the BIS_fnc_holdActionAdd function called via remoteExec

    armed = _x getVariable "armed";
    [
        _x,
        "Arm Bomb",
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
        "_this distance _target < 3 && _this getVariable 'armed' == 0",   //<-------Proper way to do this?
        "_caller distance _target < 3",
        {},
        {},
        { _this call arm_func },
        {},
        [],
        5,
        0,
        false,
        false                                
    ] remoteExec ["BIS_fnc_holdActionAdd", 0, _x];
#

Any ideas?

granite sky
#

You have a missing quote around armed

velvet flicker
#

Ah, not the issue sadly, accident when I was formatting for discord

#

"(_this distance _target < 3 && _this getVariable 'armed' == 0)", // no error, doesn't work
vs
"(_this distance _target < 3 && true)", // works

#

Verified by action not showing up at all

#

Maybe _this doesn't point to the object i'm expecting?

#

from bistudio:

conditionShow: String - (Optional, default "true") condition for the action to be shown.
Special arguments passed to the code: _target (action-attached object), _this (caller/executing unit)
#

Is caller in this case not the object referenced by _x?

#

the variable "armed" definitely exists on the object _x in this case

#

Solved: Caller is the player approaching, target is the object that owns the script. use _target instead of _this

#

Another question: How to ensure that when an action is added to an object, that players who join after the script is run can see the action?

night storm
#

hello all. writing a .sqf for an enemy aircraft spawn in a mission, and need it to spawn in the air to proceed to the waypoint. where/how do i offset the height?

pulsar bluff
granite sky
meager granite
#

What's with HandleDamage triggering on different frames for a single HE GL explosion nearby?

#
13:51:35 ---------------------------------------------------------
13:51:35 "514333: HandleDamage: B_Soldier_F"
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"head",0.0196149,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",2,B Alpha 1-2:1 (Sa-Matra),"hithead"]
13:51:35 ---------------------------------------------------------
13:51:35 "514334: HandleDamage: B_Soldier_F"
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"",0.00365744,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",-1,B Alpha 1-2:1 (Sa-Matra),""]
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"neck",0.0193211,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",1,B Alpha 1-2:1 (Sa-Matra),"hitneck"]
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"head",0.0196149,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",2,B Alpha 1-2:1 (Sa-Matra),"hithead"]
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"spine2",0.025099,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",5,B Alpha 1-2:1 (Sa-Matra),"hitdiaphragm"]
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"spine3",0.0253822,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",6,B Alpha 1-2:1 (Sa-Matra),"hitchest"]
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"arms",0.0133238,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",8,B Alpha 1-2:1 (Sa-Matra),"hitarms"]
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"hands",0.0142088,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",9,B Alpha 1-2:1 (Sa-Matra),"hithands"]
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"legs",0.0130037,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",10,B Alpha 1-2:1 (Sa-Matra),"hitlegs"]
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"body",3.80734e-005,B Alpha 1-2:1 (Sa-Matra),"G_40mm_HE",11,B Alpha 1-2:1 (Sa-Matra),"incapacitated"]
13:51:35 [B Alpha 1-2:1 (Sa-Matra),"",0.00182872,B Alpha 1-2:1 (Sa-Matra),"",-1,<NULL-object>,""]

I remember it was always wonky like this, but I still wonder why.
In this log EH returns damage divided by 2: (_this select 2) / 2, 514333 is frame number

south swan
#

inb4 first one is direct hit and others are splash

meager granite
#

First frame, damage to head arrives, supposed to set it to 0.0196149 / 2.
Next frame, damage to head arrives again, tries to set it to 0.0196149 again, like it was 0 before and that 0.0196149 / 2 didn't apply?

#

Oddity with overall damage too, second frame it fires EH for 0.00365744 damage, sets to 0.00365744 / 2, then again for overall damage but sets it to result of that / 2 division, 0.00182872, so no damage, also instigator is null

meager granite
#

Oddities summarised again:

  1. First "head" damage doesn't seem to even apply
  2. Second overall damage EH fire does 0 damage and has no instigator
#

No such issue with HandleDamage on an empty vehicle, might be only happening to units.

south swan
#

or maybe it's because head is a separate entity? 🤔

#

i mean, it behaves the same with a bullet to the knee

meager granite
#

Same fires on two different frames?

south swan
#
10:06:11 [25117,[B Alpha 1-2:1,"head",0,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",2,<NULL-object>,"hithead"]]
10:06:11 [25117,[B Alpha 1-2:1,"",0.394021,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",-1,B Alpha 1-1:1 (artemoz),""]]
10:06:11 [25118,[B Alpha 1-2:1,"",0.394021,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",-1,B Alpha 1-1:1 (artemoz),""]]
10:06:11 [25118,[B Alpha 1-2:1,"legs",0.63802,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",10,B Alpha 1-1:1 (artemoz),"hitlegs"]]
10:06:11 [25118,[B Alpha 1-2:1,"body",1.12145e-006,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",11,B Alpha 1-1:1 (artemoz),"incapacitated"]]
meager granite
#

Interesting, your head has no instigator, double overall happen on different frames (while it was on same in my case), your overalls have instigator properly

#

See no rhyme so far

south swan
#

productVersion is 3","Arma3",211,150196,"Development",true,"Windows","x64"]. Are you on different build (release/prof)?

meager granite
#

["Arma 3","Arma3",210,149954,"Stable",true,"Windows","x64"]

#

Doubt its about dev build, I remember HandleDamage on units being this messy years ago, just decided to finally have a closer look

south swan
#

lemme check, not like that takes long

meager granite
#
14:11:54 ---------------------------------------------------------
14:11:54 "Frame 663154: HandleDamage: B_Soldier_F"
14:11:54 head = 0,        EH = [(UNIT),"head",0.0115336,(UNIT),"G_40mm_HE",2,(UNIT),"hithead"], should set head to 0.00576678
14:11:54 ---------------------------------------------------------
14:11:54 "Frame 663155: HandleDamage: B_Soldier_F"
14:11:54 TOTAL = 0,        EH = [(UNIT),"",0.00215512,(UNIT),"G_40mm_HE",-1,(UNIT),""], should set TOTAL to 0.00107756
14:11:54 neck = 0,        EH = [(UNIT),"neck",0.0113742,(UNIT),"G_40mm_HE",1,(UNIT),"hitneck"], should set neck to 0.00568711
14:11:54 head = 0,        EH = [(UNIT),"head",0.0115336,(UNIT),"G_40mm_HE",2,(UNIT),"hithead"], should set head to 0.00576678
14:11:54 spine2 = 0,        EH = [(UNIT),"spine2",0.0147681,(UNIT),"G_40mm_HE",5,(UNIT),"hitdiaphragm"], should set spine2 to 0.00738407
14:11:54 spine3 = 0,        EH = [(UNIT),"spine3",0.0149461,(UNIT),"G_40mm_HE",6,(UNIT),"hitchest"], should set spine3 to 0.00747304
14:11:54 body = 0,        EH = [(UNIT),"body",2.24191e-005,(UNIT),"G_40mm_HE",11,(UNIT),"incapacitated"], should set body to 1.12096e-005
14:11:54 TOTAL = 0.00107756,    EH = [(UNIT),"",0.00107756,(UNIT),"",-1,<NULL-object>,""], should set TOTAL to 0.000538779
```added more logging, replaced long unit name with `(UNIT)` for better readability
#

damage player = 0.000538779 after the fact

#

So indeed first frame head's damage doesn't even apply

#

All other though do

#

player getHit "head" => 0.00576678

south swan
#

it starts showing instigator on the first frame when i change to stable build

#

behaves differently between a bullet hit, light splash damage and heavy splash damage, it seems notlikemeow

meager granite
#

Yeah, no rhyme to it

#

Also complete mess with server\client differences

#

Somehow HandleDamage added to remote (server) unit fires too when client unit shoots

#

Server player explodes HE GL, damage logs on client:

14:25:20 ---------------------------------------------------------
14:25:20 "Frame 57197: HandleDamage: B_Soldier_F"
14:25:20 TOTAL = 0, EH = [(CLIENT),"",0.0040391,(SERVER),"G_40mm_HE",-1,(SERVER),""], should set TOTAL to 0.00201955
14:25:20 neck = 0, EH = [(CLIENT),"neck",0.0215125,(SERVER),"G_40mm_HE",1,(SERVER),"hitneck"], should set neck to 0.0107563
14:25:20 head = 0, EH = [(CLIENT),"head",0.0218586,(SERVER),"G_40mm_HE",2,(SERVER),"hithead"], should set head to 0.0109293
14:25:20 spine2 = 0, EH = [(CLIENT),"spine2",0.0278808,(SERVER),"G_40mm_HE",5,(SERVER),"hitdiaphragm"], should set spine2 to 0.0139404
14:25:20 spine3 = 0, EH = [(CLIENT),"spine3",0.0282422,(SERVER),"G_40mm_HE",6,(SERVER),"hitchest"], should set spine3 to 0.0141211
14:25:20 arms = 0, EH = [(CLIENT),"arms",0.014843,(SERVER),"G_40mm_HE",8,(SERVER),"hitarms"], should set arms to 0.00742151
14:25:20 hands = 0, EH = [(CLIENT),"hands",0.0158519,(SERVER),"G_40mm_HE",9,(SERVER),"hithands"], should set hands to 0.00792595
14:25:20 legs = 0, EH = [(CLIENT),"legs",0.0144275,(SERVER),"G_40mm_HE",10,(SERVER),"hitlegs"], should set legs to 0.00721375
14:25:20 body = 0, EH = [(CLIENT),"body",4.23633e-005,(SERVER),"G_40mm_HE",11,(SERVER),"incapacitated"], should set body to 2.11817e-005
14:25:20 TOTAL = 0.00201955, EH = [(CLIENT),"",0.00201955,(SERVER),"",-1,<NULL-object>,""], should set TOTAL to 0.00100977

Client player explodes HE GL, damage logs on client:

14:27:22 ---------------------------------------------------------
14:27:22 "Frame 71126: HandleDamage: B_Soldier_F"
14:27:22 head = 0, EH = [(CLIENT),"head",0.0222436,(CLIENT),"G_40mm_HE",2,(CLIENT),"hithead"], should set head to 0.0111218
14:27:22 head = 0.011811, EH = [(SERVER),"head",0.0349303,(CLIENT),"G_40mm_HE",2,(CLIENT),"hithead"], should set head to 0.0174651 // WTF?
14:27:23 ---------------------------------------------------------
14:27:23 "Frame 71127: HandleDamage: B_Soldier_F"
14:27:23 TOTAL = 0, EH = [(CLIENT),"",0.00415877,(CLIENT),"G_40mm_HE",-1,(CLIENT),""], should set TOTAL to 0.00207939
14:27:23 neck = 0, EH = [(CLIENT),"neck",0.0219095,(CLIENT),"G_40mm_HE",1,(CLIENT),"hitneck"], should set neck to 0.0109548
14:27:23 head = 0, EH = [(CLIENT),"head",0.0222436,(CLIENT),"G_40mm_HE",2,(CLIENT),"hithead"], should set head to 0.0111218
14:27:23 spine2 = 0, EH = [(CLIENT),"spine2",0.0284411,(CLIENT),"G_40mm_HE",5,(CLIENT),"hitdiaphragm"], should set spine2 to 0.0142206
14:27:23 spine3 = 0, EH = [(CLIENT),"spine3",0.0287695,(CLIENT),"G_40mm_HE",6,(CLIENT),"hitchest"], should set spine3 to 0.0143847
14:27:23 arms = 0, EH = [(CLIENT),"arms",0.0151249,(CLIENT),"G_40mm_HE",8,(CLIENT),"hitarms"], should set arms to 0.00756244
14:27:23 hands = 0, EH = [(CLIENT),"hands",0.0161677,(CLIENT),"G_40mm_HE",9,(CLIENT),"hithands"], should set hands to 0.00808383
14:27:23 legs = 0, EH = [(CLIENT),"legs",0.0147837,(CLIENT),"G_40mm_HE",10,(CLIENT),"hitlegs"], should set legs to 0.00739185
14:27:23 body = 0, EH = [(CLIENT),"body",4.31542e-005,(CLIENT),"G_40mm_HE",11,(CLIENT),"incapacitated"], should set body to 2.15771e-005
14:27:23 TOTAL = 0.00207939, EH = [(CLIENT),"",0.00207939,(CLIENT),"",-1,<NULL-object>,""], should set TOTAL to 0.00103969
#
14:27:22 head = 0.011811, EH = [(SERVER),"head",0.0349303,(CLIENT),"G_40mm_HE",2,(CLIENT),"hithead"], should set head to 0.0174651 // WTF?

Client somehow has HandleDamage on remote (server) unit firing

#

0.0174651 is not applied, server still has their proper head damage value

#

Complete mess thronking

south swan
#

yaaay, jank and discovery

meager granite
#

Maybe @still forum can shine a bit of light on this?

south swan
#

with a1 setDamage 0.1 added to EH: 10:36:55 [66911,[a1,"head",1.20037,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",2,<NULL-object>,"hithead"]] 10:36:55 [66911,[a1,"",0.533586,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",-1,B Alpha 1-1:1 (artemoz),""]] 10:36:55 [66912,[a1,"",0.633586,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",-1,B Alpha 1-1:1 (artemoz),""]] 10:36:55 [66912,[a1,"face_hub",0.39007,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",0,B Alpha 1-1:1 (artemoz),"hitface"]] 10:36:55 [66912,[a1,"neck",0.419022,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",1,B Alpha 1-1:1 (artemoz),"hitneck"]] 10:36:55 [66912,[a1,"head",1.30037,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",2,B Alpha 1-1:1 (artemoz),"hithead"]] 10:36:55 [66912,[a1,"arms",0.124855,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",8,B Alpha 1-1:1 (artemoz),"hitarms"]] 10:36:55 [66912,[a1,"body",0.100039,B Alpha 1-1:1 (artemoz),"B_65x39_Caseless",11,B Alpha 1-1:1 (artemoz),"incapacitated"]]

#

sets to 0.1 at frame 11, uses that in calc on frame 12

stable dune
#

How do I get my hitpart work correctly?
Or should I use some another eh.

params ["_bombObj"];

_bombObj addEventHandler ["HitPart", { 
(_this #0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];

_data = str _target+str _shooter+str _projectile+str _position+str _velocity+str _selection+str _ammo+str _vector+str _radius+str _surfaceType+ str _isDirect;
copyToClipboard _data;
    if (_ammo don't know the check here) then {
        [_target] call VRK_IEDDcommon_fnc_bomb;
    };
}];

Currenclty check with one type of ammo, (part don't know correct check)
But if I want for let's say 4 big ammo types.
I want my explosive to expose when it get hit from big gun.

Currently my eh triggers if I shoot 20-25 ammos with regular machine gun.

So can I check with something else than typeOf ammo is gun/ ammo in my list.

south swan
#

(_this #0) params wut "HitPart" is fun

meager granite
#

HitPart returns array of arrays so its fine

stable dune
south swan
#

ammo: Array - ammo info: [hit value, indirect hit value, indirect hit range, explosive damage, ammo class name]; Or, in case of a vehicle collision: [impulse value, 0, 0, 0]; hit and damage values are derived from the projectile's CfgAmmo class, and do not match the actual damage inflicted, which is usually lower due to armor and other factors
notlikemeow

meager granite
#

@stable dune So you want lots of small caliber hits or few high caliber ones to trigger the bomb?

#

Basically have some kind of HP for the object that reduces based on ammo used?

stable dune
#

One big hit

meager granite
#

Only the big hit, ignore other?

south swan
#

"big hit" as in "hit from an ammo from big ammo list" or as "hit with high damage". Or some combination of both?

meager granite
#

.50 cal bullet has hit = 30 in config

    class B_127x99_Ball: BulletBase
    {
        hit = 30;
#

you can try checking if _ammo # 0 > 20 for example

south swan
#

or something like sqf _bombObj addEventHandler ["HitPart", { private _bigBombs = ["Bomb_03_F", "Bomb_04_F", "Bo_Mk82"]; private _bigBombHitIndex = _this findIf { _x params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"]; (count _ammo > 4) && {(_ammo#4 in _bigBombs)} }; if (_bigBombHitIndex > -1) then { hint "KABOOM"; }; }];

#

or switch to "HandleDamage" EH as it seems to fire for static objects in my testing 🤔

meager granite
#

if(_isDirect && _ammo # 0 > 20) then {

stable dune
#

Omg, 😱.
Nice. These give me alot of variations.
I will test these out.
Thanks guys alot of help.

south swan
#
_bombObj addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit"];
    private _bigBombs = ["Bomb_03_F", "Bomb_04_F", "Bo_Mk82"];
    if (_projectile in _bigBombs) exitWith { // if classname of projectile matches - do something and set full damage
        hint "KABOOM";
        1
    };
    0 // else ignore damage totally
}];```something like this may work. Or not.
stable dune
#

I will test out. Thanks

#

How it goes if I want let's say .50 cal shot to explose my object

south swan
#

if you want to check ammo stats or distinguish direct/indirect hits - then "HitPart" seems preferable. If just ammo class matching is enough - "HandleDamage" with listed ammo classes would work.

proven charm
#

what are the script entrypoints for an addon? I suppose something like init.sqf wont work

south swan
#

i guess CfgFunctions entry with pre/postInit

#

or preStart

proven charm
still forum
#

CfgFunctions, or any eventhandler (on a unit or UI or smth)
If you have CBA it also adds some eventhandlers for preInit/preStart n sucho

proven charm
#

ok thx

pulsar bluff
#

@meager granite have you experimented with blocking damage to player when involved in an "arma" vehicle collision?

#

i have players doing very cool pit maneuvers and almost invariably dying in the process. will probably look into doing something about it but maybe you've already solved it 😄

meager granite
open hollow
#

im not sure if its a bug, or if doing something wrong.

But if you have a list, and select the first thing, and use lbSelection for some reason [] is returned instaed of [0]

ive selected another values and always the [index] is returned, but when i select the 0, returns []

proven charm
open hollow
proven charm
#

i think a bug

open hollow
#

to be fair lbCurSel works fine

proven charm
open hollow
south swan
#

seems to work alright in devdiag build 🤔

winter rose
south swan
#

i can reproduce in prod build. Seems to be fixed in diag build already 🤷‍♂️

winter rose
#

perfect, less work

fleet sand
#

Hi guys a question. so i have this code:

playersInMission = {isPlayer _x} count playableUnits;
playerNames = [];
private _headlessClients = entities "HeadlessClient_F";
humanPlayers = allPlayers - _headlessClients;
{
    private _playerName = name _x;
    playerNames pushBack _playerName;
}foreach humanPlayers;

[] spawn {
    while {true} do {
        //Players in Area:
        playersInArea = humanPlayers select {_x inArea area1};
        playersNotInArea = (humanPlayers - playersInArea);
        hint format ["Players in Mission: %1 \n PlayerNames: %2 \n Players in Area: %3 \n Players not in Area: %4",playersInMission,playerNames,playersInArea,playersNotInArea];
        sleep 2;
    };
};

But this code is ugh. Question how can i make so this code is modular. Meaning i can have triggers around map and when player 1 enters in the trigger 1 it activates the code witch basicly counts all the players in the mission, checks the players in the trigger area and displays the players not pressent in the trigger area. Once all the players are in trigger area the code exits. How would i make it so i can just call this via fnc ?

still forum
#

well for one, playersInMission and humanPlayers variables will only be updated once, if a player joins in after mission start, you will not count them

still forum
#

Cleaning that up would be

[] spawn {
    while {true} do {

        private _playersInMission = {isPlayer _x} count playableUnits;
        private _playerNames = humanPlayers apply {name _x};
        private _humanPlayers = allPlayers - (entities "HeadlessClient_F");

        //Players in Area:
        private _playersInArea = _humanPlayers inAreaArray area1;
        private _playersNotInArea = (_humanPlayers - _playersInArea);
        hint format ["Players in Mission: %1 \n PlayerNames: %2 \n Players in Area: %3 \n Players not in Area: %4",_playersInMission,_playerNames,_playersInArea,_playersNotInArea];
        sleep 2;
    };
};
#

area1 is the trigger yes?

fleet sand
still forum
#

oh also inAreaArray is a thing
private _playersInArea = _humanPlayers select {_x inArea area1};
to
private _playersInArea = _humanPlayers inAreaArray area1;

#

You could turn it into a func like

L3_TriggerAreaFuncStuff = {
    params ["_area"];
    while {true} do {

        private _playersInMission = {isPlayer _x} count playableUnits;
        private _playerNames = humanPlayers apply {name _x};
        private _humanPlayers = allPlayers - (entities "HeadlessClient_F");

        //Players in Area:
        private _playersInArea = _humanPlayers inAreaArray _area;
        private _playersNotInArea = (_humanPlayers - _playersInArea);
        hint format ["Players in Mission: %1 \n PlayerNames: %2 \n Players in Area: %3 \n Players not in Area: %4",_playersInMission,_playerNames,_playersInArea,_playersNotInArea];
        sleep 2;
    };
};

and then you can call it like
[area1] spawn L3_TriggerAreaFuncStuff
But you probably also don't want multiple areas to be active at the same time? the hints will overwrite eachother

#

also the hints make a "bling" sound every 2 seconds, maybe us hintSilent instead of just hint

south swan
#

and if (_playersNotInArea isEqualTo []) exitWith {hint "Everybody home"}; before sleep 2; for the "Once all the players are in trigger" part :3

copper raven
#

just put that into condition instead

south swan
#

all the code into condition and just sleep 2; as body? Radical.

copper raven
#

i meant the if you wrote

south swan
#

it kinda depends on private variable inside the body. That kinda depends on other private variables inside the body. I'd argue exitWith would be cleaner here than moving a variable outside of while loop 🤷‍♂️

fleet sand
# still forum also the hints make a "bling" sound every 2 seconds, maybe us hintSilent instead...

Yea that is fine i dont plan for players to have 2 triggers active at the same time. Also to exit the code is it like this so i dont have Infinite loops running in buckground ?
```sqf
while {true} do {

    private _playersInMission = {isPlayer _x} count playableUnits;
    private _playerNames = humanPlayers apply {name _x};
    private _humanPlayers = allPlayers - (entities "HeadlessClient_F");

    //Players in Area:
    private _playersInArea = _humanPlayers inAreaArray area1;
    private _playersNotInArea = (_humanPlayers - _playersInArea);
    hint format ["Players in Mission: %1 \n PlayerNames: %2 \n Players in Area: %3 \n Players not in Area: %4",_playersInMission,_playerNames,_playersInArea,_playersNotInArea];
    if (_playersNotInArea isEqualTo []) exitWith {hint "Everybody home"};
    sleep 2;
};
still forum
#

yush

#

btw instead of just playerNames. You could log names of players in area and not in area.

fleet sand
still forum
#
while {true} do {
        private _playersInMission = {isPlayer _x} count playableUnits;
        private _humanPlayers = allPlayers - (entities "HeadlessClient_F");

        //Players in Area:
        private _playersInArea = _humanPlayers inAreaArray area1;
        private _playersNotInArea = (_humanPlayers - _playersInArea);
        hint format ["Players in Mission: %1 \n Players in Area: %3 \n Players not in Area: %4",
            _playersInMission,
            _playersInArea apply {name _x},
            _playersNotInArea apply {name _x}
        ];
        if (_playersNotInArea isEqualTo []) exitWith {hint "Everybody home"};
        sleep 2;
    };
fleet sand
sullen wadi
#

I need help I cant change faction config in warlords and when i am changing faction config nothing happening in the game and i have RHSUSAF mod but I dont know how I use that in faction config

meager granite
#

rhs_faction_usarmy is US Army faction, you can find other there

sullen wadi
meager granite
#

Check its child class names in config browser, these will be your faction config names

sullen wadi
meager granite
sullen wadi
winter rose
sullen wadi
winter rose
#

as in "what do you want to do?"

fleet sand
still forum
#

allPlayers is different from playableUnits?

sullen wadi
#

in warlords

winter rose
#

if you want to override a mod faction, you will need to create a config mod (pbo) - you cannot change that from scripts

fleet sand
winter rose
still forum
#

Maybe a variable is typoed

#

I can't see the error now

#

But the not in area is empty. That's.. ohhh

still forum
#

Oops
It's %1 %3 %4 in that Format
Should be 1 2 3, i forgot that

winter rose
still forum
#

That's why it displays wrong

fleet sand
#

Basicly when player 1 enters in the trigger it displays everybody is home message. and on player 2 is displaying what is in picture.

still forum
#

Remove the "hint" for everybody home

#

So on first player it will show you what values the variables contain

sullen wadi
spark turret
#

assuming in-engine-functions run faster than sqf functions
edit: nvm i responded to an hours old posting here

winter rose
spark turret
#

also, #arma3_config is incredibly unsupportive/unhelpful if you dont already know what you are doing

#

(personal opinion)

fleet sand
tough abyss
#

is there a channel for posting things about incorrect wiki places just noticed something and curious

tough abyss
#

im working on some simple unitplay unitcapture stuff and cant tell if anything is wrong with my syntax i got sqf _unitCaptureData2 = []; [Heli2 , _unitCaptureData2] spawn BIS_fnc_unitPlay
but m not receiving any errors i used this template about half a year ago has it been modified since?

winter rose
#

you need to capture first

tough abyss
#

i removed the data

#

as it is always massive due to the type of array it is

#

well there is that if you want one with data but to get to anything useful you might have to home and end key a bit

winter rose
#
private _unitCaptureData2 = [/* data */];
```could have been enough 😛 hehehe
tough abyss
#

ah ok not too used to removing massive arrays but ill remember it

winter rose
#

(also _unitCaptureData1 vs _unitCaptureData2, IDK if relevant)

tough abyss
#

also for context it is in a mission file that is being execvm'd by a condition that i confirm works

tough abyss
winter rose
#

and are you sure the code is called?

tough abyss
#
NCL_HELI = 1;
if (NCL_HELI == 1) then {
execVM "Heliflight.sqf";
};
#

code in init.sqf

#

it's really weird im hardstuck on the issue because nothing shows

#

is there a chance that the space inbetween heli2 and the comma might cause issues```sqf
[Heli2 , _unitCaptureData2] spawn BIS_fnc_unitPlay

#

im going to test 1 sec

tough abyss
#

yeah i didnt think it could and testing reveals it wont

winter rose
#

do you have error display enabled? -showScriptErrors?

tough abyss
#

1 sec going to restart

winter rose
#
NCL_HELI = 1;
if (NCL_HELI == 1) then {
sleep 1;
systemChat "werkz";
execVM "Heliflight.sqf";
systemChat "werkeded";
};
winter rose
tough abyss
#

SP and later Mp local host

#

enabled -showScriptErrors in command line saw nothing in the scripterror aspect and with your modification got both messages

spark turret
#

so, what to do with AI objects?
enableDynamicSimulation

    Enables or disables Arma 3: Dynamic Simulation for given non AI object.```
coarse dragon
#

can one stop a helo from firing its machine guns but not effect its rockets?

pulsar bluff
coarse dragon
#

I can't it's a attack heli

pulsar bluff
#

{heli removeweapon _x} foreach (weapons heli)

coarse dragon
#

Oh

coarse dragon
#

{heli removeweapon "mainGun"} foreach (weapons heli);

#

let me guess. that is wrong?

#

nvm got it XD

hallow mortar
#

No, they have no animations.

chrome hinge
#

Hi everyone. I have a issue on my mission where blufor has 10 soldiers they can switch between freely with teamswitch. However when they die they lose the wheel scroll menu and cant use arsenal, addactions etc. Any ideas what this could be?

grim ravine
#

👋 I have a question (I think) about locality for MP.

I have function that adds an EH to some targets that counts when it is hit;

{
    _x addMPEventHandler ["Hit",{ 
    params ["_unit", "_source", "_damage", "_instigator"]; 
        private "_hits";
        _hits = missionNamespace getVariable "RW_hit"; 
        _hits = _hits + 1; 
        missionNamespace setVariable ["RW_hit",_hits]; 
        diag_log RW_hit; //debug
        _unit animate ["terc",1];  //Making sure it goes down
        _unit removeEventHandler [_thisEvent, _thisEventHandler];
 }];```

I'm trying to record the hits that players make on  the targets (can only ever be `0` or `1` in a place where I can access it to the return it to a player when they look for it is missionNamespace suitable for that?
chrome hinge
sullen sigil
#

Hit isnt an mp eh

grim ravine
#

Ah thanks

#

Was wondering why it just broke on server

sullen sigil
#

arma do be like that

sullen wadi
#

i have mod RHSUSAF and RHSAFRF and How I put the codes inside this?

#

Can you give me an example of how to write?

winter rose
dreamy kestrel
#

I am working with an inherited code base. code not mine, started from ground zero repo, no commit history.
q: why do enemy AI target empty friendly vehicles, and is there a way to disable this behavior?
possibly something in a the difficulty setting?
also running with ACE, not sure if it is in there as well.

granite sky
#

If you use addVehicle then I think vehicles do remain on that side. Most empty-vehicle targeting cases are bugs though, IME.

agile cargo
#

Is there a command to get the name of a vehicle or I need to get it with using the config?

#

I mean like return "Cool Tank" from "b_o_tank123"

quiet geyser
#

I'm trying to set up an addAction on a vehicle, but I need it to remoteExec. Basically I just need it to execute a function OPTRE_fnc_PelicanUnLoadValidate on the vehicle. What's the best approach for remoteExec in an addAction?

hallow mortar
hallow mortar
quiet geyser
#

So...
this addAction ["message", {[_this] remoteExec ["OPTRE_fnc_PelicanUnLoadValidate"]}]?

hallow mortar
#

The principle of the remoteExec is correct but _this doesn't refer to the object the action is attached to

quiet geyser
#

so how would I do that?

hallow mortar
#

The addAction page contains a perfectly functional example of using params to extract the contents of _this into separate variables. You can copy that, or look up params or select to figure it out yourself. It's very simple so don't be scared.

quiet geyser
#

Yeah honestly reading the stuff on the wiki isn't helping me at all, I don't understand how I'd implement this alongside a remoteExec within an addAction

granite sky
#
this addAction ["message", {
  params ["_target", "_caller", "_actionId", "_arguments"];
  [_target] remoteExec ["OPTRE_fnc_PelicanUnLoadValidate"];
}];
#

The script parameter of the addAction is arbitrary code. Can be as long as you like.

#

In this case you can abbreviate to [_this#0] remoteExec ["whatever"], but this is illustrative.

quiet geyser
#

Thanks a bunch for the script/explanation, will test it out now. Does this implementation work for JIP as well?

granite sky
#

No, your remoteExec would need the JIP parameter.

#

Do you actually want that function to run everywhere, or just the server?

quiet geyser
#

Honestly now I'm unsure, so I'll explain the goal. Basically, OPTRE_fnc_PelicanUnLoadValidate, when executed on a given Pelican vehicle, will detach something attached to the maglift pad on it. Players can get connected to an AI Pelican just fine as the driver is the one who initiates the connection, but for whatever reason it's normally the pilot who hits the scroll action to drop the attached vehicle. I've been told that this function should effectively just detach whatever is on, which works fine. I assume it only needs to execute on the server but I could be wrong here.

granite sky
#

Well, detach is global-argument global-effect so you can run it anywhere.

#

So it depends what else the function does.

quiet geyser
#

I can send the function here if you'd like.

#

`_vehicles = ((_this select 0) getVariable ["OPTRE_Pelican_AttachedToVehiclesEffect",[]]);

if (
(
{
(_x isKindOf "OPTRE_M808B_base") OR
(_x isKindOf "OPTRE_falcon_base") OR
(_x isKindOf "OPTRE_Wombat_base") OR
(_x isKindOf "optre_hornet_base")
} count _vehicles > 0
)
) then {

if (((getPosATL (_this select 0)) select 2) < 2) then {
         
    titleText ["-------------------------------------------<br/><t color='#ff0000' size='1.5'>UNLOADING FAILED!</t><br/>-------------------------------------------<br/>Your landing gears must be raised to unload larger vehicles! Your landing gears will automatically raise when unloading large vehicles if you're flying above 2m.", "PLAIN DOWN", -1, true, true];
    playSound "FD_CP_Not_Clear_F";
            
} else { 
            
    (_this select 0) allowDamage false; 
    player action ["LandGearUp", (_this select 0)];  
                 
    sleep 2;  
    titleText ["-------------------------------------------<br/><t color='#ff0000' size='1.5'>VEHICLE UNLOADED!</t><br/>-------------------------------------------", "PLAIN DOWN", -1, true, true];
    playSound "FD_Finish_F"; 
                 
    { 
        detach _x;  
        _x setVelocity [0,0,-1]; 
        _x allowDamage false; 
    } forEach _vehicles; 
                 
    sleep 0.5;  
                 
    {_x allowDamage true;} forEach _vehicles; 
    (_this select 0) allowDamage true; 
    (_this select 0) setVariable ["OPTRE_Pelican_AttachedToVehiclesEffect", [], true];  
            
    };

} else {

0 = (_this select 0) spawn OPTRE_fnc_PelicanLoad_UnloadAllSupplyPods;

}; `

granite sky
#

That needs to run local to the vehicle & pilot, which is hopefully the same thing.

#

It definitely shouldn't be JIP'd.

#

Or executed on more than one machine.

broken forge
#

I'm having some issue getting the idc of a control that is created from a .sqf file, I've tried using ctrlIDC _ctrlName and I get scalar back as both a hint and a log. The idc is generated for each control, and it changes if you don't fully exit the ui before trying to access the ui "page" again from another ui "page"

quiet geyser
granite sky
#

You'd need to rewrite the script then, because it's doing player action ["LandGearUp", (_this select 0)];