#arma3_scripting

1 messages Β· Page 70 of 1

sullen sigil
#

objects -> game logic works right?

thorn saffron
#

yes, but as I said, I do not want to use this method for putting details on top of other props, because I'm getting a relative positions and directions in relation to the parent prop.

sullen sigil
#

first one synced to a game logic is parent, others synced are attached to parent. all game logics synced to a module? 🀷

#

I'm not sure what issue you're referring to with spawning compositions in the first place either

thorn saffron
#

save a table with stuff on top and spawn it on an slight incline, the stuff from the top will get spawned on the ground and clip through the table

#

spawning using BIS_fnc_objectsMapper

sullen sigil
#

spawning in 3den you just disable vertical mode, don't know why you'd spawn a composition during runtime

thorn saffron
#

Those compositions will be spawned dynamically during a mission

winter rose
#

ah wait, this comparison is about not parsing all elements

#

I didn't want to list apply or select or anything else to prevent people straying from for and forEach

#

I think
that or I didn't think of making the comparison

hallow mortar
thorn saffron
#

I want more control

sullen sigil
#

oh yeah -- either way there's no base game supported way for spawning compositions iirc

meager granite
#

Might be worth including inAreaArray in that example

sullen sigil
#

objectsmapper function looks old

digital hollow
#

just have the table in the comp and make its init spawn/attach the stuff on top.

meager granite
#

Btw, exitWith forEach construct has a problem of running it with empty arrays, might be a noob trap

#

{if(alive _x) exitWith {true}; false;} forEach []; => nil

winter rose
thorn saffron
meager granite
thorn saffron
#

How do you get the objects anyway for the attachto? Synching of the objects does not work, how do you tell the game with objects will be attached to?

digital hollow
thorn saffron
#

Great, idea. That is exactly what I was doing. The issue is getting the damn list of objects without doing dumb stuff like having dummy game logic syncing going on where you have make sure that the parent object is first in array just to let the script know that stuff is meant to be attached to that.

sullen sigil
#

is there a way to lock out player movement controls as I am currently trying to fly an aircraft carrier by rolling around on the floor

kindred zephyr
#

you might want to block the display 49 I believe for that?

thorn saffron
sullen sigil
#

made a movement system from scratch and now am trying to learn how to use it πŸ˜…

kindred zephyr
#

HA, classic

#

gl with that

sullen sigil
#

problem seems to be that im unable to roll left or right but I think that's due to the inputcontrols I'm using

hallow mortar
#

I thiiiiink? certain types of scripted camera take away control of the player unit

sullen sigil
#

I'll probably have to use CBA keybinds or something similar though as you cannot stack turning and increasing throttle notlikemeowcry

stark fjord
#

Annoying part is if u block user input and player is moving mouse, it will keep rolling their head

sullen sigil
#

player's mouse probably won't be needed(?)

#

It has thrust in all 3 dimensions though and pitch, roll and yaw so it could be thonk

#

or i be really mean and bind it to wasd, throttle up and down and then pitch/roll/yaw is hujkyi

stark fjord
#

Meh i needed it for my own dramatic suicide animation, but i ended up scrapping it cause camera just rolled somewhere

sullen sigil
#

I'm so confused because yaw works fine but pitch/roll doesn't πŸ€”

#

Bet I'm calling something wrong

stark fjord
#

What phone number did you use?

sullen sigil
#

Oh I reckon I'm changing orientation not target orientation]

#

but I cannot check currently because arma crashed because I walked too far away with my hearing aids connected to my laptop πŸ™‚

