#arma3_scripting

1 messages · Page 572 of 1

high marsh
#
_logic = _this param [0,objnull,[objnull]];
_params = getArray (configFile >> "CfgVehicles" >> (typeOf _logic) >> "effectFunction");

_fnc = "";
_nr = 1;
if ((count _params) > 1) then {
    _fnc = _params param [0,"",[""]];
    _nr = _params param [1,1,[1]];
} else {
    _fnc = _params param [0,"",[""]];
};
if (_nr < 1) then {_nr = 1};


if ((_fnc != "") && !(isNull _logic)) then {
    _emitterArray = [];
    while {_nr > 0} do {
        _source = "#particlesource" createVehicle (getPos _logic);
        _emitterArray = _emitterArray + [_source];
        _nr = _nr - 1;
    };
    _logic setVariable ["effectEmitter",_emitterArray,true];
    
    if (isMultiplayer) then {
        [_logic,_fnc,nil,true] call BIS_fnc_MP;
    } else {
        _logic call (missionnamespace getvariable _fnc);
    };
    
    //--- check if all triggers are still activated
    [_logic] spawn {
        scriptName "fn_moduleEffectsEmitterCreator_triggerLoop";
        _logic = _this select 0;
        _triggerList = synchronizedObjects _logic;
        _emitterList = _logic getVariable "effectEmitter";
        
        if ((count _triggerList) > 0) then {
            while {(!isNull _logic) && (({!(triggerActivated _x)} count _triggerList) == 0)} do {
                sleep (0.8 + random 0.2);
            };
            {deleteVehicle _x} forEach _emitterList;
        };
    };
} else {
    ["No particle emitter created! Missing module logic or function name."] call BIS_fnc_log;
};
potent depot
#

I’m guessing the answer is no but does anyone know if there is an event handler available for admin login? CBA or vanilla? I haven’t found one but thought I would ask. Alternative is to check for command available, I know.

high marsh
#

Your guess is correct

potent depot
#

Rip

winter rose
#

question would be: "why do you need it?"

high marsh
#

God has logged in with is ban hammer <

potent depot
#

Just didn’t want to have a onEachFrame check. And because my system needs to know who is admin logged. Mostly because we have an adminlogged curator but for other uses as well.

high marsh
#

onEachFrame??

#

just do a while loop or waitUntil

potent depot
#

Not actually but wait until and such is executed every frame is it not?

winter rose
#

simulation frame, not each drawn frame

high marsh
#

^^

potent depot
#

Fair enough probably shouldn’t have mentioned the draw handler. Yeah I was gonna use wait until or a while loop with a delay to reduce processing.

#

Is there any performance difference between the CBA variant and the vanilla one?

#

For waituntil that is

high marsh
#

Performance not afaik, utility yes.

potent depot
#

Yeah basically unscheduled vs scheduled respectively right?

high marsh
#

No, they behave the same way. CBA has extended event handlers for example, to add EH to classes, objects, etc. Chat handlers too, code is unscheduled.

potent depot
#

Yes however the CBA variant of waituntil: waitUntilAndExecute can be used in a unscheduled call function. waitUntil can only be used in a scheduled spawn.

high marsh
#

Right, but in regards to any EH like Hit, Killed, etc. Same function

potent depot
#

Well, tbh I consider EH a bit different from waituntil though functionally similar.

#

They are used differently

high marsh
#

¯_(ツ)_/¯

potent depot
#

That’s all semantics anyway no sense arguing over it

#

Thanks for the help

ember citrus
#

Would this capture all mass values even if they are located in subfolders like configFile >> "CfgWeapons" >> "Medikit" >> "ItemInfo" >> "mass" is

"getNumber (_x >> 'mass') == 1" configClasses (configFile >> "CfgWeapons")

Because i'm not finding any items with a mass of 1 (but i do find them with masses 0 or > 1).

high marsh
#

No, the condition for configClasses is true or false to return config

#

if mass is a direct child class to the config

#

then yes

ember citrus
#

ah i see thanks

#

another question; when using remoteExec to let's say add an addAction like this

(_addActionParams) remoteExec ["addAction", -2, true];

How would i capture the return value of the addAction function?
remoteExec only returns the JIP ID ..

#

(i need to call removeAction after a condition is met on all clients)

copper raven
#

use addAction condition then

high marsh
#

addAction has passed parameters for action ID

#

so whomever you're executing the addAction for can/will receive the ID

potent depot
#

Who is running the remotexec?

#

And who needs the value returned to them?

potent depot
#

So the goal is to provide an addaction to everyone, then remove it from everyone right?

ember citrus
#

The server is running the remoteExec.

This is how it looks right now

_addActionID = _unit addAction _addActionParams;
(_addActionParams) remoteExec ["addAction", -2, true];

// Some stuff happens

_unit removeAction _addActionID; // <-- _addActionID is undefined
[_unit, _addActionID] remoteExec ["removeAction", -2, true];
#

i tried to make it so the server does the addaction first to get the ID, this doesn't work though

potent depot
#

Is there something different between each user’s action or are the all identical?

ember citrus
#

all the same

#

defined in _addActionParams

potent depot
#

Why not use the condition parameter for addaction and a public variable?

ember citrus
#

Yeah that could work, i forgot about the addAction's condition

potent depot
#

Create it locally on every client. And just use a public bool? Once server get to where it needs to remove it you change the bool to false and broadcast it public. Public variable also gets resent for jip so you don’t have to worry about that.

ember citrus
#

But would that 'delete' the action forever after the condition returns false, or just hides the action until the condition becomes true ?

copper raven
#

hides

potent depot
#

It will hide it

#

Yeah

ember citrus
#

So calling the remoteExec "addAction" for the 2nd time would add a second addAction?

#

or i have to check first if the action exists already

potent depot
#

Is it the same action?

ember citrus
#

yeah

potent depot
#

Just flip the variable and broadcast it public again

#

It essentially is just a global variable on everyone’s ends

ember citrus
#

Yeah but that would mean something like this

pseudo code

_addActionParams = [..., condition, ...];
if (!addAction_set || isNil "addAction_set") then {
  (_addActionParams) remoteExec ["addAction", -2, true];
};
// Broadcast public variable here to make the `condition` return true
addAction_set = true;

To prevent the remoteExec running multiple times? (again this is the server)

potent depot
#

If the action and it’s function is the same every time, you do not need to use remoteExec to add it to each client

#

Instead have each client give it to themselves and use the condition to control its visibility

copper raven
#

check for nil first ,and use lazy evaluation

ember citrus
#

If the action and it’s function is the same every time, you do not need to use remoteExec to add it to each client
The addAction is added to a unit spawned by the server, so it's not "the same every time" as in i could hardcode it.

Instead have each client give it to themselves and use the condition to control its visibility
How would you achieve this if all the "setup code" is done on the server

#

check for nil first ,and use lazy evaluation
Yeah this was just some pseudo code 😉

potent depot
#

So the action is added to a unit spawned by the server? So let me get the criteria:
Action is added for every client to unit(s) spawned by server.
Action must be able to be disabled and enabled by server for all clients.
Anything else?

ember citrus
#

No that seems right

potent depot
#

Alright, here is a potential solution.
When the server creates the unit, it remoteExecs a function for all clients that adds the action to the unit.(pass the unit itself through the remoteExec for use by client to apply action)
Action is still controlled by either a public variable, if it is a single unit, or a setVariable on the unit itself if there are multiple.
Server can freely control the public variable or the setVariable on the units to control action availability.
Anything else?

#

Note the function is not an addaction but instead a separate function availiable to all clients

ember citrus
#

ah yes ofcourse

potent depot
#

In that function, there is the addaction

ember citrus
#

that looks like it could work

#

it remoteExecs a function for all clients that adds the action to the unit.
Didn't think about this

potent depot
#

That theory should work for multiple units and actions if needed as well.

#

Just add variables as needed

ember citrus
#

So that would be a function defined in functions.hpp and then a file for it fnc_NAME.sqf ?

potent depot
#

However you define it is up to you, it just needs to be available for clients and server

ember citrus
#

Okay i think i understand now, thanks for your time

potent depot
#

Np

spark turret
#

You want to spawn smoke via script? Yeah possible

ember citrus
#

I'm trying to create an addAction condition which looks at a variable of the unit the action is attached to

condition on the addAction

(_originalTarget getVariable ['showBuyOption',false] isEqualTo true)

This addAction is created on all clients using remoteExec.
After some setup code, the showBuyOption variable is set to true using the following code

_unit setVariable ["showBuyOption", true, true];

But somehow the clients cannot see the action on the unit.
Here is some debug code ran on the client

cursorObject getVariable ['showBuyOption',false]; // Returns `true`

cursorObject is the unit which should have the action

(everything is ran in a local hosted MP game if that helps)

spark turret
#

@ember citrus so far it looks okay, can you post the action code?

ember citrus
#

this is the actual code (sorry but i'm to tired to strip the non essentials)

_addActionParams = [localize "STR_antistasi_action_buy_dealer", {nul=CreateDialog "dealer_menu";},nil,0,false,true,"","(isPlayer _this) and (_this == _this getVariable ['owner',objNull]) and (_originalTarget getVariable ['showBuyOption',false] isEqualTo true)"];
([_dealer] append _addActionParams) remoteExec ["addAction", -2, true];

// more stuff

_dealer setVariable ["showBuyOption", true, true];
harsh vine
#

@thick lintel are u still here?

spark turret
#

Have you made sure the action itself works? Change the condition to true and make sure the action is added

ember citrus
#

if i strip the showBuyOption part from the condition it works

spark turret
#

You set your condition to true after you try to add the action

#

Do it the other way around, see if it helps

#

If that doesnt fix, make sure the _dealer and _originalTarget are the same entity.

ember citrus
#

last thing i'm gonna try before calling it a day

#

Do it the other way around, see if it helps
@spark turret did not work 😦

#

If that doesnt fix, make sure the _dealer and _originalTarget are the same entity.
@spark turret will try tomorrow, you think the remoteExec changes something about the entity?

spark turret
#

Checked that the owner condition is correct?

#

Only the owner will get the action?

ember citrus
#

Yes that works fine

#

as i said, stripping (_originalTarget getVariable ['showBuyOption',false] isEqualTo true) from the condition works

#

but i'm gonna log off, thanks for helping me out and have a good one

spark turret
#

You can delete the isequalto true

#

Just (_originalTarget gezVariable bla nla) is already checking for true

#

@spark turret will try tomorrow, you think the remoteExec changes something about the entity?
@ember citrus
I gotta be honest i dont know why its not working. Your variable is public and should be accessable on all clients

slate sapphire
#

hello is there a way to exclude from nearEntities (or using a different syntax function) the objects hidden by hideobjectglobal, I need that for construction interface.

with this line I use to hide some map objects to prepare an area to build base, but then

if (count _isFlat == 0 || count (((position _preview) nearEntities 4) - [_preview]) > 0)

is not working also if tree are not visible on screen they are still counted and I can't build doesn't matter if I don't see tree and terrain is flat, but I can't build cos the near entities return the deleted items, and I can't remove the nearentities check or there will be no limit and build can be stacked one above the other or inside map buildings.

#

I tried also to add setdamage1 and enableSimulationGlobal false but still, they result as near entities I don't know how to fix that problem, please help

exotic flax
#

you could get the list from nearEntities, and remove the items from that list which are hidden and/or destroyed

slate sapphire
#

how can I remove hidden items from the nearEntities array?

#

I mean my question is exactly that, it's possible to know the state of map objects returned in near entities array?

exotic flax
#

something like this (not tested)

((position _preview) nearEntities 4) select { !(isObjectHidden _x) };
slate sapphire
#
if (count _isFlat == 0 || count ((position _preview) nearEntities 4) select { !(isObjectHidden _x) } > 0) then {_color = _colorRed};
#

doesn't work

#

4:02:11 Error in expression <nt ((position _preview) nearEntities 4) select { !(isObjectHidden _x) } > 0) the>
4:02:11 Error position: <select { !(isObjectHidden _x) } > 0) the>
4:02:11 Error select: Type Number, expected Array,String,Config entry

