#arma3_scripting

1 messages Β· Page 49 of 1

south swan
#

well, not exactly "duplicate" it seems, but outdated for sure πŸ€”

tough parrot
#

someone with wiki account should fix that wording.

pliant stream
#

Which wording?

#

Oh, i see. The first link doesn't actually list an alternative syntax.

tough parrot
#

about the {} making it lazy

pliant stream
#

It also says introduced in A3 1.62, which is nonsense.

hallow mortar
#

Is it?

south swan
pliant stream
#

Most definitely, since that overload has existed since at least A2, if not earlier.

south swan
leaden ibex
#

Hey there, hope I can find some help here.
I am working on a teleport script, that teleports units and vehicles. I am using BIS_fnc_findSafePos https://community.bistudio.com/wiki/BIS_fnc_findSafePos to find a safe position where to teleport them.

Problem is mainly with vehicles, using this script

private _marPos = getMarkerPos "VDV3";
_vehicles = [B1, B2, B3];
{
    private _pos = ([_marPos, 5, 20, 5, 0, 20, 0] call BIS_fnc_findSafePos); 
    _x allowDamage false; 
    _pos set [2, 0.5]; 
    _x setPosATL _pos;
    _x allowDamage true; 
} forEach _vehicles;

(It's part of a bigger function, but irrelevant)
It still happens that the BMPs teleport into each other. Any idea why? Does it not take in account "dynamic" objects and only takes into account map objects? monkaHmm

Tried adding a 0.5 sleep in there between ports, did not help

granite sky
#

@leaden ibex BIS_fnc_findSafePos does a surface collision check but it's only single-point so it can certainly place vehicles inside each other.

#

As you're using a tiny radius it's going to happen a lot.

leaden ibex
#

I see. So a custom check might be needed. Thanks for the info!

granite sky
#

well, you can pass in blacklist areas as well.

leaden ibex
#

I would pass in the vehicles, but given it's Object - Trigger area I guess it only takes in triggers right?

granite sky
#

yeah, it uses inArea internally.

#

For what it's worth, there is no good command or function to place vehicles :P

leaden ibex
#

I'm listening

#

oh, no good

#

dogeKek I am blind

#

I'll do a custom check, if it's in 5 meters to another vehicle, I'll just generate new position and do it all the time, slowly increasing the minimum and maximum distances

granite sky
#

findEmptyPosition is also extremely unreliable.

#

findSafePos is dangerous to use under heavy restrictions because it'll do expensive checks on 3000 points before giving up.

leaden ibex
#

It's running on client aPES_Giggle his bad

granite sky
#

excellent

leaden ibex
#

Was thinking about moving it to server side, but I guess not in this case.

The chances of them colliding is around 5% from my testing with three vehicles, so I should be ok

faint oasis
#

Hi, i have a question ? Is it possible to hide the grass from the Thermal Camera ? Because since the new thermal camera update, it's still not fixed and i'm not able to see a man on the ground while the day or night, it doesn't matter.

low zodiac
#

Hello,
I am currently piecing together a animation for a mission of mine and I've run into a small problem. I use following script to attach the unit into a helicopter after the animation plays out:
p1 attachTO [heliCIA, [0.9,2.75,-3.30]];
and for the rotating I use this:
p1 setDir 90;
This is working, but has the problem that the rotation is visible to the point in which it annoys me (It's a small thing I know, but still it annoys me alot). I've tried the BIS_fnc_attachToRelative function too and while it keeps the rotation, I was not able to figure out how to change the height the unit after that.
Does somebody have an Idea to change that?
This is a short clip showing my problem: https://www.youtube.com/watch?v=2mjMP8VEBSA

winter rose
little raptor
#

fixed

low zodiac
faint oasis
tight nova
#

Anyone knows how I can make certain AI to a specific respawn point?

Let's say I have 3 respawn points for BLUFOR but I want team Alpha 1-1 to respawn at respawn point 1 and not 2 or 3.

#

How can I make that possible?

#

Do I need a script or is it possible with another method?

stable dune
#

Hello can you override commandmenu?
~ and actionskeys F1-F10

little raptor
#

(if by override you mean disable)

stable dune
#

No, I want access my own menu. Currently doing that via keyEh, just thought if you can config them

little raptor
#

all except target and mount menu can be replaced by config

#

those two are dynamic

stable dune
#

I didn't found any examples of these

little raptor
#

they're not documented

stable dune
#

Aa, thats why

little raptor
#

iirc they're called RscMenuMove, etc. or something like that

#

you can find them in the root of configFile

stable dune
#

I will check those out, maybe I found them from Config with that

#

Thanks alot

little raptor
stable dune
#

Awesome!

tight cloak
#

so im making an on hit event for a tank - goal is to artificially increase its health via the hit event and counting direct hits from other tanks.
unfortunately this is counting Every hit so that includes shrapnel and bullets. whats the easiest way of filtering out the damage source to just be tank shells that it counts. ive tried just classname matching so if the projectile is say 120m shell it counts but it seems to ignore it

little raptor
#

some tank shells might just act like bullets against a specific tank

#

the alternative way is using handleDamage EH

#

which gives you the calculated damage already

low zodiac
little raptor
#

So would it be possible to do it even faster?
no. that 1 frame delay will always be there when you use attachTo

low zodiac
little raptor
#

well I wanted to see how bad it is

low zodiac
#

Sec

little raptor
#

but it should be 1 frame

low zodiac
#

https://www.youtube.com/watch?v=eX7a3TSYbGY This is how it looks with two attempts with the code of Lou (of course not in a helicopter this time, but demonstrates the exact small problem that I mean.)
The first attempt looks perfect, the second one looks okay for some reason

little raptor
#

it probably has a low update frequency

#

like static objects

low zodiac
#

Would it be possible to force a update of the object at the time the attachto with the rotation happens?

little raptor
#

try obj setPosWorld getPosWorld obj

#
isNil {
  p1 attachTo [heliCIA, [0.9,2.75,-3.30]];
  p1 setDir 90;
  p1 setPosWorld getPosWorld p1
};
#

or try it for heliCIA too

low zodiac
#

will do, gonna take a few seconds

little raptor
#

why not upload here? meowsweats

low zodiac
#

No rights to do that as a normal user, can't even upload pictures here

little raptor
low zodiac
#

Okay, that might have been the reason for it LUL, thanks. I can now upload stuff too

low zodiac
# low zodiac https://www.youtube.com/watch?v=iNeWVxOUQrk ~~(not HD yet, thanks YT) ~~ This is...

This is also the whole code that I used, if it is needed or somebody wants to take a look at it.

p1 setDir 90;


p1 switchMove "Acts_NATOCommanderArrival_Commander_1"; 
p1 enableSimulation false; 
sleep 5; 

heliCIA animateDoor ["door_main_r_source", 1]; sleep 0.5;

HeliCIAD disableAI "ALL";

p1 attachTO [heliCIA, [0.50,2.619,-2.53]]; 
p1 setDir 90;

p1 disableAI "ANIM";
p1 enableSimulation true;

p1 switchMove "Acts_NATOCommanderArrival_Commander_1";
[] spawn
{
    sleep 0.5;
    p1 playMove "Acts_NATOCommanderArrival_Commander_1";
    p1 playMove "Acts_NATOCommanderArrival_Commander_2";
    p1 playMove "Acts_NATOCommanderArrival_Commander_3";
    p1 playMove "Acts_NATOCommanderArrival_Commander_4";
    p1 playMove "Acts_NATOCommanderArrival_Commander_5"; 
    p1 playMove "Acts_NATOCommanderArrival_Commander_6";
    p1 playMove "Acts_NATOCommanderArrival_Commander_7"; 
    p1 playMove "Acts_NATOCommanderArrival_Commander_8"; 
    p1 playMove "Acts_NATOCommanderArrival_Commander_9";  
};

sleep 56.616;

p1 switchMove "Acts_SittingJumpingSaluting_in"; 
[] spawn
{ 
    sleep 0.5; 
    p1 playMove "Acts_SittingJumpingSaluting_in"; 
};

sleep 07.434; 

isNil {
  p1 attachTo [heliCIA, [0.9,2.75,-3.30]];
  p1 setDir 90;
  p1 setPosWorld getPosWorld p1

};

p1 switchMove "Acts_SittingJumpingSaluting_loop1";  
[] spawn 
{  
 sleep 0.5;  
 p1 playMove "Acts_SittingJumpingSaluting_loop1"; 
 p1 playMove "Acts_SittingJumpingSaluting_loop2";  
 p1 playMove "Acts_SittingJumpingSaluting_loop3"; 
};```
little raptor
low zodiac
#

It is being re-enabled though with p1 enableSimulation true;

little raptor
#

after attachTo

#

also enableSimulation has delay

low zodiac
#

yeah, the first two attach to's are not visible, so the rotation isn't really a problem there (the reason for it was to keep the animation that is playing in a static pose until the actual animation sets play)

little raptor
#

you might want to ditch those spawns

#

and instead of sleep use anim EHs

#

but that's not the point here meowsweats

little raptor
low zodiac
#

Yeah

little raptor
#

no clue

#

remove enableSim and disableAI

#

see what happens

#

I know it might break the anims

#

just want to see how the attaching works

low zodiac
#

will do sec

little raptor
#

200 MB meowsweats

#

I ain't watching that meowsweats

low zodiac
#

It's generally the same as the other one, but the six second clip also shows the rotation

little raptor
#

yes

low zodiac
little raptor
#

I doubt that'll change anything tho

#

if that doesn't work either you can try moving the unit every frame relative to the heli

#

another idea is attaching another object there first

#

then attach the unit to that object meowsweats

low zodiac
#

That sounds like that could work though, as I could already set the direction of the object once and then won't need to change the direction of the player anymore right?

little raptor
#

well the 3rd idea will work yes (you should attach the object long before attaching the unit tho)

#

but it's slow af

#

I'd try the first one first

low zodiac
#

Yeah, I will try it all. Thank you for your time and knowledge! I prob. will post the end result here if I can fix it.

cobalt path
#

does anyone know why in MP noone but me can see particleeffects executed by a script?

cobalt path
#

any way to make them not be local?

little raptor
#

create them for everyone on every PC

cobalt path
little raptor
#

then remoteExec that script

#

you'll have to move it to its own function or file to do that

#

(I mean the addAction code not all of it)

#

also change those global vars to local

#

you only need them in that script

#

instead of getPos _target use ASLtoAGL getPosWorld _target

cobalt path
#

alright I think I fixed it, I will try it on the server once I got people to witness it and tell me if it works

cobalt path
#

same stuff, just replaced getPos _target and createVehicle. Now will put all that stuff into an sqf

#

It still works so far, but obviously without other people I wont know if its actually working

little raptor
#

like I said you must remoteExec it

#

it won't work otherwise

#

in action code:

[_this, "myfile.sqf"] remoteExec ["execVM", [0, -2] select isDedicated];
south swan
#

and you can always run 2 windowed instances of the game by disabling BattlEye and connect them together to test MP stuff πŸ€·β€β™‚οΈ

cobalt path
cobalt path
south swan
#

you execute in one window, you check in another window πŸ€·β€β™‚οΈ

tight nova
#

Reposting :

#

Anyone knows how I can make certain AI to a specific respawn point?

Let's say I have 3 respawn points for BLUFOR but I want team Alpha 1-1 to respawn at respawn point 1 and not 2 or 3.
[13:08]
How can I make that possible?
[13:08]
Do I need a script or is it possible with another method?

#

I thought about using the "sinc

#

"sinc_to" option, but it doesn't work for some reason. Maybe I have to retry.

opal zephyr
tough abyss
#

RemoteExec a script vs a inline function?

trim tree
#

how do i implement this error message from the vanilla zeus modules? https://i.imgur.com/hSox1hl.jpg
I found this code snippet on the zeus enhanced git hub but i dont know what this "EFUNC(common,showMessage);" is (if it even is what im looking for)

if (isPlayer _unit) exitWith {
    ["str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer"] call EFUNC(common,showMessage);
distant egret
#

That's an macro to zen_common_fnc_showMessage

little raptor
bronze panther
#

Anyone know why it is showing two hold acitons? It only displays one in singleplayer but it shows two on a multiplayer server.
Code Below

[ 
 HAUB_Falcon_1,            
 "take transport to UNSC Minotaur",           
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa",  
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa",  
 "_this distance _target < 7",       
 "_caller distance _target < 7",       
 {}, 
 {}, 
 { player setPosATL (getPosATL MIN_ENT) }, 
 {}, 
 [], 
 3, 
 0, 
 false, 
 false 
] remoteExec ["BIS_fnc_holdActionAdd", 0, HAUB_Falcon_1];```
tough abyss
oblique pewter
#
TAG_fnc_testRemote = {
    [missionNamespace, "arsenalOpened", {
        disableSerialization;
        params ["_display"];
        _display displayAddEventHandler ["keydown", "_this select 3"];
        {(_display displayCtrl _x) ctrlShow false} forEach [44151, 44150, 44146, 44147, 44148, 44149, 44346];
    }] call BIS_fnc_addScriptedEventHandler;
    hint "Remote Exec Received";
};

arsenalbox  = this;

remoteExec ["TAG_fnc_testRemote", 0, arsenalbox ];
#

hey guys i am having and issue with this script, for some reason it wont remove the save loadbuttons for other clients

#

it only works on my client

#

am i using the remote exec command wrong?

copper raven
oblique pewter
#

do need to write publicvarable berfore it?

warm coral
#

does anyone know the function/command for a zeus banner message?

#

lets say a player activates something then a message get sent to the zeus banner hud

gaunt tendon
#

outputs this

#

Anyone has any idea of what is wrong?

iron jacinth
#

cutRsc ["RscStatic", "PLAIN"]; How would I execvm this so it effects all players at once?

gaunt tendon
iron jacinth
#

@gaunt tendon Thanks!

boreal parcel
#

hey how should I be creating global variables to be used on server start? Currently I am trying to create them with this in the init.sqf.

I compile the initVariables.sqf script first which contains all the variables such as PMC_Factions and PMC_Bases but when I try to assign or use them I get an undefined error. What am I doing wrong?

if (isServer) then {
    [] call compileFinal preprocessFileLineNumbers "scripts\initVariables.sqf";
};
PMC_SaveData = [] call PMC_fnc_loadSaveData;

PMC_Factions = PMC_SaveData select 0;
PMC_Bases = PMC_SaveData select 1;

_assign_faction = {
    // using PMC_Faction variable
};

[player] call _assign_faction;
meager granite
boreal parcel
meager granite
#

Are you broadcasting the variables to clients?

boreal parcel
#

maybe I am incorrectly creating the variables?

#

ah

meager granite
#

Either way, not enough info to see what's wrong

boreal parcel
#

I am not, should I be publicVariableing all the global variables I create?

meager granite
#

You're initialising your variables only on server yet use them everywhere

#

If script is on clients then just run the script that initialises them instead of broadcasting from server

#

it all comes done to what you're trying to do

wary needle
#

hey i need help with this i cant use remote exec on this script but i need a way to make it so there is no save or load function on an arsenal box for other clients. it just needs to work for every cleint.

[missionNamespace, "arsenalOpened", { 
  disableSerialization; 
  params ["_display"]; 
  _display displayAddEventHandler ["keydown", "_this select 3"]; 
  {(_display displayCtrl _x) ctrlShow false} forEach [44151, 44150, 44146, 44147, 44148, 44149, 44346]; 
 }] call BIS_fnc_addScriptedEventHandler;
boreal parcel
meager granite
#
[] call compileFinal preprocessFileLineNumbers "scripts\initVariables.sqf";
```instead of
```sqf
if (isServer) then {
    [] call compileFinal preprocessFileLineNumbers "scripts\initVariables.sqf";
};
livid wraith
#

why not just remove the if statement and run it for every client ?

boreal parcel
#

right thats what I was, and now am again, doing but like I said it still remains undefined

meager granite
#

in init.sqf or something

meager granite
wary needle
meager granite
#

I see PMC_Factions yet your comment says PMC_Faction

meager granite
boreal parcel
# meager granite I see `PMC_Factions` yet your comment says `PMC_Faction`

spelling error on my part, but trying to assign to PMC_Factions gives undefined as well.
This is how im "creating" the variables in the initVariables script, is this correct?

// Variable initialization, values will be dynamically assigned and removed elsewhere.
PMC_SaveData = [[], []];
PMC_Factions = [];
PMC_Bases = [];
PMC_Approved = ["76561198201550691"];
#

I am able to use the variables later on after mission has finished starting via debug console

meager granite
meager granite
#
  1. You init them in a file
  2. Then you call your function and rewrite them
boreal parcel
#

after I initialize the variables I am trying to assign data too them

#

arrays basically

meager granite
#

Then you assign them again from your call

boreal parcel
#

ok, then I guess I should change the question as I am thinking you create global variables similar to local, just different naming syntax. How do you create a global variable?

#

wiki just says use publicVariable

meager granite
#

PMC_Factions is already a global variable

#

public variable is something that gets broadcasted over the network

boreal parcel
#

than I still dont understand, if I am executing the script that initializes the variables above where I wish to use the variable in the init.sqf, why arent they initialized or "Defined"? is it some kind of order of execution issue with my logic?

meager granite
#

You initialise then and then instantly overwrite with something else

#
PMC_SaveData = [[], []];
PMC_Factions = [];
PMC_Bases = [];
...
PMC_SaveData = [] call PMC_fnc_loadSaveData;
PMC_Factions = PMC_SaveData select 0;
PMC_Bases = PMC_SaveData select 1;
#

And I guess your function makes them undefined or something

#

Add logging lines each step to see what your variables are

#
diag_log [1, "PMC_Factions", PMC_Factions];
...
diag_log [2, "PMC_Factions", PMC_Factions];
...
diag_log [3, "PMC_Factions", PMC_Factions];
```etc.
#

Then see RPT output

boreal parcel
meager granite
#

What security purposes I wonder

still forum
#

Freezing game

meager granite
#

You can already do that with lots of other commands

pulsar bluff
#

i think battleye related

#

i forget, i remember when it was debated and it seemed reasonable at the time

meager granite
#

Reason why its an issue is because I can't use enableDebugConsole with my UID in there because it also enables debug console to anyone with #login password.

#

Thus I have to use my own scripted debug console where it doesn't work properly and lots of code needs testing in real environments on a server full of players

pulsar bluff
#

i remember when it was in dev experimenting with using it as an execution method, local tho so i dont know

meager granite
#

Having to resort to pre-command scripted performance check, pretty annoying to copy-paste extra code

pulsar bluff
#

you should have a good idea by now how things perform even before writing

#

i dont worry anymore about a few 0.0x ms over 10k iterations

meager granite
#

for "_i" from 1 to 2 do {_i = 1;} lets disable for unless you're server for security purposes

pulsar bluff
#

lol

#

there was a reason for ti but i forget. maybe it bypassed scripts.txt BE

#

like it was a way to compile

meager granite
#

It still executes it once though, 1 iteration

pulsar bluff
#

i was fiddling with it back then as an alternative to eachframe

#
_results = []
for '_i' from 0 to 9999 do {
    _results pushBack (diag_codePerformance [{ private _a = 123; }, 0, 1]);
};``` 😎
#

now i am wondering how the results would compare to raw

#

theoretically you could run that in editor and compare, and statistically filter out the overhead of the for loop from the results

#

_perf = _result - overhead

meager granite
#

there is no overhead from the loop

#
_sum = 0; 
_code = {vehicles}; 
_iters = 10000; 
for '_i' from 1 to _iters do { 
    _sum = _sum + (diag_codePerformance [_code, 0, 1] select 0); 
}; 
 
[_sum / _iters, diag_codePerformance [_code, 0, _iters] select 0];
#

Overhead from individual diag command and floating point error accumulation make manual results much less accurate.

still forum
still forum
meager granite
# still forum Not as easily
_freeze_until = diag_tickTime + 2; for "_i" from 1 to 2 do {_i = [1,2] select (diag_tickTime > _freeze_until);};
meager granite
#

inb4 10000 iterations limit for unscheduled for in 2.14 monkaW

still forum
pulsar bluff
#

so my code is 10,000 times slower than i thought it was πŸ˜„

still forum
still forum
#

😈

pulsar bluff
#

pls leave in a method to crash the client of trolls

meager granite
#

Back in OA you could do skipTime with infinity and it would make sky epilepsy-inducingly flash

#

Imagine using that to punish cheaters ☠️

pure flicker
#

πŸ’€

proven charm
#

test in debug console

distant egret
#

In what context do you want to use it? Like an foreach loop?

proven charm
#

why are animals inherited from man class? you have to do some extra work when using nearEntities

distant egret
#

It should have been the other way around πŸ˜‚

#

But what is your intented behaviour? That it exits the exitWith and continuous the original code? Because that won't happen.

little raptor
distant egret
#

Breakout and continue are for for loops I believe.

little raptor
#

Breakout is not

#

It can break out of any scope

distant egret
#

True...

little raptor
#

BreakOut does support return value

proven charm
distant egret
#

But an exitWith inside an exitWith will I believe exit out of the next outer scope. But best to test it yea.

pulsar bluff
#

presumably your doing sqf origin nearEntities ['man',50] and finding animals in the list

#
origin nearEntities ['camanbase',50]```  no animals
proven charm
little raptor
#

It just exits the exitWith scope meowsweats

#

Which means it just does nothing

distant egret
#

Ah idk then I'm not using that anymore after the breakout and continue stuff got added. It was always too complicated with exitWith for me...

little raptor
# proven charm sorry?

If you just view a soldier in config viewer you can see that it inherits from CAManBase after Man

#

which are actual men

pulsar bluff
#

it looks like "SoldierWB" would also work too

proven charm
pulsar bluff
#

unless civs arent captured

little raptor
#

I think that's west only
Not sure

pulsar bluff
#

true

proven charm
#

always used "man" for queries, hope my code isn't buggy now 😬

pulsar bluff
#

probably a more efficient way than doing sqf origin nearentities ['camanbase',50] select {((side _x) == west}

little raptor
#

Well technically a mod can just skip that class

pulsar bluff
#

yea maybe risky, i aint changing from camanbase

little raptor
#

You never know πŸ˜“

#

Tho same can be said with CAManBase πŸ˜…

pulsar bluff
#

heresy

little raptor
raw iris
#

Hey I am very new to this and I am trying to see if I can add a custom helmet to a starsim server and currently just testing it myself. Does anyone here know what I might be doing wrong?

hallow mortar
raw iris
#

Ok, will ask in there thanks

warm hedge
#

Use multiple playSounds

copper raven
winter rose
#

change the soundfile's volume

steady minnow
#

Good day.How do I create a variable for a certain class of equipment so that it then appears in the script instead of its classname?Thank you in advance

tired coral
steady minnow
tired coral
#

I'm not the one to teach you everything that's wrong there but I would read up about variables.

#

If you simply want a destroyed tank you can do so in the built in editor under "health" or something

#

or you can put this setDamage 1; in the init field

winter rose
#

☝️ this @steady minnow
what you did here is try to destroy a string (which is impossible and should throw an error)

steady minnow
# tired coral or you can put this setDamage 1; in the init field

The problem is that, in the mod in the config, the damage setting is not correctly configured, and the mod is blocked.The tank cannot be destroyed from an RPG .And I'm trying to adjust the tank's damage so that it can be blown up from a standard rpg.I wanted to create a new variable for the tank to use damage not from the mod's coffig, but from my script.

winter rose
#

I'm trying to destroy a tank from the T64 mod
not what you said here

anyway you cannot change a config from script like that
you could override the "HandleDamage" event handler to increase damage eventually, but that's a tricky one too

tired coral
#
this setDamage 1;
#

in the init field?

#

If so, you can name the tank something like "t64" in the variable field, and then in your script do t64 setDamage 1;

#

not using _ since the variable won't be local

#

All in all I think this might be beyond your abilities at the moment considering the code you previously posted. I would try and find a different soviet tank that can be destroyed normally.

steady minnow
tired coral
#

Use the firedman eventhandler and log the projectile when you fire the rpg

#

or actually just run the handledamage and shoot the tank with the rpg, then log the _projectile variable

#

so if the _projectile returns "Rpg_7_heat" when you shoot it with the rpg, you check if _projectile isEqualTo "Rpg_7_heat" before running your custom damage script

steady minnow
steady minnow
#

Is there such a script?

copper raven
little raptor
#

tho it's a bit nasty

copper raven
#

the fact that you have to select again to get the actual thing is just meh

#

(unless it's for some other purpose?) πŸ˜„

little raptor
#

I'm gonna guess that's why anyway, since inAreaArray does give you the actual things

copper raven
#

what's a good use case for indices though

little raptor
#

let me check the ticket

#

https://feedback.bistudio.com/T170535

Non-object entities have to be represented as positions and to determine which non-object entity was matched by the command, you have to resort to hacky approaches like storing indexes as position Z coordinate which creates additional overhead for high-performing scripts

#

that was the proposed use case

tired coral
#

then put them in an array like so ```sqf
_killshots = ["classname","classname","classname];
if (_projectile in _killshots && _unit isEqualTo "classNameOfTheTankT64 (Right click in editor, log classname)") then {yourscript};

or smth
little raptor
tired coral
#

there's probs a way to find out all projectiles that can be fired from an rpg and match them with all the tanks. Both for ease but also make it fair (RPG will one shot all tanks not just the t64)

#

but iirc handledamage is assigned to a unit and so it'll only work for that specific unit, so the extra check if it's the t64 is redundant here IG

copper raven
little raptor
#

yeah I just commented with that πŸ˜…

granite sky
#

Store what as hashmaps?

#

Like what's the mapping there?

still forum
#

store the position

#

as key, and your whatever non-entity thing as value

granite sky
#

huh, you can put an array in a hashmap.

#

I'd much rather have a nearestInArray command anyway

#

Z hack works for me :P

#

Trouble with returning indices is that you can't chain calls

#

so narrowing down by radius doesn't work.

tired coral
unique pollen
#

So I am doing a type of RP and I want to create units/vehicles etc that only one player can see/hear. Any ideas?

little raptor
little raptor
tired coral
#

tru

#

I accidentally went on here haven't touched arma in years lol

steady minnow
# tired coral wait you can just copytoclipboard str _projective

I'm trying to attach this.

waitUntil {
        _listT64 = player nearEntities [["Tank"], 500];

        _listT64 isNotEqualTo [];
    };
    
    player addEventHandler ["FiredMan", {
     ["player", "launch_RPG7_F"]; (damage "Tank");
}];

Only how to link the class of all tanks to damage?

little raptor
#

add EHs only once...

#

that thing is gonna trigger thousands of times

#

and the code is just wrong

#

what are you trying to do?

steady minnow
#

The problem is that, in the mod in the config, the damage setting is not correctly configured, and the mod is blocked.The tank cannot be destroyed from an RPG .And I'm trying to adjust the tank's damage so that it can be blown up from a standard rpg.I wanted to create a new variable for the tank to use damage not from the mod's coffig, but from my script.

little raptor
#

I wrote the rpg class from memory tho

#

you have to check it in the game

#

and replace insertTankClassHere with whatever tank class you want to destroy

little raptor
#

you can try initPlayerLocal.sqf. just put a waitUntil {!isNull player}; at the top of the file before that code, to be safe

little raptor
steady minnow
little raptor
#

yes

steady minnow
#

And how to recognize him ?

little raptor
#

him?

timber ridge
#

Why not try dePBO the eden .PBOs and ctrl + f for snap? Use Astrogrep for searching a local dir, it's fast and comfy :)

little raptor
#

then fire at a tank with an RPG7

steady minnow
#

I have no information about the class of the projectile, where can I find it?

little raptor
#

for now just test the code

#

if it doesn't work I'll tell you how to find it

steady minnow
little raptor
#

np

steady minnow
#

Health and well-being

jade abyss
#

I don't think so. I bet its more a "onSurface" or something

tough abyss
little raptor
#

or just defining them locally using locally executing scripts

#

e.g. init.sqf

#

you don't have to remoteExec everything

tough abyss
little raptor
#

the function is defined locally

#

you're not sending the whole code

#

you just send the name of the function to remoteExec

tough abyss
#

That’s what I meant by RemoteExec πŸ˜‚

#

maybe there is a diff word

little raptor
#

I said don't use remoteExec to send the whole inline code

tough abyss
#

Ah okay well I sajd earlier β€œremoteExec a script or inline” and you said neither, by script i meant function, i probably misunderstood

steady minnow
little raptor
#

sure

steady minnow
#

Where can I find coolnames of shells for rpg and other anti-tank weapons?

#

Classmames

#

I'm asking why, because your script works, but now the tank is burning from an anti-infantry projectile from an rpg. And this somehow does not seem to be true.

little raptor
#

well yes I thought you wanted to destroy it completely

#

I kill it instantly

#

you can adjust the damage

hallow mortar
#

I think the problem they're having is that it's being taken out by an anti-infantry (i.e. HE) projectile

little raptor
#
player addEventHandler ["FiredMan", {
  private _projectile = _this#6;
  if (typeOf _projectile == "R_PG7_F") then {
    _projectile addEventHandler ["HitPart", {
        params ["_projectile", "_hitEntity"];
        if (_hitEntity isKindOf "insertTankClassHere") then {
          _hitEntity setDamage (damage _hitEntity + 1 / 2);
        };
    }];
  };
}];
#

you can adjust that number 2 for number of shots it takes to kill that tank (right now it takes 2 shots)

#

it's a naive code but I'm not in the mood to write a complete version

hallow mortar
#

I think rather than locking it to a particular classname, it would be better to check the projectile's config to see if its warhead type is AP, HEAT, or TandemHEAT

steady minnow
#

I tried to adjust the damage.But if you put, for example, damage 0.5, then there is no reaction to a hit.

little raptor
steady minnow
timber ridge
#

Might be mistaken, but a quick look at eden source tells me BIS uses boundingboxreal for all cases when positioning entities

boreal parcel
#

I am trying to see where a strange empty nested array is coming from in one of my variables but as far as I can tell my code looks alright, is there a way to maybe add an event handler to my specfic variable to trigger whenever the variable is modifed?

little raptor
#

no. you can write a wrapper function for it tho

#

but I doubt it's gonna help you

#

the only explanations might be:

  1. you're using bad variable names and another mod is modifying it
  2. error is in your own code
boreal parcel
#

likely scenario is number 2

little raptor
#

arrays are more complicated than other types in SQF. you're probably not familiar with the concept of references

boreal parcel
#

I have been referencing the array wiki when using it but you are correct, for instance, is this code appending one array with the data, or appending a nested array with the data?

PMC_Factions append [[_factionID, _factionName, PMC_Starting_Cash, _factionLeaders splitString ",", _factionMembers splitString ",", ["G1"]]];
#

I was a little confused on the syntax

little raptor
#

one array

#

also use pushBack instead

boreal parcel
#

gotcha

#

ill just need to continue searching through and refactoring my code + debugging it till I get to the point where the strange array is added

little raptor
boreal parcel
#

the very first index of the first index here, its 3 empty arrays and im not sure where it came from yet. So far in my testing it hasnt been re added so its possible I previously fixed it and just had to flush the missionProfileNamespace to get rid of it. I also noticed that overall the first index seems to be a nested array though it shouldnt be

[ 
 [[ 
  [[[]]], ["T000","The Red Arrows",500000,["76561198201550691"],["76561198201550691"],["G1"]]
 ]],
 [[]]
]
#

probably some bad logic I need to rework

little raptor
#

nested arrays are extremely slow when you want to modify them

#

as for that empty array, make sure you're not modifying things by ref incorrectly

#

an example of ref mod, if you're not familiar with the concept:

_a = [];
_b = _a;
_a pushBack 1; // _a and _b are both [1]
tough parrot
#

This is supposed to unlock a turret, but I'm getting no effect applying it to a blackfoot:

_vehicle lockCameraTo [objNull, [0]]
hallow mortar
#

Make sure it's being executed locally to the gunner (may be different from the vehicle if it's a player)

tough parrot
#

I'm running it on my pc in the editor

boreal parcel
# little raptor why so many levels of arrays? <:meowsweats:707626030613135390>

I am probably going to look into hashmaps as per others suggestions but originally it was supposed to be one array containing 2 arrays, one for faction data, one for base location data. Faction data would contain arrays for each faction. Base data would contain arrays for each factions base.

The arrays you see in the faction data array are for multiple steam ID's and whatnot per faction

hallow mortar
tough parrot
tired coral
#

if it's a sp mission and you spawn stuff like your while true loop was meant for

#

since it's using player it seems to be sp idk

#

or mb I'm stopid ackthsually

boreal parcel
#

will if () exitWith {} stop a forEach loop?

little raptor
#

if it's nested in another scope no

boreal parcel
#

alright then no problem, and I have a question about hashmaps if you dont mind.
My assumption on how I can use hashmaps is something like this, basically nested hashmaps.

is this the correct way of thinking? (I know this isnt the correct way to create a hashmap)

_hashMap = [
    [
        "factionID",
        ["HQ", [getPosATL, vectorDir, vectorUp]],
        ["Objects", [["class", getPosATL, vectorDir, vectorUp], ["class2", getPosATL, vectorDir, vectorUp]]]
    ]
];

_base = _hashMap get "factionID";
_hq = _base get "HQ";
_hqCords = select 0;
#

and is this better than the nested arrays, or am I still being inefficient here

little raptor
#

but it could be faster due to fewer array nesting

boreal parcel
#

any suggestions? when it comes to objects there could really be an unlimited number of objects and I would need to store the class name and positions for later placing them back down

#

and each faction has unique versions of this data, so their own HQ, and own Objects

little raptor
#

nested hashmaps are not slow iirc

little raptor
#

I couldn't justify that level of nesting before faction data started

boreal parcel
#

yeah that was more supposed to be like

[
  [["faction1"], ["faction2"]],
  [["base1"], ["base2"]]
]

and also that was the overall save data, not just faction data

#

switching to hashmaps I was probably going to do something like

[
  ["factions", [ ["factionID", [data]], ["factionID", [data]] ]],
  ["bases", [ ["baseID", [data]], ["baseID", [data]] ]]
]
broken plinth
#

Hey everyone quick question

#

Im using this to add an interaction to a computer

#

this addAction ["hack", {hacked=true;publicvariable "Hacked";}];

#

But on activation of the action is there a way to send a message in chat?

#

Thought it could be something like
this addAction ["Download', 'systemChat hello"]

digital hollow
#

Just add the systemChat inside the action statement {}. If you need it to show for every player then you need to remoteExec.

jade abyss
#

Rly? oO

meager granite
#

Yeah we make cheats here. What's your steam profile?

fervent wyvern
#

hi, i find a mod call Azcoder Radiation and in the description it says that any mask or outfit with a substring in it can be use as a radiation outfit/mask, i'm new to moding and scripting but i want to know if i can change the substring of an outfit from another mod and how i can do it (how to find the code of the string open it and all that), sorry for bothering

meager granite
#

Likely you can change the substring through script in your mission without having to modify the mod

#

But it all depends on the mod

fervent wyvern
#

thanks

warm swallow
#

Is there a way to spawn a module through a script? I looked in the biki and found how to create a module, but I'd like to call it.

fervent wyvern
#

@warm swallow you can make an activator that calls a script you create

warm swallow
#

not quite sure what "activator" means.

#

Just trying to know if I can create a module through a script

#

nevermind! Found this code in biki:

private _grp = createGroup sideLogic;
"ModuleSmokeWhite_F" createUnit [
    getPos player,
    _grp,
    "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];"
];
fervent wyvern
random bane
#

hi anyone here?

#

I have a question on a mission i'm making

#

not sure if it's possible, but in arma anything is possible, right?

#

It's a capture/hold game where bluefor and opfor are fighting for control of a base that is held by indepentents who are friendly to neither...i have indepentents that spawn and waypointed to certain buildling locations ( specifically air base mike-26 on Stratis...) My question is in 2 parts, A, is there a way to make independent units respawn without making them 'Playable' and B, can I respawn these units to adhere to their original waypoints before they were killed
I want the guerrila to keep respawning and keeping control of the base to add a challenge to the opfor and bluefor teams who are trying to get control of it themselves

jade abyss
random bane
#

i tried there

somber skiff
#

Use ALiVE ;)

random bane
#

what's that?

spice kayak
#

A mod for A3.

meager granite
#
[
     diag_codePerformance [{private _class = typeOf player; _class; _class}]
    ,diag_codePerformance [{typeOf player; typeOf player}]
]
```=>`[[0.00056,100000],[0.00053,100000]]`
somber skiff
#

For mission making

meager granite
#

If you need player's class twice, its faster to just get it twice than to store it in local variable πŸ€“

spice kayak
somber skiff
#

place modules in the editor and go

random bane
#

ahh i've seen that on a server i played on

pliant stream
#

Locals seem to be really slow for whatever reason.

meager granite
#

Similar case, but local variable is tiny bit better:

[
     diag_codePerformance [{private _var = player == player; _var; _var}]
    ,diag_codePerformance [{player == player; player == player}]
]```=> `[[0.00066,100000],[0.00076,100000]]`
pliant stream
#

I guess it's just all the hashtable lookups for local variables.

pulsar bluff
#

= is expensive

pliant stream
#

Introducing the first variable in a scope is probably the greatest expense, since it has to allocate a new hashtable and unless they swapped it for a better open addressing implementation in A3, it's an array of arrays too.

still forum
#

How about

[
     diag_codePerformance [{private _x = 1; private _class = typeOf player; _class; _class}]
    ,diag_codePerformance [{private _x = 1; typeOf player; typeOf player}]
]
#

Yeah I think the issue is that the hashtable needs to resize and allocate, if its still empty. Which means it usually doesn't happen/isn't so bad in "normal" scripts

pliant stream
#

You ever consider creating static hash tables for each code during script compilation instead?

still forum
#

no

pliant stream
#

Would probably speed things up a lot.

still forum
#

"a lot" is relative πŸ˜„

pliant stream
#

In the context of SQF execution of course.

#

Overall it might or might not be a lot. I guess it depends on how many scripts are running.

pliant stream
#
local _v = 0;
for "_i" from 0 to 1000 do
{
  local _v = 0;
};

vs

local _v = 0;
for "_i" from 0 to 1000 do
{
  _v = 0;
};

This might be a very revealing comparison.

pliant stream
#

I don't have arma handy to test it myself right now.

pulsar bluff
#

anyone had this script error before

#

GIAS pre stack size violation

still forum
#

Previously it was called "Generic error in expression"

#

My guess, your function is ending with

_x = y
};