#
if (inputAction "HeliBack" == 1) exitWith { //Pitch up.
    private _currentOrientation = _ship getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]];
    _currentOrientation set [2,(_currentOrientation#2+5*diag_deltaTime)];
    _ship setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
    systemChat "HeliBack";
};
if (inputAction "HeliForward" == 1) exitWith { //Pitch down.
    private _currentOrientation = _ship getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]];
    _currentOrientation set [2,(_currentOrientation#2-5*diag_deltaTime)];
    _ship setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
    systemChat "HeliForward";
};
if (inputAction "HeliRudderLeft" == 1) exitWith { //Yaw left.
    private _currentOrientation = _ship getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]];
    _currentOrientation set [0,(_currentOrientation#0-5*diag_deltaTime)];
    _ship setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
    systemChat "HeliRudderLeft";
};
if (inputAction "HeliRudderRight" == 1) exitWith { //Yaw right
    private _currentOrientation = _ship getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]];
    _currentOrientation set [0,(_currentOrientation#0+5*diag_deltaTime)];
    _ship setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
    systemChat "HeliRudderRight";
};

I'm not going totally insane, right? Yaw and pitch are the same with different indexes?

stark fjord
#

I would use switch instead of ifs but i guess, array indexes look okay

sullen sigil
#

I know, it's just me shitting about trying to get this to work in something showcaseable
I've manually run KJW_CapitalShips_Ships#0 setVariable ["KJW_CapitalShips_TargetOrientation", [-100,-100,-100]]; and it works just fine as well thonk

#

And it is updating the array

digital hollow
quiet gazelle
#

is there an animation that's just a t-pose?

sullen sigil
#

so doesnt take vectors

#

just one array of yaw, roll and pitch

stark fjord
#

And array is showing correct values on user input? So if you yaw it right 3rd value changes?

sullen sigil
#

Yep, yaw works just fine

#

Only pitch and roll thonk

#

that being said roll doesn't actually seem to have any effect here

#

oh bruggin

#

my ctrl+h stuff didnt work properly

#

Guess I must not know what I'm looking for when setting manually

stark fjord
#

You could jank it with obj setDir yawDeg;
[Obj, pitchDeg, rollDeg] call BIS_fnc_setPitchBank;

sullen sigil
#

now I've fixed that hopefully it should be fine

#

well aside from heliforward and heliback not working but I think that's bc I'm on the ground w/ sim disabled

stark fjord
#

Also wont setVectorDirAndUp reset velocity?

sullen sigil
#

heres the fun part
there is no velocity

#

setposasl oneachframe πŸ™‚

#

object has no physics

#

and before you ask why i dont use setvelocitytransformation
dont

stark fjord
#

I wont ask

sullen sigil
#

the movement function used to be 500 lines then i woke up this morning and rewrote it in about 50 across 2 functions

#

FUCK setvelocitytransformation i hate it

#

Amazing it's pitching now

#

Rolling not pitching, pitching still doesn't work for some reason

#

Oh yeah bc I don't have the control duh

sullen sigil
#

this is perhaps a daft question but is there a way to change an objects orientation in modelspace notlikemeowcry

stark fjord
#

Yuh, mode 0

sullen sigil
#

i.e
always make it turn to the left no matter what its pitch/bank is

stark fjord
#

Oh yeah nvm. Youd have to set mode 1 and whitelist allowed. I dont think there is blacklist mode

digital hollow
sullen sigil
stark fjord
#

Dont think u can set mode for each function.

digital hollow
#

well, ideally unit direction vector, right? so yaw would be

_dirAndUp = [[sin _yaw, cos _yaw, 0], [0,0,1]] apply {_ship vectorModelToWorldVisual _x};
sullen sigil
#

I think I understand? ish? Not really? notlikemeowcry

#

vector maths has (probably obviously) always been my weakness

digital hollow
sullen sigil
#

I understand a bit more -- but I'm not sure how that'd get put into one setvdirup command though πŸ˜…

digital hollow
#

i mean literally _ship setVectorDirAndUp _dirAndUp

sullen sigil
#

what would _dirandup be though with more than just one? notlikemeow

digital hollow
#

more than just one input? easy-slow way would be to do them one after the other xD

sullen sigil
#

as in
if pitch is increased but you're rolling left, you need the nose of the ship to go up and left -- but I just have _orientation params ["_yaw", "_roll", "_pitch"]; πŸ˜…

boreal parcel
#

how does createMine work? Can I provide it any object class and it will turn it into a proximity based mine?

fair drum
boreal parcel
#

oh so it must be an existing mine? I cant turn a table into a mine or trash pile?

sullen sigil
fair drum
#

!quote 6

lyric schoonerBOT
fair drum
boreal parcel
fair drum
digital hollow
boreal parcel
#

ill give it a shot

sullen sigil
kindred zephyr
brisk lagoon
#

I forgot to ask does the custom sound files loop?

#

with say3d

winter rose
#

no

brisk lagoon
#

oh shit I thought it did, how do I make it loop?

#

found it

#

I need to add sleep right?

sullen sigil
#

yes

#

you can just find out these things yourself you know

brisk lagoon
#

well yes as you see I just found it I just need someone to confirm because I am unsure

sullen sigil
#

what

winter rose
sullen sigil
#

but i wanted him to find out what happens if you dont add sleep to a while true loop

winter rose
sullen sigil
#

best way to learn πŸ˜‰

digital hollow
# sullen sigil I do need to change it to `then` but the controls just add/subtract from the ori...

Got it!

private _roll = diag_deltaTime *5* (inputAction "AirBankLeft" - inputAction "AirBankRight");
private _pitch = diag_deltaTime *5* (inputAction "HeliForward" - inputAction "HeliBack");
private _yaw = diag_deltaTime *5* (inputAction "HeliRudderRight" - inputAction "HeliRudderLeft");

private _dir = [0,1,0];
_dir = [_dir, _yaw, 2] call BIS_fnc_rotateVector3D;
_dir = [_dir, _pitch, 0] call BIS_fnc_rotateVector3D;

private _up = [0,0,1];
_up = [_up, _roll, 1] call BIS_fnc_rotateVector3D;
_up = [_up, _pitch, 0] call BIS_fnc_rotateVector3D;

_ship setVectorDirAndUp ([_dir, _up] apply {_ship vectorModelToWorldVisual _x});
stark fjord
# sullen sigil as in if pitch is increased but you're rolling left, you need the nose of the sh...

This works for me, SHIP is heli with sim disabled

onEachFrame { 
 private _currentOrientation = SHIP getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]]; 
 
 if (inputAction "HeliCyclicBack" > 0) then { //Pitch up. 
  _currentOrientation set [2,(_currentOrientation#2+5*diag_deltaTime)]; 
  SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation]; 
  systemChat "HeliCyclicBack"; 
 }; 
 if (inputAction "HeliCyclicForward" > 0) then { //Pitch down. 
  _currentOrientation set [2,(_currentOrientation#2-5*diag_deltaTime)]; 
  SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation]; 
  systemChat "HeliCyclicForward"; 
 }; 
 if (inputAction "HeliCyclicLeft" > 0) then { //Roll left. 
  _currentOrientation set [1,(_currentOrientation#1-5*diag_deltaTime)]; 
  SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation]; 
  systemChat "HeliCyclicLeft"; 
 }; 
 if (inputAction "HeliCyclicRight" > 0) then { //Roll right 
  _currentOrientation set [1,(_currentOrientation#1+5*diag_deltaTime)]; 
  SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation]; 
  systemChat "HeliCyclicRight"; 
 }; 
 if (inputAction "HeliRudderLeft" > 0) then { //Yaw left. 
  _currentOrientation set [0,(_currentOrientation#0-5*diag_deltaTime)]; 
  SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation]; 
  systemChat "HeliRudderLeft"; 
 }; 
 if (inputAction "HeliRudderRight" > 0) then { //Yaw right 
  _currentOrientation set [0,(_currentOrientation#0+5*diag_deltaTime)]; 
  SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation]; 
  systemChat "HeliRudderRight"; 
 }; 
 SHIP setDir _currentOrientation # 0; 
  [SHIP, _currentOrientation # 2,  _currentOrientation # 1] call BIS_fnc_setPitchBank;
};```
sullen sigil
#

holy crap thank you

#

omg double trouble

stable dune
#

And stop by deleteVehicle _actionSound

sullen sigil
#

I'll give both a try and see which runs better as is oneachframe executed foreach array of ships πŸ˜…

stark fjord
#

idk, the input thing on mine is copy pasta of yours, i just added 2 commands at the bottom

sullen sigil
#

Ya I'll give that a try before amp's as it seems to be simplest πŸ˜…

#

committing the cardinal sin of building a mod to test though

stark fjord
#

also u may wanna increase this +5*diag_deltaTimeΛ› it turns slow as sin

sullen sigil
#

capital ship is 800m long πŸ™‚
though I did increase to 10 not long after I posted. turning is actually driven by a different function though based on config values πŸ™‚

#

have 4 perframehandlers for acceleration, velocity, turning and orienting at the moment notlikemeowcry

#

two just set the variable and the other two just use it

digital hollow
#

with setDir you'd have to check if bank>90 yaw is reversed, right?

stark fjord
#

good point lemme check

sullen sigil
#

errrr
I think so? Not 100% sure what the question means as my brain is frazzled rn

stark fjord
digital hollow
sullen sigil
#

Oh right -- probably; but as Marko said it's unlikely to be a problem lol

stark fjord
#

and if someone does it do hint "Get rotated"

sullen sigil
#
_x setDir _orientation#0;
[_x, _orientation#2, _orientation#1] call BIS_fnc_setPitchBank;``` doesn't seem to work as if you turn 90 degrees and try and pitch up it... doesn't πŸ˜…
#
[{
    {
        private _orientation = _x getVariable ["KJW_CapitalShips_Orientation",[0,0,0]];
        _orientation params ["_yaw", "_roll", "_pitch"];
        private _type = _x  getVariable ["KJW_CapitalShips_Type", ""];
        _x setDir _orientation#0;
        [_x, _orientation#2, _orientation#1] call BIS_fnc_setPitchBank;
    } forEach KJW_CapitalShips_Ships;
}, 0, []] call CBA_fnc_addPerFrameHandler;``` full code
stark fjord
#

90 deg in what?

sullen sigil
#

Roll 90 degrees, pitch up :p

stark fjord
#

i see what you mean xD

#

it doesnt follow the model πŸ˜„ it goes up according to world

sullen sigil
#

Think Amp's is probably the better approach even if I do not understand what's going on πŸ˜…

digital hollow
#

I don't fully get the matrix math either, just glad the function is there n_n

sullen sigil
#

That works amazingly, thanks amp πŸ˜„
Time to just turn it back down from 50 deg/s πŸ˜…

#

I think that's my movement system finished aside from lightspeed stuff

stark fjord
#

I hope u dont intend that for mp

sullen sigil
#

I do πŸ™‚

#

runs on server

stark fjord
#

Thats alot of setVectorDirAndUp to sync

sullen sigil
#

indeed
but setvelocitytransformation is effectively the same thing so not a big deal

#

I've done much worse on servers

stark fjord
#

And this is why 20 fps is acceptable in game xD

sullen sigil
#

its only on a single object for the ship πŸ˜‰
we're ignoring everything attached

#

i dont doubt there'll be network problems but 🀷 i'll figure it out

#

worst comes to worst i broadcast the values and make each client run it locally

#

wait no that wouldnt even work either bc setposasl is local args

#

oh well!

#

Now I just need to stop it from flipping over itself tons πŸ˜…

brisk lagoon
#

MosqueSpeakers say3d ["ArabTalking1", sleep 037]
did I write the line wrong?

#

I tried without the 0 as well

#

like only 37

brisk lagoon
#

LOL

winter rose
brisk lagoon
#

ugggggghhhhhhhhhhhhhhhhhh

hallow mortar
#

The second parameter for say3D is the maximum audible distance. This must be a number, if it's present at all. You can't put a command in it unless the command outputs a number.

winter rose
#

does sleep 037 look like maxDistance to you??

brisk lagoon
#

XD

brisk lagoon
hallow mortar
#

I do try to stay helpful but the whole "I have already forgotten everything we just went over" thing is becoming....less amusing

brisk lagoon
#

Well I do............................

hallow mortar
# brisk lagoon I get it but I also don't understand how to type it with the sleep then <:notlik...

The command in itself does not contain a mechanism for looping. (You can see on its wiki page, none of its parameters have anything to do with looping.) This means you have to construct the loop outside of the say3D command, using a loop command such as while. The sleep, which is designed to make the game wait until the first sound has finished before doing the next one, will be located inside the loop but outside the say3D command.

stark fjord
#

[] spawn {
myradioooo say3D ["despacito", 200];
sleep 37;
myradioooo say3D ["aaaaaaaa", 500];
};

This will make object play despacito, which can be heard 200m away, then wait for 37 seconds and then play aaaaaaaaa, which can be heard 500m away

sullen sigil
#

the scream of pain after hearing despacito i see

astral bone
#

is there an event or something for when a unit starts to target something

brisk lagoon
astral bone
#

||Asked in editor, but think it'd probably be fixed with scripting so deleted there||
Flak cannons are targetting infantry. I'd prefer if they- ya know- didn't annihilate infantry x3

stark fjord
# brisk lagoon wth is ``while`` I just tried something from a steam guide but I deleted some s...

Okay so lets imagine in cfgSounds you have sound classed as despacito and you know its 37 seconds long

[this] spawn  //spawn following code in scheduled environment, so we can use sleep command, parameter is the object, you want the sound to originate from
{
  //Grab object from arguments of spawn
  params["_radio"];
  //continue looping while object is alive, if radio is destroyed loop stops
  while {alive _radio} do
  {
    //Make object play sound, that can be heard 200 meters away from object
    _radio say3D ["despacito", 200];
    //Wait while sound is playing, in our case 37 seconds
    sleep 37;
    //Go back to the start of the loop, check if object is still not destroyed
  };
};```
stark fjord
hallow mortar
#

Also "I tried the thing from the guide but deleted some stuff basically at random" is not really a good approach. Start with the example and prove it works (and understand why it works). Don't start by taking out potentially vital chunks.

astral bone
#

Ah ok, so not an 'elegant' solution

digital hollow
#

Put it in a pit / hbarrier, or on a roof so it doesn't have angle to hit infantry.

brisk lagoon
#

oh wait wait

#

I got it

#

so it's supposed to be

#

actually no I didn't get it, honestly I just copy pasted the line
nul = [this] spawn {while {true} do {(_this select 0) say3D "sound01"; sleep 150;};};
and it worked, but to se the distance does it needs to be
nul = [this] spawn {while {true} do {(_this select 0) say3D "sound01"; 200; sleep 150;};}; ?

little raptor
hallow mortar
winter rose
little raptor
#

I sense chatGPT think_turtle

granite sky
#

I think he's just working badly from a bad example.

#

One-liner bracket spam is not a good way to learn.

brisk lagoon
#

I know that we went over it and I know that I remember, but this line is written differently and that's why I am unsure if it's supposed to be "sound01"; 200; sleep 150; or "sound01", 200; sleep 150;

winter rose
#

neither

#

reread the good example

hallow mortar
brisk lagoon
winter rose
#

hint: []

brisk lagoon
hallow mortar
#

We've already established how to use the say3D optional parameters, and that part is not going to be any different to what we did before, because we're now working on the loop, which is outside of say3D and doesn't change how say3D works.

brisk lagoon
#

all those brackets are confusing me ok that's why I have no clue how the fk to write it, in my eyes (not your professional eyes which say the easy solution) it will end with a bracket inside a bracket inside a bracket and it won't makes sense

winter rose
#

an array is a list of things:

["string", 42, { code = "value" }]
```a command can take zero, one or two arguments:```sqf
nularCommand; // a command without arguments
unaryCommand rightHandArgument; // a command with one argument
leftHandArgument binaryCommand rightHandArgument; // a command with two arguments
````say3D` is a **binary** command (`theObject say3D something`)
`something` can be either a **string** (`"string"`) or an **array** (`[elements, in, array]`)
sharp grotto
hallow mortar
#

Normally it can only be executed only on the server.
This means it could instead be executed on the client where the argument (i.e. the object) is local.
Most things in a mission are local to the server so this isn't a massive difference, but sometimes it may be useful.
In implementation it would look exactly the same, except you don't need to remoteExec it to the server if you know for a fact the object is local to the current client.

sharp grotto
winter rose
#

(no, I won't upload that to the biki)

stark fjord
#

Client: i can tell server to modify simulation of everything via remoteExec

winter rose
#

if there are no BE filters

sharp grotto
#

Shouldn't animate work on a object that is simulated globally thonk
It doesn't animate when no player is nearby meowsweats

winter rose
#

what about animateSource instead

sharp grotto
digital hollow
#

is it on dynamic simulation?

astral bone
#
params ["_obj",
["_range",2000,[1]]];
while {alive _obj} do {
    sleep 2;
    _units = [];
    if(_obj isKindOf "Man")then{
        _units = [_obj];
    }else{
        _units = crew _obj;
    };
    {
        _aa = _x;
        _aa disableAI "AUTOTARGET";
        {
            _x params ["_pos","_type","_side","_cost","_objt","_acc"];
            _last = 0;
            if ((_aa countEnemy [_objt]) isEqualTo 1) then {
                if (_type isKindOf "Air") then {
                    if (_cost > _last) then {
                        _aa doTarget _obj;
                    };
                };    
            };
        } forEach (_aa nearTargets _range);
    }forEach _units;
};
#

This ain't working it seems. Keeps shooting at the same spot as the thing moves.

sharp grotto
little raptor
#

also I have no idea what that script is actually supposed to be doing

#

and you can use lazy eval instead of that chain of if thens

#
if (_expression1 && {_expression2 && {_expression3}}) then {

}
astral bone
#

oh huh

#

anti air to not have them shooting at infantry

little raptor
#

how's that supposed to help? think_turtle

#

at the very least you should have a forgetTarget or something? think_turtle

little raptor
sharp grotto
#

Looks like once the object was subject to enableDynamicSimulation you are not able to disable it and do enableSimulationGlobal meowsweats

#

Found it! Thanks for the input salute

[_ToggleObject, true] remoteExec ["enableSimulationGlobal", 2];
[_ToggleObject, false] remoteExec ["enableDynamicSimulation", 0];
snow viper
#

I am not a great arma coder and trying to learn as i go, apologizing in advance for not using correct terms, i would if i knew them. I found out about weights in random selection not too long ago and i'm having to edit code using them in Antistasi. I was wondering how exactly the weight values work

#

So for example there are vehicle categories like lightAPC, Tank etc. In one of the Antistasi scripts that handles vehicle spawns during enemy attacks, there are is an array of "weights" per 'war level' (maximum is 10) for each of these categories. So for example

lightAPC = [ 5, 10, 15, 20, 25, 30, 35, 40, 45, 50];

was what i encountered, where each value represents the "weight" or likeliness of a vehicle from this type appearing during calculation per war level. I changed it in hopes that no light APCs would get selected by the script to the following

lightAPC = [ 0, 0, 0, 0, 5, 10, 15, 20, 25, 30];

and while they are much more rare, they still show up

#

so apearantly this weighting is some kind of way to influence random selections, and i am curious what terms i can google to learn more about this kind of way of setting up scripts, whatever its called. I know its not unique to antistasi or arma script. If anyone can suggest me search terms that would be very welcome

#

and more importantly, i am trying to figure out how to give values here so i can actually achieve the result i was after. Could i for example use negative weight values to make the chance even smaller, or is there some other weight value i can set here to very simply guarantee that it will never be randomly selected?

#

i believe this might be called "weighted random" or "weighted random sampling"

winter rose
#

WoT
See selectRandomWeighted for the sqf command
now regarding Antistasi itself I do not know their framework, the best to do would be to visit their Discord

snow viper
#

oh thats cool i didnt know arma also has this present

#

@winter rose so what exactly do the values do

#

are they relative or something?

#

So what would happen if i changed

lightAPC = [ 0, 0, 0, 0, 5, 10, 15, 20, 25, 30];

to

lightAPC = [ 0, 0, 0, 0, 50, 100, 150, 200, 250, 300];

in terms of possible results?

#

would doing something like that make sense then?

snow viper
#

think i figured it out actually

#

chat gpt has all the answers lol

snow viper
#

and the reason why vehicles are still being selected with weight set to 0 is because something is adding to the weights elswhere in the code, making them no longer 0

kindred zephyr
#

!quote 6

lyric schoonerBOT
snow viper
#

it accurately answered my question faster than discord did though

#

and without the attitude too πŸ˜›

meager granite
#
Searching 89 files for "createHashMap"
261 matches across 30 files
```Hashmaps are the greatest thing to happen to Arma 3
#
Searching 806 files for "createHashMap"
1170 matches across 86 files
```Through entire project, more than half of these are objective configs in SQF though
#
Searching 806 files for "getOrDefaultCall"
34 matches across 12 files
```Turned out to be very useful too
frigid oracle
#

I need to get around to learning the uses of hashmaps.

meager granite
#

I can't live without them any more, I even use them as function arguments, function returns, where lots of data is sent or received from the function

#
     _target addAction (createHashMapFromArray [
         ["title", format["<img image='i\ico_repair.paa' shadow='0'/> %1", localize "STR_KOH_Acts_ServiceAction"]]
        ,["action", {isNil{call client_func_actions_doFullService}}]
        ,["priority", ACTIONS_TOP_PRIORITY]
        ,["condition", "!client_isBusy"]
        ,["condition_key", "service_repair"]
    ] call client_func_actions_hashMapToAddAction)
```Sleek `addAction` wrapper to avoid defining unwanted parameters, only define what I really need into hashmap and have the function sort out `addAction` arguments mess.
#

Yeah, I'm bragging aviator

copper raven
meager granite
copper raven
#

well same thing still

#

(what i wrote)

#

no need for that call

meager granite
#

πŸ€”

copper raven
#

isNil { call { blabla } } and isNil { blabla } is same thing

frigid oracle
#

Considering most of my mission scripts don't need to be scheduled this could be very useful to look into understanding

meager granite
#

No way to send arguments into functions like this though, unless you manually redefine _this beforehand.

#

I guess I'll leave it wrapped in isNil because other actions include arguments and

,["action", {isNil{call client_func_actions_doFullService}}]
...
,["action", {isNil{true call client_func_actions_doKickstart}}]
```looks better not far from each other than
```sqf
,["action", {isNil client_func_actions_doFullService}]
...
,["action", {isNil{true call client_func_actions_doKickstart}}]
```which triggers some kind of OCD reaction or something when I look at both
#

GIB ANYTHING isNil CODE

#
,["action", {_this = true; isNil client_func_actions_doKickstart}]
```![notlikemeow](https://cdn.discordapp.com/emojis/700311897937018890.webp?size=128 "notlikemeow")
copper raven
#

callUnschd πŸ˜„

brisk lagoon
#

does disabling path (on specific units) will stop from Ai moving around on mulitplayer server? or do I need to use the command in the init?

hallow mortar
#

disableAI "PATH" prevents AI units from moving. It works in multiplayer provided it's executed where the AI is local. A unit's Editor init field is executed on all machines, so you can put it there and be sure it will take effect. (Note: use of init fields should be done with caution on a case-by-case basis as it causes problems with some commands or use cases.)

willow hound
stark fjord
#

To be sure command, disableAi or any other that require to be ran where object is local, or commands with global effect (so they dont run 1+number of player times), you can use if (local this) then { this disableAI "PATH" };
But sometimes global execution is desired, with eg clientside commands, like say3D

velvet merlin
winter rose
#

the day you start to trust chatGPT in its current state is the day you come here posting nonsense asking "why does this doesn't work?" πŸ˜„

half moon
#

Guys - would it be possible somehow to script a proper Azimuth and Elevation for an AI artillery gunner? So not just give a target to fire at, but set its azi and ele to X and Y, so a human would have to do calculations but AI would just fire the gun

winter rose
#

I believe this is what is done behind the curtains, a fake target is given to an artillery piece and it fires in the air like that

manic sigil
#

I think he meant to change the gameplay loop, so the player has to do the calculations but then tell an AI to use them. Similar to ACE, but without directly acting on your figures.

hallow mortar
#

Force setting turret elevation and traverse is complicated, the only command for it we have is lockCameraTo, and that works by targeting a pos or object, not in degrees. Someone probably could figure out a way to use that to fake it, but it'd be some pretty brutal maths

stark fjord
#

I tried with elevating turret by animation... didnt quite work

hallow mortar
#

You can turn off the artillery computer on a vehicle so that a human gunner is forced to use azimuth and elevation (...and then script a way for them to know the true values of those because the displayed values are relative or some crap like that), but the AI doesn't care about that

tough trout
#

How do I spawn an active grenade with a trigger? As if the grenade was connected via trip wire (not the actual plan, but close enough that I can get the gist).

warm hedge
#

createVehicle should do

tough trout
#

Cool, thanks. I'll probably poke my head back in in a couple hours to make sure I got the syntax right

winter rose
#

"GrenadeHand" is the class iirc, but I don't know if one can trigger it with triggerAmmo

tough trout
#

I would go into detail of what I'm actually trying to accomplish, but I have too many of my players in here that it'll spoil the surprise. (Needless to say it's designed to have an air of occultism).

winter rose
#

explosions involved? I'm in

tough trout
#

Actually, because this may make things more exciting, how would I make it so an AI dropped a specific grenade on death? Like the old CoD Martyrdom perk.

winter rose
tough trout
#

Cool.

manic sigil
#

I used something similar, spawning a grenade on a stairwell right as any player tries to climb it to deal with an MG nest. Just πŸ§‘β€πŸ³πŸ’‹

snow viper
winter rose
kindred zephyr
#

thats what quote 6 is for after all

digital hollow
astral bone
#

sorry for late response-

little raptor
#

if you don't mind making a mod you can even fix it yourself using a config patch

#

aiAmmoUsageFlags and airLock control which type of vehicles they can target

#

ofc you might have some AI mod that does its own thing, so check without any AI mods first

astral bone
little raptor
#

no not necessarily

#

AI targeting is a bit weird I'll admit

#

autotarget is not really what you think it is

astral bone
#

Wait, so autotarget could be making it so the unit will still get the target and shoot at it after forgetting target and setting target to objNull?

little raptor
#

well autotarget allows the AI to target something when it cannot target its assigned target. but iirc if the AI itself is the leader it gives targets to itself so it doesn't need an assigned target

#

it's been a while since I messed with that tho

astral bone
#

oh uh- that could be an issue

#

wait-

#

It looks like it might be auto response sorta thing?

hallow mortar
stark fjord
#

Well, even vanilla AAA will target infantry or ground vics, if no higher priority air is avalible.

little raptor
#

true

stark fjord
#

You could set their spotting skill to 0 and then manually reveal air targets

#

As in spotTime and spotDistance

hallow mortar
#

I wonder to what extent the AI relies on the vehicle's visual sensor component rather than simulated eyes. Maybe disabling that component (and the NV component) and just leaving them the radar would work.

#

Assuming it's a radar AAA anyway.

astral bone
#

Well I am testing rn with just man units b/c debug weee

digital hollow
#

setTurretLimits above head height xD

astral bone
#

opfor unit is autocombat false and they don't target the nato man if the nato man has simulation set to false when I forget target. I think the game is setting the opfor's target automatically in response to the unit becoming a target.

stark fjord
#

The way i did it for my mission, i had hidden radar on the map, and ai had spotting skills down to 0.
It still engaged air. But if player was stupid enough to approach it from direct front or climb infront of the turret it still razed them.
But appraching from back to plant charges was ok.

#

And data link enabled, set to receive and send.

velvet knoll
#

Hey guys, trying to create an addAction that will then put the player into an animation and call up a timer

#

does anyone have any tips on where to start looking?

frigid oracle
manic sigil
fleet sand
#

Quick question how would i check if player has enough space for x amount of items and not just for 1 ?

winter rose
#

@sullen sigil blobdoggoninja πŸ’₯ ☁️

fleet sand
sullen sigil
#

(i realised halfway through typing i probably shouldnt answer while im this sleep deprived)

#

on the plus side that capital ships mod you told me was a bad idea is nearing completion πŸ™‚

winter rose
sullen sigil
winter rose
#

(oh nice, I love such rewrite stories ^^)

sullen sigil
#

it now uses 0 setvelocitytransformation as well thank GOD

#

now just has target velocity and orientation variables you modify and the mod does the rest

granite sky
#

wrote that function

winter rose
#

πŸ˜„

sullen sigil
sullen sigil
fleet sand
#

Question Is there a better way to check if player can fit these items in invenotry then this ?

if((_unit canAdd ["ACE_morphine",2]) && (_unit canAdd ["ACE_quikclot",10]) && (_unit canAdd ["ACE_tourniquet",4]) && (_unit canAdd ["ACE_salineIV_500",1]) && (_unit canAdd ["ACE_salineIV_250",1])) then {true} else {false};
digital hollow
#

That checks if there's space for each one of those sets, but not all of them once the previous sets take up space.

dire plaza
#

hi, the text to texture procedural doesn't seem to work
i do sqf ((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,'Caveat',0.2,#0000ff,#ff0000,'aaaaaaaaaaaaa')"]; while i have an object selected in 3den
or am using it wrong?

fleet sand
little raptor
#

also do you use the dev branch?

dire plaza
#

no, i don't

little raptor
#

ah that was merged in 2.12 nvm you don't need dev

little raptor
dire plaza
little raptor
dire plaza
#

white plain

winter rose
winter rose
little raptor
#

then check against max load of player - loadAbs

fleet sand
little raptor
#

no

#

via config

dire plaza
little raptor
little raptor
dire plaza
#

oh. here

((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,'Caveat',0.3,'#0000ff','#ff0000','aa')"];```
little raptor
#

doesn't it need alpha?

#

this is what the wiki says:

"#0000ff7f"

#

so it does need alpha

dire plaza
#

this is also what wiki says

backgroundColor - in format #RRGGBB or #RRGGBBAA
textColor - in format #RRGGBB or #RRGGBBAA

#

i'll try with alpha, one sec

little raptor
#

yeah just saw that one

dire plaza
#

nothing changed

winter rose
#

code?

dire plaza
#
((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,'Caveat',0.3,'#0000ff00','#ff00007f','aa')"];```
winter rose
#

alpha is 0, so fully transparent

dire plaza
#

how do i set it to one?

winter rose
#

FF

dire plaza
#
((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,'Caveat',0.3,'#0000ffFF','#ff0000FF','aa')"];``` still nothing
little raptor
#

looks like it doesn't support ''

dire plaza
#

double "" it is then

fleet sand
little raptor
#

use this instead:

((get3DENSelected "object")#0) setObjectTextureGlobal [0, '#(rgb,512,512,3)text(1,1,"Caveat",0.3,"#0000ff00","#ff00007f","aa")'];
little raptor
dire plaza
#
((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,""Caveat"",0.3,""#0000ffFF"",""#ff0000FF"",""aa"")"];
``` this works too
little raptor
#

I mean yes πŸ˜…

dire plaza
#

however your example is... transparent??

#

your example

little raptor
#

I just copied your code

dire plaza
#

my example

velvet knoll
dire plaza
#

lesson learned; use this command with always double decker "". thanks for the help!

little raptor
#

your own example has alpha set to 00

dire plaza
#

ok, i tried to run this code:

((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,""Caveat"",0.3,""#0000ff00"",""#ff000000"",""aa"")"];``` and got a completely transparent image, which was the desired result, since alpha is set to 00.
however, if i run this code:
```sqf
((get3DENSelected "object")#0) setObjectTextureGlobal [0, '#(rgb,512,512,3)text(1,1,"Caveat",0.3,"#0000ff00","#ff00007f","aa")'];``` the background is transparent but the letter's aren't
little raptor
#

weird

#

Β―_(ツ)_/Β―

dire plaza
#

thanks for help! the only different is the double ""

digital hollow
dire plaza
fleet sand
# digital hollow you almost never need to do this ```sqf if(_canFit > 23.5) then {true}else {fals...

I am doing it like this so it returns true or false for a coddition:

["FirstAidKit", ["CONTAINER","CLOTHES"], "Open IFAK", nil, nil, [{
params ["_unit"];
private _canFit = maxLoad _unit - loadAbs _unit;
if(_canFit > 23.5) then {true}else {false};
},{params ["_unit"]; _unit isEqualTo vehicle _unit;}],
{
params ["_unit", "_container", "_item", "_slot", "_params"];
for "_i" from 1 to 2 do {_unit addItem "ACE_morphine";};
for "_i" from 1 to 10 do {_unit addItem "ACE_quikclot";};
for "_i" from 1 to 4 do {_unit addItem "ACE_tourniquet";};
_unit addItem "ACE_salineIV_500";
_unit addItem "ACE_salineIV_250";
true
}, true, [0,1,2]] call CBA_fnc_addItemContextMenuOption;
digital hollow
fleet sand
digital hollow
little raptor
#

gives you the amount of free mass in the vest

#

so if you want to check if you can add an item to the vest you check if _freeMass >= _addedMass

#

where addedMass is just:

_addedMass = 0;
{
  _x params ["_item", "_cnt"];
  _addedMass = _addedMass + _cnt * getNumber (configFile >> "CfgWeapons" >> _item >> "ItemInfo" >> "mass");
} forEach [["ACE_morphine", 10], ...]
fleet sand
#

Yea i was just testing this a bit.
private

private _maxLoadUniform = getContainerMaxLoad uniform player;
private _currentLoadUniform = loadUniform player;
private _freeSpaceInUniform = _maxLoadUniform - (_currentLoadUniform * _maxLoadUniform);
systemChat format ["Max Load: %1 Current Load: %2 FreeSpace: %3",_maxLoadUniform,_currentLoadUniform,_freeSpaceInUniform];
fleet sand
# little raptor so if you want to check if you can add an item to the vest you check if `_freeMa...

I think i manage to make it work ty very much and Ampersand
here is code in future if somebody is interested:

["FirstAidKit", ["CONTAINER","CLOTHES"], "Open IFAK", nil, nil, [{
params ["_unit"];
private _freeMassVest = (1 - loadVest _unit) * getContainerMaxLoad vest _unit;
private _freeMassUniform = (1 - loadUniform _unit) * getContainerMaxLoad uniform _unit;
private _freeMassBackpack = (1 - loadBackpack _unit) * getContainerMaxLoad backpack _unit;
private _addedMass = 0;
{
  _x params ["_item", "_cnt"];
  _addedMass = _addedMass + _cnt * getNumber (configFile >> "CfgWeapons" >> _item >> "ItemInfo" >> "mass");
} forEach [["ACE_morphine", 2], ["ACE_quikclot", 10],["ACE_tourniquet", 4],["ACE_salineIV_500",1],["ACE_salineIV_250",1]];
if((_freeMassVest >= _addedMass) || (_freeMassUniform >= _addedMass) || (_freeMassBackpack >= _addedMass)) then {true} else {false};
},{params ["_unit"]; _unit isEqualTo vehicle _unit;}],
{
params ["_unit", "_container", "_item", "_slot", "_params"];
for "_i" from 1 to 2 do {_unit addItem "ACE_morphine";};
for "_i" from 1 to 10 do {_unit addItem "ACE_quikclot";};
for "_i" from 1 to 4 do {_unit addItem "ACE_tourniquet";};
_unit addItem "ACE_salineIV_500";
_unit addItem "ACE_salineIV_250";
true
}, true, [0,1,2]] call CBA_fnc_addItemContextMenuOption;
little raptor
#

this is a bit messy tho meowsweats

#

and it's not exactly correct

#

e.g. if an item needs a mass of 100 and your total backpack, vest, uniform load is 101 it doesn't necessarily mean you can fit the item

#

you need to have 100 units free in at least one container

tough trout
little raptor
#

also a couple of notes:

#

if((_freeMassVest >= _addedMass) || (_freeMassUniform >= _addedMass) || (_freeMassBackpack >= _addedMass)) then {true} else {false};

#

you can just write that as:

(_freeMassVest >= _addedMass) || (_freeMassUniform >= _addedMass) || (_freeMassBackpack >= _addedMass)
#

for "_i" from 1 to 2 do {_unit addItem "ACE_morphine";};
for "_i" from 1 to 10 do {_unit addItem "ACE_quikclot";};
for "_i" from 1 to 4 do {_unit addItem "ACE_tourniquet";};
use the other syntax

#

it's faster

#

ah wait it doesn't have any other syntax πŸ˜‚

#

something did tho? think_turtle

fleet sand
#

So i can just have this as return?

(_freeMassVest >= _addedMass) || (_freeMassUniform >= _addedMass) || (_freeMassBackpack >= _addedMass)
little raptor
#

yes

fleet sand
#

Cool didnt know that i can return it like that.

little raptor
#

your if was taking a bool and returned the same bool meowsweats

stray flame
#

okay im having some issues.

#

I am trying to make it so that any player within trigger area gets punished

#

but I cant seem to figure out how thisList is suppose to work

winter rose
#

thisList is "current units in the area matching the trigger's conditions"

stray flame
#

well if I say, wanted damage 1 to be applied to units in a trigger, how may I do this?

#

I tried

thisList setdamage 1but that gives no luck

winter rose
#

how do you do it for any array?

winter rose
#

use forEach

stray flame
#

ah

fleet sand
#

it would be something like:

{
_x setDamage 1;
} foreach thisList;
stray flame
#

ahhhh

digital hollow
little raptor
#

it's easily solvable, but kinda slow

#
_canFit = true;
{
  _x params ["_item", "_cnt"];
  _mass = getNumber (configFile >> "CfgWeapons" >> _item >> "ItemInfo" >> "mass");
  for "_i" from 1 to _cnt do {
    if (_freeMassVest > _mass) then {
      _freeMassVest = _freeMassVest - _mass;
      continue;
    };
    // do for other containers too
    ...
    // then finally
    _canFit = false;
    break;
  };
  if (!_canFit) then {break};
} forEach [["ACE_morphine", 2], ["ACE_quikclot", 10],["ACE_tourniquet", 4],["ACE_salineIV_500",1],["ACE_salineIV_250",1]];
_canFit
frigid oracle
#

What's the main difference between post and pre init using cba config event handlers? As in for use cases.
Most mods I open for example seem to favor post init. So what the particular reason?

stark fjord
#

Post init is called once all objects are created in mission.

Pre init happens before that

#

In a nutshell, if you need to do something with objects use post.

frigid oracle
#

Ah ok

stable dune
brisk lagoon
#

I used my audio files today in a mission in the unit we have in arma 3 (some mosque sounds etc.) when I tested it, it sounded pretty quiet, I used audacity and level up the sound, it sounded perfect, but when we ran it on our server it became pretty damn loud, anyone knows why?

stark fjord
#

Diffrent sound effect settings?
You changed volume in description.ext?
Always test em with sound effect turned up to normal levels.

winter rose
brisk lagoon
stark fjord
#

Yes but thats very loud.
Also as Lou said perhaps your script played it multiple times all at once. If sound is played twice from same source it amplifies

winter rose
brisk lagoon
#

well I just used the playSound3D in the init

winter rose
#

ta-daaa

#

the init field is played for each player + the server

brisk lagoon
#

sorry not playsound
Say3d

brisk lagoon
winter rose
#

well, playSound too

brisk lagoon
#

Uhm weird, I will try again tomorrow, I will add the original files without amplifying the volume, but my main question is how come in the editor when I start "play in mutliplayer" it sounds normal but in the server it's louder? if say3D isn't the issue really

winter rose
#

"play in multiplayer" = server

#

I don't get what you wrote

brisk lagoon
#

I always use play in mutliplayer, but when I listened to it it was pretty quiet, but when we added the mission file to our actual server

#

it was louder

#

makes sense?

winter rose
#

ah ok, Eden MP preview vs dedicated server

#

I have to say "no idea" for now

#

what's your code?

#

remoteExec?

brisk lagoon
#

Awe 😦
I will try again tomorrow with the normal level sounds

brisk lagoon
#

I actually don’t remember atm lol
I’m in bed but it’s something with say3d, file name, distance (only some of them) and sleep

#

Wait sorry by code you mean like a code file?

#

My brain isn’t working at 4 am lol

winter rose
#

and even with just one person starting the mission on the server, is it louder?

#

anyway, let's see that when fully awake

brisk lagoon
#

Yeah that would be a better idea haha
But uhm no it’s was just louder in general, I went straight into zeus to check and it was louder, maybe setting the volume on the description file does not affect in the editor but only in a server or something

quaint garden
#

does anyone know if there is a public retractable turret script? i saw one in a rimmy video and wanted to use it for an op that my unit it doing

winter rose
#

what's that?

quaint garden
#

where the turret slowly pops up out of the ground

winter rose
#

turret, like an M2?

quaint garden
#

anyturret

winter rose
#

like an M2
not like "a tank turret" for example

well you can script it with setPosATL
regarding an existing script, I believe Google will be of more help

quaint garden
#

ok thanks

young current
brisk lagoon
#

There is a civilian population module but it doesn't show all the civilian factions I have, is there anyway to change the loadouts from the ones I CAN use? (uniforms and whatever)

winter rose
winter rose
agile pumice
#

I'm experiencing a weird issue with pboprojec

#

get a missing inheritance class error for line 34, but when I comment out this line (line 31), the error goes away: class EventHandlers {init = ""};

#

class EventHandlers {}; seems to work, but why shouldnt an empty init?

modern meteor
#

Hi, I am using the following to detect enemies within player's range of 350m:

arraytarget = player targets [true, 350];   // enemy targets in 350m

How can I sort the received array by distance to player (from smallest to largest?)

modern meteor
#

Tyvm. This should work

astral bone
#

I am debating on how to make static gunners. All in seperate groups or 1 massive group?

proven charm
#

maybe one group because of the group limit and I think they are more dangerous in single group as they share targets...

astral bone
#

oh wait

#

how have I managed this xD

#

civilian grouped to a opfor.

manic sigil
#

setCaptive?

astral bone
#

nope

#

must be something weird with joining groups and stuff?

#

oh wait-

#

wait then why is it working at all? xD

#

weird-

proven charm
astral bone
#

yes, but why is there a group with an opfor and a civilian in it

split nebula
#

Does anybody know how i can reliably retrieve the positions of the wheels of a vehicle? or axis would be even better

proven charm
#

maybe the unit is wounded "UNCONSCIOUS"

scarlet igloo
#

hey guys, how would I be able to get myself some ambient explosions in a certain area

#

i tried say3d but it hasn't worked

astral bone
#

he's perfectly fine. both are

manic sigil
scarlet igloo
#

playing the battlefield_explosions1 from a vr entity

#

and also having it looped

manic sigil
#

Isn't it's title just "BattlefieldExplosions", not "battlefield_explosions1"?

scarlet igloo
#

i mean the filename is battlefield_explosions1-5 or 6

#

iirc

manic sigil
#

Oh :x You're talking a custom sound effect, or one from the game already?

scarlet igloo
#

one from game

#

sorry if I'm confusing i have no clue how to script stuff lol

little raptor
astral bone
#

the group marker is also civilian

little raptor
#

there's no other way to have a civilian in a non-civilian group

little raptor
astral bone
stable dune
# scarlet igloo yeah these

You can also use config path to use current sound

playSound3D ["A3\Sounds_F\sfx\alarm_independent", player]; //Β no sound
playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]; //Β alarm
little raptor
manic sigil
#

eachFrame EH that switches the unit's group?

scarlet igloo
#

also how would i be able to loop it?

manic sigil
#

Prisoner's method also works, though looping for either method is gonna take some scripting.

scarlet igloo
#

tyvm to the both of u

#

works now, just gotta figure out how to loop it lol

thorn saffron
#

I'm having problems with object rotations, vectors and terrain normal. I have a an object that I have rotated at custom angles: how can I add a surface normal to the rotation so the object keeps it's rotations, and align along the terrain normal?

astral bone
little raptor
astral bone
#

unit spawner makes them be apart of an initial civilian group, then adds them to a provided group. But I accidently am providing it with grpNull, so-

little raptor
astral bone
#

How the HECK are any of them opfor and not just civilians xD

astral bone
#

this is really weird, some of the first code I ever wrote for arma but

#

ALARM_LoopSound2 = {
params["_CurAlarm","_pos"];

while { _CurAlarm select 0 } do {
        _source = _pos say3D [(_CurAlarm select 2),(_CurAlarm select 4)];    
        waitUntil {(isNull _source || not (_CurAlarm select 0))};
        if((_CurAlarm select 0)==false && not isNull _source)then{
            deleteVehicle _source;
        };
    };
};
thorn saffron
# little raptor first set the direction, then set the vectorUp

The issue is what to set the vectorUp to. I am calculating a new up vector as I'm rotating a whole composition. It works perfectly on flat ground. However on angled ground the objects still behave and align as on flat ground, as Im still using my new up vector. Simple terrain normal + new up vector does not give a good result.

astral bone
#

for multiple alarms, but basically, say3D, then wait until the say3D is nil.

#

i kinda wanna redo the code but then this works so eh x3

little raptor
#

if you attempt to align the parts with each normal they'll get misplaced

thorn saffron
#

I realize, ignore the composition part. I have a vectorup, how do I add the terrain normal to it so the object "inherits" the terrain rotation and then adds it's own rotation to that.

little raptor
#

make a rotation matrix

#
_vectorSide = _vectorDir vectorCrossProduct _surfaceNormal;
_matrix = matrixTranspose [_vectorSide, _vectorDir, _surfaceNormal];
#

multiply that by each vector and they'll get rotated the way you want

#

also _vectorDir and _surfaceNormal must be perpendicular

thorn saffron
#

_vectorDir is the object's vectorDIr?

little raptor
#

if they're not make them perpendicular

little raptor
#

and must be perpendicular to surface normal

#

if you're not sure if they are, you can make them perp as follows:

#
_vectorSide = _vectorDir vectorCrossProduct _surfaceNormal;
_vectorDir = _surfaceNormal vectorCrossProduct _vectorSide;
thorn saffron
#

I have a _newVectorDir and and _newVectorUp calculated. Those are used to orient the object in the new position and they work fine. It's the terrain aligning what throws me off.

little raptor
#

e.g. if you want to rotate the composition by 40 degrees:

thorn saffron
#

I got the composition rotation figured out.

little raptor
#
_vectorDir = [sin 40, cos 40, 0];
astral bone
#

anyway back to my original thing :P

thorn saffron
#

Its the rotation of individual objects in relation to the terrain normal, in a way so they keep their vectorUp, but instead to the flat ground they align to the normal.

little raptor
#

that's what I'm trying to explain to you blobdoggoshruggoogly

thorn saffron
#

me dum dum, vectors hard
Sorry about that. I just have problems wrapping my head around the vector stuff.

agile pumice
#

combination of selectionPosition and modelToWorld

little raptor
#

well to summarize:

  1. calculate the new direction of the whole composition (where the whole composition will face)
  2. calc the surface normal
  3. use this:
_vectorSide = _vectorDir vectorCrossProduct _surfaceNormal;
_vectorDir = _surfaceNormal vectorCrossProduct _vectorSide;
_matrix = matrixTranspose [_vectorSide, _vectorDir, _surfaceNormal];
  1. calculate the new pos, dir and up for each composition part as follows:
_pos = flatten (_matrix matrixMultiply _partRelPos) vectorAdd _compositionPos;
_dir = flatten (_matrix matrixMultiply _partRelDir);
_up = flatten (_matrix matrixMultiply _partRelUp);

_compositionPos is where you want the "core" (reference) object of the composition to be
_partRelPos is the position of each composition part relative to the reference object

#

yes

#

did you mean then or than? think_turtle

split nebula
#

its actually the modelspace coordinates im interested in, thx i'll check it out

little raptor
#

than

#

yeah select is faster

thorn saffron
#

@little raptor
So I have this:
_orgDirVector - the original vectorDir of the object
_orgUpVector - the original vectorUp of the object
_orgRelPos - original position in relation to the composition anchor
_spawnPos - position that the new composition is spawned on
_compDir - the new direction that the new composition will be roated to

_newVectorDir - a new vectorDir calculated by rotating the whole composition around it's anchor point
_newVectorUp - new up vector also calculated for the rotated composition

The _newVectorUp _newVectorDir are calculated properly and work fine, on the flat ground.

Now I'm trying to figure out with of my variables are supposed to be in your code.

#
_vectorSide = _newVectorDir vectorCrossProduct _surfaceNormal;
_vectorDir = _surfaceNormal vectorCrossProduct _vectorSide;
_matrix = matrixTranspose [_vectorSide, _newVectorDir, _surfaceNormal];

?

little raptor
#

but if they don't something else is wrong

#

_newVectorUp - new up vector also calculated for the rotated composition
this part is a bit confusing for me tho

thorn saffron
#

it's because I'm just rotating them around with this:

private _newVectorDir = [_orgRelativeDir, _compDir,2] call BIS_fnc_rotateVector3D;

private _newVectorUp = [_orgRelativeUp, _compDir,2] call BIS_fnc_rotateVector3D; 

I'm not taking the terrain normal into consideration

little raptor
agile pumice
#

_obj modelToWorld (_obj selectionPosition "some memory point")

thorn saffron
#

Yes, but also there are some objects that were posed in specific ways, like folded chair propped against table. If I just surface normal it, it will just lay flat on the ground

quick peak
#

Is there any way to force vehicle to stay in one place without attachto? I want to make crashed heli but with attachto rotors are spinning no matter if engine is on or if it have fuel

little raptor
agile pumice
#

something like that

thorn saffron
#

Ah

little raptor
#

or do you want other axes too?

thorn saffron
#

Z axis only, but I want the objects to align to the ground, while preserving their poses.

little raptor
#
_vectorDir = [sin _compDir, cos _compDir, 0];
_vectorSide = _vectorDir vectorCrossProduct _surfaceNormal;
_vectorDir = _surfaceNormal vectorCrossProduct _vectorSide;
_matrix = matrixTranspose [_vectorSide, _vectorDir, _surfaceNormal];

{
  ....
  _partFinalPos = flatten (_matrix matrixMultiply (_orgRelPos apply {[_x]})) vectorAdd _spawnPos ;
  _partFinalDir = flatten (_matrix matrixMultiply (_orgDirVector apply {[_x]}));
  _partFinalUp = flatten (_matrix matrixMultiply (_orgUpVector apply {[_x]}));
  _part setPosWorld _partFinalPos;
  _part setVectorDirAndUp [_partFinalDir, _partFinalUp];
} forEach _parts;
#

@thorn saffron btw I forgot one thing. the vectors must be in [[x], [y], [z]] format for matrix multiplication

#

fixed the code (needed an apply {[_x]})

little raptor
little raptor
#

what does attachTo have to do with object animation?

astral bone
#

ah ha! auto man static weapons is now working in my liberation thingy :P

dawn knoll
#

Is there a script to only add weapons from a specific mod to the virtual arsenal?

#

Want to add the RHSUSAF weapons and gear to an arsenal without having to go through and choose each one separately

quick peak
# little raptor you sure?

thats the best part - i have no idea if anything. But i tested it and in VR and its like i said. Rotors wont spin if they were not spinning before attachto and wont stop if they were before

little raptor
quick peak
#

nope, from trigger

little raptor
#

no other function?

little raptor
#

doesn't matter where

quick peak
little raptor
#

that's a command not a function meowsweats

#

anyway...

#

which heli?

quick peak
quick peak
little raptor
little raptor
#

looks like you're right

jade acorn
#

now is it a bug or a feature

little raptor
#

I guess neither

#

attached objects don't get simulated anymore

#

so the engine state never changes

#

but I guess it's worth making a ticket nontheless

little raptor
#

use setVelocityTransformation every frame

#

tho why do you want to make it stay in place?

#

a crashed heli doesn't move think_turtle

sullen sigil
#

probably can make it only run for a second or two if its to prevent crashed vehicles bouncing from impact

quick peak
little raptor
#

ah then setvelocityTransformation won't be useful

#

it'll explode...

quick peak
#

exactly

#

well ill just work it around and teleport it a bit above ground with engines off

#

this will have to do

little raptor
#

you can also just create a simple object in its place, or disable its simulation

#

another way is moving the ground using setTerrainHeight meowsweats

quick peak
little raptor
#

well you can attach the players to the simple object meowsweats

#

and set their animations

#

it'll look as if they're actually sitting in it meowsweats

#

(tho they can't move their heads)

#

actually for the head problem you can use setVelocityTransformation

scarlet igloo
#
{
bomb = "O_GBU12_LGB" createVehicle (getMarkerPos (selectRandom ["mortar", "mortar_1", "mortar_2", "mortar_target_1", "mortar_target_2"]));
sleep 20;
};```
#

tried this, works without the "while true do" but doesnt with it

#

whenever loading in i get an error saying "error suspending does not work in this context"

little raptor
#

no

#

you don't even need a variable

scarlet igloo
#

tried with your code again, still doesnt work

scarlet igloo
little raptor
#

[] spawn {}

#
0 spawn {
  while {true} do
  {
    "O_GBU12_LGB" createVehicle (getMarkerPos (selectRandom ["mortar", "mortar_1", "mortar_2", "mortar_target_1", "mortar_target_2"]));
    sleep 20;
  };
};
scarlet igloo
#

for whatever reason still doesnt work

#

might be something wrong on my end

#

no error this time though

tranquil lintel
#

Hi fellas, quick question
I've been trying to use setAnimSpeedCoef to change move speed on a unit, and it kept getting reset. Tracked it down to being ACE Advanced Fatigue doing it (whenever its disabled, I can use the function just fine)

Is there a way to selectively disable ace fatigue on units, or is there another way to solve this?

little raptor
scarlet igloo
#

ah

#

yeah i found that while looking for answers

#

works with R_80mm_HE

#

thank you

little raptor
#

you can force disable it tho

#

(for the current local player)

#

if (!GVAR(enabled)) exitWith {};

#

so you can just do ace_advanced_fatigue_enabled = false

#

it won't affect the user's CBA settings

tranquil lintel
#

Since I want fatigue enabled for everyone else, except one unit (i.e. me, the zeus)

little raptor
#

then just run that where your zeus player is local

scarlet igloo
little raptor
#

it's just a code that changes a variable

tranquil lintel
tranquil lintel
scarlet igloo
#

thank you very much

little raptor
scarlet igloo
#

ah

little raptor
#

or alternatively sleep (1 + random 14)

scarlet igloo
#

so 1 is min, 8 mid and 15 max

#

yeah

little raptor
little raptor
tranquil lintel
little raptor
#

in that case it can work. or just put this in the Zeus player's init:

if (local this) then {ace_advanced_fatigue_enabled = false};
tranquil lintel
little raptor
#

that's why it has local this

#

i.e. only execute the code where this unit is local

#

which obviously is on the PC that claims the Zeus spot

tranquil lintel
little raptor
#

what if you add some delay?

tranquil lintel
#

Before or after setting the setting?

little raptor
#
if (local this) then {0 spawn {sleep 1; ace_advanced_fatigue_enabled = false}};
tranquil lintel
#

Thanks, let me test it out

little raptor
#

ah wait it checks the setting before mission is initialized meowsweats

tranquil lintel
#

Fugg, seems like there's nothing then

tranquil lintel
#

I tried it, and it didn't work, so its probably just the case that it gets overwritten

#

or I'm just wrong

#

Β―_(ツ)_/Β―

little raptor
#

wait

#

ok fixed

tranquil lintel
little raptor
#

np

tranquil lintel
#

Although I really hope this doesn't break something in my mission lmao

little raptor
#

shouldn't

#

unless you rely on ACE fatigue on your Zeus PC

tranquil lintel
#

Thanks again

dawn knoll
#

Is there a script to only add weapons from a specific mod to the virtual arsenal?

split nebula
#

:S probably not going to work for my needs as it seems everyone is using different names for their wheels ...

dim terrace
#

then do a check through wheels class?

novel basin
#

Good morning ! Quick question: if I add a Cfg RemoteExec.hpp in a pbo of one of my mods, are remoteExec accepted in the multiplayer server?

warm hedge
#

Finally some worth opponent to good morning in a morning in this Discord! :D

Basically yes, your Mods' configuration can be overwritten by description.ext. On the other words, your Mod can set the default state

split nebula
#

planes and choppers don't seem to care about the wheels class

#

which are the types of vehicles i need this for. for ground vehicles i suppose it works

dim terrace
#

imo there is no way to do it then

split nebula
#

what i was afraid of, oh well at least i tried haha

#

i can still do some sort of guestimation based on bounding box and just use a random point for the wheel axis

digital hollow
#

Mine ammo being created by Put doesn't have any init EHs, right?

little raptor
#

projectileCreated?

digital hollow
#

oh! 2.10. Will try <3

mortal saffron
#

Is there a way to replace or remove (hide) the Support Module Icons once sync'd to a player?

manic kettle
#

So I'm familiar with creating editor modules in a mod..
But Is it possible to add editor modules from inside the mission folder? For testing without having to restart the game on every change/repack mod pbo? Or just a way to make the process of making changes less pain?

digital hollow
#

for scripts either put the file in the mission folder or use filepatching to live load changes.

#

for configs, use diag exe to live merge changes

opal zephyr
manic kettle
#

That's exactly what I needed, thanks!
I never knew about diag exe

#

I would be interested in hearing more as well, if what j3ff says is possible

velvet merlin
#

if !(local _vehicle) exitWith {nil};

#

is this fine to do with handleDamage, or would you still to return a damage value?

manic kettle
sharp grotto
#

is there a way to do an animDone EH for objects (doors for example) ? thonk

meager granite
#
player addEventHandler ["HandleDamage", {
    if(true) exitWith {0};
    1;
}];
```This will never apply any of the damages, not `0` not `1` and will just use engine default calculated damage
cedar cape
#

is it possible to run a script on server startup?

#

i want to run this script: ```0 enableChannel false;

1 enableChannel [true, false];

2 enableChannel false;

3 enableChannel false;

4 enableChannel false;

5 enableChannel false;``` when my server starts

#

so i dont have to do it every mission

velvet merlin
# meager granite If done in top scope, exitWith value will be ignored because top most scope in e...

Not sure if I follow.

I think to remember the engine will always apply something with HD yes.
If you have stacked HD for example not sure how that nil returns affects anything.

Your exitWith sample should apply no damage due to 0. While Suma/Ondra said, exitWith behaviour is "undefined"/not guaranteed, I'am not aware of any case it doesnt work to have a function return to the value from the the end of the exitWith statement scope.

velvet merlin
meager granite
#

You can't exitWith top scope that engine calls as an event handler

meager granite
#
player addEventHandler ["HandleDamage", {
    if(true) exitWith {0};
    1;
}];

Means that this scope was broken out of and its result is nil, there is no higher scope to use 0 in as return

#
player addEventHandler ["HandleDamage", {
    call {
        if(true) exitWith {0};
        1;
    };
}];
```This on the other hand will make player invincible and always set damage to 0
#

Because EH function ended with return of call which is 0

velvet merlin
#

well i guess we use to call a function within and circumvent that then

#

will check if we have anything directly in the top scope

meager granite
#

Or wrap your whole code in if(local _this # 0) then {

#
player addEventHandler ["HandleDamage", {
    if(local _this # 0) then {
        // Anything you want here, including exitWiths
    };
}];
#

As there is no else, event handler will return nil and use engine behaviour

#

returning anything on non-local entities in HandleDamage doesn't do anything anyway (it can fire on non-local due to bugs)

cedar cape
#

using the debug console or the init.sqf

grizzled lagoon
modern meteor
#

What is the command to make a Helicopter landing on a landing pad and unload the passengers incl. the player (pilots stay in)?

proven charm
modern meteor
#

Hmm, it seems it does not work if the group leader is the player?

proven charm
#

i think wps are for AIs only, not sure

modern meteor
#

Ok, tks

mellow scaffold
#

I have inherited a rather sizable pile of SQF code in a mission framework, and I've been wondering if there is a way to 'profile a whole mission', in the same way cProfile/pprof etc work for general purpose languages. My wishlist would be to have it run alongside a 1h-2h mission with tolerable impact, and then at the end I can see which mission-side scripts ate the most CPU time (or strangled server FPS the most). Ideally also telling me if the framework code is the issue, or just the humongous modpack. I have heard of ArmaScriptProfiler, but I dunno if it can do what I am looking for

velvet merlin
velvet merlin
# mellow scaffold I have inherited a rather sizable pile of SQF code in a mission framework, and I...

Not sure how good the logging options with ArmaScriptProfiler are - in general probably the best there is.
May depend on amount of scheduled vs unscheduled code is in that mission framework.

Next that is the native, but largely very basic https://community.bistudio.com/wiki/Performance_Profiling and https://community.bistudio.com/wiki/diag_captureFrameToFile

Probably for both you need to parse/convert the output to a format to be able to visualize it with some third party software

#

that said, usually more important than scripts/functions, are the amount of units, groups and other entities. especially about of vehicles

#

how much of that is simulated permanently vs temporary (dynamic simulation, unit caching, dynamic spawning, etc)

#

and with mods its about how draining the assets (models/textures) and the terrain are

velvet merlin
mellow scaffold
#

thanks, kju, I will take a look into those, then

modern meteor
#

What is the command to make an AI unit throw a smoke grenade please?

compact maple
#

Hello, is it possible to attach a createSoundSource to a building?

hallow mortar
drowsy geyser
#

is it possible to rename the variable name of a unit which was set in the editor, mid-scenario?

warm hedge
#

No

cosmic lichen
#

Why would you rename it?

#

you could alway do

myNewVarname = myOldVarName; but that doesn't make much sense.

warm hedge
#

O wait variable name?

#

I somehow thought displayName, sorry

cosmic lichen
drowsy geyser
#

ah okay thanks i will try this

modern meteor
brisk lagoon
#

Good afternoon everybody
question about the civilian presence module
I checked the wiki and I noticed you can add loadouts from other mods (CUP civilians for example) but I did not see anything about custom loadouts (the one you make on ACE arsenal for example) is it possible at all?

jade acorn
#

yes, and there are few ways I reckon

#

easiest would be to create a bunch of custom loadouts in mission config and then use the example for CUP units but replace CUP classes with classes you have made

#

other would be creating your own units through a mod and then adding them to your module through everything that's in "Expanding module" section (except new terrains)

brisk lagoon
modern meteor
hallow mortar
#

I don't know which muzzle IR grenades belong to

#

it may not be SmokeShellMuzzle

stable dune
modern meteor
#

AH, that's the issue

#

Got it

#

But how can I find out the muzzle of a certain grenade. Eg. "ACE_HandFlareRed".

stable dune
modern meteor
#

Thank you. Maybe I am too stupid but I still can't make it work. Don't know which muzzle I have to use for ACE_HandFlareRed.

hallow mortar
little raptor
little raptor
little raptor
#

I'm gonna guess your framework is all scheduled stuff

modern meteor
modern meteor
hallow mortar
#

The ACE Github page allows you to browse the full file structure of the mod. I just went up one level, into the grenades folder, and clicked on CfgWeapons.

#
  • it's also visible in the left sidebar
little raptor
#

including the driver

modern meteor
#

I did setCaptive true;

modern meteor
little raptor
#

all throwable muzzles are in: getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles")

#

I think after that you can just use the compatibleMagazines command think_turtle

#

yeah it works:

compatibleMagazines ["Throw", "HandGrenade_Stone"]
modern meteor
#

Brilliant, thanks a lot!

brisk lagoon
#

hey I am creating a faction now with alive, some time when I move between units to look that everything is ok, It changed to the original loadout of the unit I am modifying, why is that?

#

wait, I think I am actually modifying a unit and did not create a NEW unit ffs smh

sullen sigil
#

Would anyone know why particlesource createvehiclelocal is creating on top of player? standby for sqfbins

little raptor
#

why not manually use setPosXXX?

sullen sigil
#

Tried that too notlikemeowcry

little raptor
#

!quote 5

lyric schoonerBOT
sullen sigil
#

ASL may have it below terrain/objects, why would you have a ship explosion from crashing into terrain under terrain? thonk

little raptor
#

so?

#

adjust your position

#

you're using modelToWorld (should be modelToWorldWorld for ASL), which is relative to model

#

it doesn't care about terrain

sullen sigil
#

yes, it returns agl. waituntilandexecutes wait until its <= 0 agl so it crashes thonk

little raptor
#

setPos is just a broken command

sullen sigil
#

i mean, i can try asltoagl but 🀷

#

oh the function is already called hang on

#

so the function is called when criteria is met so it doesnt matter

#

so long as im consistently using asl right

#

gotcha

#

same problem

#

changed to modeltoworldworld and to setposasl, no dice

little raptor
#

no dice as in?

sullen sigil
#

same issue

#

spawns on players pos

little raptor
#

is _obj1 the player?

sullen sigil
#

no, capital ship object. pos is different to player

#

verified with systemchatting it -- as well as _pos from the destroyship part

little raptor
#

setParticleParams is using player meowsweats

sullen sigil
#

...buh

#

serves me right for not breaking lines

#

should just be able to change all that to _obj1 without issues then

#

or just objNull actually as the ship's moving πŸ€”

#

meh, i'll figure it out -- thanks lol

fleet sand
#

Question is there a way to set Vision Mod ?

sullen sigil
#

on what

#

unit? camera?

fleet sand
#

Unit.

sullen sigil
#

_unit action ["nvGoggles", player];

fleet sand
sullen sigil
#

do they have thermal vision nv

fleet sand
#

yea

sullen sigil
#

take a look at that page

#

i cant find anything but could be blind

#

second param could be vision mode string or something but i doubt it

wind sapphire
#

I am looking for the most efficient way to test if a unit is inside a building. Is it best to use calls to lineInterSectsSurfaces but insideBuilding? Is one of these faster or more/less reliable?

sullen sigil
#

read the page

#

insidebuilding is engine driven but poorly configured modded buildings may not work

hallow mortar
#

insideBuilding is likely to be faster, but does have some cases where it might not detect a unit that seems to be inside a building. Its detection is based on whether the unit is on a surface configured as interior, so some open-bottomed buildings won't be detected.

#

Using raycasting is likely to be more reliable, but since it requires a lot of moderately expensive checks, it will be slower.

wind sapphire
#

Thanks - for this application which is for porting mission layouts as SQF raycasting should be fine.

sullen sigil
#
KJW_CapitalShips_Ships = if (isNil "KJW_CapitalShips_Ships") then {[]};
KJW_CapitalShips_Ships pushBack _shipHelperObject;
publicVariable "KJW_CapitalShips_Ships";``` seems to be causing the `KJW_CapitalShips_Ships` array to be getting undefined when run after the array has been emptied of one object? ![thonk](https://cdn.discordapp.com/emojis/700311400152825906.webp?size=128 "thonk")
#

oh, the if statement seems to need an else {kjw_arr};. seems like a bug..?

south swan
#

why?

sullen sigil
#

as its making the variable nil if the if condition isnt met

south swan
#

it makes variable nil when you ask it to make variable nil

sullen sigil
#

but i don't meowsweats

#

if it was else {} sure

south swan
#

if (isNil "KJW_CapitalShips_Ships") then {[]} else nil

sullen sigil
#

yeah, im not doing that -- without the else it's nilling it thonk

south swan
#

okay

#

what if is supposed to return then in your opinion?

sullen sigil
#

if kjw_capitalships_ships doesnt exist return [], else dont do anything

#

thats what erm

#

either lou or leopard said too

south swan
#

if (isNil "KJW_CapitalShips_Ships") then {KJ_CapitalShips_Ships = []};

sullen sigil
#

i had been doing that (else variable) previously but one of those two told me it wasnt needed meowsweats

sullen sigil
south swan
#

you're explicitly assigning return of if to variable πŸ€·β€β™‚οΈ

sullen sigil
#

hmmmmmmmm

#

either way i was only doing it bc either lou or leopard said to 😎

south swan
#

Posted on May 19, 2022 - 01:11 (UTC)
When using if to assign values to a variable, if you not have an else block it is treated as nil and returned, setting the variable value to nil. A3 2.08.149102
https://community.bistudio.com/wiki/if blobdoggoshruggoogly

little raptor
sullen sigil
#

i want to tell him hes wrong

#

lou you are wrong

#

oh fuck no youre not i didnt read it properly the first time either notlikemeowcry

#

thats embarrassing whoops

#

sorry for the ping too

winter rose
sullen sigil
#

oh wow it was even for the exact same line of code

#

thats even more embarrassing

winter rose
#

good. 😈

sullen sigil
#

ive changed it to what you suggested now

winter rose
#

oh no, it works!

sullen sigil
#

ive nested 5 cba waituntilandexecutes because i refuse to use the scheduler for this so working probably isnt the word i'd use

wind hedge
#

does anyone knows if the comment "Must be executed on all clients to work properly in MP" found here https://community.bistudio.com/wiki/setAnimSpeedCoef still stand true? It says global argument, local effect. So the server changing some Ai's animation speed coef should be updated on the clients as well, right? Or do I need to remoteExec it?

little raptor
fleet sand
#

Quick question how would i make a simple Jagged Array or MutliDimentional Array or how ever is called.
basicly array of arrays something like this:

[
  ["....","...","..."]
  ["....","...","..."]
]
little raptor
#

for what?

fleet sand
#

I just wonna learn how to make a Jagged Array in arma 3.

little raptor
#
[
  [1,2,3],
  [1,2],
  [1]
]
fleet sand
#

Ok lets say i have x amount of players is there a way to get me a gear of each player in seperate array ?

little raptor
#
allPlayers apply {getUnitLoadout _x};
#

non-apply version:

_loadouts = [];
{
  _loadouts pushBack getUnitLoadout _x;
} forEach allPlayers;
#

and if you want to store more information per element:

allPlayers apply {[_x, getUnitLoadout _x, "someOtherStuff"]}; // each array element is [player, playerLoadOut, someString]
fleet sand
brisk lagoon
#

I closed it by accident 😒

digital hollow
opal zephyr
#

Thankyou!

manic flame
#

Im trying to make a vehicle explode whenever a player enters. I assigned the vehicle the variable car_bomb, currently im doing this to blow it up:

initServer.sqf

{
    while { alive car_bomb } do {
        if !(_x != vehicle _x) then {
            sleep 2;
        } else {
            vehicle car_bomb setDamage 1;
        };
    }
} forEach allPlayers;

But im assuming this works if the player enters in ANY vehicle, right?

any possible way to check only for car_bomb?

#

Specifically; if !(_x != vehicle _x) then {

little raptor
#

use GetIn event handler instead

#
car_bomb addEventHandler ["GetIn", {
  _this#0 setDamage 1;
}];
#

no need for any loop

manic flame
#

Thanks!! i was looking for the event but i couldnt find in the wiki

#

so i ended up doing a loop

#

πŸ˜›

manic flame
little raptor
#

it selects item 0 yes

manic flame
#

so it would be #0 -> vehicle #1 -> player?

little raptor
#

no. #2 is the unit that got in

manic flame
#

tbh i'll just check the wiki it prolly says there

#

thanks

little raptor
#
this addEventHandler ["GetIn", {
    params ["_vehicle", "_role", "_unit", "_turret"];
}];
manic flame
#

ah i see

#

params array

#

thanks

#

_turret is bool?

little raptor
#

array

#

turret path

manic flame
#

ok

pastel crater
#

I'm trying to find a way for illegal items to be deleted from your loadout if the arsenal you are loading them on doesn't allow them.

For example, let's say I don't have any NVG allowed on said arsenal. If someone kills an enemy with an NVG and picks it up, then saves a loadout with said NVG, he'll still have it. I want that NVG to be gone upon loading the loadout, as it is not ''listed'' on said arsenal. Any tips?

manic sigil
#

Top of my head nuclear option, add an inventoryOpened EH to each player character that checks for and deletes the items on a black list.

pastel crater
#

Uhhhhh I don't really know what that is. Don't really know much scripting myself

#

and if I'm getting that correctly, I'd have to make a blacklist with every single item in the game that I don't wanna allow... how would I go about doing that?

manic sigil
#

If you're just talking NVGs, thatd be easier, but if you want to erase specific items, you're gonna have to make the list of items you don't want players to have (Alternatively, items they're allowed to have) and operate with that.

pastel crater
#

got it

warm swallow
#

Is there any way to see if a user is running the game on the profiling branch of arma?

grizzled lagoon
warm swallow
#

Could you explain?

I tried using productVersion but that doesnt differentiate between stable and profiling

agile pumice
#

its memory points, leshrack

#

not selections

agile pumice
#

the memory points should always be the same

#

no matter the model

warm swallow
#

Some GUI elements break when on profiling, so I want to give a warning to player if they are on profiling that some elements may not show correctly

little raptor
#

ah meowsweats

agile pumice
#

wheel_1_1_axis

#

wheel_1_2_axis

#

wheel_2_1_axis

#

wheel_2_2_axis

sullen sigil
#

am i completely bruggin (again) or is there an engine command for finding the position based on direction from position and distance? meowsweats

hallow mortar
#

vectorAdd+vectorMultiply should do it for vector directions

sullen sigil
#

yeah just seem to recall a specific command for it