exotic flax
#

because it now tries to check for hidden objects on a count...

#
if (count _isFlat == 0 || count (((position _preview) nearEntities 4) select { !(isObjectHidden _x) }) > 0) then {_color = _colorRed};
slate sapphire
#

tested, no errors but doesn't work

exotic flax
#

Without the full script and exact conditions it's also a bit hard to give a perfect solution...
Although it should give you some ideas on how to solve it yourself

slate sapphire
#

with construction interface I have an object that remove terrainobjects with this code:

{
        _x setDamage 1; _x enableSimulationGlobal false; _x hideObjectGlobal true;
    }forEach nearestTerrainObjects [_position, ["TREE", "SMALL TREE", "BUSH", "FOREST BORDER", "FOREST TRIANGLE", "FOREST SQUARE", "FOREST", "ROCK", "ROCKS","FENCE", "WALL", "POWER LINES", "HIDE"], 25];
    deleteVehicle _defense;
};
#

ok this works fine, and delete the tree rocks etc.

#

but then if I try to build

#

I don't know how if the like we wrote remove the hidden objects from the count, so if there are 2 tree 1 rock all hidden the result of that will be 0 ?

exotic flax
#

your if...then statement is now taking all entities within 4 meter from _preview, removing all entities which are hidden and if the amount is more than 0 it will return true

#

no idea that the count _flat == 0 is doing

slate sapphire
#

that's not interfeering with our code

#

but to be sure I can remove it and use only our code

#

no you are right

#

it's interferering

exotic flax
#

perhaps it needs to be && instead of ||?

slate sapphire
#

it's my fault I should have post also the previous code

#
_isFlat = (position _preview) isFlatEmpty [
                            (sizeof typeof _preview) / _minDist,     //--- Minimal distance from another object
                            0,                                         //--- If 0, just check position. If >0, select new one
                            _maxGrad,                                 //--- Max gradient
                            (sizeof typeof _preview),                 //--- Gradient area
                            0,                                         //--- 0 for restricted water, 2 for required water,
                            false,                                     //--- True if some water can be in 25m radius
                            _preview                                 //--- Ignored object
                        ];
exotic flax
#

well, if you read the wiki page of isFlatEmpty you would know that the second parameter must be -1

slate sapphire
#

but I should also add to ignore objects the hidden objects ?

exotic flax
#

could help, since I don't know how this function works internally

slate sapphire
#

Ican't put -1 will allow to build over other objects

exotic flax
#

The second element must be -1 (<= 0 really) at all times, otherwise command becomes unusable
from the wiki

slate sapphire
#

yes but the proximity works fine, example if heavy factory it need more space to build if the command center is smaller you can put closer to map objects so that's working fine

exotic flax
#

although ignoreObject only accepts one object, and not an array

slate sapphire
#

well then I don't know how to fix that

#

thinking about a logical solution

#

so the problem is this isflatempty keep considering map object also if they are hidden

#

hidden/damaged/without simulation

exotic flax
#

well, set minDistance to -1 to ignore proximity check

#

this will only check if it's flat enough, and then the second part of the if...then statement will check if there are objects nearby

#

and instead use the gradientArea to check if the area is flat

slate sapphire
#

if I use -1

#

let me build over map objects tree / building

#

but near entities check stop me to build near vehicles

#

so I have to say what we wrote on near entities was useless cos is already not counting the map objects at least that's the result I hve now

#

I have no clue how to fix that

#

maybe

#

I need another or

#

using

#

so its flat empty will check the flatness, nearentities vehicles / soldiers, terrain objects the terrain objects

#

so I should use the !(isObjectHidden) on the near terrain

#

let me try

#

@exotic flax THANKS THANKS THANKS A LOT! it works now

exotic flax
#

thank the wiki 😉

slate sapphire
#

well before happiness I hould try on dedicated server I am now hosting from editor and sometimes it has different results

#

now, I have this situation

#

vehicles and soldiers are working

#

terrain objects are working

#

but building that I constructed are not working

#

I'll need a third check...

#

I guess it's nearestObjects for the warfare buildings

#

nearObjects

#
if (count _isFlat == 0 || count ((((position _preview) nearEntities 5) select { !(isObjectHidden _x) }) - [_preview]) > 0 || count (( nearestTerrainObjects[position _preview,[],12]) select { !(isObjectHidden _x) }) > 0 || count (((position _preview) nearObjects 12)- [_preview]) > 0) then {_color = _colorRed};
#

I didn't give up 🙂

#

now is working but I need to find the size of the item instead use 12 meters, what's best method to get the size of the object (radius) ?

#

sizeof boundingbox or boundingboxreal 🙂

lapis ivy
#

Hi.
I have a mod for map markers that is compatible with TFAR.

Here's an example: if a player doesn't have a long-distance radio, they can't put a marker on the map in the side Channel.
It also changes the marker interface.

The problem is that if I run the mod together with the ACE mod, but the interface doesn't change and the mod doesn't work correctly. Who can help me with this? I would write to the author of the mod, but on the site where I found the mod, the author has not been online since 2017.

The mod was created in 2015.
https://forums.bohemia.net/forums/topic/228004-d_map_adv_markers-for-ace/

Help please 🙂

still forum
#

Not actually but wait until and such is executed every frame is it not?
No, at most once per frame, but usually less.
Is there any performance difference between the CBA variant and the vanilla one?
For waituntil that is
The CBA one executes every frame, in unscheduled, ignoring the 3ms time limit. So yes, there is a performance difference.
No, they behave the same way.
No they don't @high marsh
How would i capture the return value of the addAction function?
Don't remoteExec addAction, instead use call or a custom function, that grabs and stores the ID. @ember citrus
return value of remoteExec doesn't make sense, because you are running the code on multiple players, so a single returned ID could never work.
condition on the addAction
_originalTarget variable is undefined
isEqualTo true is nonsense, unless you expect the variable type to be something other than boolean, which is nonsense too as you never set it to anything else.
But somehow the clients cannot see the action on the unit.
Yes as the condition is never true, as _originalTarget is undefined in the condition.

#

@lapis ivy Afaik ACE also modifies the marker creation interface, you can't run two mods that replace the same thing.
unless you write the mod on top of ace

lapis ivy
#

@still forum How do I make it on top of ACE?

still forum
#

You rewrite the mod to modify the ACE version of the UI, instead of the vanilla version, and add ace to required addons

austere sentinel
#

is there a way to reorder my squads in the MP lobby, or do I just have to go through and replace/regroup everyone? (also this probably belongs in editor, my bad)

still forum
#

replace everyone

#

there is a WIP UI to reorder them in CBA, but it hasn't landed in release yet

austere sentinel
#

F. Alright thanks. Hopefully that lands before I get to release lol

winter rose
#

Ctrl+X Ctrl+S / Ctrl+Y (or Ctrl+V?) Ctrl+S could do

austere sentinel
#

Thats what I'll probably go with. Was just wondering if there was a way I could be lazy 😁

winter rose
#

nah 😛

cosmic lichen
#

Can anyone confirm that sqf [true,10,10] call BIS_fnc_EXP_camp_setCinematicMode; ignores the fade values (10,10) ?

#

It works fine when disabling the effect.

#

Oh I see the issue sqf 0 cutText ["", "BLACK FADED", _fadeScreenTime]; should be sqf 0 cutText ["", "BLACK OUT", _fadeScreenTime];

austere sentinel
#

How do I make it so you can pick an item up (e.g; Pick up a laptop and carry it in your backpack/vest/etc)? Is this a cfg thing?

cosmic lichen
#

For it to be in your backpack it needs to be an inventory item.

#

That can only be done via mod.

#

other than that you can use addAction or BIS_fnc_holdActionAdd to pick something up

austere sentinel
#

how do you mean via mod? What I've read has used CfgWeapon and subclassing ItemCore & InventoryItem (dont remember the exact thing). Do I just do that in description.ext?

When I tried it I got No entry in config.bin/CfgWeapons.itemclassname

cosmic lichen
#

You cannot do that through the missionConfigFile. You need to create a config.cpp which can only be added by a mod.

austere sentinel
#

Thats what I was afraid of 😆 will do; thanks

copper raven
#

_originalTarget variable is undefined
wiki says it isn't though? Thonk I actually haven't seen this one myself, but after i checked the wiki it's appereantly a thing since 1.81, i thought it's not the issue in the code JohnDoe posted.

winter rose
#

what code?

winter rose
#

well _originalTarget doesn't exist there

copper raven
#

wiki says it does? or am i not understanding something lol

winter rose
#

oh, wait

copper raven
#

unless it's dev branch, but it says 1.81 if i understand correctly

winter rose
#

first, better syntax:

_addActionParams = [
  localize "STR_antistasi_action_buy_dealer",
  { createDialog "dealer_menu"; },
  nil,
  0,
  false,
  true,
  "",
  "(isPlayer _this) and (_this == _this getVariable ['owner',objNull]) and (_originalTarget getVariable ['showBuyOption',false] isEqualTo true)"
];
([_dealer, _addActionParams]) remoteExec ["addAction", -2, true];

// more stuff
_dealer setVariable ["showBuyOption", true, true];
#

what doesn't work is "append"

#

(original: ([_dealer] append _addActionParams) remoteExec ["addAction", -2, true];)

#

@ember citrus

#

append doesn't return anything

copper raven
#

actually didn't look at that xD "if i strip the showBuyOption part from the condition it works" got me looking at the condition

ember citrus
#

Wait but why does it work when i change the condition?

copper raven
#

does it even work at all? xD

worn forge
#

From what I'm seeing in that code example, _originalTarget isn't defined in that context

cosmic lichen
#
(_originalTarget getVariable ['showBuyOption',false] isEqualTo true)```does that even make sense?
#

isEqualTo true is obsolete

worn forge
#

Yeah, if showBuyOption is set to be a boolean then you can just evaluate (_originalTarget getVariable ['showBuyOption',false])

ember citrus
#

Yes that was to make sure the check works

#

But is indeed obsolete

cosmic lichen
#

also use (condition1) && {condition2}

ember citrus
#

does it even work at all? xD
@copper raven yes, without the showBuyOption condition

worn forge
#

who in this context has the showBuyOption variable set?

#

The target?

cosmic lichen
#

What is original target?

worn forge
#

🙂

ember citrus
#

also use (condition1) && {condition2}
@cosmic lichen why { and will this work with 3 conditions?

cosmic lichen
#

Does it even return the unit you want?

ember citrus
#

who in this context has the showBuyOption variable set?
@worn forge the target

cosmic lichen
#

@ember citrus It's faster and this condition is checked on each frame iirc.

ember citrus
#

What is original target?
@cosmic lichen from the addAction wiki, its one of the 3 condtion params

worn forge
#

Try

 "(isPlayer _this) and (_this == _this getVariable ['owner',objNull]) and (_target getVariable ['showBuyOption',false])"```