#

so no return value

pulsar bluff
#

hmm ok ill look into it. occurs only once per session

keen stream
#

ALiVE is one of these essential mods for A3 next to ACE3 and TFR/ACRE2 imho. :)

little ether
#

Maybe a random question, but before I waste a bunch of time looking, does anyone know if it's possible to add ACE interations to an object purely through that objects init field?

meager granite
#

Assigning local variable and using it twice is still slower

proven charm
#

I'm trying to figure why groups are so easy to flee when I have allowFleeing set at 0.2 . im also doing lot of deletevehicle/createunit for spawning the groups so maybe those affect it

#

courage of the units is above 0.9

#

wish there was away to get the current "morale" (how close unit is to fleeing)

pulsar bluff
#

i mean there is the "morale" command

proven charm
#

aah nice!

pulsar bluff
#

you could create your own moral function to incorporate damage, suppression, group members killed, etc

proven charm
#

if i just get the vanilla working im happy

#

morale 0.8 and the guy starts fleeing :/

south swan
#

If the group losses by injury/damage or death/destruction are higher than the max strength, multiplied by leader's courage or allowFleeing level , then the group will start fleeing.

cowardice: Number - 1 is maximum cowardice and 0 minimum. A value of 0 will disable fleeing all
The command description on wiki seems to contradict itself notlikemeow

