#arma3_scripting

1 messages ยท Page 666 of 1

robust tiger
#

Or whatever position is the one in the back

little raptor
#

All I know is that it's a visual error
everything is correct

robust tiger
#

oh wait nvm

dusty whale
little raptor
#

it is

#

the math is saying that

dusty whale
#

how can that be a visual bug when the arrows dont allign

#

there are 2 objects

little raptor
#

that's what the math says
they are aligned

#

I don't care what is seen

dusty whale
#

ok, the portion they do allign is when the vectorLinearConversion is 1

#

so it IS vectorLinearConversion that is fucking it up

#

when the rangeTo is 1, the linear conversion returns correct

robust tiger
#

it might be floating point imprecision because the vector is too long and the rangeTo argument of vectorLinearConversion too small

little raptor
#

it's not
I told you before
when the math is correct the issue is somewhere else

#

you can't trust drawLine3D

dusty whale
#

look at the arrows

#

and listen to me

#

the arrows and the lines allign at rangeValue 1

#

but anything less than one and they diverge

little raptor
#

rangeValue 1 = end

robust tiger
#

its maybe the drawLine3D. it accepts AGL positions and Z coordinate in AGL system denotes the height above GROUND, so you need to adjust for that

robust tiger
#

well I fixed it ๐Ÿ˜›

#

it was just ASL AGL conversion chaos

#

the first arrow is still a bit fussy around hilltops

little raptor
robust tiger
#

lines 26 and 27 should be

arrow2 setPosASL _pos;  
arrow3 setPosASL _end;
little raptor
#

and you're converting them to AGL again?

robust tiger
#

well, they're no longer diverging, I thought that was the issue here

little raptor
#

and you're double converting to AGL

#

so Z is less than zero

#

so it always sticks to the ground

#

so you didn't fix anything

robust tiger
#

"it works on my machine"

little raptor
#

nothing is broken in the first place
nothing needs fixing

little raptor
#

@dusty whale actually I just realized what's wrong

#

I can't believe I didn't see it before

#

you're using vectorLineaConversion wrong

#

you first take the average of two AGL positions

#

then convert them to ASL

#

you have to convert them to ASL

#

then do the linearConversion

#

why?

#

because AGL is a relative position

#

you have to use ASL

#

which is absolute

#

yet another reason why I tell people to always use ASL

#

the correct version of your code:

arrow2 = "Sign_Arrow_F" createVehicle [0,0,0]; 
arrow3 = "Sign_Arrow_F" createVehicle [0,0,0]; 
addMissionEventHandler ["Draw3D",{ 
 private _end = [0,0,0]; 
 private _ins = lineIntersectsSurfaces [ 
   AGLToASL positionCameraToWorld [0,0,0],  
   AGLToASL positionCameraToWorld [0,0,viewDistance],  
   player, 
   vehicle player, 
   True, 
   1, 
   "FIRE" 
   ]; 
 private _start = vehicle player modelToWorld (vehicle player selectionPosition ["konec hlavne", "memory"]); 
 if (count _ins > 0) then { 
   _end = ASLToAGL (_ins select 0 select 0); 
  } else { 
   _end = positionCameraToWorld [0,0,viewDistance]; 
  }; 
 drawLine3D[_start, _end, [1,0,0,1]]; 
  
 private _perc = 100/(_start distance _end); 
  
 private _pos = (vectorLinearConversion [0,1,_perc,AGLToASL _start,AGLToASL _end,True]); 
  
 arrow2 setPosASL  _pos; 
 arrow3 setPosASL AGLToASL _end; 
 drawLine3D[_start, ASLToAGL _pos, [1,0,0,1]]; 
  
 hintSilent str(_pos); 
  
}];
#

All I did was move AGLtoASL inside vectorLinearConversion

#

it should work

dusky pier
#

is exists any command to check player connection to server?

still forum
#

can you explain in more detail?

dusky pier
#

i mean - need to check if player connection not lagged atm, something like -

call checkPlayerConnection;

without send request to server with script and waiting for answer,
or sending data from server to all players every few seconds

still forum
#

can't really do that without sending data/request

winter rose
#

getting the client's connection status from the client is doable I believe (when desync is found)
getting the client's connection status from the server mayhaps ๐Ÿฎ

dusky pier
#

understood :\

needed to check if player's connection is not lagged when player open inventory of container

autumn swift
#

Hi, how can I remove the right picture of a item in a tree view? Passing an empty string like: _ctrlTree tvSetPictureRight [_path, ""] doesn't seem to work...

stable wedge
#

Are there class name lists of weapons and equipment from popular mods like RHSUSAF etc?

#

Wanting to create a restricted arsenal with just those mod weapons without going through it one by one

robust tiger
#

There's probably a property on that in their config

#

you just need to dig through it

#

I do not have RHS installed right now, but it would be something like:

private _arr = "getText (_x >> 'property') == 'somethingRHS'" configClasses(configfile >> "CfgWeapons");
private _RHSWeaponNames = _arr apply {configname _x};
dark ivy
#

I'm trying to find the side of a player before he dies via onPlayerKilled.sqf
The wiki says that this has the passed argument of _oldUnit so I attempted side (_this select 0); but that returned CIV even though the player was BLUFOR. Same with side player, that also returns CIV. Is there a reliable way in which I can identify a player's side in onPlayerKilled.sqf or do I have to just do it quick and dirty with a global variable in initPlayerLocal.sqf?

little raptor
#

your other option is side group _oldUnit

dark ivy
#

was the player unconscious?
Nah. Straight up respawn button

#

Just tested side group _oldUnit and stumbled across playerSide and both work in that they display WEST. Thanks

little raptor
hollow lantern
#

I have the same codeblock in three switch-cases. Is there an efficient way to define it only once and re-use?

#

I know that you can define a function like KI_myFunction = {}; not sure if this is the correct way to do such things in this case

winter rose
#

you can yes

#
private _myCode = { hint "it works!"; };
switch (true) do
{
  case false: { hint "it does not workโ€ฆ"; };
  case true: _myCode;
};
hollow lantern
#

hmmm interesting, thanks!

upper siren
#

I've added a write to log file functionality to this fps monitor script: https://github.com/MildlyInterested/Arma3-Stuff/blob/main/FPS_Monitor.sqf (linking to github because script too long for discord).

Unfortunately it doesn't work correctly if executed on the server.
Executed on the player it looks like this in the rpt:
[Local FPS: 18 - 19] [Server FPS: 100 - 110 Servers: 1] [Headless FPS: 0 - 0 HCs: 0] [Client FPS: 48 - 69 Players: 1]

Executed on the server it looks like this:

17:22:38 [Local FPS: 111 - 111] [Server FPS: 0 - 0 Servers: 0] [Headless FPS: 0 - 0 HCs: 0] [Client FPS: 0 - 0 Players: 0]

I'm guessing this is because of some arma 3 locality thing in scripting? Can anyone point me in the direction as to what exactly in that script would need modifying?
Quite new to scripting, thanks ๐Ÿ™‚

hollow lantern
#