cosmic lichen
#

Make sure _originalTarget is not objNull

ember citrus
#

Try

 "(isPlayer _this) and (_this == _this getVariable ['owner',objNull]) and (_target getVariable ['showBuyOption',false])"```

@worn forge tried that, same result

cosmic lichen
#

@ember citrus To whom is that action attached? A player?

worn forge
#

are the getVariables made public on their respective ends? thing setVariable ['value', value, TRUE] ?

ember citrus
#

@ember citrus To whom is that action attached? A player?
@cosmic lichen a unit

#

are the getVariables made public on their respective ends? thing setVariable ['value', value, TRUE] ?
@worn forge yes

worn forge
#

I'm a bit confused as to why the owner variable needs to be there

#

might also try (_this isEqualTo (_this getVariable ['owner, objNull])), not sure you can == an objNull

winter rose
#

not sure you can == an object
you can,sqf leader player == player also, won't work with objNull which is good in that case (even objNull == objNull will return false)

runic spoke
#

Wiki claims you can

worn forge
#

I guess what I was meaning was you can't == an objNull, as I == an object all the time in my code 😛

runic spoke
#

objNull == objNull

#

Still an object lol

ember citrus
#

I'm a bit confused as to why the owner variable needs to be there
@worn forge that is original code from what i'm trying to port. But as i said, it works without the last condition

#

I'll take a look at it tonight

still forum
#

Wiki claims you can
No it doesn't

worn forge
#

Ded beat me to it 😛

still forum
#

might also try
syntax error, missing '

ember citrus
#

Still have to check if _target and _originalTarget have something sensible as value on the clients

runic spoke
#

not sure you can == an object

#

Was what i was referring to

worn forge
#

Wait let me edit that line and all confusion will be erased

#

(Stokes you're not wrong, it was my typo)

ember citrus
#

Editing might cause more confusion 😂

runic spoke
#

😝

winter rose
#

screenshot for further blackmail

lost copper
#

Hi everyone! Can i use pushBack for adding nil to array?

winter rose
#

try, and thy shalt know!

#

(but I think "yes" - to be tested)

cosmic lichen
#

Doesn't work

lost copper
#

(I code that without Arma, and want to know about that without downloading)
Ok, i will try. Ty, @winter rose 🙃

cosmic lichen
winter rose
#

^
then set or resize may work

cosmic lichen
#

Use set or plus

lost copper
#

@cosmic lichen ooo, thanks. I'm blind a little.

hollow thistle
#

maybe you could also use _arr append [nil]

#

_arr + [nil] is an array copy so will be slower.

still forum
#

maybe
Don't see any reason for that not to work

austere sentinel
#

is there a command that gives the path to an object's inventory icon via debug?
Found the path to it's model, but not it's icon

meager granite
#

"picture"

austere sentinel
#

so something like
getText (CfgVehicles >> V_DeckCrew_blue_F >> "picture");?

still forum
#

inventory items are CfgWeapons

#

and you are missing the quotes about the classname, but yes. something like that

austere sentinel
#

That did it, thank you both 👍

ember citrus
#

Okay guys, i think i know what might be going on with my issue..
I may have lied a bit when i said it worked before with the 'old' addAction condition..
It did work, but that was when my code looked like this:

_addActionParams = [localize "STR_antistasi_action_buy_dealer", {nul=CreateDialog "dealer_menu";},nil,0,false,true,"","(isPlayer _this) and (_this == _this getVariable ['owner',objNull])"];
_addActionID = _dealer addAction _addActionParams; // <-- OLD
([_dealer] append _addActionParams) remoteExec ["addAction", -2, true];

// Some stuf

_dealer setVariable ["showBuyOption", true, true];

And ofcourse this works on my client, because i'm running a local MP session (so my client is also my server) ..


So i started thinking that maybe i'm doing something wrong with my remoteExec targets, i thought something like this would work but sadly it doesn't:

_addActionParams = [localize "STR_antistasi_action_buy_dealer", {nul=CreateDialog "dealer_menu";},nil,0,false,true,"","(isPlayer _this) and (_this == _this getVariable ['owner',objNull]) and (_target getVariable ['showBuyOption',false])"];
([_dealer] append _addActionParams) remoteExec ["addAction", [0, -2] select isDedicated, true];
// Using `isDedicated` to determine wether i need to call everyone or just everyone BUT the server
#

(i also tried my new code without the addAction condition, no luck there ..)

copper raven
#

Lou told u that append is wrong there

#

append has no return value

ember citrus
#

ah yes i was going to test that!

#

give me a sec

copper raven
#

[_dealer, _addActionParams] remoteExec ["addAction", [0, -2] select isDedicated, true];

ember citrus
#

I think you've done it @copper raven

#

It works (without condition, but i'll try that next)

#

works like a charm, with the condition added!

lapis ivy
#

Help, mod ACE

How can I remove the interaction with the box using the win button?

I need the box to not be able to carry and move.

potent depot
#

good to hear you finally got it figure out JohnDoe.

still forum
#

setCarryable setDraggable

#

use ace github search

still forum
#

Thanks

potent depot
#

needed to clone the repo anyway so might as well find it for him

hollow thistle
lapis ivy
#

thanks

ember citrus
#

How do you check if a variable is an array? Thought isArray would do it, but that only works on configs..

high marsh
#

in

#
if("Blah" in ["Blah"]) then {
  hint "Blah";
};
ember citrus
#

what if i dont know the values inside the array?

#

i thought something like

if(count _array > 0) then {};

but _array could be a string here and return true

high marsh
#
_blahArray = ["Blah"] select {typeName _x isEqualTo "string"};
if(count _blahArray > 0) then {

};
#

might be missing parenth butr you get the idea

still forum
#

private

#

isEqualType

#

isEqualTo []

high marsh
#

¯_(ツ)_/¯

still forum
#

shakes head and leaves

ember citrus
#
if(typeName _array == "ARRAY") then {};

?

still forum
#

Don't use typename

ember citrus
#

ah that seems like the safest way, thanks

still forum
#

also neither that, nor count nor whatever posted here will help you if what you want to do is really

How do you check if a variable is an array?

#

but I think you don't actually mean that and need to explain in more detail what you actually want

ember citrus
#

i just want to know if my getArray found something, but i just noticed that the return value for it is always Array (according to the wiki)

still forum
#

if getArray didn't find anything, it returns empty array afaik

#

so
if (_array isEqualTo []) then { didn't find any }

ember citrus
#

count would be sufficient enough here right?

still forum
#

isEqualTo is more efficient

#

or.. you could do the right thing, and check if you actually have an array at all.

#

if your config entry is not an array, the getArray won't give you anything sensible

#

Thought isArray would do it, but that only works on configs..
Yes it does, but.. whats the problem with the fact that it only works on configs, while you are trying to read a config. You already have a config, so you can use it.

ember citrus
#

Yea that makes sense

cosmic lichen
#

How can I prevent an unit from dying if the dmg it received exceeds a threshold (0.9)? If I use handleDamage EH the damage will often immediately go from 0.5 to 1 and the unit dies.

#

If code provided returns a numeric value, this value will overwrite the default damage of given selection after processing. Return value of 0 will make the unit invulnerable if damage is not scripted in other ways (i.e using setDamage and/or setHit for additional damage handling). If no value is returned, the default damage processing will be done. This allows for safe stacking of this event handler. Only the return value of the last added "HandleDamage" EH is considered.

#

I might have found the solution

ember citrus
#

What is the best way of setting up your private ["_xxx"] variables?
I'm looking for some sort of automated solution

hollow thistle
#

can you explain more? This does not make much sense.

ember citrus
#

after i finished writing my script, i have to make all my local variables _XXX private (that's the recommended way right?) using the private ["_XXX", ...] function.
This is pretty tedious if my script is long, so i was hoping there is some sort of script out there that does it for you

cosmic lichen
#

Althought it's recommended to do private _variable instead of private ["_variable"]

ember citrus
#

Althought it's recommended to do private _variable instead of private ["_variable"]
@cosmic lichen Thats a thing? That makes it much more bearable

cosmic lichen
#

yes

ember citrus
#

god i love Regexes

winter rose
#

My colleagues hate them

#

to me, it may be hard to read but so easy to write

cunning crown
#

Regexes are pretty neat once you're familiar with them 🙂

cosmic lichen
cunning crown
#

Because I've written regexes that were worse than that xD

ornate prairie
#

If i play a sound with say3D through addMPEventHandler, it should play locally for each clienty right? I don't need to remote execute for everyone to hear it?

cosmic lichen
#

yes

ember citrus
#

How can you love that ? 😄
@cosmic lichen It is a special kind of love 😏

winter rose
#

How can you not* love that

cunning crown
#

/\([^\(\)]*(((?<Open>\()[^\(\)]*)+((?<Close-Open>\))[^\(\)]*)+)*(?(Open)(?!))\)/
Regex are pretty easy to read, I don't see any issues 😕

cosmic lichen
#

sgamosdfjsdduckyouoashdfoawenfioawnef 😛

ember citrus
#

Regexes are powerfull aswell, i think 1 regex recursion crashed multiple CloudFlare servers a while back

cunning crown
#

Yup, it crashed their whole network for 30 minutes or so iirc (altough this was an addition of different issues that let to this result)

ember citrus
#

let's just keep it at that one rogue regex caused it 😉

worn forge
#

Late to the party, but why not use typeName ?

ornate prairie
#

im getting an error from this expression "Error missing )". Why is that?

if (player_1 not in escape_jeep) then {player_1 moveInCargo escape_jeep};

winter rose
#

@worn forge it's (way) slower than isEqualType

#

@ornate prairie because```sqf
if (not (player_1 in escape_jeep))

worn forge
#

Wiki on isequaltype is fairly thin, how would you use that to determine a boolean? Or object, or group?

winter rose
#
_myVar isEqualType true
worn forge
#

But I don't want to know if it's true, I want to know if it's a boolean

winter rose
#

and that's precisely what it does

worn forge
#

A tad confusing in the sense of readability. If _myVar is false, that statement would return true?

winter rose
#

yes

#

it's isEqualType, not isEqualTo

worn forge
#

So _myVar isequaltype objNull world return true if _myVar is an object?

queen cargo
#
// The following
A isEqualType B
// Is the same as
typeName A == typeName B```
worn forge
#

I will just test it next time in the editor...

queen cargo
#

at least for things like this, SQF-VM probably would be the faster solution (unless you got the game open obviously)

worn forge
#

I'll have a look at that. Thanks.

potent depot
#

Hey, anyone happen to know if deleting elements of an array through a forEach causes problems? i.e. clearing all of a certain value such as null

winter rose
#

yes, as usual there are issues in editing an array you are going through.
you should instead parse it and create a new array with only the elements you want, or use select

#
_myArray = _myArray select { not isNull _x };
``` @potent depot
potent depot
#

that works, but doesn't that still resize it?

winter rose
#

it does, of course??

#

you want them to be nil?

potent depot
#

so wont that cause a problem in foreach?

winter rose
#

please post code sample

#

you should do what I wrote before the forEach, not in it

potent depot
#

then where do you get the _x?

#

wait, just saw that syntax for select

winter rose
#

by select

#

Yep

potent depot
#

had no idea it could do that

winter rose
#

ta-daaa! 😁

potent depot
#

well thats handy

winter rose
#

it saves (Arma) lives