still forum
#

previously with any variable or nular command the engine was checking at execution whether that name is a variable, if it isn't it must be a nular command, and if it then isn't actually a command it just returns a nil.
So I moved that check to compiletime

My test results were good, but not as good as I expected

Actually, that only applies to global variables... so won't apply here.
Locals are already fast because it checks for starting _

#

But... every nular command also tried to look up a global variable with the same name first.
So all nular commands are getting faster, and I guess also undefined global variables πŸ€”

meager granite
#

Interesting details, thanks for the insight πŸ€”

copper raven
still forum
#

Actually that will make your variable thing even worse XD
Because player will execute faster, so the one without variable will even further ahead

meager granite
pliant stream
meager granite
winter rose
meager granite
pliant stream
pliant stream
meager granite
still forum
meager granite
still forum
#

Also on compilation its hashtable so, not that much better to have less

meager granite
# pliant stream Yeah, possibly.
[
     diag_codePerformance [{
        private ["_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "_r", "_s", "_t", "_u", "_v", "_w", "_x", "_y", "_z"];
        _a = 1; _b = 1; _c = 1; _d = 1; _e = 1; _f = 1; _g = 1; _h = 1; _i = 1; _j = 1; _k = 1; _l = 1; _m = 1; _n = 1; _o = 1; _p = 1; _q = 1; _r = 1; _s = 1; _t = 1; _u = 1; _v = 1; _w = 1; _x = 1; _y = 1; _z = 1;
    }]
    ,diag_codePerformance [{
        private _a = 1; private _b = 1; private _c = 1; private _d = 1; private _e = 1; private _f = 1; private _g = 1; private _h = 1; private _i = 1; private _j = 1; private _k = 1; private _l = 1; private _m = 1; private _n = 1; private _o = 1; private _p = 1; private _q = 1; private _r = 1; private _s = 1; private _t = 1; private _u = 1; private _v = 1; private _w = 1; private _x = 1; private _y = 1; private _z = 1;
    }]
]
```=> `[[0.00531,100000],[0.00365,100000]]`
copper raven
copper raven
#

the first code, you allocate _v and store a 0 into it. everytime that loop iterates, it allocates a new variable (in that scope), and assigns 0 to it.
the latter code, you allocate _v again, store 0, but this time when the loop iterates, it instead assigns 0 to the one in the parent scope, and no new variables are created (no private).

meager granite
#

codePerformance doesn't run code on same scope each iteration, is it?

copper raven
#

we are talking about different things here πŸ˜„ i meant the for test you did

meager granite
copper raven
meager granite
#

Another test, now with nested scopes:

[
     diag_codePerformance [{
        private ["_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "_r", "_s", "_t", "_u", "_v", "_w", "_x", "_y", "_z"];
        call {_a = 1; call {_b = 1; call {_c = 1; call {_d = 1; call {_e = 1; call {_f = 1; call {_g = 1; call {_h = 1; call {_i = 1; call {_j = 1; call {_k = 1; call {_l = 1; call {_m = 1; call {_n = 1; call {_o = 1; call {_p = 1; call {_q = 1; call {_r = 1; call {_s = 1; call {_t = 1; call {_u = 1; call {_v = 1; call {_w = 1; call {_x = 1; call {_y = 1; call {_z = 1}}}}}}}}}}}}}}}}}}}}}}}}}};
    }]
    ,diag_codePerformance [{
        call {_a = 1; call {_b = 1; call {_c = 1; call {_d = 1; call {_e = 1; call {_f = 1; call {_g = 1; call {_h = 1; call {_i = 1; call {_j = 1; call {_k = 1; call {_l = 1; call {_m = 1; call {_n = 1; call {_o = 1; call {_p = 1; call {_q = 1; call {_r = 1; call {_s = 1; call {_t = 1; call {_u = 1; call {_v = 1; call {_w = 1; call {_x = 1; call {_y = 1; call {_z = 1}}}}}}}}}}}}}}}}}}}}}}}}}};
    }]
    ,diag_codePerformance [{
        call {private _a = 1; call {private _b = 1; call {private _c = 1; call {private _d = 1; call {private _e = 1; call {private _f = 1; call {private _g = 1; call {private _h = 1; call {private _i = 1; call {private _j = 1; call {private _k = 1; call {private _l = 1; call {private _m = 1; call {private _n = 1; call {private _o = 1; call {private _p = 1; call {private _q = 1; call {private _r = 1; call {private _s = 1; call {private _t = 1; call {private _u = 1; call {private _v = 1; call {private _w = 1; call {private _x = 1; call {private _y = 1; call {private _z = 1}}}}}}}}}}}}}}}}}}}}}}}}}};
    }]
]
```=> `[[0.00881,100000],[0.0101404,98615],[0.00889,100000]]`
#

What's interesting is that sometimes it works much slower [[0.0132219,75632],[0.014583,68573],[0.0135597,73748]], probably memory allocation or something.

copper raven
#

all makes sense there, the first one you allocate a bunch of variables at once, then all thats left is just the scope lookup (to see if the variable exists already). the second one, it has to do a scope lookup and also allocate one by one (which ofc makes it the slowest), and the last, no scope lookup, but allocating one by one again.

meager granite
#

The main comparison was about 1st and 3rd codes, about my thought that old style private ARRAY initialisation of all function locals as first line was beneficial to code performance, and how much.

#

Not much it seems.

warm coral
#
["Message: %1", _hint] call zen_common_fnc_showMessage
#

how would i turn this into remoteexec?

#

i have been trying but couldnt figure it out

hallow mortar
#
["Message: %1",_hint] remoteExec ["zen_common_fnc_showMessage"];```
#

If you want to use the optional target and JIP parameters, they go at the end of the right argument, e.g.

["Message: %1",_hint] remoteExec ["zen_common_fnc_showMessage",0,true];```
to target all machines and add to the JIP queue
faint oasis
#

Hi, i have a question ? I put some units directly in a VTOL with the editor but everytime i launch the mission they are getting out and the same thing happen sometimes with the zeus when i teleport units inside a vehicle so is there a command to avoid this ? Because when the units are getting in with the "order" instead, it's working.

marble plume
#

Hi all, looking for some scripting help and hoping for a miracle.

I've recently made a few missions for my unit which are making use of triggers and hold actions. The triggers are working fine with everyone being able to see/hear the effects (mostly SFX and other audio, with some teleports).
The hold actions, however, seem to be a little finicky. They work fine in 3den (I have used them to do small effects like spawn an explosion or delete doors, which work fine) but the various other effects like screenshake and audio playing don't play for all nearby players and it seems kind of random who does and doesn't hear it.

Is there a way round this? Can it be set to run locally? Should I put the whole sequence inside of a determiner like nearPlayers or something?
Thanks in advance.

wanton swallow
#

Is it possible to disable channel input for a player, but allow read chat?

marble plume
little raptor
#

Another important thing is that scheduled script timing is heavily dependend on the number of active scripts in the scheduler. If you have timing problems too that could be the issue (e.g. you use sleep 1 but the script seems to sleep for 2 seconds, etc.)

little raptor
marble plume
#

Gotcha

#

Gotta love ARMA scripting fml

stuck palm
#

Trying to pass a variable through to a custom function that spawns comps. The function works in other tests just fine. However, I am trying to call it on initServer.

_ZoneComp = missionNamespace getVariable ["ALP_mainZone", ""];
diag_log format ["_ZoneComp value:%1", _ZoneComp];
_compReference = [_ZoneComp, [], [0,0,0], 0, true, true, false] call LARs_fnc_spawnComp;

Upon mission start, I get the Error >>: Type Object, expected string.
In the RPT, this pops out:

11:17:13 "_ZoneComp value:ALP_Area_01"
11:17:13 Error in expression < missionConfigFile >> "CfgCompositions" >> _compName;

Made sure it's calling something valid. Anyone have any ideas?

broken plinth
little raptor
digital hollow
#
this addAction ["Hack", {
    bexy_hacked = true;
    publicVariable "bexy_hacked";
    "Hacked" remoteExec ["systemChat"];
}]; 

or did you mean remoteExec? @broken plinth

broken plinth
broken plinth
#

So this from my understanding?

digital hollow
#

That should be fine.

marble plume
# little raptor Not everywhere. You must check the script thoroughly, read the wiki page for eve...

Question for you, if you don't mind.
I was able to get say3D working in 3den using [exectest_1, "Alarm"] remoteExec ["say3D"] instead of just exectest say3D "Alarm";
Is this the correct syntax for locality for the say3D command? I can't see anything on the wiki that specifically mentions locality, though I can see there are a few for say3D in particular that offer quite a few variables like pitch or offset.
Will this work? Do I need to add additional files somewhere in the mission folder or something? Thanks.

broken plinth
winter rose
marble plume
winter rose
#

if it doesn't what?

#

if it says "Global effect" then one call on one machine will be broadcast to all the others, yes

#

then the icon looks like this

marble plume
#

Gotcha. And if it has neither, such as in the case of "sleep"?

winter rose
#

it is either undocumented or irrelevant

marble plume
#

So sleep could work feasibly like this:

Line1 with remoteExec
sleep 5;
Line2 with remoteExec

marble plume
winter rose
#

anytime! 🍻

lavish canyon
#

Hi guys. How to get all unit names from allUnits to new array?

copper raven
lavish canyon
marble plume
#

Currently trying to convert the following script into a remoteExec format, anybody able to lend a hand? I'm a little confused given it's kind of a multi-stage thing.
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;

#

Is this along the right lines? Only the addCamShake is a local effect, the rest are unspecific.
["forEach (getPos podstart) nearObjects 50"] remoteExec ["addCamShake [20, 6, 50]"]

marble plume
little raptor
#

I'm not talking about remoteExec. that code is wrong

marble plume
little raptor
#

pretty sure it doesn't

marble plume
#

I can get you a gif of it working lmao, it does.

little raptor
#

it does add the camshakes and then throws an error

marble plume
#

Mine doesn't throw an error, weirdly enough.

#

But if there's an issue there I need to address as well I'm happy to learn. I wanna make some more immersive stuff for my guys.

little raptor
#

well I have no idea what you're trying to do with it anyway

#

it just makes no sense

marble plume
#

It's part of a series of stuff that results from a Hold Action command. I can send you the whole thing in PM if you want, or post it here.

#

I am also using 3den Enhanced to do this stuff, if that matters.

little raptor
#

no. I just mean what is that code supposed to do?

little raptor
#

I can tell you without running it that it does throw error

marble plume
#

It calls a series of sounds and camshakes in a sequence for nearby players.

#

Then the final part of it deletes an object that allows them to exit the shuttle-esque thing they're in. I tried a setPos but that proved to be kinda laggy, so deleteVehicle works way better.

#
sleep 5;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 3;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 1;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 1;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 1;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 1;
breachtop say3d "DT_C_Overdrive";
{addCamShake [10, 16, 10]} forEach (getPos podstart) nearObjects 50;
sleep 8;
breachtop say3d "Smash_rockHit";
{addCamShake [20, 6, 50]} forEach (getPos podstart) nearObjects 50;
sleep 3;
breachtop say3d "Pod_doors";
deleteVehicle breachtop;
deleteVehicle breachbottom;```

This was the original script. I've already rewritten most of it in the remoteExec format, but the camshake line is giving me a headache.
#

(That script works perfectly in 3den with no errors, but this is the first serious attempt I've made in designing automated sequences beyond using triggers to blow stuff up)

jaunty zephyr
#

o.O I strongly disagree.But then, there's also people who disagree with ACE and TFR/ACRE being essential...

hallow mortar
#

Why are you doing addCamshake once for every object within 50 metres?
(and why start a new camshake before the previous one has finished?) the duration is / 2 for some reason, ignore that

south swan
#

Inb4 "i want players inside 50 meters radius to have a camshake"

little raptor
#

so it's running it 3 times for each component of getPos

hallow mortar
marble plume
#

My unit runs two ground squads, so I want them to be able to use the boarding torpedoes without hearing each other's sounds, hence the necessity for the nearObjects.

hallow mortar
#

Unfortunately that code would not do what you want it to do. It just runs addCamShake once for each object nearby. It doesn't apply it to the object - addCamShake only affects the local player's camera and can't accept an object as a target. It just applies a camshake to the local camera, once for each object. 20 objects nearby? The local player gets 20 camshakes.

marble plume
#

Right, because it definitely did not function that way in practice. It did what I wanted it to - it gave small camshakes the first few times, then a slightly larger one, then a much larger one. I don't know how, but it worked exactly how I wanted it to when I was testing it in 3den (prior to the knowledge that you need to remoteExec local effects).

#

I'm not meaning to cast doubt here for the record, I am just confused as to how it worked correctly when I'm being told it definitely shouldn't have.

hallow mortar
#

Testing alone in the Editor doesn't tell you anything about the (lack of) multiplayer effects

#

Probably you can only have one camshake effect active at a time, so those 20 shakes aren't stacking. But it won't affect other players like that, just the local one.

marble plume
#

By local you mean whoever activates the hold action, yes?

hallow mortar
#

Yes

south swan
#

and wouldn't account for distance at all

marble plume
#

Right. Do you know of any alternative solutions to get the same end result?

hallow mortar
#

Since say3D is also local effect, you should put this whole sequence into a function. Then in the holdAction, get a list of nearby players (this will require a little logic but not too hard) and remoteExec the function to all of them.

marble plume
#

Right. I have no clue how to do that.

south swan
#

or just if (player distance podstart < 50) then {addCamShake [20,6,50]}; and execute globally πŸ€·β€β™‚οΈ

marble plume
south swan
#

where do you have the script above? sfq file? Function? Whatever else?

marble plume
#

I should specify that I am also trying to make all of this in as "lite" a way as possible. I have other people who Zeus for my unit who aren't as technically-inclined, so I often give them stuff they can copy&paste as compositions.

marble plume
south swan
#

whoo boy

marble plume
#

As I said, I am trying to do this in a way that it's easiest to disseminate to my community.

#

It's, uh, a fine line to walk.

south swan
#

my first reaction would be to send the entire script first and still execute globally with something like sqf if (isNil "BAL_ShakeMeme") then { BAL_ShakeMeme = { if (isNil "breachtop" || isNil "breachbottom") exitWith {}; breachtop say3d "DT_C_EngineLoop"; sleep 5; breachtop say3d "medium_boom"; ... deleteVehicle breachtop; deleteVehicle breachbottom; }; publicVariable "BAL_ShakeMeme"; } [] remoteExec ["BAL_ShakeMeme", 0]; πŸ€·β€β™‚οΈ

foggy stratus
#

When I use Voice Attack with my SOG AI mod, to execute some of my scripts via some key bindings (specifically T key to invoke my custom menu, followed by 1 to call the first option's script), the following Interact Menu flashes on screen. This is not my menu, and I've never seen it before in all my years of playing ARMA. What is this menu, and why does it appear? https://i.ibb.co/WyssrQx/Capture.jpg

hallow mortar
#

That's the radio menu, the same kind of menu used when you give the AI orders using the F-keys. Custom ones can be made; some mod might be using it.

south swan
#

the same "when action completed" field should work

hallow mortar
marble plume
marble plume
hallow mortar
#

No

#

You need to read it and get how it works. It requires a cfgFunctions entry which is why it was probably a waste of time, since I'm guessing you don't want to use that.

marble plume
#

Yea, I'm trying to avoid more complicated stuff like that.

#

The rest of the sequence runs fine (all the sounds, sleeps etc) now that I've rewritten them with remoteExec, but the camshake is the only part that eludes me. If there really is no alternative, or no way to run the shake with a simple line of code, I'll just have to remove it.

#

But, y'know, it's pretty fuckin cool and immersive, so I'd rather find a way.

hallow mortar
#

It is possible to do it just purely by remoteExecing everything in the sequence. Use the list-of-targets generator from my script and remoteExec every single say3D and addCamShake to that list. This will work. It's just not a great way of doing it because it causes more network traffic than would be ideal.

marble plume
#

If CAManBase is the name for the standard human skeleton, then uh... bad news

digital hollow
hallow mortar
marble plume
#

And if not, just replace CAManBase with whatever is there?

foggy stratus
hallow mortar
marble plume
#

Ok so it does inherit from CAManBase.

#

I'll continue banging my head against the keyboard over this. Thanks for everybody's help thus far.

hushed tendon
#

Anyone have any clue as to why this doesn't work? It spawns and adds the item but it doesn't act as an item. I can only pick it up right kinda if I use inventory and drag it but it doesn't take up space and I can't use it. Also if I pick it up like most people by hand it doesn't go in my inventory and drops the next item I pick up

private _holder = createVehicle ["GroundWeaponHolder", _relPos, [], 0, "CAN_COLLIDE"]; 
_holder setDir (random 360);

_holder addWeaponCargoGlobal [_classname,_amount];
sullen sigil
#

I've got two objects of the same class -- though one can have its rotation changed loads and the other is always static. How would I go about teleporting the player to the same position on the static object as they are on the rotating one? For example, if they are at the edge of the object but it is rotated by 351 degrees, how would I put them at the same position on the object that is not rotatable?

#

Genuinely have no idea where to start with this one aside from a bunch of trigonometry but I'm convinced that's 100% not the approach I should be taking

hallow mortar
#

getPosATL > worldToModel on rotating object > modelToWorld on static object > setPosATL

sullen sigil
#

So something like

private _relPos = player worldToModel (ASLToAGL getPosASL temp1);
player setPosASL (AGLToASL (temp2 modelToWorld _relPos))```?
#

Where temp1 is rotating object and temp2 is the other

#

And for clarification just in case

hallow mortar
#

the worldToModel should be the other way around. You want the player's relative position to the object model, not the object's relative position to the player model

sullen sigil
#

ah that would explain why i was being put behind the object πŸ˜…
just need to do the same for rotation but think I can figure that one out, thanks -- surprisingly less headache than trig would've been πŸ™‚

sullen sigil
#

ok, rotation isnt quite there and idk why

private _vel = velocityModelSpace vehicle player;
private _dir = vehicle player getRelDir temp1;
private _vehDir = vectorDir vehicle player;
private _relPos = temp1 worldToModel (ASLToAGL getPosASL (vehicle player));
(vehicle player) setPosASL (AGLToASL (temp2 modelToWorld _relPos));
vehicle player setVectorDir [_vehDir#0, _vehDir#1, (_vehDir#2 - (_dir/360))];
vehicle player setVelocityModelSpace _vel;``` is what I'm using at the moment
#

Except it's turning the player a fair few degrees further than they were. _dir/360 is an attempt to normalise getRelDir to work with vectorDir

#

only just realised setvectordir is not xyz ive been daft

#

yeah problem solved nvm

sullen sigil
#

i was doing something stupid

manic kettle
#

is there a "pushFront" variant to "pushBack" function? I want something stored at the front without overwritting the first index

meager granite
#

Not as quick though

manic kettle
#

oh so specifying 0 wont overwrite 0?

meager granite
#

It might be better to build an array reversed and then do reverse once when you're done

meager granite
manic kettle
#

oh duh, i guess it is "inserting"... I'll test, thanks

broken plinth
#

New question.
If I have a action named Con2_Disable, and on its activation I want to delete a said object. How would I do that?
actionName Con2_Disable, delete shield1;

fervent wyvern
#

hi, i'm trying to add a sound when a player die but i can't do it with all the scrip i find, how can i do it?.

The script i use is:

in description.ext

class CfgSounds

{

sounds[] = {};

class music

{

name = "music";

sound[] = {"sound\music.ogg", 1,1};

titles[] = {};
};

};

and i try calling it via a sqf or just calling it in game but it doesn't work

viral birch
#

I think I need some help with BIS_fnc_guiMessage...Is it just not possible to make a conditional guiMessage??

I want to create a prompt that shows only one of two possible messages but the outcome is the same no matter which message is displayed.

// Return Territory Level (ie: _level = 6;)
_level = _flag getVariable ["ExileTerritoryLevel", 0];

// Compare Territory Levels and then display appropriate message
if (_level <= 5) then {
    _result = ["ONLY ASK NEWBIE QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
}
else {
    _result = ["ONLY ASK VETERAN QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
};

waitUntil {uiSleep 0.05; !isNil "_result" };

if (_result) then
{
    // If they click "Yes", do the things you do
};
// If they click "Nah", do nothing at all

However, the results I am getting are this:

if level >= 5, show veteran question and then show veteran question again after clicking "Yes/Nah" the first time
if level < 5, show veteran question first and then show newbie question after clicking "Yes/Nah" the first time

I don't get it. πŸ€·β€β™‚οΈ What am I doing wrong?

meager granite
#

You probably call this function twice

#

Once where _level is always 0 (_flag is null) and then where _level is proper (_flag is not null and returns your wanted level)

#

Add

diag_log [diag_frameno, "My question function", "_flag", _flag];
```to the top of the function and check the RPT
hasty current
#

Is there any way at all to disable collision between two PhysX objects - in my case, vehicles, specifically?

viral birch
hasty current
meager granite
hasty current
#

Dang..

viral birch
meager granite
#

Still got prompt show up twice?

viral birch
#

Yes

meager granite
#

Then its from another function elsewhere

#

Also just noticed, are you sure you have _result privated before your code?

#
if (_level <= 5) then {
    _result = ["ONLY ASK NEWBIE QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
}
else {
    _result = ["ONLY ASK VETERAN QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
};

waitUntil {uiSleep 0.05; !isNil "_result" };

Result will always be nil here because its defined in deeper scope

#

So your waitUntil never completes

viral birch
#

Yes. private["_object", "_result", "_level"]; are at the very top of this.

meager granite
#

Alright then

viral birch
#

_flag is not because it calls another function and needs to be used elsewhere in order to define it

meager granite
#
0 spawn {
    private ["_result"];
    _level = random 10;
    if (_level <= 5) then {
        _result = ["ONLY ASK NEWBIE QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
    }
    else {
        _result = ["ONLY ASK VETERAN QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
    };

    waitUntil {uiSleep 0.05; !isNil "_result" };

    systemChat str ["_result", _result];
};
```execute this in debug console, it works as it should
#

means you have another script or something that does the question prompt again

#
private _result = if (_level <= 5) then {
    ["ONLY ASK NEWBIE QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
}
else {
    ["ONLY ASK VETERAN QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
};
```you can setup your assignment like this btw
viral birch
#

Correct, it works as it should. That is why I am confused lol. I don't know why else that prompt would run a second time seeing as this function is the only place that it is used.

meager granite
#

If you see RPT line of "My question function" just once, yet you have 2 prompts, means another prompt is from another script

#

Unless there is something else in the function that you didn't post

viral birch
#

I understand and agree with what you are saying. I am just stumped as to how that is even possible. Any tips on trying to set up a breadcrumb to even begin to track that down?

#

....

#

LOL

#

I think I found it out, one sec....

#

If this is right, I am done for the night.

#

Jesus fucking christ...I can't believe that was the problem. πŸ˜… I somehow copied and pasted it a few lines above by mistake so it was running twice. I just didn't see it because it was much further up.

#

I was stuck on that for like an hour before bringing it here. Too much time coding today. Starting to make ridiculous and embarrasing mistakes after so many hours. πŸ˜† Thanks for walking my dumbass through it either way @meager granite 🍻

meager granite
#

Glad you figured it out

viral birch
#

Me too. Now to hide under a rock. πŸ˜„

warm hedge
#

It happens when it happens! πŸ™‚

pulsar bluff
#

the need is often "disable collision with everything" , and the available tool is "disable collision with 1 thing"

#

my guess is that "attachto" and "disablecollisionwith" are quite similar

#

you cant have A attachTo [B] and A attachTo [C] at the same time

#

nor can you have A disablecollisionwith B and A disableCollisionwith C

#

simultaneously

meager granite
#

Didn't it work when you did B A and C A?

#

basically swap arguments

#

I think it was something like each object can store one object they're not colliding with or something

#

So if you wanted to stop A from colliding with B and C, you set A to both of these objects, not B and C to A

south swan
#

isn't disableCollisionWith symmetric? Let me actually check.

#

example 3 in doc says it is

meager granite
#

Guess my info is wrong then

south swan
#

testing seems to confirm πŸ€·β€β™‚οΈ Still doesn't allow for any kind of many-to-many raltions

pulsar bluff
#

yea best to view it as a little sister of "attachto"

meager granite
#

@still forum Have you even looked into volumetric clouds in the game? I wonder how difficult it would be to have them identical between different players? I know that TrueSky was designed to be synced in multiplayer, but I wonder what goes wrong in Arma 3 with it.

#

Is it some kind of random number generator with different seed between clients? Is it bound to some internal timer that's different between clients?

#

Not sure how much work is it to debug it, but if its fixable, it will be a huge boost to immersion

pulsar bluff
#

arent the clouds another company

meager granite
#

They are, but I wonder if something wrong is being fed into them from Arma 3 side so they're not network synced.

#

Because TrueSky is supposed to be multiplayer compatible and produce same clouds

pulsar bluff
#

i use simulweathersync locally at sneaky moments to keep client cloud cover sorta synced. never considered global synced cloud cover tho

#

lets see what dedmen thinks

meager granite
#

That was the first thing I noticed when I player Arma 3 the first time, clouds were different between players

#

Huge immersion breaker for me

pulsar bluff
#

noticable when testing with 2 clients in loopback mode i agree

#

simulweathersync locally helps altho it has a stutter so you need to pick right moments to use it

meager granite
#

It doesn't produce same cloud coverage, my guess is that procedural cloud generation depends on something that isn't network-synced

#

Like some arbitrary "center" position, or some seed value or some timer, idk.

#

Knowing that TrueSky was made to be net-synced, it might be fixable in Arma 3

coarse needle
#

Needing alive depends on what kind of missions you mainly play :P

still forum
meager granite
#

Making it rain only if you're directly under a cloud could also be a thing, but you'll end up with 2 players near each other with one having a cloud above and the other not, would be an immersion breaker as well.

still forum
#

could be a thing but isn't and won't be

meager granite
#

Not talking about it being engine thing, I wanted to script that when I saw these cloud position check commands.

winter rose
#

Dwarden mentioned something about clouds shadows at one point 😏

meager granite
#

In Reforger πŸ€”

winter rose
#

and clouds should be sync in Reforger iirc

#

so quit complaining and update πŸ˜›

meager granite
gloomy basalt
#

Hi, I was wondering if anyone could help me.
In my fn_assignZeus.sqf I have this bit of code:

params [
    ["_unit",objNull,[objNull]]
];

private _uid = getPlayerUID _unit;
private _zeusVariable = format ["zeus_%1",_uid];
private _zeus = missionNamespace getVariable [_zeusVariable,objNull];

if (isNull _zeus) then {
    private _group = createGroup [sideLogic,true];
    _zeus = _group createUnit ["ModuleCurator_F",[0,0,0],[],0,"NONE"];
    missionNamespace setVariable [_zeusVariable,_zeus];

    _zeus setVariable ["owner",_uid,true];
    _zeus setVariable ["Addons",3,true];
    _zeus setVariable ["BIS_fnc_initModules_disableAutoActivation",false];

    private _missionObjects = entities "Man";
    _zeus addCuratorEditableObjects [_missionObjects,true];

    _unit assignCurator _zeus;

    if !(SS_isZenEnabled) then {
        _zeus addEventHandler ["Local",{SS_fnc_zeusLocalityChanged}];
    };

    ["Admin Permissions granted.", player] call SS_fnc_notify;
};

private _adminMenu = [
    "adminMenu",
    "Admin Menu",
    "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\armor_ca.paa",
    {[] remoteExecCall ["SS_fnc_commandMenu",2]},
    {true}
] call ace_interact_menu_fnc_createAction;
[player,1,["ACE_SelfActions"],_adminMenu] call ace_interact_menu_fnc_addActionToObject;

Which is being called from initPlayerLocal.sqf through this bit of code:

if (profilename in ["SiegeSix"]) then {
    [player] remoteExecCall ["SS_fnc_assignZeus",2];
};

The issue I have is that when loading initially, I'll have access to zeus and the admin menu. When i respawn, I only have the admin menu, yet I don't have zeus access anymore. For info, I have ZEN loaded and the fn_zeusLocalityChanged.sqf looks like this:

params ["_zeus","_local"];

if !(_local) then {
    private _unit = getAssignedCuratorUnit _zeus;

    if (getAssignedCuratorLogic _unit isNotEqualTo _zeus) then {
        unassignCurator _zeus;
        [
            {
                params ["_zeus"];
                isNull getAssignedCuratorUnit _zeus
            },
            {
                params ["_zeus","_unit"];
                _unit assignCurator _zeus;
            },
            [_zeus,_unit]
        ] call CBA_fnc_waitUntilAndExecute;
    };
};

and the public variable SS_isZenEnabled is drawn from initServer.sqf

SS_isZenEnabled = isClass (configFile >> "CfgPatches" >> "zen_main");
winter rose
#
// pick your poison
_zeus addEventHandler ["Local", { call SS_fnc_zeusLocalityChanged }];
_zeus addEventHandler ["Local", { _this call SS_fnc_zeusLocalityChanged }];
gloomy basalt
#

Neither seems to work

winter rose
#

that may not be the problem, just raising this issue

#

and I suppose the EH is only added server-side

south swan
#

seems to be called from initPlayerLocal though disregard me it's remoteExec'd

#

if !(SS_isZenEnabled) then { may also misbehave is SS_isZenEnabled is nil (isn't defined)

gloomy basalt
gloomy basalt
lone glade
#

DAC and ALIVE and both staples for mission making

#

ALIVE is also updated pretty often

meager granite
#

https://community.bistudio.com/wiki/UAVControl

[player1, "DRIVER", player2, "GUNNER"] - player1 is controlling the UAV and is the pilot, player2 is controlling UAV and is the gunner
```How can two players control different UAV units in same UAV vehicle? UAV Terminal doesn't let you connect to a vehicle that's already connected to by another player.
#

Unless this is for script-connected cases?

#

Trying connectTerminalToUAV to connect second player, returns true yet its not connected

#

Oh, you must do direct control with remoteControl command, UAV terminal doesn't allow two players controlling same UAV

#

More reason to ditch it and script my own

fervent wyvern
#

hi, i'm trying to add a sound when a player die but i can't do it with all the scrip i find, how can i do it?.

The script i use is:
in description.ext
class CfgSounds
{
sounds[] = {};
class music
{
name = "music";
sound[] = {"sound\music.ogg", 1,1};
titles[] = {};
};
};

and i try calling it via a sqf or just calling it in game but it doesn't work

gloomy basalt
little raptor
#

i try calling it via a sqf or just calling it in game but it doesn't work
explain exactly what you do. just saying "it doesn't work" is meaningless

fervent wyvern
meager granite
#

ARRAY append ARRAY and ARRAY insert ARRAY not returning left operand array

meager granite
#

note the back slash \ at the beginning

#

Also make sure you reload the mission in editor after you change description.ext so changes apply

little raptor
meager granite
#

Will let you chain it like _array append _array2 append _array3 for example

south swan
#

people.like(javascript-style).method(chaining) 🀣

little raptor
meager granite
#

Currently writing this piece of code:

private _crew = if(unitIsUAV _vehicle) then {
      (UAVControl _vehicle select {_x isEqualType objNull})
    + (crew _vehicle select {_x call is_not_a_uav_unit && alive _x})
} else {
    crew _vehicle select {alive _x}
};
```All fine expect one edge case where same player can be both passenger and controlling the UAV.
#

So you end up with _crew having 2 of the same unit

#

I'd make it:

    (UAVControl _vehicle select {_x isEqualType objNull})
    insert [-1, crew _vehicle select {_x call is_not_a_uav_unit && alive _x}, true]
```(`array insert [index, valuesToInsert, onlyIfUnique]`) but `insert` doesn't return and I have to declare another local variable
#

If there was appendUnique but it probably wouldn't return the array either

#

Thus my frustration

#

Muh microseconds

#

Its map's Draw event so I'm trying to squeeze as much ms as possible

little raptor
#

you're doing all that select and array creation and you're worried about defining a local var?!

meager granite
#

Wish there was something like liveCrew to return alive and non-UAV crew in one command notlikemeow

south swan
#

and it seems you'd get objNull in your array if your UAV isn't currently controlled by a player

little raptor
#

microsec alone is not important. what percent of the total operation is what matters

meager granite
#

Great idea to return mixed type values in same array, thanks Arma, very cool

little raptor
# meager granite πŸ‘†

change your select code to alive _x && is_not_a_uav_unit and use _x instead of _this in that function and it'll give you 3x more us than not defining a local var would give you blobdoggoshruggoogly

#

and that's 3x per iteration

south swan
#

inb4 #define-ing the is_not_a_uav_unit to allow reusing while not creating extra scope in runtime

meager granite
#

There are players in UAVs very rarely

#

But good idea nonetheless

little raptor
#

in case you've forgotten, sqf && (|| too) is not lazy. when you run call _a && call _b both will always run

#

so you would call the function and your alive check would run too

#

with that change at least the function call is lazy

#

also the call now omits _x and implicit definition of _this so those 2 will save perf too. and call is removed too. so altogether you get at least ~3x more us than skipped local var def. if the unit is not alive the function call is skipped completely and you get many more us

meager granite
#
    if(!isNil"uav") then {deleteVehicle uav};
    uav = createVehicle ["B_UGV_01_rcws_F", getPos player, [], 10, ""];
    createVehicleCrew uav;

    is_not_a_uav_unit_cache = createHashMap;
    is_not_a_uav_unit = {
        private _not_uav = is_not_a_uav_unit_cache get typeOf _this;
        if(isNil"_not_uav") then {
            _not_uav = getText(configFile >> "CfgVehicles" >> typeOf _this >> "simulation") != "UAVPilot";
            is_not_a_uav_unit_cache set [typeOf _this, _not_uav];
        };
        _not_uav
    };

    is_not_a_uav_unit2 = {
        private _not_uav = is_not_a_uav_unit_cache get typeOf _x;
        if(isNil"_not_uav") then {
            _not_uav = getText(configFile >> "CfgVehicles" >> typeOf _x >> "simulation") != "UAVPilot";
            is_not_a_uav_unit_cache set [typeOf _x, _not_uav];
        };
        _not_uav
    };

    [
         diag_codePerformance [{
            crew uav select {_x call is_not_a_uav_unit && {alive _x}}
        }]
        ,diag_codePerformance [{
            crew uav select {_x call is_not_a_uav_unit && alive _x}
        }]
        ,diag_codePerformance [{
            crew uav select {alive _x && is_not_a_uav_unit2}
        }]
    ]
```=> `[[0.00404,100000],[0.00406,100000],[0.00372,100000]]`
#

Indeed, a small performance gain

little raptor
#

it's roughly ~9% faster

meager granite
#

Fixed

#

Thanks for the good idea

manic kettle
#

These guys shaving off a percent of a percent of a ms, meanwhile I'm here defining variables like I'm a thrift store

velvet merlin
#

is it possible to use createSimpleObject object with FX classes and it works in a meaningful way? or is createVehicle[Local] a must with FX?

#

or weaponholders

little raptor
velvet merlin
#

_light = "#lightpoint" createVehicle _centerPos;
_lowCloud = "#particlesource" createVehicleLocal (getPos (vehicle player));
_fire = "Land_LIB_FX_Big_Fire" createvehicle [0,0,0]; //cfgVehicle - type house. dummy object with initEH
_smokegrenade = "LIB_NBKS39" createVehicleLocal [0,0,0];//cfgAmmo

little raptor
#

that too

velvet merlin
#

can simpleObjects move at all?

little raptor
#

no

south swan
#

i'd say it depends on definition of "move" πŸ€·β€β™‚οΈ You can setPos* them. You can set the animation phase. If you're willing to negate most of its performance benefit - you can, say, animate them per-frame or something

hallow mortar
#

They will also move if attached to something

little raptor
#

I'm sure he just meant normal movement (e.g fall, etc.)

little raptor
south swan
#

well, i myself found the "animate needs instant flag set to true" part less-than-obvious at point, so i decided to mention it here πŸ€·β€β™‚οΈ

sullen sigil
#

Is there any way to increase the update frequency of an object that anyone knows of

winter rose
#

the… update frequency?

#

like, 144 Hz and such?

proven charm
#

the static objects for example have really long update frequency, if that's what is meant here

hallow mortar
#

Attached objects inherit the simulation rate of the object they're attached to. Obviously that can cause other problems, though.

velvet merlin
#

just looking into perf optimizations from replacing createVehicleLocal if possible

sullen sigil
#

Sorry I didn't clarify mb

proven charm
#

why is loading map with many static objects so slow? i once put walls around a town and loading took really long. but why, they are just static objects

pulsar bluff
#

in your own mission? static objects shouldnt increase load time too much

proven charm
#

but they do...

pulsar bluff
#

there are systems out there which spawn objects slowly and hold the loading screen up until the spawning is done

hushed tendon
#

Anyone have any clue as to why this doesn't work? It spawns and adds the item but it doesn't act as an item. I can only pick it up right kinda if I use inventory and drag it but it doesn't take up space and I can't use it. Also if I pick it up like most people by hand it doesn't go in my inventory and drops the next item I pick up

private _holder = createVehicle ["GroundWeaponHolder", _relPos, [], 0, "CAN_COLLIDE"]; 
_holder setDir (random 360);

_holder addWeaponCargoGlobal [_classname,_amount];
little raptor
tough parrot
#

is there a command to get 3d unit direction

little raptor
#

vectorDir

outer python
#

Hello, I have a little problem, I need your help.

Let me explain. I want in my scenario to have a trigger that "Triggers an ambient sound for all players in all the game. And that this via another trigger can be deactivated.

My ambient theme is an ambient noise of war. Something normal audible from everywhere without having a specific distance.

You will probably tell me "There are videos" but the problem is that no matter how much I do as in the "Videos" it's never what I'm looking for". Would you have a solution, help?

little raptor
#

in CfgSounds?

outer python
#

@little raptor I'm having trouble understanding what I should do to create a cfgsound, and how it should be linked. If it is txt, sqf, etc... This is my first time using this

little raptor
outer python
#

@little raptor Okay, lets go I tell you that again

#

@little raptor compared to that in my description.txt I put it or that? How do I place it in relation to that?

#
respawnOnStart = -1;```
#
{
    sounds[] = {};
    class wolf1
    {
        // how the sound is referred to in the editor (e.g. trigger effects)
        name = "my_wolf_sound";

        // filename, volume, pitch, distance (optional)
        sound[] = { "fx\wolf1.ogg", 1, 1, 100 };

        // subtitle delay in seconds, subtitle text
        titles[] = { 1, "*wolf growls*" };
    };```
little raptor
#

don't use google translate on that page...

#

the config must be exactly like that page

#

you're translating it

#

so it won't work

outer python
#

oh yeah, sorry πŸ™‚

#

yes it's in basic english, it was just me to know what was written lol

outer python
little raptor
#

anyway, let's say you want to add a "war sound" as you said. put your ogg file in sounds\warsound.ogg in your mission folder

respawnDelay = 10;
respawnOnStart = -1;
class CfgSounds
{
    sounds[] = {};
    class myWarSound
    {
        // how the sound is referred to in the editor (e.g. trigger effects)
        name = "War sound";

        // filename, volume, pitch, distance (optional)
        sound[] = { "sounds\ambience1.ogg", 1, 1, 100 };
        titles[] = {};
    };
};
hallow mortar
outer python
#

I have this in my "Beginning" scenario file.

little raptor
#

remove the txt file

outer python
#

in the .ext my respawndelay is there.

outer python
#

and...

little raptor
outer python
#

Okay, so what next?

little raptor
#

in your sounds folder add your warsound.ogg file

outer python
#

its okay

hushed tendon
outer python
#

Then I have to know how and where to place the CfgSounds without it blocking my respawndelay, line 1 and 2 @little raptor

little raptor
#

I showed you that a hundred times

outer python
#

@little raptor then, in game, how do I make it from a trigger activated by the players it can be audible until having reached another trigger for example or not and deactivated or not.

little raptor
#

for now test if your sound works at all

#

playSound "myWarSound"

outer python
#

ok I will try.

#

@little raptor

little raptor
outer python
little raptor
#

does it play the sound?

outer python
#

Which line should I touch to increase, decrease the volume?

outer python
little raptor
#

the first 1 is the volume

#

// filename, volume, pitch, distance (optional)

outer python
#

to have a good sound, audible without being too loud, how much could I set it to for a war atmosphere like this?

hallow mortar
#

That depends on the sound file. The volume the sound is recorded at, in the sound file itself, also affects the volume. You'll have to figure that out yourself, by trying it and listening to the results.

outer python
#

Is there a maximum for the setting? or else an infinite number until killing the ears πŸ™‚

#

@hallow mortar

hallow mortar
#

I have no idea.

outer python
fiery sage
#

Hello everyone. I'm trying to work on a SIGINT type mod. To preface, this entire script could be 100% wrong but I'm still learning. I keep getting a missing ) for the following when trying to execute in game:

private _radius = 1000;
private _units = [];

forEach (allUnits inArea (position Ant_Collect_Deployed), _radius) {
    if (side _x in [west, east, independent, civilian]) then {
        _units pushBack _x;
    };
};

private _blufor_units = _units select {side _x == west};
private _opfor_units = _units select {side _x == east};
private _indep_units = _units select {side _x == independent};
private _civilian_units = _units select {side _x == civilian};

// Clear existing markers
{
    if (typeName _x == "STRING" && _x call BIS_fnc_inString && (markerType _x) == "mil_dot") then {deleteMarker _x;};
} forEach allMapMarkers;

// Add new markers for detected groups
{
    private _marker_color = switch(side _x) do {
        case west: { "ColorBlue" };
        case east: { "ColorRed" };
        case independent: { "ColorGreen" };
        case civilian: { "ColorViolet" };
    };
    private _marker = createMarker ["", position _x, _marker_color];
    _marker setMarkerType "mil_dot"; // Set the marker type to a circle
    _marker setMarkerSize 100; // Set the size of the circle
} forEach _units;

// Schedule another sweep in 30 seconds
[] spawn {
    sleep 30;
    if (!isNull findDisplay 46) then {
        [] spawn {call compile preprocessFileLineNumbers "sigint_sweep.sqf";};
    };
};```
Any ideas?
#

oof sorry for the wall

outer python
#

Thanks for your help both of you! I'll make way for my next problem when I have one, surely soon πŸ˜‚ @hallow mortar @little raptor

hallow mortar
fiery sage
#

LOL

#
{
    if (typeName _x == "STRING" && _x call BIS_fnc_inString && (markerType _x) == "mil_dot") then {deleteMarker _x;};
};``` This or wouold the forEach be inside the braces with the rest?
hallow mortar
#

That's not the first forEach

fiery sage
#
    if (side _x in [west, east, independent, civilian]) then {
        _units pushBack _x;
    };
};``` Ah so that to this? ```{
    if (side _x in [west, east, independent, civilian]) then {
        _units pushBack _x;
    };
    forEach (allUnits inArea (position Ant_Collect_Deployed), _radius)
};```
hallow mortar
#

Almost. Remember, forEach goes { code } forEach _array.

{
      if (side _x in [west, east, independent, civilian]) then {
        _units pushBack _x;
    };
} forEach // ....BUT WAIT!```
The way you're trying to generate the initial list of units (that stuff with `allUnits`) is also wrong. `allUnits` is an array of units. `inArea` doesn't accept an array, so you can't use it like that. And the syntax is wrong where you're trying to throw in a radius parameter as well.
still forum
hallow mortar
#

The first forEach can be replaced entirely with this:

_units = (allUnits inAreaArray [Ant_Collect_Deployed,_radius,_radius]);```
tough parrot
#

doArtilleryFire is very unreliable. sometimes the position that is targeted is wrong and sometimes and it just looks in the direction for a moment, then goes back.

last rain
#

Are there functions similar to linearConversion, only to be able to specify arrays of values from which to choose an approximate number?

outer python
#

@hallow mortar I have this displayed but I don't know why, I added a sound in the + file, it works but I have this nonetheless.

#
{
    sounds[] = {1};
    class myWarSound
    {
        // how the sound is referred to in the editor (e.g. trigger effects)
        name = "War sound";

        // filename, volume, pitch, distance (optional)
        sound[] = { "sounds\ambience1.ogg", 5, 1, 100 };
        titles[] = {};
    };   |LINE 14|
    sounds[] = {2};
    class myLandingSound
    {
        // how the sound is referred to in the editor (e.g. trigger effects)
        name = "Landing sound";

        // filename, volume, pitch, distance (optional)
        sound[] = { "sounds\landing.ogg", 4, 1, 100 };
        titles[] = {};
    };
};```
hallow mortar
#

Remove sounds[] = {2};, it's unnecessary. sounds[] = {1}; is wrong, replace it with sounds[] = {};

outer python
#

ok

hallow mortar
#

You don't need a sounds[] = {}; for every entry in CfgSounds. It's a single thing that only exists once in all of cfgSounds.

outer python
#

ok, so I have to delete what and on which line to add as many sounds as I want on the same document here?

#

I have change

hallow mortar
#

When I said remove sounds[] = {2}; I meant remove it. Do not have that line.

outer python
#

Ahhh

#

This ?

hallow mortar
#

Yes

outer python
#

no first ?

#

" 1 "

hallow mortar
#

You still need the first sounds[] = {}; at the start, but only that one, and without modification. There can only be one of those in all of CfgSounds, and that's all it needs to be.

outer python
#

ok

#

and suddenly the problem of the 3 Line 14 "of the screen above, what is it?

#

Ah, I just understood, that was it, like what he tells me that there is already 1 suddenly.

hallow mortar
#

That error was caused by the line you've just removed. You had two of that line, and that's not allowed. I think if you test it now, you'll find the error is gone.

outer python
#

i go test

#

@hallow mortar its good for me πŸ™‚

#

@hallow mortar Another important question. The first sounds, "War Ambient". I want them to be permanent as long as there is no trigger that deactivates it, activates it.

#

Haha, lots of questions... πŸ™‚

#

because the first sound lasts around "4 minutes" but I think it will stop one moment or another after this time... I wish that it repeats itself as long as they have not not been deactivate.

hallow mortar
#

What is the trigger condition?

outer python
#

here

#

condition "this"

#

What do I have to do ? @hallow mortar

hallow mortar
#

I'm thinking

#
// In this trigger
azul_var_doSound = true;
while {azul_var_doSound} do {
    azul_var_soundSource = playSound "myWarSound";
    sleep 240; // Change this number to the actual length of the sound, in seconds.
};

// In the other trigger, to stop it
azul_var_doSound = false;
deleteVehicle azul_var_soundSource;```
When the trigger is activated, this creates a loop, and sets a variable to `true`. The loop plays the sound, and saves the sound source object as another variable. It then waits for the duration of the sound to finish. Then it does it again. It does this as long as that first variable is `true`.

Your other trigger, to stop the sound, sets the first variable to `false`, which stops the loop. It also deletes the sound source object, which stops the sound that's currently playing, without waiting for it to play all the way through.
outer python
#

What is this ? " azul_var_doSound " its me ?? πŸ˜‚

#

or code ?

hallow mortar
#

It's the name of a variable. It's good to put your name on variables to make them unique, so they don't get overwritten by other scripts using the same variable names.

outer python
#

Oh ok, and so I put it like this? :Wait

#

just that and it's good, it repeats ad infinitum until the other variable is set to "False". ?

hallow mortar
#

Yes. Make sure to change the sleep 240; to use the actual length of the sound file in seconds. It's probably not exactly 240 seconds long, that was just a guess.

If you only set the variable to false, the sound that's currently playing will continue to play until it reaches the end. For example, if your sound is 240 seconds long, and you stop it 200 seconds into the current loop, it will keep playing for the remaining 40 seconds. It won't start the next loop, though.
The part with deleteVehicle is what stops it immediately instead of letting it finish the current loop.

outer python
#

yes its 286sec

#

i change this

#

@hallow mortar

#

this is the first trigger to play

hallow mortar
#

🀦 that's my mistake. I always forget.

outer python
#

ahah Don't worry

hallow mortar
#
azul_var_doSound = true;
[] spawn {
    while {azul_var_doSound} do {
        azul_var_soundSource = playSound "myWarSound";
        sleep 286;
    };
};```
Trigger code runs in what's called an "unscheduled" environment. This means the code is done _right now_, without any consideration for what other code wants to do. In this case, you can't have pauses like `sleep`, because you'd freeze the entire game. You have to use `spawn` to create a "scheduled" environment, which lets the game manage how the code is executed.
outer python
#

however when it triggers, so any player can trigger it. But is it specific to the player or is it for example activating and deactivating for everyone at the same time even if they are not in the trigger.

hallow mortar
#

This trigger uses Any player present activation, so it will activate whenever any player enters the trigger, even if that's not you.
If you want it to be player-specific, try changing the Condition field from this to player in thisList.

outer python
#

ok

#

@hallow mortar

#

Its good ?

hallow mortar
#

Keep the Activation drop-down set to "Any player" or "Anyone". Apart from that, yes.

outer python
#

ok

hallow mortar
#

We don't want to actually use the "Any player" or "Anyone" condition itself. That was what having this in the Condition field did. However, we still need the information it would use to detect whether that condition was true, which is contained in the thisList reference. Setting that dropdown tells the trigger to provide that information.

outer python
#

I go test, the first and 2nd trigger

hallow mortar
#

Actually, about that second trigger - does it basically just stop the sound if the player isn't in the area any more? If so, it's possible to bring all of this into the one trigger.

outer python
#

So, I put the "Player in thisList" and set it to "Anyone" - Present. But nothing happens...

#

I think I misunderstood.

outer python
hallow mortar
#

That's all correct. You might need to exit the Editor (save the mission first!) and open it again. The game doesn't always detect new sound files straight away.

outer python
#

I watch, wait

broken plinth
#

Hey everyone quick question, what would be the line of code to delete a object after interaction with a object.
So for example a console to delete a wall.

#

I have the action part down. Just cant find a way to make it delete the object.