@winter rose question to that, my sqflinter displaying a warning stating that the variables I define at the start of my script might be undefined in the code block now (https://i.imgur.com/JNlIKgY.png) is this a expected behaviour? Do I need to have a params inside the codeblock and pass the variables to it?

still forum
#

If they are defined depends on where your function in there is called from

#

If you use it in a switch or "call" it directly below, it'll be fine

hollow lantern
#

from the same script in a switch-case where the variables are accessible to the switch-case

#

yes

still forum
#

But sqflint cannot really see how you will use the function

#

So it doesn't know

hollow lantern
#

hmm yeah makes sense

#

thanks

little raptor
dreamy kestrel
#

Q: trying to understand techniques such as # and ## better defining bits like MVAR(varName), which might yield something like "KPLIB_mission_varName". any pointers?

#

based on the preprocessor docs, not sure this makes sense...

#define LIB KPLIB
#define MODULE mission
#define MVAR(var)                   LIB##_##MODULE##var
#define MVAR_S(var)                 #(MVAR(var))
little raptor
#

With quotes?

dreamy kestrel
#

with or without yes

little raptor
#

Without:

#define MVAR(x) LIB##_##x
```With (not 100% sure)

#define QUOTE(x) #x
#define MVAR_s(x) QUOTE(MVAR(x))

dreamy kestrel
#

ah ok, cool. thanks...

little raptor
#

Also I typed this on the phone so there might be typo

dreamy kestrel
#

no worries, I have enough of a hint, thank you

#

but of course preproc does not work in a debug console ๐Ÿ˜–

dark ivy
#

Okay, I got a question: It seems like BIS_fnc_respawnTickets is executed twice in onPlayerKilled.sqf. If I have it set to subtract 1 ticket, it subtracts 2. If it's set to subtract 2, it subtracts 4. How can I fix this?

#

Might be related:

 0:59:39   Error Missing ;
 0:59:39 File C:\Users\Admin\Documents\Arma 3 - Other Profiles\ComboTombo\mpmissions\OP_Timber.Altis\onPlayerKilled.sqf..., line 10
 0:59:39 Error in expression <st, -1] call BIS_fnc_respawnTickets;
dark ivy
#

Well I must say, these error messages are very detailed and informative! I'm trying to end a mission in onPlayerKilled.sqf only when a side has no players alive AND no tickets left. I've tried this:

if (_numPlayersOnSide isEqualTo 0 && _numTicketsOnSide isEqualTo 0)
then {
endMission "END1";
};

and also this:

player call BIS_fnc_respawnEndMission; //I've also tried using (this select 0) and the variable name of an empty vehicle.

In both cases, I simply get this error:

if (_numPlayersOnSide isEqualTo 0 && _nu>
 9:56:11   Error position: <if (_numPlayersOnSide isEqualTo 0 && _nu>
 9:56:11   Error Missing ;

10:06:27   Error position: <player call BIS_fnc_respawnEndMission;
10:06:27   Error Missing ;
10:06:27 File C:\Users\Admin\Documents\Arma 3 - Other Profiles\ComboTombo\mpmissions\OP_Timber.Altis\onPlayerKilled.sqf..., line 13
warm hedge
#

Post the entire code

dark ivy
#
_playerSide = side group (_this select 0); //Check side of _oldUnit (aka the player before he died)
_numTicketsOnSide = [_playerSide,0] call BIS_fnc_respawnTickets;
_numPlayersOnSide = _playerSide countSide playableUnits;

if (_playerSide isEqualTo west)
then {
[west, -1] call BIS_fnc_respawnTickets; 
}
else { 
[east, -1] call BIS_fnc_respawnTickets;
}

player call BIS_fnc_respawnEndMission;
warm hedge
#

The error says everything you have to check. The ; after the } is missing

#

Line 11

dark ivy
#

Well it stopped screaming but it still executed -1 tickets twice

warm hedge
dark ivy
#

Yes

warm hedge
#
_playerSide = side group (_this select 0); //Check side of _oldUnit (aka the player before he died)
[_playerSide, -1] call BIS_fnc_respawnTickets; 

player call BIS_fnc_respawnEndMission;```Try. I never experienced with such multiplayer things maybe simplify it makes the troubleshoot easier
dark ivy
#

Unfortunately it still takes 2 tickets

copper raven
#

do a diag_log and see how many times the script is ran

warm hedge
#

Is there any chance that you're calling the script twice? Double check time

dark ivy
#

so diag_log [_playerSide, -1] call BIS_fnc_respawnTickets; ?

#

sorry I'm not the best in SQF as you can clearly see

#
10:30:48 [WEST,-1]
10:30:48 [WEST,-1]
warm hedge
#

That's not probably what he meant but you can see it's called twice

dark ivy
#

I think I know why. My custom respawn templates asks for a file to be executed when the player is killed, and I have that set as onPlayerKilled.sqf so what happens is that the mission calls that file once and then the respawn template calls for it again. I've removed it from my custom respawn template, hopefully it'll work now

#

Fuck yeah, its working!

#

Thanks guys!

#

I spent all of yesterday on this one file

copper raven
#

if you see that there is a pattern when you change stuff e.g, -1 ticket but its -2, -2 tickets but it's -4, you can instantly assume that your script runs twice

dusty whale
#

You are correct, it's the fact that AGL is a position relative to the ground level

#

๐Ÿ˜…

#

i dont know how i didnt spot that

#

ofcourse the numbers would be scewed, since the position relative to ground level is always 0 at ground level

#

Thank you for spotting that

leaden wharf
#

Hello, anyone knows why my script works on local server but not dedicated?

cosmic lichen
#

No, how would we without looking at the script?

warm hedge
#

No, how would we without looking at the script?

sinful hemlock
#

๐Ÿ˜Ž

leaden wharf
#

this is one of the script i am using: ```
deleteMarker "m_AC1";
localThis = laptop_1;
FOBThis = newFOB_1;
("ACE_G_Chemlight_HiGreen_Infinite" createVehicle position localThis) attachTo [localThis,[0,0,0]];
[west, FOBThis] call BIS_fnc_addRespawnPosition;
hint "FOB Alpha is now Available";
fob_1 = true;

things seems to work until fob_1 which was set as Activation for another trigger.
#

and this:```
_this addEventHandler["Killed",{params["_Victim", "_Killer", "_Intisgator", "_bEffects"];
if (isPlayer _Killer) then {
_Killer say3D "dontDiePlz";
hint format["%1 killed a civilian. The resistance is now Enemy. SHAME", name _killer];
peaceTreatyFail = true;}}]

this one is part of the `Civilian Presence`'s `Code on unit Created`. the `PeaceTreatyFail` works, the rest doesnt..
dusty whale
#

because if fob_1 is not a network variable, then it wont be updated on all devices

leaden wharf
#

Oh? What should I do to make it a network var?

dusty whale
#

make sure you read example 1

leaden wharf
#

Oh looks like thatโ€™s the problem, thanks ^^ imma test it out now

dusty whale
leaden wharf
robust tiger
#

Is there some sort of a isMinized or isInBackground command to detect if Arma has been ALT+TABed out of?

spark turret
#

OR:
subtract -1 in first run, subtract 2 in second run ๐Ÿ‘€

dark ivy
odd bison
#

Hello, I would like to ask for help.
How to add(assign) already existing task to a player? (JIP)
Task is created by BIS_fnc_taskCreate
Reason: Lobby slots are for west. On the mission start (init.sqf) players side changes to independent. Therefor task is not shown for JIP players. I have to assign the task by script after player side is changed.

dusty whale
#

can i make cutRsc not fade?

#

the resource has duration = 9999999; in description.ext

#

but cutRsc ignores this

#

and fades out the rsc in about 5 seconds

little raptor
dusty whale
#

hold on

#

here is the whole resource config

#

i'm posting this there

dusty whale
#

i mean, the config is config

#

๐Ÿ˜“

agile pumice
#

How do I increimentally add lines to a parse text? Something like

_textStringArr = ["<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>"];
_textStringArr append ["<br/>"];
_textStringArr append ["<t size='%1'><t size='1' align='left' valign='middle'>A Name</t> </t>"];
hintSilent parseText str _textStringArr;```
robust tiger
#

You mean: how to join strings together?

agile pumice
#

well I sort of know how to do that, just not in structured form

#
_textStringArr = ["<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>"];
_textStringArr pushBack ["<br/><t size='%1'><t size='1' align='left' valign='middle'>A Name</t></t>"];
_textStringArr pushBack ["<br/><t size='%1'><t size='1' align='right' valign='middle'>A Score</t></t>"];
_textStringArr joinString "";
hintSilent parseText str _textStringArr;
robust tiger
#

ยฏ_(ใƒ„)_/ยฏ ?

_textStringArr = "<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>";
_textStringArr + "<br/><t size='%1'><t size='1' align='left' valign='middle'>A Name</t> </t>";
_textStringArr  + "";
hintSilent parseText _textStringArr;
agile pumice
#

nah that just shows the top line

copper raven
#

it's because the code above doesn't reassign the result of the +

dusty whale
#
  • is not assignment, as sharp said
#

x = x+y adds y into x and assigns

agile pumice
#

ah right it should be

_textStringArr = "<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>";
_textStringArr = _textStringArr + "<br/><t size='%1'><t size='1' align='left' valign='middle'>A Name</t> </t>";
_textStringArr = _textStringArr + "";
#
_textStringArr = "<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>";
{
  _textStringArr = _textStringArr + format ["<br/><t size='%1'><t size='1' align='left' valign='middle'>%1</t></t>", name _x];
  _textStringArr = _textStringArr + format ["<t size='%1'><t size='1' align='right' valign='middle'>%1</t></t>", _x getVariable ["score",0]];
  _textStringArr = _textStringArr + "";
} forEach (units (group player));
hintSilent parseText _textStringArr;
#

there we go

copper raven
#

you could put everything into a single format, instead of doing that + mess

agile pumice
#

it looks better in my iDE

mental prairie
#

I'm trying to teleport an object a random distance within a 10 meter radius from it's position. How do I do that?

agile pumice
#

obj setPos (getPos obj vectorAdd [random 10, random 10, 0]); maybe this?

copper raven
#

obj setPos (obj getPos [random 10, random 360])

agile pumice
#

Hey sharp, how would I sort my array based on _x getVariable ["score",0]]

copper raven
agile pumice
#

I'm looking at BIS_fnc_sortBy

copper raven
#

there is also bis function for it

#

ye that one

#

not sure which one is better in perf

agile pumice
#

my arrays are globs of structured text so how can I extract the actual value of the indexes?

#

_textStringArr = [_textStringArr, [], {_x select 1}, "DESCEND"] call BIS_fnc_sortBy;

copper raven
#

you mean extracting score value from those strings?

agile pumice
#

yes

copper raven
#

best thing would be if you kept score and the string

#

extracting it will be expensive

#

e.g [["the string", 5], ["another string", 4]], then you can easily get the score at index 1

agile pumice
#

right, but how do I do that with the parseText?

copper raven
#

hmm? getting the full string out of it for parseText?

vale swift
#

Hi. Quick question: Where can I find a list of all (or most) names of entities, or commands, or statements, or anything that can help me put a script together?

agile pumice
#

Instead of sorting I think I need to change the order of the array adding

vale swift
#

Much appreciated.

copper raven
#

then something like joinString, and pass it to parseText

ember path
#

is there a way to make a unit class with a certain camo?

copper raven
#
private _textStringArr = units player apply {
  private _score = _x getVariable ["score", 0];
  [_score, format ["<t size='1' align='left' valign='middle'>%1</t><t size='1' align='right' valign='middle'>%2</t>", name _x, _score]]
};

_textStringArr sort false;

hintSilent parseText ("<t size='1' align='center' valign='middle'>------ Chickens Killed ------</t><br/>" + (_textStringArr apply {_x select 1} joinString "<br/>"));

something like that, will display in descending way (untested) @agile pumice

winter rose
#

(you're welcome)

ember path
#

oh and i dont want this

_veh = createVehicle ["Tomahawk_Red_IND",position player,[],0,"NONE"];
[
  _veh,
  ["woodland",1], 
  ["showCamonetHull",0,"showBags",0]
] call BIS_fnc_initVehicle;
ember path
#

i want to somehow have, like, uh idk what u call that but like "Tomahawk_Red_IND" but like, its own......like "Tomahawk_Wood_IND" idk

winter rose
#

ah for that you would need to create a mod

ember path
#

writes down: please stop making things harder for yourself you big dummy

winter rose
#

hey! don't be so hard on yourself!

ember path
#

could i uhm...edit the existing mod

winter rose
#

you're not that big

ember path
#

akjfgagh

agile pumice
#

Thank you so much Sharp

#

that's way beyond my scope of arma scripting at the moment

winter rose
ember path
#

nobody has to know wink wink

#

i'll see if i can contact them, rip to that modder

winter rose
ember path
#

hm, now to just figure out how to do it!

opal sand
#

Main Question
Hello, how do i make all of the animations in below list play in order, and not skip to final animation, which only plays for a second?
(My first thought was include sleep 3; after the comma of each line)

Side question:
Does formatting my code like this (new line for each animation) good working practice? or does it prevent code from working?

IF (script = true) THEN {[] spawn {
sleep 1;
{caw1dc1 switchmove _x } forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out'
]
};

copper raven
#

if you want to sleep between the animations, add sleep x; after the switchMove inside the forEach, x being the amount of seconds you want to sleep for

opal sand
#

IF (script == true) THEN {[] spawn { <<<< howcome this wont work lel? (amended: 'IF (script == true) THEN {chat here};')

little raptor
copper raven
#

you're missing a }

#

but then, what is that script = true?

#

pls don't tell me you were trying to do script == true

little raptor
#

I blame you @winter rose ๐Ÿคฃ (or whoever it was that wrote the channel description)

copper raven
#

script == true == true == true == true is same as just script

opal sand
#

so, e.g;

{caw1dc1 switchmove _x } forEach, sleep 3;
['Acts_JetsShooterIdle', 'Acts_JetsShooterIdleMoveaway_in'];

?

copper raven
#

nope

#
{
  caw1dc1 switchMove _x;
  sleep 3;
} forEach [
  'Acts_JetsShooterIdle', 
  'Acts_JetsShooterIdleMoveaway_in'
];
opal sand
#

ah, right, i see, the ; is for new commands like and , is for strings of command to work in connection, or something like that?

copper raven
#

; and , is essentially the same thing, seperator, "end statement"

little raptor
#

even as end statements they may behave differently

copper raven
#

ok but for the most part, they can be used in the same way, it's just that almost everyone uses semi colon hint "hi", hint "hi2"

opal sand
#

Written something here but cant see *the error;

caw1dc1 switchMove _x;
sleep 3;
forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};

?

copper raven
#

where did the { } go?

#

there is no unary forEach

opal sand
#

[] spawn
{
sleep 1;
{caw1dc1 switchmove _x }
sleep 3;
}
forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};
To me that looks like it will work kek

copper raven
#

look at the example i sent you previously, also you have a , after the last element in the array, shouldn't be there

opal sand
#

(Trying to format the code like this so its alot easier on the eye to take in info)

copper raven
#

use
```sqf
<my code>
```
and indent your code properly, not only it's easier to spot mistakes, it's also much easier to read the code

opal sand
#

sorry, what do you mean by indent?

cold mica
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
opal sand
#

it wont send when i press enter only carriy returns?

cold mica
#

Without Indent

[] spawn 
{ 
sleep 1;
{caw1dc1 switchmove _x } 
sleep 3;
}
forEach 
 [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};

With Indent

[] spawn 
    { 
        sleep 1;
        {caw1dc1 switchmove _x } 
        sleep 3;
    }
    forEach 
    [
        'Acts_JetsShooterIdle',
        'Acts_JetsShooterIdleMoveaway_in',
        'Acts_JetsShooterIdleMoveaway_out',
        'Acts_JetsShooterShootingLaunch_in',
        'Acts_JetsShooterShootingLaunch_out',
    ]
};
cold mica
copper raven
#

you can instantly see that your curly braces are messed up

opal sand
#
[] spawn 
{ 
sleep 1;
{caw1dc1 switchmove _x } 
sleep 3;
}
forEach 
 [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};

hint "BRUH, where am i, what world am i in lol;
#

๐Ÿฅณ

vapid wadi
#

Hey, I was working on a banking system for my server.
I was bug fixing for the past few hours, and the way I was calling my function worked every time. It started ALMOST working, and I added a few diag_log's to check what my variables were, obviously.
After doing this, its not even executing on the server side. As none of the diag_log's are outputting anything, and there are no errors in my RPT.
I'm executing using this:

  [player] remoteExec ['Server_fnc_getBanking',2];

And I'm executing this code:

private ["_player", "_fetch", "_banking"];
_player = _this select 0;

_fetch = ["getBanking", 2] call ExternalS_fnc_ExtDBasync;
_fetch = call compile str(_fetch);

_banking = [];
_uid = getPlayerUID _player;

{
    diag_log format["Checking bank account %1", str _x];
    if (getPlayerUID _player IN (_x select 1)) then {
        diag_log "player is apart of epic bank account";
        _banking pushBack _x;
    };
} forEach _fetch;

diag_log str _banking;

[_banking, "BANK"] remoteExec ["client_fnc_openFinancials", _player];

If any can help me out it would b very useful, as I'm currently bashing my head off the keyboard. hehe

#

No errors in client or server rpt as well.

opal sand
#

@cold mica @copper raven my bad guys, i remember what indent is now, thanks for bearing with

vapid wadi
#

@opal sand this might work, lol not 100% sure

[caw1dc1] spawn {
    private _person = _this select 0;
    private _anims = [
        'Acts_JetsShooterIdle',
        'Acts_JetsShooterIdleMoveaway_in',
        'Acts_JetsShooterIdleMoveaway_out',
        'Acts_JetsShooterShootingLaunch_in',
        'Acts_JetsShooterShootingLaunch_out'
    ];
    {
        uiSleep 1;
        _person switchMove _x;
        uiSleep 3;
    } forEach _anims;
};
copper raven
vapid wadi
#

I have, the issue is that it isn't executing the code at all anymore, no errors are thrown either.

#

The rest of the server mod is working though, as I'm able to login and such

copper raven
#

well then the error is elsewhere

vapid wadi
#

Weird, Ill take a longer look, I have 0 errors in my RPT, on client on server, and it was working before I put in diag_log's.
Not sure why doing that would cause other issues to pop up, thanks though.

willow hound
#

What is _fetch after ["getBanking", 2] call ExternalS_fnc_ExtDBasync?

copper raven
#

it doesn't even run that line from what i understand

opal sand
#

@vapid wadi yes that code works thankyou sir

vapid wadi
#

No problem,

#

I had a diag_log at the top of the code and it didn't even execute, but _fetch is just an array

opal sand
#

what is the significance of the animations ending in _m?

vapid wadi
#

?

#

I don't work with animations often, that would be a question for someone else sorry haha

opal sand
willow hound
#

You try to call compile a stringified array?

vapid wadi
#

Is that incorrect? I took quite a break from Arma, been coding in lua for the past 4-5 months. So I'm pretty rusty. But it is an array that has been stringified.

copper raven
#

I had a diag_log at the top of the code and it didn't even execute, but _fetch is just an array
there is no point in trying to narrow down the issue in that function if it doesn't even get called

#

your remoteExec doesn't run, look there

opal sand
vapid wadi
#

Okay, I tried to manually call it from the debug console, and from my interaction menu, which works with every other interaction. And still nothing, any idea of how I could try and call it in a different way?

copper raven
willow hound
vapid wadi
#

Yeah, I wasn't sure if It was an array or not. I have no way of seeing if its not being called currently :/

willow hound
#

If you're not even getting output from the very first line of the function, you might want to ensure the function actually exists (under the name you are calling).

vapid wadi
#

Its in my CfgFunctions under a class where every other function in it works...

willow hound
#

Does the Functions Viewer display the source code?

vapid wadi
#

im kinda pissed rn, sorry for wasting everyone's time. I just found an error at the top of my rpt.
Missed a colon...

#

Thanks for all of the help though guys.

opal sand
#

You scrpting guys must have steam coming out of your ears quite often id imagine, when you miss a very small detail lol, very infuriating lol

vapid wadi
#

for sure, 90% of my time is debugging.

#

I got another quick question. when I retrieve my array from the database. Everything that is a string returns with ""TEXT HERE"" wrappers, what causes that?

copper raven
#

iirc there is an extDB setting for that

vapid wadi
#

well, im looking into the rest of my db, and all of the other array's are the same as mine, so im going to check how the function that retrieves those handles it

opal sand
#

Two questions;

  1. One; ive never seen that 'privateperson' code before? thats like mad level coding?
  2. Where should i go to learn coding (coding biased for this game) more? apart from just learning as i go? how long would it take to learn this game coding on a casual/part time basis?

I appreciate your guys help, but out of courtesy, will try to attempt to solve errors on my own first where possible, before asking for help*

willow hound
#

It should be params lul

opal sand
#

How do i improve the animation interpolation? right now it just chops through to next animation
IIRC, it might be wrong, there is an interpolate to code, does this even exist? or help? help? please? pops green flare

[caw1dc1] spawn { 
private _person = _this select 0; 
private _anims = [ 
        'Acts_JetsShooterIdle', 
        'Acts_JetsShooterIdleMoveaway_in',                                    'Acts_JetsShooterIdleMoveaway_loop', 
        'Acts_JetsShooterIdleMoveaway_out', 
        'Acts_JetsShooterShootingLaunch_in',                                  'Acts_JetsShooterShootingLaunch_loop', 
        'Acts_JetsShooterShootingLaunch_out' 
    ]; 
    { 
        uiSleep 1; 
        _person switchMove _x;  
    } forEach _anims; 
};
hint "This is the code im working with";
vale swift
#

I could use a hand here, any help is appreciated.

while {true} do //Infinite loop
{
    [/*Help?*/, nil, true] spawn BIS_fnc_moduleLightning //Should spawn a Zeus Lightning Bolt
    sleep ((random 10) + 10); //Adds random delay, between 0 and 10 seconds
}```Objective: Make a Zeus Lightning Bolt (Not just ambient weather, but one that can kill!) spawn randomly on the map, every 10~20 seconds. 
Problem: `spawn` demands an object to create a Zeus bolt, and not co-ordinates. 
Situation: I was instructed to first spawn an invisible object, randomly on the map, then use said object to spawn the bolt, then despawn the object. 
Question: What object can I use? And how do I spawn it? And how do I **de**spawn it after? 
Question 2: I was also told that an infinite loop only executes like 10,000 times only, is that true? How do I avoid that?
Thanks in advance.
Note: I should've clarified, this is my very first script ever. I have the SQF coding skills of a newborn.
little raptor
little raptor
#

also does any docs say it should be spawned?

dusty whale
#

when using switchCamera and moving from gunner view to external view, sometimes the gunner view audio doesnt go away and stays on an endless loop

vale swift
#

Like I said, I have the scripting skills of a newborn. Obviously, most of my code is unnecessary, unsanitary, and a bunch of un-things.

little raptor
#

I'm in a game rn so I can't help. hopefully some other guys will come along to help

copper raven
#

that function needs to be spawned, it's ok to call it if you're doing so from scheduled environment

#

I was also told that an infinite loop only executes like 10,000 times only, is that true? How do I avoid that?
only in unscheduled

#

for the logic part, you just need to create a curator logic, and pass it to the script

vale swift
#

Sounds great... except I don't know what's the meaning of (un)scheduled... ๐Ÿ˜ฌ ||please don't hate me, we all gotta start somewhere lol||

copper raven
vale swift
opal sand
winter rose
#

but some animations do not have transition and have to look "abrupt"

vale swift
copper raven
#

correct

winter rose
#

or keep it and move it when needed, of course

vale swift
#

Can you give me an example line that can spawn it?

little raptor
#

but use playmovenow for the rest

little raptor
#

actually nvm

copper raven
#

it's intended to be used with a module, but people use it without it from what i've seen

opal sand
little raptor
# vale swift Can you give me an example line that can spawn it?
_obj = createVehicle ["Land_Invisible_Helipad", [0,0,0]];
while {true} do //Infinite loop
{
    _obj setPos [random worldSize, random worldSize, 0];
    [_obj , nil, true] spawn BIS_fnc_moduleLightning //Should spawn a Zeus Lightning Bolt
    sleep ((random 10) + 10); //Adds random delay, between 0 and 10 seconds
}
#

I'm not sure about the classname

#

check it in the game

opal sand
# little raptor but use playmovenow for the rest

Not sure where to go from here, see below please;

[caw1dc1] spawn { 
private _person = _this select 0; 
private _anims = [ 
        'Acts_JetsShooterIdle', 
        'Acts_JetsShooterIdleMoveaway_in',                                    
        'Acts_JetsShooterIdleMoveaway_loop', 
        'Acts_JetsShooterIdleMoveaway_out', 
        'Acts_JetsShooterShootingLaunch_in',                                  
        'Acts_JetsShooterShootingLaunch_loop', 
        'Acts_JetsShooterShootingLaunch_out' 
    ]; 
    { 
        uiSleep 1; 
        _person switchmove _x;  
    } forEach _anims; 
};
hint "replacing switchmove with playmove or playmovenow doesnt work?";
little raptor
# opal sand Not sure where to go from here, see below please; ```sqf [caw1dc1] spawn { pri...
[caw1dc1] spawn { 
private _person = _this select 0; 
private _anims = [ 
        'Acts_JetsShooterIdle', 
        'Acts_JetsShooterIdleMoveaway_in',                                    'Acts_JetsShooterIdleMoveaway_loop', 
        'Acts_JetsShooterIdleMoveaway_out', 
        'Acts_JetsShooterShootingLaunch_in',                                  'Acts_JetsShooterShootingLaunch_loop', 
        'Acts_JetsShooterShootingLaunch_out' 
    ];
    _person switchMove _anims#0;
    { 
        _person playMove _x;
         sleep 1; 
    } forEach _anims; 
};
#

but I don't recommend doing it that way

#

it'll probably never work

opal sand
#

@winter rose @little raptor letssss gooooooo 90% there, just seen some mad connection, of the deck crew pointing at the pilots and doing backflips n stuff ๐Ÿ˜‚

little raptor
#

because of AI interference

opal sand
#

hey, leopard, lou, see the unit name as above? [caw1dc1], can i make the same code play on more than one unit? like this;

[caw1dc1, caw1dc2] spawn {  
private _person = _this select 0;  
private _anims = [  
        'Acts_JetsShooterIdle',  
        'Acts_JetsShooterIdleMoveaway_in',                                    
        'Acts_JetsShooterIdleMoveaway_loop',  
        'Acts_JetsShooterIdleMoveaway_out',  
        'Acts_JetsShooterShootingLaunch_in',                                  
        'Acts_JetsShooterShootingLaunch_loop',  
        'Acts_JetsShooterShootingLaunch_out'  
    ]; 
    _person switchMove _anims#0; 
    {  
        _person playMove _x; 
         sleep 1;  
    } forEach _anims;  
};
hint "Does this work? >> [caw1dc1, caw1dc2] ??";
little raptor
#

but like I said don't use that code

opal sand
#

howcome? should i resort to something like we used earlier?

[] spawn 
{ 
sleep 1;
{caw1dc1 switchmove _x } 
sleep 3;
}
forEach 
 [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};
hint "more like this?";
little raptor
#

no

#

use event handler

opal sand
#

ok, im completely new to eventhandlers, my knowledge goes as far as knowing the word, more or less, please let me know ๐Ÿ˜„

vale swift
little raptor
# opal sand ok, im completely new to eventhandlers, my knowledge goes as far as knowing the ...

an event handler, as the name suggests, executes the code only when an event takes place.
it doesn't use a loop. so it is more efficient. plus, since it is unscheduled, the code will execute exactly when that event takes place.
For example, this is how the Fired event handler works:
you add an event handler to player with some code
player presses mouse button
the engine processes everything necessary to fire a bullet (such as creating the bullet object, muzzle flash, etc.)
it then sees you have a Fired event handler added to the unit and will execute it

little raptor
vale swift
#

Yup, I see. Much appreciated!

opal sand
# little raptor an event handler, as the name suggests, executes the code only when an event tak...

This is me trying to take some initiative to solve, using your advice/guidance;
(Source: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers (https://imgur.com/EUGAN3r))

this addEventHandler ["AnimDone", {
    params ["caw1dc1", "'Acts_JetsShooterIdle'"];
}];
this addEventHandler ["AnimStateChanged", {
    params ["caw1dc1", "Acts_JetsShooterIdleMoveaway_in"];
}];
hint "something like this? or even in right direction?";
exotic tinsel
#

i am trying to see how bad it is if i allow grass up to 1k. but the following functions are not helping me do that.
setTerrainGrid, setDetailMapBlendPars, setViewDistance, setObjectViewDistance
Does anyone know what settings enable me to allow grass up to 1k?

idle sierra
#

is there a way to add script to "hide terrain objects" so it'll show a specific set of objects? like, tell it to hide all building1s but ignore building2s?

exotic tinsel
split coral
#

You need a mod to change the grass rendering distance. ClutterDistance in the cfgWorld config iirc

exotic tinsel
#

@split coral thx mate

opal sand
#
this addEventHandler ["AnimChanged", {
    params ["caw1dc1", "Acts_JetsShooterIdle"];
}];
this addEventHandler ["AnimDone", {
    params ["caw1dc1", "Acts_JetsShooterIdle"];
}];
hint "Yes good?";
winter rose
#

no

opal sand
#

do you see how my brain sees it though? lol

winter rose
#
mySuperUnit addEventHandler ["AnimChanged", {
    params ["_theReferencedUnit", "_theNewAnimationName"];
hint _theNewAnimationName;
}];
opal sand
#

oh my goodness, can this be done inside the triggers on act?

winter rose
#

I don't know what you are talking about, but let'sโ€ฆ reset back to what you want to do.

vale swift
#

Alright, hate me if you will, but umm... say I finished my script and it 'should work'... how do I load it in my mission? xD

opal sand
# winter rose ```sqf mySuperUnit addEventHandler ["AnimChanged", { params ["_theReferenced...

Resetting; basically im looking at how to how smooth animation transitions for video pieces

Referring to above message

(PREVIOUS) (1/2)

[] spawn 
{ 
sleep 1;
{caw1dc1 switchmove _x } 
sleep 3;
}
forEach 
 [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out'
]
};

new code proposal (including Lou Montana guidance notes);

this addEventHandler ["AnimChanged", {
    params ["caw1dc1", "Acts_JetsShooterIdleMoveaway_in"];
}];
this addEventHandler ["AnimDone", {
    params ["caw1dc1", "Acts_JetsShooterIdle"];
}];
hint "so i wasnt far off then?;
copper raven
#
[1, 2, 3] call {
  //_this = [1, 2, 3];
  params ["_one", "_two", "_three"];
}

is same as

[1, 2, 3] call {
  //_this = [1, 2, 3];
  private _one = _this select 0;
  private _two = _this select 1;
  private _three = _this select 2;
}

instead of you providing arguments, in the eventhandler engine passes you some arguments (depending on event handler), you can look them up on wiki

vale swift
#

Well, it's currently saved as a .txt ๐Ÿ‘‰ ๐Ÿ‘ˆ

opal sand
copper raven
#

yes

#

for example with this EH you're provided a unit that triggered the new animation, and the animation that the unit started params ["_unit", "_anim"];

copper raven
willow hound
#

Because I have not gotten around to writing the section about file locations (and because this probably answers your next question): You need to place the script file(s) in the mission root folder (that's a folder called MyMissionName.Altis for example). You can find the mission root folder in your Arma profile directory (most likely located at Documents\Arma 3 - Other Profiles\NiceGuyKc) (the missions and mpmissions subfolders) or you can open your mission in the Editor, then go to Scenario > Open Scenario Folder in the top left.

little raptor
#

@opal sand ```sqf
_anims = [...]; //array of anims to be played

{
_unitAnims = +_anims; //get a copy of this array, since it'll be modified using deleteAt
_x setVariable ["anim_queue", _unitAnims]; //add a new variable to the unit, called "anim_queue", which hold the animation list

_x addEventHandler ["AnimDone", {
    params ["_unit", "_anim"];
    
    _anims = _unit getVariable ["anim_queue", []]; //get the variable, default to [] if it doesn't exist
    
    if (count _anims == 0) exitWith { //done, delete the event handler
          _unit removeEventHandler ["AnimDone", _thisEventHandler]
    }; 
    
    _unit playMoveNow _anims#0; //play the first anim from the list
    _anims deleteAt 0; //delete the first anim from the list
}];

_x switchMove _anims#0; //play the first anim from the list; needs switchMove to jump to the first frame
_x playMoveNow _anims#0;  //need a playMove after switchMove for the AnimDone event handler to trigger
_unitAnims deleteAt 0; //delete the first anim from the list

} forEach [_unit1, _unit2, ...]

opal sand
#

@winter rose @copper raven im losing track, Lets reset again...

Target: playing several animations through one trigger (in on act), lost from here

so many additional variables has got my mind boggled;

_privateVars
params
addeventhandler

I just want to play several animations through one trigger, but lack of knowledge means its too hard to fix on my own

this addEventHandler ["AnimChanged", {
    params ["caw1dc1", "Acts_JetsShooterIdleMoveaway_in"];
}];
this addEventHandler ["AnimDone", {
    params ["caw1dc1", "Acts_JetsShooterIdle"];
}];
copper raven
#

read again what i wrote

little raptor
#

for descriptions re-read the previous comments

opal sand
little raptor
#

literally one post before yours meowsweats

opal sand
opal sand
willow hound
#

Read the documentation about commands you are not familiar with to be enlightened ๐Ÿ™‚

opal sand
copper raven
#

missing semi colon in there

little raptor
#

yep saw it

little raptor
winter rose
opal sand
#

@little raptor

How does this look? Hopefully its not a meowfacepalm or a meowsweats ๐Ÿ˜‚ (included the +)

_anims = 
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out'];

{
    _unitAnims = +_anims; 
    _x setVariable ["anim_queue", _unitAnims]; 
    
    _x addEventHandler ['AnimDone', {
        params ["cac1d1", 'Acts_JetsShooterIdle'];
        
        _anims = _unit getVariable ["anim_queue", []]; 
        
        if (count _anims == 5) exitWith {
              _unit removeEventHandler ["AnimDone", _thisEventHandler]
        }; 
        
        _unit playMoveNow _anims#2;
        _anims deleteAt 1;
    }];
    
    _x switchMove _anims#2; 
    _x playMoveNow _anims#1; 
    _unitAnims deleteAt 1; 
} forEach [cac1d1, cac1d1, cac1d1]

hint "good!";
little raptor
#

and why did you change the indices?

#

they all should be 0

#

so it's a meowsweats

#

count _anims == 5?

opal sand
#

5 anims in the list ๐Ÿ˜‚

little raptor
#

all you had to do was put the animation list and unit names

#

everything else was ok

opal sand
#

i was trying really hard to not just accept your script but understand it also

#

making your helping me more worthwhile, but i guess i overanalysed

#

Questions:

  • _unit = do i leave this blank because theyre mentioned at forEach [1,2,3]?
    -_animqueue = leave this as this calls stored anim list?
little raptor
#
_anims = 
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out']; //array of anims to be played

{
    _unitAnims = +_anims; //get a copy of this array, since it'll be modified using deleteAt
    _x setVariable ["anim_queue", _unitAnims]; //add a new variable to the unit, called "anim_queue", which hold the animation list
    
    _x addEventHandler ["AnimDone", {
        params ["_unit", "_anim"];
        
        _anims = _unit getVariable ["anim_queue", []]; //get the variable, default to [] if it doesn't exist
        
        if (count _anims == 0) exitWith { //done, delete the event handler
              _unit removeEventHandler ["AnimDone", _thisEventHandler]
        }; 
        
        _unit playMoveNow _anims#0; //play the first anim from the list
        _anims deleteAt 0; //delete the first anim from the list
    }];
    
    _x switchMove _anims#0; //play the first anim from the list; needs switchMove to jump to the first frame
    _x playMoveNow _anims#0;  //need a playMove after switchMove for the AnimDone event handler to trigger
    _unitAnims deleteAt 0; //delete the first anim from the list
} forEach [cac1d1]

that's it

#

also cac1d1 is duplicated

opal sand
#

bruh, thats so good, so, to help me get my head around this, its all generic calls for code built into game, which are connected together via engine, and makes it possible to crunch through loads of code through some simple call lines of code like above?

little raptor
#

not connected together via "engine"
the engine simply executes my code. it's up to me how I program it

#

there's no "magic"
just carefully constructed system

opal sand
#

just had to shout 'haha woooooooooooooooooooooo' we did it!!!!!! task#1 and only task done today ๐Ÿ˜„ but happy, this is such an amazing piece of code and will be very productive in my workflow, thankyou @little raptor sir!

#

(and honorable mentions to @copper raven @winter rose @cold mica @willow hound giving love to all)

agile pumice
#

I'm trying to use addMissionEventHandler ["EntityKilled", { inside an initServer.sqf but it the eventhandler only seems to work in the editor and not on dedicated

winter rose
#

and what is the code?

agile pumice
#

its kind of a goofy mission

winter rose
#

I suppose so, prepare the Holy Hand Grenade ^^
but yeah it should work as far as I can see

agile pumice
real tartan
#
[_text] remoteExec ["BIS_fnc_dynamicText"];

gives me error
Performance warning: SimpleSerialization::Write 'params' is using type of ',TEXT' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types

#

any idea for alternative ?

#

maybe

[_text, "BIS_fnc_dynamicText"] remoteExec ["call"];

?

little raptor
real tartan
little raptor
#

it doesn't matter
the text (structured text) must be composed on the client's system
you shouldn't send them over the network

#

@real tartan example:
instead of _text = parseText "blabla"; [_text] remoteExec ["BIS_fnc_dynamicText"];
you should use:

["blabla", {[parseText _this] call BIS_fnc_dynamicText;}] remoteExec ["call"];
opal sand
#

@little raptor your such a good guy dude, helping everyone out so consistently, even if you helped me or not, i want to let you know i see you, and appreciate what you do my guy ๐Ÿ’ช โœŒ๏ธ (theres probably many others, @copper raven @winter rose been my guy since day one, @cold mica @willow hound)youre all Kings

winter rose
#

tell us something we don't know ๐Ÿ˜Ž
joke aside, you're welcome ๐Ÿ˜‰

agile pumice
#

is it impossible to do setVelocity on ambientLife units?

#
(findDisplay 46) displayAddEventHandler ["KeyUp", {
    params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
    if (_key == 47) then {
      _vel = velocity player;
      _dir = getdir player;
      player setvelocity [(_vel select 0) + 1 * (sin _dir),(_vel select 1) + 1 * (cos _dir),(_vel select 2) + 5];
      playSound3D [selectRandom[getMissionPath "bounce1.ogg", getMissionPath "bounce2.ogg"], player, false, getPosASL player, 5, 1, 50]
    };

    false
 }];
``` works on players, not rabbits
winter rose
#

maybe not if they touch the ground

agile pumice
#

any proposed solutions?

winter rose
#

lift them by 10cm before throwing them

agile pumice
#

with just a simple setposatl?

winter rose
#

yup

agile pumice
#

hurray, its working

#
(findDisplay 46) displayAddEventHandler ["KeyUp", {
    params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
    if (_key == 47) then {
      _vel = velocity player;
      _dir = getDir player;
      player setPosATL ((getPosATL player) vectorAdd [0, 0, 1]);
      player setVelocity [(_vel select 0) + 1 * (sin _dir),(_vel select 1) + 1 * (cos _dir),(_vel select 2) + 1];
      playSound3D [selectRandom[getMissionPath "bounce1.ogg", getMissionPath "bounce2.ogg"], player, false, getPosASL player, 5, 1, 50]
    };

    false
 }];
#

this is hilarious

#

Also about my mission eventhandler, I don't think its triggering any script errors on the server

#

I checked the rpt

agile pumice
#

Also, I think I'm having server performance issues. I'm running this on the server:
initServer.sqf

gameTimeLeft = 1200; // 20 mins * 60 seconds
publicVariable "gameTime";
while {true} do {
  if (gameTimeLeft == 0) exitwith {"timeUp" call BIS_fnc_endMissionServers};
  gameTimeLeft = gameTimeLeft - 1;
    publicVariable "gameTime";
  sleep 1;
};```
#

and this on the clients:
fn_ScoreBoard (cfgFunctions defined)

while {true} do {
  private _textStringArr = units group player apply {
    private _score = _x getVariable ["score", 0];
    [_score, format ["<t size='1' align='left' valign='middle'>%1</t><t size='1' align='right' valign='middle'>%2</t>", name _x, _score]]
  };
  _textStringArr sort false;
  hintSilent parseText (
    "<t size='1' align='center' valign='middle'>------ Rabbits Killed ------</t><br/>" +
    format ["<t size='1' align='center' valign='middle'>------ Time Remaining: %1 ------</t><br/><br/>", [gameTimeLeft, "MM:SS"] call BIS_fnc_secondsToString] +
    (_textStringArr apply {_x select 1} joinString "<br/>")
  );
  sleep 1;
};```
but the timer decreases every 4-5 seconds instead of 1. I'm testing in the editor
dusty whale
#

use delta-time instead

#

dont rely on sleep to be accurate

outer fjord
#

So I'm struggling a bit here.

I want to add a players name to a dairytask. But I can't seem to get the game to reconize that I'm trying to call a variable instead of just a text. Like is there a certain format within the string text I can use to make it understand to look for that?

outer fjord
#

oooh, thank you! ๐Ÿ˜„

dusty whale
#

is it just to have them both in one command?

agile pumice
#

Also interestingly, gameTimeLeft isn't sent from the server to the clients on my dedicated server either

#

gameTimeLeft shows as 00:00

#

Which would help explain why the missionEventHandler isn't doing anything either

cold mica
dusty whale
#

publicVariable "gameTime";

#

you'd want to do publicVariable "gameTimeLeft";

maiden warren
#

what is the best way to store value for each player from array?
Let's say I have PlayerArray and inside I have Player1 and Player2
What's the best way to add 1 + 2 to Player1 and 2 + 3 to player 2?

#

so when I fetch the values are Player1[1,2] and Player2[2,3]?

winter rose
#

I, huh, what ?

maiden warren
#

well basically, I'm adding a player to an array right

#

then another player is added to the same array

#

so I have player1, player2 array

#

so how would I go about giving values to each of them?

crimson walrus
#

how about an array where each element is also an array:
[[player1, player1value1, player1value2], [player2, player2value1, player2value2]]

#

or, you could use setVariable on the player objects. What the 'best' way is may be determined by how you plan to use the information.

agile pumice
#

@dusty whale I renamed the var and forgot to rename all instances of it

#

So with this:

addMissionEventHandler ["EntityKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
}];```
Is _killer and _instigator usually the same object? Why bother having both?
little raptor
agile pumice
#

hmmm okay

#

So everything works, its just that the server is performing so terribly that the effect is very delayed

#

I was spawning a bunch of rabbits (800) in a 4km radius so maybe that was the reason

#

I'm going to try adding a cfgWorlds to my description.ext instead and see if I can get a result I like

#
class CfgWorlds
{
    class Malden
    {
        class AmbientA3
        {
            maxCost = 500;

            class Radius440_500
            {
                areaSpawnRadius = 440.0;
                areaMaxRadius = 500.0;
                spawnCircleRadius = 30.0;
                spawnInterval = 4.7;

                class Species
                {
                    class Rabbit_F
                    {
                        maxCircleCount = (200 * (0.1 - houses)) * (1 - sea); //20 * 10
                        maxWorldCount = 40; // 4 * 10
                        cost = 5;
                        spawnCount = 10; // 1 * 10
                        groupSpawnRadius = 10;
                        maxAlt = 600;
                        minAlt = 0;
                    };
                };
            };
        };
    };
};
cosmic lichen
#

You cannot edit CfgWorld through mission config. Only exception is

class CfgWorlds
{
    class Any // or specific world name
    {
        author = "author";
        description = "description";
        pictureMap = "picturepath";
        pictureShot = "picturepath";
        loadingTexts[] = {"text1", "text2", "text3"};
    };
};
winter rose
#

oooh, 'tis neu and shiny

little raptor
#

So guys I need a second opinion.
I want to subtract an array of strings (hashmap keys, let's call it _arr1) from a second array of strings (_arr2)
_arr2 can potentially have thousands of elements.
Which one do you think is faster?

  1. using pushBack to fill _arr2
  2. using pushBackUnique to fill _arr2
  3. using set to fill a hashmap, and later using keys to get _arr2

I'm more inclined towards 1 and 3. set is nearly ~2x slower than pushback. but it also avoids duplicate elements, which can potentially make the subtraction faster.

still forum
#

you can use insert to insert lots of elements at once

little raptor
#

also, if you need more context, this is for my Debug Console mod's dictionary

still forum
#

instead of calling set multiple times

little raptor
#

I want to delete stale keys

distant oyster
#

I'd say the one that uses the least amount of sqf commands

still forum
#

but how about _result = _arr1 - _arr2
?

little raptor
#

that's what it is

#

but how to get arr2?

#

using hashmap? or pushBack?

still forum
#

array insert also has a "only unique" option

#

like pushBackUnique in bulk

#

what do you mean how?
I thought you have _arr2 already?

little raptor
#

I have _arr1

still forum
#

how do you want to subtract something from something you don't have

#

where does _arr2 come from

#

your question starts about subtracting array elements.
But then you only ask about filling an array, not subtracting/filtering

#

stop defining things twice

#

class Radius440_500: Radius440_500 no

#

class Malden: Malden malden doesn't inherit from malden

#

you need to use the same inheritance, as the class you are modifying

#

that means if Malden inherits from Altis, you need to also inherit from altis

agile pumice
#

This should have gone in config editors sorry

still forum
#

yes

little raptor
# still forum your question starts about subtracting array elements. But then you only ask abo...

well it's complicated

I don't know how to explain it

but simply put, I have an array (_arr1) containing old + current dictionary keys
and a second array called _arr2 that contains only current dictionary keys

_arr2 is built by going thru every word in the debug console. so it can have many duplicates if I use pushBack

the question is about getting the best performance out of a combined process of filling an array (_arr2) and subtracting two arrays (_arr1 - _arr2, which can be affected by duplicate elements).

still forum
#

so you want to get only the "old" keys

#

out, and keep the "current" keys

little raptor
#

yes to delete them

still forum
#

_oldKeys = _arr1 - _arr2

little raptor
#

I know

#

but I mean how to fill _arr2 to make it faster?

#

using hashmap?

#

or pushBack?

#

or pushBackUnique?

#

the bigger _arr2 , the slower the subtraction

#

but also hashmap set is slower

still forum
#

but isn't the filling method always the same? "_arr2 is built by going thru every word in the debug console"

#

probably pushBack, and then arrayIntersect to remove duplicates

little raptor
#

that would be very slow

#

I don't need _arr2

still forum
#

everything else is slower too

little raptor
#

it's just a temporary array

#

simply used to delete old keys

still forum
#

You are asking if, while going through debug console and all the words.
Instead of collecting all the words and then deleting in bulk.
You want to get rid of the collecting

#

But you cannot do that.

#

you can either delete/remove for every word.
or you can collect them all and delete in bulk

#

the latter would be way faster due to SQF

little raptor
little raptor
#

let me explain again

#

with an example

#

this is how my mod does the syntax highlighting:
first it uses a hashmap which is constant (used in each document tab, let's say _hm = _tab getVar "hashmap"). this is read on each iteration. now the process:

  1. splits the text into lines and goes thru all lines

  2. detects if this line existed in the last run

  3. if it didn't (new line):
    detect all words (goes thru them word by word). use set to add them to _hm (so they'll be unique). also add these words to _arr2 (if array: pushBack, if hashmap set)

  4. if it did (old line): simply add the words it detected before to _arr2 (if array: append, if hashmap: merge)

  5. once this is done for all lines:

{
  _hm deleteAt _x;
} forEach (keys _hm - _arr2);

this is done everytime it detects that the debug console contents are changed
now the question is whether I should fill _arr2 using hashmaps or arrays

#

in other words, _arr2 can be either an array, or hashmap

#

it's a temporary storage

#

the objective is to make filling _arr2 and later the subtraction faster

still forum
#

"5. once this is done for all lines:"
maybe make a cache for all the lines. And only do it for the lines that actually changed

little raptor
#

I do

#

they're cached

still forum
#

A line is probably not longer than a hundred words. Which isn't that "huge"

#

_arr2 as array is probably faster

little raptor
#

even if it has hunderds of duplicates?

still forum
#

unless you can do bulk insertions

#

yes

#

actually. Gotta change something for hashmap bulk insert.
That you only need to provide keys, and the values just stay nil.
So you can just bulk insert one array of strings as keys

#

but array insert command also has "only unique" parameter

#

dozens of pushBackUnique calls bad, dozens of pushBack + 1 single unique insert == better

little raptor
#

but isn't array uniques slower than hashmap unique?

still forum
#

deeepends on size

#

hundreds of elements, probably

#

but only if you can bulk insert into hashmap

#

hundreds of set calls are pretty slow

#

but there is no good hashmap bulk insert currently

little raptor
still forum
#

merge merges two hashmaps

#

insert does bulk insert, but only for key-value pairs. but you only have keys and don't care about the values

little raptor
#

I can use that too (if I go with hashmap method)
for non-new lines

little raptor
still forum
#

Yes as I said. You don't have values, you only have keys

#

Arma 2.06 gets insert [keys, values]
so you can just give it a big array as keys

#

and leave all values as nil

little raptor
#

btw which one is faster?

#

arrayIntersect

#

or hashmap createhashmapFromArray?

#

or merge?

#

(just some hashmap method)

still forum
#

they are all different things

little raptor
#

I know

#

but let's say given a certain array

still forum
#

for merge, you need a hashmap first.

#

createHashMapFromArray needs values too, not only keys

#

you don't care about values, so constructing all the arrays with nil values is a HUGE waste of time

#

but you'll also get in 2.06 the ability to just pass keys as one array

little raptor
#

and then?

#

will it be faster?

still forum
#

should be

#

will also depend on number of elements

little raptor
#

thousands

still forum
#

for low number the array will be faster

#

arrayIntersect is O(Nยฒ) (if zero duplicates), every element is compared to every other element.
HashMap insert is O(1) for one element. So in total for inserting many elements its generally O(N) (Average case, can be O(Nยฒ) in worst case)

little raptor
#

how can it be O(N2)?

#

it's 1-1

still forum
#

if all elements get hashed into the same bucket

#

then its just an array

little raptor
#

@still forum anyway, did you say bulk inserting into a hashmap is faster than set?
in other words, is something like this wise or stupid?

_hm = createHashmap;
_arr = [];
{
  _arr pushBack [_key, _value];
} forEach _something;
_hm insert _arr;
still forum
#

you are creating arrays (expensive-ish) with values that you never care about

#

so its pretty wasteful

#

and very probably worse

little raptor
#

ok thanks

#

so I guess I don't have to change that! ๐Ÿ˜„

still forum
#

2.06 gets some more hashmap goodies that will help in that regard

#

_hm insert [_arrayOfKeys, []]

little raptor
still forum
#

the next one

little raptor
#

2.04 then! ๐Ÿ˜„

still forum
#

ah. My brain

maiden warren
#

is there a way to use || / or in switch do?

little raptor
maiden warren
#

in a nutshell:

..switch bla bla
{
case (varA # 0 isEqualTo varB # 0)
so how would I go and do it so it's like
case (varA # 0 || varA # 1 isEqualTo varB # 0)
}

little raptor
maiden warren
#

so it's possible?

little raptor
#

yes

maiden warren
#

I'm probably placing operators wrong aren't I

little raptor
#

yeah

maiden warren
#

ugh

#

๐Ÿ˜•

warm hedge
#
switch brah do {
  case 0;
  case 1: {};  //When 0 or 1
  case 2;
  case 3;
  case 4: {};  //When 2, 3 or 4
};```IIRC
maiden warren
#

not sure what you mean

#

case (varA # 0 || varA # 1 isEqualTo varB # 0): {}; is what I wanna do but I'm not doing it right

warm hedge
#

Hmm...

maiden warren
#

case ((DATA_PLAYER_DB # 0 || DATA_PLAYER_DB # 1) isEqualTo DATA_TEST # 1): { DATA_PLAYER_DB set [2, "test_x"] };

#

obviously not working

little raptor
dark ivy
#

Hello guys. I may or may not need some help, I've been scratching my head on this one for a while. So I have a mission where every player gets two personal respawn tickets, and 1 is deducted every time they die. Once they have no personal respawn tickets, they're sent to spectator mode. I've ran into a problem: Although the player's tickets are 0, and the player goes into spectator, their body actually respawns somehow.

Here's my description.ext:

respawn = 3;
respawnOnStart = -1;
respawnDelay = 10; 
respawnVehicleDelay = 300;
respawnButton = 1;
respawnTemplates[] = {"Counter"};
respawnDialog = 1;

Here's my initPlayerLocal.sqf:

[player, 2] call BIS_fnc_respawnTickets;

Here's my onPlayerKilled.sqf:

_killer = (_this select 1);
[player, -1] call BIS_fnc_respawnTickets;  //Deducts one respawn ticket from player.
[_killer, 1] call BIS_fnc_respawnTickets;  //Adds one respawn ticket for player's killer.
_numPlayerTickets = [player,0] call BIS_fnc_respawnTickets; //Checks number of respawn tickets of player.
if (_numPlayerTickets == 0) //If a player's personal tickets have run out, they'll be sent to spectator mode.
then {
["Initialize",[player]] call BIS_fnc_EGSpectator;
};
#

The question is: How do I disable a player's ability to respawn once they're either in spectator mode or their tickets have ran out?

dark ivy
robust tiger
#

onPlayerKilled.sqf:

_killer = (_this select 1);
_numPlayerTickets = [player,0] call BIS_fnc_respawnTickets;
if (_numPlayerTickets == 0)then 
{
  ["Initialize",[player]] call BIS_fnc_EGSpectator;
}
else
{
  [player, -1] call BIS_fnc_respawnTickets;
};
[_killer, 1] call BIS_fnc_respawnTickets; 

~~I think the problem is that the tickets get checked before this script and you check for the number of tickets 1 ticket early. When the player has 1 ticket, it means, he can respawn 1 more time. So I just rearranged the script to account for that. The player can totally have 0 respawn tickets, except he won't get respawned the next time he dies. ~~ Somebody correct me if I'm wrong ๐Ÿ™‚
EDIT: This assumption is wrong; it's an off by 1 type of bug

dusty whale
#

i think i found a bug

#

running vehicle player setAmmo ["autocannon_40mm_CTWS", 0] when inside a marshall will not set the magazine to 0

#

can someone confirm?

#

same command works on the slammer just fine

#

same issue with gorgon

copper raven
#

can it be the case of marshall having multiple magazines of same type?

#

try removing all magazines but one

dusty whale
#

hopping in the gunner seat and running the command clears this avenue

copper raven
#

wait so, you were running the command while not being in gunner seat?

dusty whale
#

you dont need to be in the gunner seat to run it

copper raven
#

look at the examples on the wiki

dusty whale
#

what of them?

#

it's in a singleplayer mission

#

all objects are local

copper raven
#

nvm, anyways, what i was trying to say is that you need to have the gunner seat manned for it to work

warm hedge
#
vehicle player setMagazineTurretAmmo ["60Rnd_40mm_GPR_Tracer_Red_shells", 0,[0]]```Works pretty fine
copper raven
#

yeah, i'd also use that over setAmmo ^

dusty whale
#

if not, then i'll make a bug report on the feedback tracker

#

because the command works on the slammer and the other tanks, but not on the APCs

warm hedge
#
vehicle player setAmmo ["autocannon_40mm_CTWS", 0]```Just clarify this is the code for sure?
dusty whale
#

yep

#

vehicle player selectWeapon ("autocannon_40mm_CTWS"); doesnt work either

#

selectWeapon doesnt work on the APCs the same way it works on the tanks

warm hedge
#

And the code works for Slammer?

dusty whale
#

yep

warm hedge
#

Sounds like you're doing something wrong... There's no such weapon/magazine/whatever on default Slammer

dusty whale
#

HOLY!

#

listen

#

ofcourse i switch out the weapon classname to the 120 mm cannon

warm hedge
#

That's what you should said

#

Listen here. Troubleshooting does need the exact steps to reproduce, otherwise that's a garbage

dusty whale
#

i am SPECIFICLY talking about the setAmmo command

#

and the selectWeapon command

#

not the classnames

#

vehicle player setAmmo ["cannon_120mm", 0]

warm hedge
#

Even though the point was the commands, the exact step is required

dusty whale
#

here's the command i use for the slammer

#

that WORKS

#

there is nothing to talk about in it

#

the issue is the vehicle player setAmmo ["autocannon_40mm_CTWS", 0] which DOESNT work

warm hedge
#

Doesn't work on Marshall, right

dusty whale
#

and the vehicle player setAmmo ["cannon_120mm", 0] works on the slammer

#

same command

#

you can also replace the classname with (vehicle player weaponsTurret [0])#0

#

vehicle player setAmmo [(vehicle player weaponsTurret [0])#0, 0]

#

that is the exact same command

#

works on the slammer

#

doesnt work on the marshall or other APCs

copper raven
#

im guessing the command doesn't work on weapons that have more than one muzzle

dusty whale
#

that would be nice to document

copper raven
#

specifically muzzles[] array in the weapon's config

winter rose
#

Please detail the what and how indeed, then either ask for a fix on the feedback tracker or ask for doc in #community_wiki (not both)

dusty whale
#

then i should use selectWeaponTurret instead of selectWeapon since that supports muzzles

#

and setMagazineTurretAmmo

warm hedge
#

Okay so...

vehicle player setAmmo ["HE", 0];```Works pretty fine for me on Marshall. So, this actually takes a muzzle not a weapon
copper raven
#

ah, here we go ๐Ÿ˜„

warm hedge
#

My very best guess is if the currentMuzzle is "this", works fine with the weapon name but if isn't, don't

dusty whale
#

doc change?

#

the doc for the command details "weapon"

winter rose
#

Should be muzzle I suppose

warm hedge
#

Looks like it's better to do. Let me do some further test before edit

dusty whale
#

Thanks POLPOX

warm hedge
#

So well, I think it's working just the same method with ammo command?

#

selectWeapon also does take a muzzle

cosmic cipher
#

Hello, I'm looking for a way to get a return value with the path calculations tools (calculatePath,EH PathCalculated,
setDestination,setWaypoint "move"). Whether he can plan the route or not. So if the route cannot be planned then an empty array should be returned. The event handler only works if the calculation was successful. I need a solution before whether the way is possible or not. Thanks in advance. P.S. maybe there is also another solution (what I actually don't want is a time solution, wait so long and if nothing happens, no way out)

dusty whale
#

but removeWeaponTurret doesnt take muzzle

#

as the name suggests

#

my GOD

#

now i have to make amends to the scripts

#

to take into account that APCs have muzzles

hollow lantern
#

is there a specific trick to get a helicopter to fly on a waypoint?

            _onTarget = _helicrew addWaypoint [_destination, 1, 1, "Dropzone / Pickup"];
            _onTarget setWaypointType "MOVE";

            [_helicrew, 1] setWaypointSpeed "FULL";
            [_helicrew, 1] setWaypointCompletionRadius 30;```
is my current implementation. Yet the chopper just hovers 78 meters before the _destination. Instead of max 15m.
#

the expected result would be that the helo flies very close to the waypoint. Instead of waiting far away

little raptor
hollow lantern
#

how do I know if I need to adjust the X or Z axis? I have no defined flight path, the helo could be coming from anywhere

little raptor
cosmic cipher
#

Yes i wrote it the the Eventhandler is no option, so the time is everytime 13 s or is it how far is the distance?

little raptor
warm hedge
#

It does not fire at the same frame

#

(which is sad)

little raptor
cosmic cipher
little raptor
# cosmic cipher okay and there is no other solution? But surely the AI โ€‹โ€‹has to be told somewhe...

The return value is what the event handler gives. If you want to know the result beforehand, you can run a path generation on an agent. Add a variable to the agent for the "owner" (who you're running the path gen for).
Then add a path calculated event handler to the agent and give it a destination.
When you get a result, read the "owner" and do whatever you want there (e.g if it was moving tell it to stop and go some other way)
Sadly there is no good solution

cosmic cipher
brave lotus
#

Does anybody remember an article possibly in armaholic that explained how to increase grenade blast damage by randomly spawning "invisible" crates (server side only) triggered by explosion? It had a proof of concept piece of code showing how it would also fell trees in the blast radius too. I can't find it anywhere now I am looking for it. Or if anybody could point me at something similar it would be very appreciated ๐Ÿ™‚
Or did I dream the whole thing lol

dark ivy
#

@robust tiger I can still infinitely respawn even with 0 tickets

_killer = (_this select 1);
_numPlayerTickets = [player,0] call BIS_fnc_respawnTickets;

if (_numPlayerTickets == 0)
then {
  ["Initialize",[player]] call BIS_fnc_EGSpectator;
} else {
  [player, -1] call BIS_fnc_respawnTickets;
};

//[_killer, 1] call BIS_fnc_respawnTickets; 
#

I got it fixed. Added the official "Tickets" respawn template and just set onPlayerKilled.sqf to this:

_killer = (_this select 1);
[_killer, 1] call BIS_fnc_respawnTickets; 
_numPlayerTickets = [player,0] call BIS_fnc_respawnTickets;

if (_numPlayerTickets == 0)
then {
  ["Initialize",[player]] call BIS_fnc_EGSpectator;
};
#

The tickets template automatically deducts the personal tickets of the player. onPlayerKilled.sqf will give tickets to the killer and manage spectator mode once the player has no tickets left

robust tiger
opal sand
#

ok guys, so, basically im trying to make 2 jets fly via the vehiclecapture, but when i trigger play (bear in mind the jets are being flown by unnamed class fighter pilot)
the jets just blow up whereever they are midflight, what to do please?
(https://imgur.com/Ruru2Gw)

dark ivy
#

@robust tiger Yes. If he had one ticket, it'll get deducted and now he has none

#

Think of it as a "life ticket" rather than a "respawn ticket"

#

3 tickets = 3 lives

robust tiger
#

Yeah, I was on the opposite side of that

hollow lantern
# little raptor Use a waypoint a couple of hundreds of meters before the actual position The sec...

well I can just use the already present one on the "destination" and just set the completion radius to 80 meters (chopper is always 75m before the point) and then calculate a second one.
Question is now how do I calculate the second wp? Du I just use velocity _aircraft select 1 and create a wp based on the y-axis (aka check if the y-axis goes minus or plus and then create a wp further to that axis) or how would one do this?
Or do I jusy use getRelDir and create a wp in that direction just a few hundred meters away?

primal belfry
#

@opal sand I normally disable damage on vehicles when I do unit capture have you thought about trying that?

primal belfry
robust tiger
# hollow lantern well I can just use the already present one on the "destination" and just set th...

Even doMove has this tolerance for helicopters. I cheated the waypoint system a little bit. If you really need this:

//made in debug console so globals everyhwere
wpPos = getWPPos [group player,1]; //heli has single editor-placed WP
vect = (getposASL heli) vectorDiff [wpPos select 0,wpPos select 1,getposASL heli select 2]; 
phi = (vect select 1) atan2 (vect select 0); 
heli doMove ([(wpPos select 0)+88.3*cos(phi+180),(wpPos select 1)+88.3*sin(phi+180),200]);
//You could just relocate the waypoint also with SetWpPos
phi;

The magic number of 88.3 is for AH-9 Pawnee, it is slightly different for helicopters with different maneuverability. It is the distance where the heli stops in front of the WP. If you want it exactly, best way to do that is to measure it in editor. Obviously, this does not cover the case when the heli has more waypoints and you want it to stop at the doMove position. No guarantee it will work 100% of the time because AI.

hollow lantern
#

gonna check this out, thanks! Helo has only one wp created, so should be fine. After it has reached the wp it will be deleted anyway after 20 seconds so that's fine

opal sand
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

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

checking one thing

#

!code

wicked roostBOT
opal sand
#

@primal belfry Although thanks for your assist, used (https://www.youtube.com/watch?v=V2fWndbgtDA)
and found out;

rec = [car1,180] spawn BIS_fnc_UnitCapture;
hint "good!";

And was using car2, car3, car4 on the intended vehicles to be/recorded instead of changing this value, which caused the car2, car3, car4, to propel forward and be destroyed

primal belfry
#

@opal sand Glad you worked it out

dusty whale
still forum
dusty whale
#

oh wow, didnt see that

still forum
#

Also listed under "See also" at the bottom

dusty whale
#

thank you!

#

can i use hashmaps within hashmaps in arma 3?

still forum
#

yes

#

Value can be anything

#

be careful not to cause any circular references (inserting hashmap into itself)

dusty whale
#

not to worry, i'm building my hashmaps on startup and not chan... wait, why dont i just use dummy-configs?

still forum
#

config lookups are somewhat slow-ish, depending on usecase tho

dusty whale
#

fair enough

#

UI configs too?

still forum
#

probably better to benchmark if its actually slower

#

all configs

dusty whale
#

mmmh

#

i thought Configs were just CPP classes

#

but i guess theyre handled internally in some other way

#

because im never actually changing the values

#

i just need it to be hashed

#

because some have the values and some dont

idle jungle
#

Anyone know if there is a way for a hint to appear when someone uses respawn from the pause menu

#

Like hintSilent "name used force respawn";

cold mica
idle jungle
#

Nice ok thanks pal

dusky pier
#

hi, is possible to get memPoints list via script?
(i mean - memPoints for attachTo command)

cosmic lichen
dusky pier
#

@cosmic lichen thank you a lot!

primal belfry
#

Hi. I have this code below which is run from a units init which basically means every time a unit shoots all units with 200 meters go into combat mode. I'm a trying to make the AI be more responsive rather than staying still whilst a group near it is in full on combat. The script works as intend and so does the silencer check which means the script doesn't do anything when a silenced weapon is fired. However the delay does not work. Any idea how to add a sleep to this to simulate reaction time?

{   
_x addEventHandler ["Fired",{    
 
 params ["_firer"]; 
 hasSilencer = _firer weaponAccessories currentMuzzle _firer param [0, ""] != ""; 
 if !(hasSilencer) then {
 
 _delay = [] spawn {
    sleep random[1.8,2.2,3.5]; 
    };
 {
 _x setBehaviour "COMBAT";
 }forEach (allUnits select {_x distance2D _firer < 200});
   
 _firer removeEventHandler ["Fired", _thisEventHandler];    
};
}];
}forEach allUnits;
cosmic lichen
#

First of all, singleplayer or multiplayer?

#

@primal belfry

#

also, the delay is running in it's own thread, it decoupled from the rest of the script so to speak

primal belfry
#

single player atm as I understand multiplayer would mess evrything up with this script

#

How would i go about integrating it?

cosmic lichen
#
{
  _x addEventHandler ["Fired",
  {
    _this spawn
    {
      params ["_firer"];
      if !(_firer weaponAccessories currentMuzzle _firer param [0, ""] == "") exitWith {};
      sleep random [1.8, 2.2, 3.5];
      {
        _x setBehaviour "COMBAT";
      } forEach (allUnits select {_x distance2D _firer < 200});
      _firer removeEventHandler ["Fired", _thisEventHandler];
    };
  }];
} forEach allUnits;

Not tested but should work.

primal belfry
#

I get undefined variable _thiseventhandler

cosmic lichen
#

position _firer nearEntities ["CAManBase, 200]

Might be faster than allUnits select....

cosmic lichen
primal belfry
#

still getting same error

cosmic lichen
#

Oh wait, for some reason it didn't edit the code

primal belfry
#

I have changed it to this which seems to work

{
  _x addEventHandler ["Fired",
  {
    _this spawn
    {
      params ["_firer"];
      if !(_firer weaponAccessories currentMuzzle _firer param [0, ""] == "") exitWith {};
      sleep random [1.8, 2.2, 3.5];
      {
        _x setBehaviour "COMBAT";
      } forEach (allUnits select {_x distance2D _firer < 200});
      
    };
  _firer removeEventHandler ["Fired", _thisEventHandler];    
  }];
} forEach allUnits;
#

@cosmic lichen you asked earlier about single player & mp how would this make a difference?

little raptor
#

I have replaced my array method for configs with hashmaps
It seems to be a lot faster meowsweats

#

btw a question I forgot to ask yesterday

#

if I know that the values will be unique, will batch insertion be faster?

hollow lantern
#

@robust tiger works flawless, thanks.

still forum
#

though array building for batch insertion will also be many script commands think_turtle

dusty whale
#

i lvoe bohemia:

40 round belt of 40mm red tracer apfsds: "40rnd_40mm_apfsds_tracer_red_shells"
60 round belt of 30mm red tracer apfsds: "60rnd_30mm_apfsds_shells_tracer_red"```
hallow mortar
#

wait 'til you see 6.5mm LMG belt that is both caseless and cased

velvet merlin
#

is it possible to disable via scripting config based useractions but keep scripted? (per object/vehicle)

exotic tinsel
#

can someone point me in the direction of a solution for disabling server messages like join and disconnect messages. google is not helping.

winter rose
exotic tinsel
#

i dont want to disable channels i want to disable the messages for join and disconnect

winter rose
#

you can disable system channel for that and no other

#

(maybe)

exotic tinsel
#

ill give it a try

#

it doesnt work. systemchat still works and i see join messages

#

@winter rose

winter rose
#

okรฉ

exotic tinsel
#

rgr my bad

#

@winter rose the wiki pages for enabling channels and checking if their enabled channel id 6 is the first custom channel. but on the description.ext wiki 6 is system chat. lol fml.

winter rose
#

f the doc mostly
something may have gone wrong at some point, I remember it was a pain

exotic tinsel
#

there is no id of systemchat upon further research

#

arg why arma so hard

winter rose
#

hard_coded_

exotic tinsel
#

does anyone know how to hide/disable system chat?

#

or a mod i can use?

winter rose
#

I found some mods about it in my Google search
I suppose overriding some stringtable entries might do the trick

exotic tinsel
#

links?

winter rose
#

closed the pages ๐Ÿ˜ฌ it was mostly about KeyCat giving it in dm in 2012

exotic tinsel
#

yeah saw that one, no response from here for 2 days

#

I pm him already

finite imp
#

Hey Guys, sorry if this is the wrong channel but I could really use some help with a script I'm trying to run.

I'm trying to implement a teleport script with Fade In/Out, Time, Date and Weather Change. Linking to an Object with addAction, so all players on the server get teleported at the same time to a predetermined location.

For some reason, this only works for the host (if im trying on local) and for none if its on dedicated. The Teleport is working, but no Time/Date/Weather Change or Fade Out.

This is the script I'm running:

teleport.sqf:

0 setFog [0.4, 0.1, 25];  
{    
 [0,"BLACK",0.1,3] call BIS_fnc_fadeEffect;     
 _x SetPos ((getPos t1)  vectorADD ([random[0, 12.5, 25], random[-1.5, 0, 1.5], 0]));  
 [1, "BLACK",5,1] call BIS_fnc_fadeEffect;  
 0=[[["near the coast... ","align = 'center' size = '0.7' font='PuristaBold'"],["","<br/>"],["5 days later","align = 'center' size = '0.7'","#aaaaaa"]]] spawn BIS_fnc_typeText2; 
}foreach allPlayers;```

and this is in the 

Object Init:
```[this,["To U-Boat","scripts\teleport.sqf",[],1,false,true,"","_this distance _target < 3"]] remoteExec ["addAction",-2, true];```

Does anyone know what I'm doing wrong? I watched some youtube videos, but am new to scripting or mapping in general. Some insight if anyone has any would be really great. Thank you tons in advance.
winter rose
#

but ideally remoteExec something on the server that will then remoteExec to clients what is needed (e.g, remoteExec'ing setPos should not happen)

finite imp
winter rose
#

oh wait, I did not realise x)
you are remoteExecuting addActionโ€ฆ
use addAction normally, and remoteExec 0 the script

wild prairie
#

Do structured text hyperlinks support anything other than browser addresses? I'm trying to add a clickable link to join my TS server to a welcome message. Here's what I have.

private _ts = parseText "<a href='ts3server://74.91.115.227'>Teamspeak IP: 74.91.115.227 (Click Me!)</a>";
private _discord = parseText "Be sure to join our <a href='https://discord.gg/fxeATZR'>Discord (Click Me!)</a> if you are interested in learning more about our unit.";
private _arsenal = parseText "The Arsenal can be accessed by ACE Self Interaction > APM Arsenal.";
"Welcome to APM!" hintC [_ts, _discord, _arsenal];

The Discord link works fine, but the TS one doesn't do anything.

finite imp
winter rose
#

try this instead (ugly but should work)

this addAction
[
  "To U-Boat",
  {
    [[], "scripts\teleport.sqf"] remoteExec ["execVM", 2];
  },
[],1,false,true,"","_this distance _target < 3"
];
winter rose
#

@finite imp?

finite imp
# winter rose <@!140260962551726081>?

Oh sorry, I forgot to send an answer. Yes, the teleport is working like that. SetDate aswell, but the setFog command does only get executed on the host for some reason. And, for another reason, the fadefunction from the teleport.sqf gets executed on the host only aswell

winter rose
#

yes, you need to use remoteExec 0 the fading inside the file

finite imp
#

So I have to remoteExec everything separately inside the file?

winter rose
#
// we are on the server
setDate [2012, 9, 1, 4, 30];  
0 setFog [0.4, 0.1, 25];  

[0,"BLACK",0.1,3] remoteExec ["BIS_fnc_fadeEffect"];
_x setPos ((getPos t1) vectorAdd ([random[0, 12.5, 25], random[-1.5, 0, 1.5], 0]));
[1, "BLACK",5,1] remoteExec ["BIS_fnc_fadeEffect"];
[[["near the coast... ","align = 'center' size = '0.7' font='PuristaBold'"],["","<br/>"],["5 days later","align = 'center' size = '0.7'","#aaaaaa"]]] remoteExec ["BIS_fnc_typeText2"]; 
```more or less
finite imp
#

Give me a second to try that

winter rose
#
// we are on the server
setDate [2012, 9, 1, 4, 30];  
0 setFog [0.4, 0.1, 25];  

[0, "BLACK", 0.5, 3] remoteExec ["BIS_fnc_fadeEffect"];
sleep 0.5; // may help, dunno
_x setPos (getPos t1 vectorAdd [random [0, 12.5, 25], random [-1.5, 0, 1.5], 0]);
[1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect"];
[
  [
    ["near the coast... ", "align='center' size='0.7' font='PuristaBold'"],
    ["", "<br/>"],
    ["5 days later", "align='center' size='0.7'", "#aaaaaa"]
  ]
] remoteExec ["BIS_fnc_typeText2"];
finite imp
winter rose
#

yep for setFog
teleportation should work, but yes I removed the forEach allPlayers mb

use this

{ _x setPos (getPos t1 vectorAdd [random [0, 12.5, 25], random [-1.5, 0, 1.5], 0]) } forEach allPlayers;
finite imp
#

Tried that already, does not work. Not for anyone, neither host nor player

winter rose
#

wat

finite imp
#

Ill try again

winter rose
# finite imp Ill try again

try that?```sqf
// we are on the server
setDate [2012, 9, 1, 4, 30];
[0, [0.4, 0.1, 25]] remoteExec ["setFog"];

[0, "BLACK", 0.5, 3] remoteExec ["BIS_fnc_fadeEffect"];
sleep 0.5; // may help, dunno
{
_x setPos (getPos t1 vectorAdd [random [0, 12.5, 25], random [-1.5, 0, 1.5], 0]);
} forEach allPlayers;
[1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect"];
[
[
["near the coast... ", "align='center' size='0.7' font='PuristaBold'"],
["", "<br/>"],
["5 days later", "align='center' size='0.7'", "#aaaaaa"]
]
] remoteExec ["BIS_fnc_typeText2"];

finite imp
#

I really appreciate the help, I hate scripting lmao. Give me a second

finite imp
#

Learned a lot today

winter rose
# finite imp Learned a lot today

what we did here:

  • add an action in init field (so everyone has it)
  • trigger the script by the client on the server
  • from the server, send instructions for local-effect commands/functions
    et voilร ย !
fading dust
#

hello i want to ask is their a script that let soldiers roam around specific area ( camp or base ) in safe mode

#

and if they get attacked they go take cover and fight

lean anchor
#

i was looking through places and ive been wondering if there is a way to add an EH that removes any silencer from the gun of the player who has just closed an ACE arsenal box?

My current throught is to use something like

_suppressorlist = getArray (configfile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems");
 removePrimaryWeaponItem
 {
_x = _temp;
if (((primaryWeaponItems player) arrayIntersect _suppressorlist)!= nil) then {player removePrimaryWeaponItem "_temp"};
} foreach _suppressorlist ;
wild prairie
#

Look at ACE Wiki's ACE Arsenal framework, should be an eventhandlers section.

#

Can use getUnitLoadout _unit, edit the loadout array, then setUnitLoadout again.

#

Although, at that point, why don't you just remove suppressors from the arsenals?

lean anchor
#

@wild prairie sorry just updated my last reply with my intial code thoughts

#

but i dont think that would would work

leaden haven
#

Is there any way to have an addaction on a simple object at all? Thanks.

finite jackal
brave lotus
#

4 times out of 5, I'm getting 0,0,0 reported in the message, not the location of the grenade prior to explosion. The only time it seems to pick up the coords is if the RGO has lodged in a tree or wall corner prior to exploding. What am I doing wrong? I already tried changing the velocity check from ==0 to <1, but no difference. Trying to hack the CRS grenade script for something else. It seems I'm missing the boat for grabbing the coords prior to the grenade despawning.

CRS_NadeList=["HandGrenade","CUP_HandGrenade_RGO","CUP_HandGrenade_M67","CUP_HandGrenade_RGD5","CUP_HandGrenade_L109A1_HE","CUP_HandGrenade_L109A2_HE"];
player addEventHandler["Fired",{
    if(_this select 5 in CRS_NadeList) then
    {
        _nade=(_this select 6);
        [_nade]spawn
        {
            private _nade=(_this select 0);
            waitUntil{vectorMagnitude velocity _nade<1};
            private _nadePos=getPosATL _nade;
            sleep 0.1;
            waitUntil{isNull _nade};
            hint format["grenadeyboom! %1", _nadePos];
            // spawn projectiles and stuff, then deleteVechicle each one after 5 secs
        };
    };
};];
still forum
#

@little raptor that should help you if you just want a set

_hm = createHashmap; 
_hm insert [true, [1,2,3,4], []];
_hm

[[2,<null>],[4,<null>],[1,<null>],[3,<null>]]

exotic tinsel
#

I am attaching two objects and trying to change the direction of the attached object after its attached but its not working. im geting the objects dir before attaching and then reapplying it after attaching but it only changes direction slightly. Any reason why thats happening?

still forum
#

I think direction is relative to the object its attached to

exotic tinsel
#

I thought that might be the case so I even did get dir of object that its attached to and calculate difference to obtain original dir relative to the object its attached to but im getting odd results.

#

idk im prolly screwing something up. ill take a break and work on it later.

warm blaze
#

I have a tricky situation with joinSilent command. Originally I have FFA setup for all sides including civilian. When I generate blufor group and use joinSilent civilian, it becomes civilian. All works good. But when I start killing them staying on other side (west, east, resistance) I am becoming renegade and friendly units start shooting me. Is there any way out of it?

exotic tinsel
#

do like 10000 though.
To clarify are you trying to join civilian to bluefor or bluefor to civilian?

warm blaze
#

blufor to civilian

#

shall I use addRating each time after killing of any civ unit ?

#

on EH side f.e.

exotic tinsel
#

ok then increase player rating and they will never upset their friendly faction for killing civis or same team. or you can add an eventhandler on civi killed to negate player rating points if you want to upset friendlies for team killing but not for civi killing.

#

you can set it once when misison starts or on player join

warm blaze
#

what is max limit value for addRating ?

exotic tinsel
#

not sure but 10000 does it. i use it

warm blaze
#

does it decrease everytime I have friendly fire in eyes of side logic ?

exotic tinsel
#

yes

warm blaze
#

so if I have potentially 20 civ groups and they all have been killed by a player, his rating can become -2000 after some time

#

so it's better to check it dynamically I assume

exotic tinsel
#

yes

#

on civi killed EH check if killer is player and then increase player rating by the amount reduced. i dont know the amount deducted each time you will have to test that.

warm blaze
#

is addRating server side command only ?

exotic tinsel
#

it tells you on the wiki

warm blaze
#

yup, sorry ๐Ÿ˜„

exotic tinsel
warm blaze
#

yeah, looking at it now. Also I found this addEventHandler ["HandleRating", {
params ["_unit", "_rating"];
}];

#

can be attached to a player

exotic tinsel
#

yep thats the way i would go. cleaner that way let EH firing on server

warm blaze
#

does ai bot also have rating ?

exotic tinsel
#

no idea

warm blaze
#

I mean if some bot kills tons of civ bots then he could become a renegade too in theory

exotic tinsel
#

i would assume so. but i dont know

#

google

winter rose
#

AIs can kill without being worried

exotic tinsel
#

yay lou, can you help me with my SIT code i posted above? cant get setdir to work properly on an attached object.

winter rose
#

what Dedmen said, setDir is relative to the base-attach object direction

#

e.g setDir 0 will face the same way, 90 to the right etc

exotic tinsel
#

rgr got it working. im dumb. so dumb. thank you @still forum & @winter rose. Not enough sleep.

dreamy kestrel
#

Q: if we are passing around a HASHMAP as an argument, is there an objNull analog we can use as a type constraint? i.e. ["_hashmap", _hashmapValue, [hashmapNull]] ?

final sun
#

Hello, I'm new to Arma scripting. I'm trying to trying to make units take cover behind walls, in order to give them a said position i require the center of the object. though the problem is that some wall centers are not the same(e.g green arrow is center , red is the position unit takes). I tried using bounding center but it didn't work. Could I have some help with this please?

dreamy kestrel
#

@still forum and what do you do with the memory hole afterward? it GC's automatically?

still forum
#

what memory hole?

dreamy kestrel
#

createHashMap creates a new instance, correct? that's not a potential memory leak?

still forum
#

no.
You already asked if you need to delete the hashmap, and you were already told no.
About a month ago

dreamy kestrel
#

sorry if I don't trust that. seems like a memory leak to me.

still forum
#

why?

#

because it says "create"

dreamy kestrel
#

right with no delete

still forum
#

its the exact same as objNull, grpNull, scriptNull

dreamy kestrel
#

no it's not exactly the same. those are "null" placeholders. whereas there is none for hashmap that I know of

still forum
#

It is the exact same.

dreamy kestrel
#

so you're saying an empty hash map is considered the same? which in and of itself, that's something to consider.

still forum
#

createHashMap returns a empty hashmap.
objNull returns a empty object.
scriptNull returns a empty group.
[] creates a empty array.

dreamy kestrel
#

so we can do something like emptyHashMap = createHashMap and use that instance

still forum
#

yeah

dreamy kestrel
#

groovy, that's all I needed

winter rose
#

๐Ÿ˜‚

dreamy kestrel
#

@winter rose have had a few fall the cracks over the years, yessir, thanks

winter rose
dreamy kestrel
#

@winter rose it's all good, cheers ๐Ÿป

final sun
# robust tiger maybe this? https://community.bistudio.com/wiki/getPosWorld

Thank for your reply!, Unfortunately it didn't work it just increased the altittude. The problem is the center point of this stone wall (Land_Stone_4m_F) is on it's left corner , I've thought of getting the two corners of the object to try to get it's center but I can't think of a way to implement it. here's the code I'm using

#

//naming pattern for units : Blue_"Acronym"
_coverableTerrain = ["Wall"];
private _WestUnits = allUnits select {side _x == west};
_result1=  nearestTerrainObjects  [Blue_M, _coverableTerrain, 50];
sleep 1;
systemChat format ["%1", _result1];
//gothere is nearest object (stone wall)
gothere= _result1 select 0;

// Blue_m doMove getPosATL gothere;
// Blue_M setBehaviour  "STEALTH";
// _objDir1 = vectorDir gothere;
// systemChat format ["%1", _objDir1];

_meter = Blue_M distance gothere;
_Lamba = 1+ 2/_meter;
//----bounding center test 
_center = getPosWorld  gothere;
//equation to put unit 2m behind nearest object using the center point of said object
_result2 = ((getPosATL player) vectorMultiply (1 -_Lamba)) vectorAdd ((getPosATL gothere) vectorMultiply (_Lamba));

private _arrow = createVehicle ["Sign_Arrow_Large_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_arrow setPosATL _result2;

private _arrow = createVehicle ["Sign_Arrow_Large_Green_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_arrow setPosATL ((getposATL gothere) vectorAdd [0,0,2]);

systemChat format ["green arrow position is: %1", _result2];

systemChat format ["bounding center position is: %1", _center];
dusty whale
#

Found an issue with the switchCamera command where audio keeps playing if you stay in the same vehicle as the camera you switched to:
https://streamable.com/zz38tz

#

switching to a camera outside the vehicle or stepping out of the vehicle is a dirty fix

#

but you need to stay in that camera for atleast what seems to be a single frame

#

you can immediately switch

#

introducing an annoying flicker

#

same issue occurs witch selectPlayer

winter rose
dusty whale
#

oh, forgot to ask

#

can someone repeat this behaviour?

#

or is this just me?

winter rose
#

ah, it changes something ๐Ÿ˜„

dusty whale
#

need to ensure first it's not an issue with just my system

robust tiger
final sun
warm blaze
#

is it possible to get gear loadout by unit classname only?

winter rose
#

yes

warm blaze
#

can't find command to get gear array by provided classname string.

warm blaze
#

ah, thanks a lot, you saved my day ๐Ÿ™‚

winter rose
#

w/ pleasure! have fun ๐Ÿ™‚

hasty violet
#

Feasibility idea - Script for Mute/Selectively Mute Arma 3 Players to display typing in the world

Using drawIcon3D text lines to show text after they type it or, preferably, as they type it.

Big stretch: American Sign Language hand animations as they type.

Anyone with experience -- can systemChat be read from (figure yes), and can it* be read from in real time, as someone types? (figure no without CBA keybind or some way to manually read the typing)

#

Text would be on body or above head. Playing with mute players frustrates me sometimes, this would help with that a lot. Give them an avenue to communicate easier.

#

One important note is, obviously, when people are typing they cannot input anything else. This may help make implementation a lot easier.

dusk shadow
#

Good evening gents, a quick question: Does the CfgFunctions set scopeName for functions defined in it automatically?

still forum
#

yes

dusk shadow
#

_fnc_scriptName?

#

*Same as above?

still forum
#

uh.. I think so

#

do
BIS_fnc_MP in debug console, and look at the start of it

dusk shadow
#

Reads "scriptName _fnc_scriptName;" if that's what you're refering

#

but is scriptName == scopeName when it comes to breakOut

still forum
#

ooooh scopeName

#

Good question. I think no. Don't really know can just guess

dusk shadow
#

Aight, cheers. I guess breakOut is rarely used anyhow so shouldn't be too hard to remember to put a scopeName at the top lol

mighty vector
#

so...a few days ago, you 2 made me cry converting my 30 lines code to a shameful 17 lines of easier & cleaner code...
today, a kill-counter script which uses global mission entity killed event:

//On mission start
private _mission_event_entity_killed = addMissionEventHandler ["EntityKilled", {
  params ["_unit", "_killer", "_instigator", "_useEffects"];
  if(isNull _killer) exitWith { false };
  //systemchat format ["%1 was killed by %2", name(_unit), name(_instigator)];
  if (isPlayer _instigator) then {
    //systemchat format ["PMCES %2 KILLED %1", name(_unit), name(_instigator)];
    diag_log format["PMCES %2 KILLED %1", name(_unit), name(_instigator)];
  };
}];
//On mission end, remove event handlers
private _mission_event_mpended = addMissionEventHandler ["MPEnded", {
  removeMissionEventHandler ["EntityKilled", _mission_event_entity_killed];
}];

is that ok? any room for improvement? would it be a bad idea to invoke a SQL insert each time someone kills an enemy? (i can handle an array of players, each one with kill counter and insert at mission's end instead)

winter rose
#

you don't need to remove EHs if the mission ends ๐Ÿ™‚

mighty vector
#

aside of that?

winter rose
#

you could inline isNull _killer && isPlayer _instigator, other than that nothing ๐Ÿ™‚

#

name _instigator, it is not a JS function ๐Ÿ˜„

livid wraith
#

is there a command to delete a single magazine from a container (GroundWeaponHolder) without totally clearing it (clearMagazineCargo<Global>) ?

still forum
#

no

winter rose
#

you are writing name(_instigator)

mighty vector
#

yep...to display the name of the killer

winter rose
#

no need for () is what I am saying

mighty vector
#

oh!...."name _instigator"

#

tbh, I dont like this language grammar xD neither he likes me

#

which one should be a fair pick to store this on mariadb/which is the most used ddbb extension for arma3...extdb3?

winter rose
#

dunno

tough abyss
#

want to make AI do a simple reload script for some arma cinematic i'm doing, can someone link me the correct arma wiki? there are a bunch of different ones not sure which one I need exactly.

mighty vector
#

hmm...can I store a hashmap as a global variable? or do I have to serialize it/make it an array?

tough abyss
#

I am trying to make a helo have itโ€™s engine started up in-air, the mod Iโ€™m using doesnโ€™t start it when doing an air start so Iโ€™m trying to do it manually with

this engineOn true;
Not quite sure why it wonโ€™t work. I have minimal scripting knowledge

#

Maybe itโ€™s the mod? Or my code

#

Iโ€™m thinking itโ€™s the mod but Iโ€™m not quite sure

#

the issue i'm having is that it plays the animation, but he doesn't actually reload

#

I used playActionNow and playAction

#

which does the animation, but he "fake" reloads it

winter rose
tough abyss
#

soldier action "reloadMagazine"; ?

#

oh "reloadMagazine" is not an action

winter rose
#

see the wiki

mighty vector
tough abyss
#

yeah looking at the wiki

#

s action ["loadmagazine",s,s,0,0 ,"arifle_MX_Black_F","arifle_MX_Black_F"];

shadow sapphire
#

Can someone help me understand why "Player in thisList;" doesn't work as a trigger condition?

tough abyss
#

what i got so far, still working on it though.

#

kiwi arma wiki for the reloading?

#

i don't care if the weapon is actually loaded or not, i care if it plays with the animation and the actual mag gets taken out a new one gets put in

mighty vector
#

hey @winter rose, just to be sure:

//...
function={
  if (foo) then {
    _myvar=0;  <---------------- is this variable local/private/if-scope only or I need to explicit "private"?
  };
  //_myvar shouldn't exist here!
};
//...
warm hedge
#

private is needed to make it local in the scope, otherwise it exists in the entire code

mighty vector
#

any way to avoid needing to type private everywhere?

warm hedge
#

I used to hate write private everywhere but I don't anymore. So just be patient and write

tough abyss
#

ok so got it to work

#

s action ["loadmagazine",s,objNull,0,10002809 ,currentWeapon s,currentMuzzle s];arma wiki was wrong, 0 for the id does not work.

warm hedge
#

Or, maybe here's an idea, you can put private into an #define, like#define P privateso sqf P _myVar = 0;is a privated

tough abyss
#

@winter rose Thanks, figured it out!

distant oyster
shadow sapphire
#

Ah! That's a good tip. Okay, what about normal list?

#

I basically need a condition like:

East countSide thisList < 0.7 West countSide thisList;
``` If I do
```SQF
Alive NamedUnit;
``` or 
```SQF
!Alive NamedUnit;
``` In a condition field, it works just fine.

But, if I do
```SQF
NamedUnit in thisList;
``` Then I get nothing.
distant oyster
#

cant you just set the unit as the trigger's owner?

shadow sapphire
#

Which unit?

The named unit is just for experimentation.

I need to compare a ratio of occupation of nameless units.

distant oyster
#
East countSide thisList < 0.7 West countSide thisList;
``` in this case the trigger has to be activatble by anyone
#

also:

East countSide thisList < 0.7  * (West countSide thisList);
shadow sapphire
#

That makes sense, and was my initial inclination, but I was concerned that civilians and the like might mess with it. I guess that was a needless concern.

#

Thanks SO much!

Haha, yeah, the count was just like my pseudo code to convey what I needed.

distant oyster
#

would only be a problem if you would use the default condition

shadow sapphire
#

Gotcha! Thanks so much!

distant oyster
#

performance wise i am not too sure how much impact a larger thisList array has, since literally every entity in the trigger area is listed

shadow sapphire
#

That is important to consider, since the scenario will require many triggers of this type. I was however going to slow the trigger checks WAY down. One check every ninety seconds or so.

Performance is one of the reasons I'm not using the default sector control modules.

distant oyster
#

if it is only every 90 seconds it should really not be too bad

shadow sapphire
#

Fingers crossed. This is my third or fourth attempt at this scenario.

distant oyster
#

i also can't think of a way to make it more simple, all alternatives would include more sqf commands and that is worse for performance

shadow sapphire
#

I am going to try to cross that bridge when I get there, haha. Might be able to figure a way to just count groups or something. IDK.