potent depot
#

im assuming isNull will return tru on a grpNull right?

winter rose
#

yes, iirc.

#

if in doubt… wikiwiki

potent depot
#

kk, thanks

winter rose
#

Checked, works for group check

potent depot
#

1 more thing, passing an array as a param, duplicates the array as a new variable right? So i can clear the old array?

winter rose
#

where?

potent depot
#

Say I pass a global array that is continually changing into a scheduled script.

winter rose
#

if passing in a script, it's the array's reference iirc. So duplicate it with +

potent depot
#

ok, so it would need to be duplicated in the function again?

winter rose
#

just in the function

potent depot
#

because I want the values of the array at the time of the spawn call and then to clear the global array so those values dont get reprocessed

#

so taking a copy and setting the global to [] will work right?

winter rose
#

yes

potent depot
#

ok, well that gets rid of my need to use null then.

#

Thanks for the help

#

One more thing since it would make my life easier. Is there a way to have a scheduled function wait until a spawned function returns(completes)?

#

does waitUntil work in that way?

#

though I suppose I could use a global variable but having it bound directly to the function would be nice if anyone happens to know if its possible

winter rose
#

@potent depot waitUntil scriptDone

potent depot
#

ofc there is a nice way of doing it

#

ty

ebon palm
#

Really new to scripting, sorry if I hardly understand a thing

#

I enter in all the code into a init.sqf I created in my mission folder, but it still doesn't work with entities I try to use

#

I tried using another .sqf file with a trigger, but it still doesn't work

#

I know it's not on the trigger as I misspelled it the first time like a dumbass and got a popup

#
    private ["_o1","_o2","_v"];
    _o1 = _this select 0;
    _o2 = _this select 1;
    _v = _o2 worldToModelVisual [0,0,0];
    [
        _o2 worldToModelVisual vectorDirVisual _o1 vectorDiff _v,
        _o2 worldToModelVisual vectorUpVisual _o1 vectorDiff _v
    ]
};
KK_fnc_attachToRelative = {
    private ["_o","_v"];
    _o = _this select 0;
    _v = _this call KK_fnc_vectorDirAndUpRelative;
    _o attachTo [_this select 1];
    _o setVectorDirAndUp _v;
};```
ebon palm
#

Where do I put this?

smoky verge
#

Anyone knows how to disable looting from corpses?

worn forge
#

Han it's not quite as simple as that, you have 2 functions there: you would need to supply them with variables that they'd process in order to produce an effect.

ebon palm
#

I have that set up in the eden editor

#

It's just simply not working

worn forge
#

Sanchez, either add an inventoryOpened event handler that immediately closes the inventory dialog, or just remove all inventory items when the target dies :)

ebon palm
#

the intended effect is attatchto with rotation

worn forge
#

Han you'll need to describe how you are setting it up, we have no idea how to help you

ebon palm
#

I have the code above in a init.sqf file in "D:\Documents\Arma 3 - Other Profiles\HanSolo1519\missions\gayapc.VR"

#

and I have "[Object1,Object2] call KK_fnc_attachToRelative "

#

on the init of object 2

smoky verge
#

don't wanna step over Han
I was trying to remove the inventory option at all, and can't remove everything because its a corpse, I'd have to remove uniforms and etcetera

ebon palm
#

That's fine, this place is for both of us to get answers

#

[apc,log3] call KK_fnc_attachToRelative;

#

apc being a vehicle, and log3 being an object

#

this is in the init of log3

worn forge
#

I think you might need to spawn in init field? Instead of call. Plus you need to give it a result, ie, 0 = [Object1, Object2] spawn kk_fnc... Etc

#

Sanchez you can't remove the inventory function as it's a core part of the engine, but you can manage what happens when the inventory action is initiated or ended

#

Try this addEventHandler ["inventoryOpened", { closeDialog 0; true}];
in init box

#

Hard to do this on mobile :)

smoky verge
#

lol its fine
tried with an eventHandler but it also made doors impossible to open
I'll check

worn forge
#

That might not be the right eh actually, but that's the idea

#

Yeah it's the containerOpened eh

smoky verge
#

yeah still opens

worn forge
#

On player = inventoryOpened, on everything else it's containerOpened

smoky verge
#

by player you mean corpse or the players units?

worn forge
#

Corpse

#

Use containerOpened eh on corpse

smoky verge
#

doesn't seem to work nope

worn forge
#

Might need a delay before closeDialog

smoky verge
#

like a sleep 0.01?

worn forge
#

Probably more than that as I think it needs time to generate before you try to use closeDialog

smoky verge
#

I'll try better tomorrow

copper raven
#

just waitUntil display 602 is active

#

and then closeDialog/closeDisplay

#

or actually you can just return true to the EH(allthough never tried this, referring to the wiki) <player> addEventHandler ["InventoryOpened", {true}];

still forum
#

@potent depot

so taking a copy and setting the global to [] will work right?
If you mean GlobalVar = []
then you don't need to copy, because you create a NEW array with GlobalVar = [], you are not modifying the old one, thus not modifying anything that still has a reference to it

Is there a way to have a scheduled function wait until a spawned function returns(completes)?
Uh.. Just use call instead of spawn when executing it?

cosmic lichen
#

Is there a way to convert hitpoint damage into overall damage returned by damage command?

winter rose
#

I think damage takes it from the "" hitpoint, I am although not sure about this

#

You could have arms damage, legs damage, torso damage to 1, I think you would not die until you set "" to 1
Not sure about head damage

cosmic lichen
#

What I basically wanna do is sqf if (damage _unit + _recievedDamage > _threshold) exitWith {....}

#

Doing it like this inside the handleDamage EH seems to be unreliable.

#

since _recieved damage is the dmg of a hitPart and can sometimes be > 1, although that doesn't mean the unit would die

winter rose
#

well "received* damage" is received on this body part
the "core" damage is "", and you could reduce it by comparing the previous and the current "" hitpoint damage

#

(again, from what I understood, which can be partially to completely away from the truth)

neon snow
#

Can we get position at which camera is looking at?

cosmic lichen
#

so the delta of _oldHitpointDmg and _newhitPointDmg is added to the core damage?

still forum
#

Can we get position at which camera is looking at?
yes, screenToWorld

cosmic lichen
#

screenToWorld [0.5,0.5];

neon snow
#

Should precise, not user camera but camera created with script

cosmic lichen
#

should be the same

#

it's always screen center

#

Or are you talking about a UAV camera or something along those lines?

neon snow
#

But even if it is used for PIP?

cosmic lichen
#

No, not for PIP 😄

neon snow
#

Yeah thats what I thought

#

Alternative, is there a function that calculates position on the ground from vector intersecting with it from point in space

#

Yeah exactly like for UAV for example

still forum
cosmic lichen
#

lineIntersects might help

neon snow
#

Yeah but that hardcoded distance doesnt help ;d

cosmic lichen
#

What hardcoded distance?

neon snow
#

NOTE: Doesn't work under water. Max harcoded distance is 1000m.

cosmic lichen
#

There are other commands, not sure if they are all limited to 1k m

neon snow
#

Yeah will check those, thanks

still forum
#

hardcoded distance doesn't matter if you think a bit

wary field
#

Do multiple runs and move the start position forward each run

neon snow
#

Yeah did that

spark turret
#

that moment when you find the ACE has a rickrolling joke in its framework guide

#
// Example: Add radio self-action to all civilian cars
["ace_interact_menu_newControllableObject", {
    params ["_type"]; // string of the object's classname
    if (!(_type isKindOf "Car")) exitWith {};
    if ((getNumber (configFile >> "CfgVehicles" >> _type >> "side")) != 3) exitWith {};
    
    private _action = ["playRadio","Play Radio","",{playMusic "NeverGonnaGiveYouUp"},{true}] call ace_interact_menu_fnc_createAction;
    [_type, 1, ["ACE_SelfActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;
}] call CBA_fnc_addEventHandler;
velvet merlin
#

_entity setUnitTrait ["engineer",true];
Error position: <engineer",true];
Error Missing ;

#

the other setUnitTrait uses it doesnt complain about

still forum
#

Error position: <engineer",true];
Error Missing ;
What? how would there be a semicolon missing.
if the skillname was wrong (which it cannot be, as custom skill names are also allowed) it would through enum error, not semicolon

bright flume
#

same error with all 3 fields?

winter rose
#

I believe in a non-closed string here @velvet merlin

velvet merlin
#

IDE shows nothing but trying with 2nd one

worn forge
#

wild possibility, but is it in fact two apostrophes instead of one quote?

#

'' vs "?

bright flume
#

example is def "

still forum
#

I'd look at the line before the error

#

if you use IDE linting, maybe thats just its bug

velvet merlin
#

Lou to the rescue

#

was few lines above missing closing "

winter rose
#

\o/
the ' ' was a real possibility as well

real tartan
#

When I create BIS task with enabled notifications, sometimes CREATED state notification is showed after SUCCEEDED. Is the way to eliminate this behavior?

bright flume
#

Is there any way to create custom viewport/camera for a player that offsets the center of the screen?

winter rose
#

if you mean "changing the external camera position for a vehicle/soldier", not without mod

bright flume
#

Im guessing its not feasible, otherwise someone would have created a mod for it already.

#

was thinking dual head display then maybe just maybe offsetting the center on each screen....

spark turret
#

is there a way to use "ace_interact_menu_fnc_addActionToClass" with isKindOf classes instead of looping over a ton of classnames?

#

parent paths i mean

#

so rather have all "heli" childs get the action instead of habving to get every heli classname

exotic flax
#

use configs instead?

spark turret
#

i dont know anything about configs so ild rather not

exotic flax
#

fnc_addActionToClass only works on the given class itself, and not parents or children.

exotic flax
#

and something like this is waaay easier:

class CfgVehicles {
   class Air;
   class Helicopter: Air {
    class ACE_Actions {
           class some_action {
              // some settings
           };
        };
   };
};
spark turret
#

thanks guys thats helpful (y)

#

how do i check for objNull?

#

without crashing when something else is returned.
_transportingVehicle = isVehicleCargo _target; //returns objNull

#

nevenmind

still forum
#

isNull

ember citrus
#

is it possible to let a unit speak in direct communication like we can do with sideChat?

#

(i need to let a unit speak in chat, unit is of side CIV and player of side GUER. Player starts "dialogue" with an addAction on the unit)

crude vigil
#

Not as easy as sideChat command, you need to implement a function. I think a system that creates a new radioChannel, adds everyone nearby to that and directs that message to others in location then removing it may help. You may wanna check radioChannel... commands.

ember citrus
#

yeah that was what i was going for..
Another question; nearEntities is that efficient for finding nearby players?

crude vigil
#

It may be more efficient if you get all players and check distance from each than doing that. Depends on the environment and parameters of course but most likely this way is more efficient.

ember citrus
#

how is that better?
nearEntities ["man",10] would be way faster than going through all players and using the distance function right?

crude vigil
#

depends on how many entities there are in that radius.

ember citrus
#

yea okay lets say ~5

crude vigil
#

depends on environment, think of 1000 can of beans between that 5 meters. You will go through them all.

#

Player count in most scenarios is lower than entity count in radius.

ember citrus
#

oh i never thought about beans being equal to "man" 😏

crude vigil
#

I don't know how this command works on engine side of course, but I would assume it still looks for the can of beans but not returning them since it is not suiting to your filter. Does not mean it is not wasting time of beans.

ember citrus
#

We'll see how this code holds up, but thanks for the feedback

crude vigil
#

I would assume not much can be done since after all, it is making a position based search. While checking for players is a known list. It has a pre-stored value.

winter rose
#

@ember citrus have you considered say?

ember citrus
#

seems like a lot of work to declare every line of text for it

#

but the customChat solution seems to work fine

crude vigil
#

customChat does fine, I assumed you wanted player to have same impression as if there is a conversation in direct chat.

#

otherwise, definitely the easy way out.

bold kiln
#

oddly enough the Wiki syntax had nothing to say about what this does. >>
here is the whole line of code in case you want it
_value=[(configFile >> _whereToLook >> _classNameToLook),_configAttribute,_defaultVal] call BIS_fnc_returnConfigEntry;

cosmic lichen
bold kiln
acoustic abyss
#

Hi everyone,
Question about (multiplayer) script performance.

I have an "entitykilled" eventhandler that checks if the _victim 's classname is in an array of 60 strings. How efficient is the Arma engine at this? Would this produce noticeable lag in a 12 player coop mission?

I don't know an effective way of testing this, which is why I ask.

bright flume
#

btw what is the precedence level on >> dont see it listed?

acoustic abyss
#

@bright flume How do you mean? What do you not see listed?

bright flume
#

nvm found it ninja'n down at the bottom of 3. ah the pains of small fonts.

spark turret
#

@acoustic abyss you could record the time it takes for the script to run and you can also log FPS
But 60 Strings isnt that much, i have logged and compared a ton more information without lag before

exotic flax
#

do note that even a "simple" script can cause a lot of issues, especially when called at the wrong time

spark turret
#

If i recall correctly i was told that the number of lines have a lot more impact than the actual commands used.

#

But unless you have excessive loops, performance is usually fine.

warm iris
#

I am looking at eventhandlers, is there any eventhandler (or scripting) that can work when a unit gets hit by a projectile, but that unit is also set to not allow damage?

young current
#

probably not

#

if hit does not register how could there be event

warm iris
#

Thats gonna make this difficult 🤔

young current
#

Invulnerability is not really a purposeful thing in Arma by default

lost copper
#

U can get hit but set no damage to unit 😋

bright flume
#

armor protection...

lost copper
#

So unit get hit, you make smth with that and return no damage to unit

warm iris
#

I'm trying to get a message to display in system chat that a player (as like: "playername has been hit" has been hit, however that player not to take damage. The other way I thought of in my head was if I could set unit on hit to full-heal? But this is a bit above me

lost copper
bright flume
#

EH hit doesnt pop, as documented, always for low damage

lost copper
#

You can add variable to unit and check it in EH. If unit should be immortal - return damage is zero, otherwise return standart damage

warm iris
#

Ah, alright! I shall have a fiddle and see how I get on!

fair lava
#

this might be a server question, but i use ace's check pbo thing to manage addons on my server (not all my mods have keys :/) and currently to generate the list of pbo's i need to run a script manually.
How could i automate this process? currently all i can think of is a mod which, on startup, prints the list to the RPT file, with some unique searchable string, and then some kind of python script which started arma in the first place waiting for that unique string which then closes arma

#

trying to make an auto updater that works with ace's "check pbo"

ornate prairie
#

is setSoundEffect a global command? if its in a server only trigger, will it play for all connected clients in range?

velvet merlin
#

setUnconscious true how do you get an unit out of that state not using scripting?

#

having a Medikit and unitTrait "medic" doesnt seem to do it

real tartan
#

How can I skip to next item in forEach loop? Something like continue function in loop.

real tartan
#

I guess scopeName, breakTo ?

cosmic lichen
#

Just wrap the code in a sqf if (condition) do {};

finite sail
#

@ornate prairie , am testing it now, wait 10

#

the sound is local to the trigger

#

so if a player activates the trigger, only they will hear it

#

not sure about the waypoint syntax, untested

#

in your case the trigger is server sided, so no one will hear it

verbal saddle
#

@velvet merlin from what I understand there isn't anyway other then using the command.
The BI revive system uses the following,

//reset death reason
bis_revive_deathReason = DEATH_REASON_UNKNOWN;

//not bleeding
bis_revive_bleeding = false;

//remove unconscious state
_unit setUnconscious false;

//allow AI shooting the unit
AI_PROTECTION_DEACTIVATE(_unit);

\a3\functions_f_mp_mark\Revive\fn_reviveOnState.sqf

velvet merlin
#

@verbal saddle ty. so you need manual addAction or is there some framework for it?

#
//disable built-in death messages
if (bis_revive_killfeedShow && !bis_revive_hudLocked) then
{
    private _hud = shownHUD; _hud set [9, false]; showHUD _hud;
};```
#

is there missing index? @still forum

#

count shownHUD = 10

verbal saddle
#

There is the default BI revive system

#

Other then that you will have to make it yourself

velvet merlin
#

what is the "default system"?

verbal saddle
velvet merlin
#

well thats the one from above, no?

#

the coding in \a3\functions_f_mp_mark\Revive looks like that. maybe a more progress version

#

or what should be different about it?

verbal saddle
#

The default BI revive system is the one in the functions_f_mp_mark\Revive folder.

velvet merlin
#

its MP only tho

fervent kettle
#

Hi, ive got some problems
ive placed down a trigger with the condition s == 1; my triggers variable name is "s" and i have a "addAction" leading to an sqf with s = 1; in it.
It works but i get a "generic error" message every time

winter rose
#

1/ name your variables so you can reread them 6 months later 😉
2/ did you define s= 0 somewhere like in initServer.sqf? else s in an undefined variable
@fervent kettle

fervent kettle
#

new problem, i am using playSound but it only plays one sound, the second one (different trigger) doesnt play, no matter wich ones been triggered first

winter rose
#

depends on the conditions you have set @fervent kettle

fervent kettle
#

"this" I want a sound to be played when blufor enters the area (I also set blufor as activation)

tame lion
#

Does the command limitSpeed not work even if looped? I'm having an issue with this scripting here in that it isn't limitting the speed of the vehicle:

_forklift spawn {
    sleep 1;
    waitUntil {
        _this limitSpeed 5;
        _item = _this getVariable ["APM_forklift_object", objNull];
        isNull _item
    };
    _this limitSpeed 500;
};```
For reference, `_forklift` is an ATV and `"APM_forklift_object"` is an object that has been `attachTo` the ATV
winter rose
#

@tame lion limit speed, not force speed

#

didn't see the first line, my bad.

tame lion
#

I'm assuming that limitSpeed is used to set a Max speed correct? as in the ATV in my script shouldn't go above 5km/H?

#

I put the sleep in too to make sure the variable was defined on the vehicle before it had a chance to return true for the condition

winter rose
#

See the wiki, it works for non-threatened AI

tame lion
#

damn... I missed that note lol. Any idea how to limit for a player then?

dark ocean
#

where can I find the default inventory scripts

winter rose
#

@dark ocean ?

still forum
#

u sure you aren't looking for the car script?

bright flume
#

is there any way to detect the strength of an explosion regardless where it happens? like in a trigger area vs a vic or player ie EH damage likely wont be called cuz it'll likely be terrain objects?

#

basically wanna detect a explosion near a building to ensure the detonation destroys a building long as the explosive is at least above grenade blast strength.

winter rose
#

add an event handler on the building to check the bullet type?

#

which would be "" in case of an explosion iirc

bright flume
#

building part of the map so just trying to go the simple route and maybe just detect any explosion based on the explosive source's class but got no clue of they grouped like that parentage wise

#

I mean this could be from a cruise missle explosion and instead of doing nothing to the map. actually wipe out everything in a 20m circle...

#

could a EH on actual explosive/munition setoff trigger damage EH for itself?

#

@winter rose if it was a eden placed building yeah likely would be nothing more then a EH on the building but this one of the static ones dunno how to pop a script on those. other then deleting it and replacing it with a placed one?

winter rose
bright flume
plucky minnow
#

Hello boys i need some help since I'm not the best at scripting

#

i hope im using the correct channel

#

i want to make the following

#

a lowered turret to be operated with standing up animation

#

i hope you guys can understand what i mean

cunning crown
#

Why not use the raised turret?

plucky minnow
#

i want to place it on top of a wall and look authentic

#

im all about the details :D

worn forge
#

Player operated or AI operated? Either way, likely that arma physics will kill it

#

@bright flume how about hide the target building and create vehicle your own, put the eh on that?

thorn saffron
#

I've been trying to get the AI artillery to behave, but I stumbled onto a bunch of pretty serious issues.
The vanilla artillery commands kinda break if you want to have a custom spread, meaning firing one projectile at one point then another and slightly different point. Using vanilla arty command to do that results in very slow firing artillery as the AI will have delay, aim, fire, then it tries to reset the turret and then aim again. All because the AI just HAS to move the damn turret after firing.
I tried to kludge together a solution with uses the doArtilleryFire, on a unit with forced hold fire, to get the launcher to aim at the target. That actually worked, but after triggering fire via script, the AI gunner tries to move the turret back into rest position. I tried making a loop with disableAI "WEAPONAIM", but you have to keep the turret locked for at least 5s or the AI will try to move it into the rest position. With means you can have spread during that time.
I also tried doWatch with an object placed along the firing solution's vector, didn't work either.
To make things even more hilarious, if you order the Sandstorm MLRS to doArilleryFire and fire all 12 rounds, it will fire only 10 of them.
To make things even even funnier this does not work for some reason on the Sandstorm (named arty in editor): gunner arty forceWeaponFire ["rockets_230mm_GAT", "Mode_6"] However this works arty fire ["rockets_230mm_GAT","Mode_6"];
More: after using fire and then sleeping for aiRateOfFire taken straight from the weapon's config does not let you correctly fire the ordinance, the firing is too fast and rockets end up unfired as the loop ends up prematurely.
And a cherry on the top: animateSource does not seem to work at all. I even tried the sample that is supposed to let you spawn a UGV and move the turret around, the actions did nothing. I tried animating the sandstorm to manually set the turret's elevation and heading, no luck.

bright flume
#

problem is the building itself is just buggered nothing can do about it. have to look for another area. but at some point I wanted to detect any kind of explosion and know what/where it was if that was feasible

young current
#

Normally buildings just take damage and break when enough damage is applied

#

you need to make more powerful bombs perhaps?

bright flume
#

trying to make an 'effect' buildings always wont be involved. eg. cruise missle misses but still wipes out everything within x meters... plants all that... maybe spawn a crater...

young current
#

have you tried just setdamage 1 for objects within x range?

bright flume
#

yeah its when to set it off.. and detect a explosion 'anywhere' is the underlying issue

young current
#

add it to the fired event of unit or vehicle that uses weapons that can trigger it

#

Id say theres no other way to get a position of a hit

bright flume
#

was thnking trying to detect the actual destruction of whatever itself that is exploding but I stopped, dang back killing me.

young current
#

yah thats not really a good option

bright flume
#

was thinking it likely isnt gonna be.

young current
#

Id track the life and death of the bullet/missile/bomb of given types through the fired event.

#

You would want to limit such to the most powerful weapons only though or it will get too heavy

bright flume
#

yeah that I figured.

cunning crown
#

disable the ability to remoteExec the function

austere hawk
#

is there any benefit to, instead of
sleep 10;
use

while (_c < 20) do {
    sleep 0.5;
    _c = _c+1;
};```
?
cunning crown
#

The first is easier to read and understand 😄

austere hawk
#

naturally

cunning crown
#

If I had to guess, the first one would be sligthly faster as the second one, once at 10s, it will need to check again and then continue

austere hawk
#

i mean more from a scheduler "optimization" standpoint ("real time to completion" doesnt matter in this case)

still forum
#

the first one is way better from a scheduler standpoint, and also without scheduler in mind

#

the second one is simply stupid

austere hawk
#

😄

winter rose
#

@austere hawk unless you execute something else in the while… no-effin-thing

#

Sorry for the late reply, Discord had a hard time updating ^^

thorn saffron
#

Does animateSource command even work at all? I'm completely unable to get it work despite multiple attempts.

austere hawk
#

yes it works

#

but it doesnt work on everything. what do you want to animate?

#

it wont work with turrets that are not on drones/UGV for example

#

at least that was the case a while back

thorn saffron
#

I want to animate a turret on an artillery vehicle. I tried arty animateSource ["maingun", rad 15] It does nothing, with or without AI. I also tried the UGV example posted in the animateSource article. None of the actions worked at all.
https://community.bistudio.com/wiki/animateSource

austere hawk
#

yeah regular turrets are not animatable by this - i never checked the ugv myself, maybe it only works in certain conditions ...

thorn saffron
#

Its not the Aiming. I can get the AI to aim at exact point without problems (you just force hold fire and use doArilleryFire). The problem is that once fired the AI gunner will try to move the gun into the rest position, that is something I want to prevent, while maintaining the control over the turret movement, so I can have custom spread on impact.

austere hawk
#

you could use doWatch/doTarget on a point right after it

thorn saffron
#

nope, tried that and the AI still tries to move the turret

young current
#

in some cases it probably simulates the reloading

austere hawk
#

tried disabling certain AI functions?

#

i doubt that (reloading)

#

the arty computer system is just baaad... so i wouldnt be surprised if there are some things that make life even more difficult than it already is

thorn saffron
#

disabling WeaponAIM does top the AI from moving the turret, but you have to keep it off for at least 5s or the AI will try to move the turret to rest positon

smoky verge
#

what are you trying to do?

thorn saffron
#

also it's not the arty computer, its the AI moving the turret back into rest position

#

@smoky verge see my rant post above

austere hawk
#

isnt it the same with if you tell AI to kill a target (and the target dies)

young current
#

do they do the same if fire command is used?

thorn saffron
#

yup

#

and forcedFire does not work on the Sandstorm BTW

austere hawk
#

i use doTarget and fireAtTarget, but at a calculated point in front of the muzzle - not somewhere down range

thorn saffron
#

well I can get the AI to fire accurately at the point, the problem is after firing each round the gunner tries to move the turret back into rest postion with sends rockets all over the palce as the script makes him keep firing

smoky verge
#

never tried it on arty but how does unitcapture work on artillery vics?

thorn saffron
#

well I want to have something that works all the time for arty call script I'm making

smoky verge
#

oh nevermind then

austere hawk
#

well it seems connected to doArtyFire, so dont use that then

thorn saffron
#

no

#

well then I will use that great function that lets you accurately calculate firing solution, and then use even better one that lets you tell the AI to turn the turret exactly to match coordinates, and then fire the weapon without doing anything stupid.

#

I literally got to the point where I just want to manually animate the turret just to get the artillery to behave, but nope, we can't have that

austere hawk
#

🤷‍♂️

thorn saffron
#

I just want it to fire, slightly adjust to fire within a splash zone, then fire again and so on, while firing as fast as possible. Is it that much to ask?

thorn saffron
#

I tried doTarget, with the point being calculated by taking the "usti hlavne" memory point (AKA the end of the gun) and the weaponDirection taken when the artillery is accurately aimed at the target (by doArilleryFire). The target point seems to be calculated correctly, but the AI borks when I tell it to doTarget the aim object. The Rockets ended up landing 2km off target.

#

doTarget does not seem to work on my target object. doWatch does get the AI to look at it, but after firing it just starts to randomly swing the turret around

young current
#

@thorn saffron was it the MLRS that also returned down after it fired?

#

I just tried it with a named VR cube placed above the tank and used dotarget to point at it and fireAtTarget to shoot

#

and it did nothing in between

thorn saffron
#

Yeah the sandstorm

young current
#

are you commanding the gunner or the vehicle?

thorn saffron
#

no, I'm just looking at it, there is only the gunner in the vehicle

young current
#

no with the script

thorn saffron
#

I tried doTarget with the gunner

young current
#

use the vehicle

#

I think your commands are fighting with the commander of the tank

thorn saffron
#

the gunner is the damn commnader, how the hell can I change that?

young current
#

well try pointing the command on the vehicle

#

and not the gunner

#

perhaps there is a difference

thorn saffron
#

tried both, none worked

#

BTW: no addons, just CBA and 3den enhanced

young current
#

k I'll just try this with a continous spawned script

thorn saffron
#

at least I managed to solve the fire rate issue

young current
#

just a sec

thorn saffron
#

setWeaponReloadingTime after the delay is enough to get the AI to fire at the full fire rate, without leaving anything in the tube

#

tried doTarget on a VR Cube object, using the Sandstorm MLRS, didn't work, not when telling the gunner to do it, nor the vehicle

velvet merlin
#

disable simulation of the gunner

#

setEffectiveCommander

thorn saffron
#
artyG enableSimulation false;

arty setEffectiveCommander artyG;

artyG doTarget artyAim;```
Nothing
#

arty doTarget artyAim; version also does not work

young current
#

now got it to do the same as you

#

what did you use as targets before?

#

and now it did shoot at each target in sequence

thorn saffron
#

a marker pos, an invisible blufor target from CBA (the AI freaked out when it was OPFOR), a VR selector object, and the VR cube

young current
#
_poopfire = [] spawn 
{
    plop2 reveal target1;
    plop2 reveal target2;
    plop2 reveal target3;
    plop2 dotarget target1;
    waituntil {plop2 aimedAtTarget [target1] > 0.8};
    plop2 fireAtTarget [target1];
    plop2 setWeaponReloadingTime [gunner plop2, currentMuzzle (gunner plop2), 0.0];
    sleep 2; 
    plop2 dotarget target2;
    waituntil {plop2 aimedAtTarget [target2] > 0.8};
    plop2 fireAtTarget [target2];
    plop2 setWeaponReloadingTime [gunner plop2, currentMuzzle (gunner plop2), 0.0];
    sleep 2;
    plop2 dotarget target3;
    waituntil {plop2 aimedAtTarget [target3] > 0.8};
    plop2 fireAtTarget [target3];
    plop2 setWeaponReloadingTime [gunner plop2, currentMuzzle (gunner plop2), 0.0];
};```
#

so this is crude but it did run

#

aand now it doesnt run again xD

thorn saffron
#

It worked. The target has to be within the range of the current fire mode

young current
#

yeah thats what I just figured too

#

the aimedAtTarget value should maybe be tweaked too.

#

dunno if arty can get it to full 1.0

dark ocean
#

how could in an edit hide the characters with this "·" saving what you write

young current
#

the what now?

#

@dark ocean unfortunately your question does not make sense, can you try again to explain the problem

thorn saffron
#

@young current Sadly your script does not seem to work on anything other than targets that are withing first fire mode. I tried with switched fire mode, even manually team switching to the gunner, changing the fire mode, and then switching out. No luck, the mode is correct, and the AI keeps it

young current
#

😑

#

odd

thorn saffron
#

Nope, tried multiple ways, using the doartillery fire to get the correct fire mode and all. however the fireAtTarget does not work on targets that are further away

#

putting the target in front of the gun (to get the correct angle) and getting the AI to aim at it does not work either, the AI tries to use the high angle of attack to hit a target that is like 10m in front of it

velvet merlin
#

aimedAtTarget and dotarget are not reliable

#

@thorn saffron did you remove the commander? switch effectiveCommander to drive? disabled simulation on vehicle and all crew one by one or in combos?

thorn saffron
#

I did everything I could

dark ocean
#

I would like to make an eventhandler that hides what I write in an edit and saves it in a variable

#

this example

winter rose
#

@dark ocean you could do a fake field that when you click gives the focus to an out of screen text field, and get this value

austere hawk
#

putting the target in front of the gun (to get the correct angle) and getting the AI to aim at it does not work either, the AI tries to use the high angle of attack to hit a target that is like 10m in front of it
@thorn saffron yes this is exactly what artillery computer does. It wont ever calculate solutions for < 45° elevation

austere hawk
#

if you use vanilla weapons, then you can use very simple formula to determine angle of elevation, because vanilla arty shells dont have airfriction

viral basin
#

is there any significant performance difference between using FSM or while loops?

sacred slate
#

how can i combine:
player disableAI "TEAMSWITCH";
with
onTeamSwitch { doStop _from };

winter rose
#

that's not the player you want to disableAI, it's either _from or _to

sacred slate
#

well right now i play a large HC thing. but when i play local roles, i don't wan't the squad leader to issue commands.

#

a positioned soldier should stay where he was, when i switch away.

winter rose
#

so, _from or _to?

sacred slate
#

i am not sure, maybe both? its confusing, cause i cant script. but i can read css and google some php strings around

#

i just want the squad leader to shutup, and each switched unit should stay where they are.

winter rose
#

it's not a scripting problem, it's a logical problem

#

which do you want to mute, the one from which you switch, or the one to which you switch?

sacred slate
#

i want to mute the squad leader, from him i switch to the next unit

#

also, they should get a stop command, so they won't wander away.

#

let me be so impudent to ask the next question. how do i make:
onTeamSwitch selectLeader -> the unit i switched to.
i tried:
onTeamSwitch { selectLeader _to };

winter rose
#

something here tells me that you didn't read the wiki page about this command

thorn saffron
#

@austere hawk Again, getting accurate angle of elevation is NOT the problem, just telling AI with forced hold fire to doArtilleryFire will have the AI correctly aim and set the firing mode to hit the target, you can even get the animation source to get the elevation angle the AI is using, not that it matters as you can't animate the turret. Again, problem is that AI tries to move the gun to rest position if you try tell it to fire shots one by one instead of burst.

thorn saffron
#

Ok, we could go the stupid way then: is it possible to increase the dispersion of the launcher weapon via scripts? I'm aware that you could use the fired EH to "capture" the rocket and tweak it's heading, but that would require some wizardry to get the correct cone.
Anyway, I thought that I could start by simply making the weapon/gunner inaccurate.

winter rose
#

setSkill maybe?

finite sail
#

everytime someone uses the setskill command, Maruk laughs and strokes a white cat

young current
#

That probably depends on if the ai firemode for rocket have any dispersion to it

finite sail
#

for locked weapons, it doesnt

young current
#

Artillery isn't locked though I think.

finite sail
#

no, it isnt

#

laser guided... not sure how that would work

young current
#

But changing the direction vector would be pretty simple

#

Laser guided is supposed to go where pointed though

finite sail
#

'supposed to'

young current
#

The talk now is to cover area with artillery rockets

finite sail
#

ive lost count of the times ive artilleried my arse with LG arty

#

did with plain HE just last night, in fact. i respawned quickly enough to get killed again by the second salvo

#

yeah, soz, didn't mean to drag convo off topic

thorn saffron
#
_artyG setSkill ["aimingAccuracy", 0.0001];
_artyG setSkill ["aimingShake", 0.0001];
_artyG setSkill ["aimingSpeed", 0.0001];

Made no difference on the spread.

#

so, adjusting each rocket it is then

young current
#

Yeah the weapon does not probably have that set up

finite sail
#

or add some random variance to the rockets supplied target

thorn saffron
#

AI uses AIdispesssionCoef config setting to add more dispersion to simulate recoil and such. Sadly we cannot control this via configs

#

@finite sail Great idea, I will just use that awesome, totally existing, command to tell the AI gunner to nicely spread the fire without doing anything stupid

finite sail
#

thats how I do it

thorn saffron
#

Yeah, I will have to tweak each missile after it's fired

finite sail
#

cant rely on vanilla mortar gunner AI, so I have to give them targets manually, but that makes them bot accurate, so I add random shift to their target pos

thorn saffron
#

ok, you have no idea what my problem is

finite sail
#

clearly 🙂

finite sail
#

oh yes, I did skim read that yesterday

#

I was talking about mortar not arty..does the virtual arty have the same problem you described yesterday?

thorn saffron
#

mortar has the same issue, with gunner resetting the aim if you try to tell him to fire shells individually, but since it's slower rate of fire you don't notice it.
And I don't want virtual artillery

#

with virtual artillery you can spawn whatever you want at whatever position

finite sail
#

which is why I mentioned it, but I don't use it either.. my arty provider is on the frigate just offshore so players can often see it firing, thats why i wont use virtual

#

So, how what that achieved with the sandstorm/scorcher, (I forget which it is)

thorn saffron
#

This a vide showing my problem with AI gunner moving the gun back to the resting position

#

This behavior is triggered just by the fire command.

finite sail
#

so it 'ripplefires' 10 rounds slightly dispersed, isn't that what you want?

thorn saffron
#

slightly dispersed wat? It keeps firing wildly when it tries to move the turret back to resting position

#

nothing is safe

#

That is NOT controlled dispersion over target area

ebon ridge
#

when can a unit handle become null?

#

(or can it not)

winter rose
#

deleted unit

ebon ridge
#

right and that makes all handles immediately null?

#

seems there could be problems in a lot of code if value of a handle can change in the middle of a function, is there some mechanism to deal with this?

still forum
#

you can check for isNull

ebon ridge
#

i.e. if i say ```sqf
private _nearestObj = nearObjects [player, ...] select 0;
...
...
// Can _nearestObj become null?!

still forum
#

yes it can

ebon ridge
#

okay so how can check for null help? it can become null after i check but before i actually use it

still forum
#

yep it could

ebon ridge
#

so am i missing something, because this seems like it actually makes it impossible to write error free code?

still forum
#

most commands don't error on null

ebon ridge
#

without workaround like critical sections that aren't actually in the language that is

#

but they then return nil right?

still forum
#

there are critical sections, unscheduled

#

no, not always. not sure

ebon ridge
#

which i then also have to check for

still forum
#

depends on what you doing

#

getPos returns 0,0,0
and other commands other respective default values

ebon ridge
#

so i have to check for null last before i use the values i read i guess

#

getVariable returns nil btw even with a default

still forum
#

Bug then, please create ticket on feedback tracker and ping @dedmen

tame lion
#

How would I go about detecting a terrain object like a tree or bush?

finite sail
#

its a fancy command, it's too expensive on the CPU even with relatively large ranges if you keep the types array tight and turn off sorting

#

correction not too expensive

tame lion
#

thank you thats exactly what I needed. I also don't need it to find too big an area. I'm making a FOB building system and players have requested a way to "remove trees/bushes/rocks" so it only needs to search like a 5m area of filtered results

finite sail
#

ah yes

thorn saffron
#

Does anybody know how to adjust vector in a cone? It is pretty much getting a random point in a cricle. I know the origin point of the cone, its direction and the size at the foot. Now I have troubles even imagining how to find a point on a plane, and then have that point transformed into local position of the vector along with the angle.

young current
#

@thorn saffron you can use modelToWorld to pick a point in front of the missile

thorn saffron
#

no

#

I use the ustu hlavne of the launcher

#

this way I get the exact point from with the missiles are launched

#

What I have trouble with is wrapping my head around transforming the "end" point of the vector from the cone's local into world coordinates, as well as finding the random point and rotating it around the origin point

potent depot
#

probably the non visual one is what you want

thorn saffron
#

its more of a math issue than arma

potent depot
#

ah, doubt I can help you too much there

thorn saffron
#

the trick is they are randomly selected withing the circle that is the cone's "foot"

warm iris
#

Does anyone have experience with ACE medical? Been looking around to write a script on an addaction that fully heals the player, anything I find does not actually want to work.

finite jackal
#
player setDamage 0;```
warm iris
#

That should work with ace med?

worn forge
#

Ace has its own command for a full heal, not near a pc right now but I'm fairly sure it's documented

warm iris
#

I found something for it, but it did absolutely nothing

fast frost
#

Does anyone have an idea on how to make an addon overwrite another?
Basically, addonx has a feature I don't want. I've gone through the files of addonx and changed the config and some other files to my liking, but I haven't gotten the slightest clue on how to create an addon which'll overwrite the config etc. found in the original addon file (Only solution I've found has been to simply reupload the modified addon, which isn't great for obvious reasons). I'm guessing there's a fairly obvious answer to this, but so far I've failed to find one.

warm iris
#

@copper raven thanks mate, joined the slack and asked there. Its sorted now <3

sturdy cape
#

hey there.i am trying to bind a particle source to an eden placeable object and let it have the vector/dir and stuff of the eden object.i cant figure out how to do this

#

basically i want a stream of water to be pointable into a direction

young current
#

@fast frost your addon has ot have the other addon as cfgPatches required addon to be loaded after it

reef grove
#

Can I make it so people dont swim and instead just walk on the ocean floor

young current
#

not really I think

snow cipher
#

where am i supposed to put this?
[ configFile >> "class CfgORBAT" >> "navyesp" >> "teamgreen" ] call BIS_fnc_ORBATGetGroupParams;

#

tried doing the orbat viewer thing but this is giving me errors

exotic flax
ebon ridge
#

why will group sometimes just refuse to follow move order, and instead move wp disappears?

#

in fact i say sometimes but it appears to happen all the tim

#

whelp problem goes away if i put a waypoint a lot further away, then back again, even though they are way outside the waypoint completion radius

#

actually nm i don't even set completion radius which (according to docs) should result in leader going exactly to the position of the waypoint

#

The way it works now it is complete once unit is inside and does not think it would be reasonable to move any closer.
lol what.

rustic plover
#

Are this and _this equal in SQF scripts?

restive leaf
exotic flax
#

@ebon ridge not sure how this is a #arma3_scripting issue, unless you use scripts to modify AI, Zeus or waypoints. In which case it would be useful to post those as well.

ebon ridge
#

yeah all script generated, although i think the problem is i didn't explicitly set completion radius

exotic flax
#

but the video shows you using Zeus to set a WP, not a script

unreal leaf
#

Why does this throw errors?

[] call {
  _a = nil;
  _a call {};
}; //no erros

[] spawn {
  _a = nil;
  _a call {};
};//error variable not defined 

[] spawn {
  nil call {};
}; // works again

I like to use nil as argument for a function i'm calling. ofcourse i dont want to use only nil as argument. In the program im writing i would like to do some something like this [_a,_b,_c] call _fnc_test; I like to be able to set for example _b too nil

exotic flax
#

sqfvm is showing errors on all 3 examples (since you can't send a undefined variable to call).
However the following does work (and is technically correct):

[] spawn {
   _a = nil;
   [_a] call {};
};
unreal leaf
#

Well ingame it doesnt

exotic flax
#

tested in-game and you are right; although it does make sense it doesn't work / returns an error

unreal leaf
#
[] spawn {
  _a = "";
  _c = "";
  if(isNil "_b")then{
    [_a,nil,_c] call {};
  }else{
    [_a,_b,_c] call {};
  }; 
};
exotic flax
#

since you can't use an unset variable

#

it's like breathing non-existing air

#

so it would be better to use

[] spawn {
  _a = "";
  _c = "";
  if(isNil "_b")then{
    _b = objNull;
    // or
    _b = false;
  };
  [_a,_b,_c] call {};
};
unreal leaf
#
[] spawn { 
  private _a; //<--- error
  if(true)then{_a = 0};
}

Isnt it strange that you can do things in call but not in spawn?

exotic flax
#

I agree that it's strange that it doesn't return an error in all cases, or that using nil inside an array isn't working

copper raven
#

in scheduled you can't use a variable that has nil value

#

in unscheduled however its fine, and works with things like param

plain vale
#

Is there a simple script for limiting total ammo on ammo trucks like Zamak truck? Basically i want to have vehicles re-arm but only really just a bit, not have an infinite supply. As a side note ive played around with the "vehicle ammo" which i thought might effect that but it does not.

Also as a secondary and unrelated thing, i need a waypoint to be activated by either one of two triggers, as it stands i think its waiting for activation on both, is there a simple "or" statement that i can plug into the waypoint to accept an activation from either trigger area?

cosmic lichen
fast frost
#

@young current Alright, and how would I go about specifying what files I want replaced and with what?

young current
#

Possibly by using same class names. I recommend you read up the wiki explanation of class inheritance for starters.

fast frost
#

Will do. Thanks.

ember citrus
#

how would i add local variables to an Event Handler?

young current
#

Like what for example? You just add them to the code you run I suppose.

ember citrus
#

but isn't the scope in the event handler code different?

_a = 123;
_unit addEventHandler ["Killed", {
  systemChat str _a; // Doesn't work
}];
_unit setVariable ["a", 123];
_unit addEventHandler ["Killed", {
  _a = (_this select 0) getVariable ["a", objNull];
  systemChat str _a; // Works
}];
#

i fixed it already with setVariable, is this the most efficient way?

winter rose
#

Yes

quartz pebble
#

Imagine a server using a headless client. There are AIs spawned on HC with their waypoints. What will happen with those AIs when/if HC disconnects? Will those AIs be transferred to server or something else will happen?

wispy cave
#

they'll be transferred to server

quartz pebble
#

With waypoints?

wispy cave
#

unless you've got a script running on the HC that's creating their waypoints: yes it should

quartz pebble
#

ok, thanks

austere sentinel
#

When I compile a file script, I only need to use preprocessFile if there are preprocessor macros in it, correct?

winter rose
#

preprocessFileLineNumbers is still recommended for error finding

#

@austere sentinel also, no comments with loadFile

austere sentinel
#

so basically preprocessFileLineNumbers until all my testing is done then swap to loadFile for the optimization pass?

winter rose
#

just keep preprocessFileLineNumbers, it's a one time process

austere sentinel
#

Hm, fair enough. Thanks!

tough abyss
#

Anyone know where i can find more JWOLF scripts?

winter rose
#

internet?
joke aside, try Armaholic or the forums

tough abyss
#

ight cheers

#

cuz i couldnt find anything but some random tik tokers

#

nvm there is nothing on armaholic

tough abyss
#

I cant find J-Wolf Scripts (They arnt on the web), anyone got a link.

winter rose
#

who is he and what does he do?

tough abyss
#

he made some really useful scripts for zeusing and made some admin menus to spawn a full arsenal and all that shebang

exotic flax
#

why not use ZEN? which is actually maintained 😉

tough abyss
#

whats ZEN?

#

sorry am kinda dumb

exotic flax
tough abyss
#

Ohhhh ok

exotic flax
tough abyss
#

@exotic flax Do you know who J-Wolf is?

exotic flax
#

nope, although a quick google search didn't return anything useful other than a Zeus Admin Menu from years ago

winter rose
#

@valid star hmm, sorry. it seems there is no RHS server.
try in #arma3_config though

still forum
#

@unreal leaf

private _a; //<--- error
yes, thats not the correct syntax. Read the wiki.
[] spawn {
_a = nil;
_a call {};
};//error variable not defined
Correct, the variable is undefined which will error

[] call {
_a = nil;
_a call {};
}; //no erros
The variable is still undefined, and the call command is never executed, but you are in unscheduled and unscheduled doesn't throw undefined variable errors

#

@winter rose you yet again, baited someone into crossposting. 👏

#

Thank you for trying to keep the moderators on their toes

winter rose
#

you're welcome!

plain vale
#

@cosmic lichen ok will try that for the ammo thing, what about the two triggers linked to one waypoint problem?

#

Im guessint the waypoint just needs a simple "activate if either trigger A or trigger B synced trigger is activated" but im not sure how to phrase that or if that is the 100% right solution

cosmic lichen
#

Sorry, I didn't read the thing about the waypoint

#
triggerActivated TRIGGER_1 || triggerActivated TRIGGER_2```might work
plain vale
#

ok will try that out

worn forge
#

I'm finding that buildings don't produce a result with a Dammaged or HandleDamage event handler, but they do effect a Killed event handler. Some buildings do (ie., the Barracks) and some do not (ie., Military Offices). These are obviously editor-placed buildings. Any ideas? I'm trying to complete a task when a player destroys an objective building with charges.

winter rose
#

just to be sure, it is impossible to overwrite a BIS_fnc function through Description.ext/CfgFunctions?

plain vale
#

@cosmic lichen Hmm gave that a shot but still no dice, i feel like this should be pretty simple to do

sacred slate
#

//
{
addSwitchableUnit _x;
} forEach (allUnits select {playerSide isEqualTo side _x});
//
player disableAI "TEAMSWITCH";
//
onTeamSwitch { doStop _from
selectLeader player
};
//

#

hello. i can't script. can some one help me just to combine those 3 snippets into one hotkey?

#

i don't need a external file, debug console is just fine for me

worn forge
#
yourAction = (findDisplay 46) displayAddEventHandler ["KeyDown", {
    params ["_display", "_key", "_shift", "_ctrl", "_alt"];
    if ( _key in (actionKeys "GetOver") ) then
    {  {    addSwitchableUnit _x; } forEach (allUnits select {playerSide isEqualTo side _x});
        player disableAI "TEAMSWITCH";
    }
}];```
#

I didn't include the onTeamSwitch command because it won't work, as far as I can tell. _from won't be defined inside the event handler

runic quest
tough abyss
#

Hey guys, I'm having some trouble with a script. I'm trying to get an addAction to play a sound on multiple items. Here is what Igot so far but it dosn't work and idk what do to anymore. I'm not familiar with SQF enough.

this addAction [ "QRF Alarm" , { //just dosn't work
    alarmPosts = nearestObjects [[11498.6,17725,5.73599], ["jenk_cobra_siren_object"], 2000, false];
    alarmPosts[i] say3D ["QRF", 1000, 1, true] forEach alarmPosts
} ];

this addAction [ "QRF Alarm" , { 
    nearestObjects [[11498.6,17725,5.73599], ["jenk_cobra_siren_object"], 2000, false] say3D ["QRF", 1000, 1, true]; //Overflow of Object into say3d
} ];

// Pseudocode
MakeAction
    Set alarmPosts length
    for i in alarmPosts
        say3D
    end
end```
cosmic lichen
#
this addAction [ "QRF Alarm" , { //just dosn't work
    PYTH_alarmPosts = nearestObjects [[11498.6,17725,5.73599], ["jenk_cobra_siren_object"], 2000, false];
    {_x say3D ["QRF", 1000, 1, true]} forEach PYTH_alarmPosts
} ];```
#

_x is the current element in forEach.

#

Also always add a TAG to global variables

tough abyss
#

Works awsome!! thanks a lot

worn forge
#

Anyone able to shed any light on my previous ask?
I'm finding that buildings don't produce a result with a Dammaged or HandleDamage event handler, but they do effect a Killed event handler. Some buildings do (ie., the Barracks) and some do not (ie., Military Offices). These are obviously editor-placed buildings. Any ideas? I'm trying to complete a task when a player destroys an objective building with charges.

hollow thistle
#

not as good as event handlers but you could just check if it's alive

worn forge
#

Not my issue, the Killed event handler works just fine

#

It's like buildings don't take damage (if I put a dammaged or handle damage or hit event handler on them, and shoot them, nothing happens), but they can either be alive or dead.

winter rose
#

maybe for performance issue, their hit EH are not broadcast

#

(btw, English speakers: broadcast or broadcast_ed_?)

worn forge
#

no english speaker is gonna give you a hard time for using either, except the pendants

austere sentinel
#

If the objective is just to destroy it, why check for damage & not just destruction?

Also what ryko said. Either works, broadcasted just sounds more natural as past tense to me.

winter rose
#

I said English speakers, not whatever the United Statians use 😜

#

(but seriously, I haven't yet found the answer; I will google it)
EDIT: (for the record, broadcasted "exists" but is clearly non-recommended)

worn forge
#

The objective is to destroy it, but some buildings are super tough. So the idea I had was to use a hit/dammaged/handledamage EH to assess the amount of damage that's been inflicted, and if it reached a certain amount, setDamage it to 1.

#

For example the Mine warehouse from the new Livonia assets, you can lay a dozen satchel charges next to it and set them off, but the building just sits there and takes it.

#

I may be reduced to having "helper" objects created locally on the server, if they take damage, setDamage the associated building to 1...

#

(English is seriously messed up when it comes to "proper" rules of usage, btw)

austere sentinel
#

Do satchels trigger fired when placed or set off?
If its the latter you could maybe count the number of handlers if they were close enough.
Pretty hackish honestly, but it would give you control over how many satchels == a dead building

worn forge
#

There are a good half-dozen hackish ways around it to solve the problem, but now I'm really curious what allows a hit / dammaged / handleDamage EH to fire. I'm beginning to think it's associated with a particular class.

steady terrace
#

question, can you write stuff to a file on the server? I want to save/restore inventory to a spreadsheet. I'm seeing things about full on databases, but that seems both overkill and like yet another dependency

worn forge
#

not easily.

steady terrace
#

how not easily are we talking

worn forge
#

it depends on what you want to write and for what reason. Arma isn't designed for the level of interaction you're suggesting.

steady terrace
#

like headscratching not easily or more throw pc out the window not easily

worn forge
#

diag_log is the easiest way, will let you write out anything you want to a rpt file

#

But then you have to wade through lots of dross to find what you want

steady terrace
#

hmm..

worn forge
#

Otherwise you'll have to fool with setting up a dll / extDB or some such, beyond my experience

steady terrace
#

no that works great! probably. thanks!

worn forge
#

It's the recommended way to debug, actually 🙂

austere sentinel
#

https://community.bistudio.com/wiki/callExtension
If you're just looking to spit a string into a file it's pretty easy honestly.
Anything more involved is gonna require you parsing the string that gets handed to your DLL via callExtension in C++/C#

worn forge
#

Ok did a bit of experimentation.

  1. The dammaged eventhandler is pretty much unreliable as it never triggered once on any building (it might be tied to units or physX objects).
  2. The hit and handleDamage event handlers fire on objects which have the House_F, House, HouseBase, Building classes. This includes a sample house and the Mine Warehouse.
  3. No eventhandler fired on objects in the ThingX / Thing category, such as cargo containers. In fact, no amount of explosives would even destroy them, and they don't have a destroyed state (setDamage 1).
  4. Parts of buildings seem to have a natural level of "damage resistance." Shooting a wall with a rifle has no effect, but shooting it with a tank's cannon will provoke a reaction from Hit/HandleDamage.
  5. Firing a weapon or throwing a grenade at a house object will provoke a Hit and/or HandleDamage EH reaction if you inflict visible damage, ie., if you shoot a glass window.
#
  1. Curiously, an ammobox (NATO Supply crate - B_supplyCrate_F) has the classes ReammoBox_F, ThingX, Thing and it will report a handleDamage EH; a cargo net barrels object CargoNet_01_barrels_F has the same classes, with additional CargoNet_01_base_F and Slingload_base_F classes - and it will not report a handleDamage EH. So if it's slingloadable, it might not work with EH's... more weirdness
#
  1. Unsurprisingly, objects in the Static or Rocks_base_F (rocks) are unaffected by damage
#
  1. Items with Item_base_F provoke responses from handleDamage and hit eventhandlers. Items with Cargo_base_F do not. Both items have Thing, ThingX and All classes in common.
#

I'll stop now, as it's pretty spammy, but indeed it seems that the EHs seem to be aligned with certain classes.

snow cipher
#

@exotic flax would it work if put on an init.sqf file?

queen cargo
#

@steady terrace peofilenamespace

#

Profilenamespace*

steady terrace
#

that doesn't seem to write to a file that you can read manually, unless I'm looking at it the wrong way

queen cargo
#

Kinda true, you can derapify it and read it then
However, that is the only way you can read and write without anything else to and from a file using arma

potent depot
#

I believe the only other alternative is using a .dll

#

There is nothing in arma itself to write to files afaik. So you will need to make your own extension or use a premade one from somewhere.

austere hawk
#

is there a custom "tag" system around (CBA, ACE etc) , with which i can tag my vehicles/weapons/etc, so that other scripts can properly know what the custom stuff can be used for?
e.g. Heavy Armor, Light Armor, artillery - stuff like that

winter rose
#

you could get the editor category from config @austere hawk ?

faint obsidian
#

I've got a problem with the spectrum device documentation found here https://community.bistudio.com/wiki/Arma_3_Spectrum_Device
I'm new to scripting and all that but following this I can get the device to show up signals on the screen but they are always present so I figure I have to put a frequency on an object through scripting so that it will only show up when facing said object but I dont know how. Anyone have ideas?

austere hawk
#

@winter rose its very unprecise precise though... No differentiation between light and heavy tank possible

winter rose
#

getMass 😜

austere hawk
#

what if i have a very large light tank 😛

potent depot
#

you could create a list for each classification of their classnames but that doesnt seem to be what you want.

winter rose
#

@austere hawk you use the bounding box volume divided by the mass and calculate density!

austere hawk
#

hm not too bad actually... Still - i guess most other people just dont have requirements for any of this / dont care about stuff like that?

#

Wanted to know if some already existed, so i wouldnt waste time on making a home cooked version that someone already has made in a better way

winter rose
#

if it is in a very closed system, you can list the classnames
if it has to be mod-friendly, better find a smart generic way

austere hawk
#

first option is verboten in my mind...

winter rose
#

lazy me would use the Eden category, and maybe handmake some smaller categories within them

snow cipher
#

managed to get the orbat viewer module working but im getting the getgroupparams hasnt been found error

#

and im not sure if its because of the group sizes but i cant zoom a lot into it

#

can zoom out tho

austere hawk
#

is there a command to check on an AI units ammo status (yllow - low on ammo/ red -out of ammo) without explicitly checking magazines?

exotic flax
#

Count magazines in AI inventory? Since I don't think they do tactical reloads, so mags in inventory should always be full

austere hawk
#

its for vehicle weapons (which may have different muzzles & mag types)

#

guess i have to explicitly check