#arma3_scripting

1 messages ยท Page 660 of 1

little raptor
#

Do you use mods?

distant oyster
#

yeah just tested. the eventhandler just goes ballistic when crashing

little raptor
#

makes no sense to me

#

maybe it's a bug?

distant oyster
#

hmmm it kind of works just with a little bit delay

#

damaging the main rotor will destroy it but it will regenerate quickly

#

or not. weird

#

sometimes it can handle the damage and sometimes not

little raptor
#

I'll just ping dedmen for now so he can take a look at it later @still forum

smoky verge
#

tried getting the selection name of the rotating diorama piece with
selectionNames GalleryDioramaUnit_01_F;
but it didn't work;

#

did I use it wrong?

little raptor
smoky verge
#

oh got it

opal ibex
#

Is there anyway to get Container Object of the last added Container to a box/vehicle? I'm trying to create a container with specific items inside with a script but i have not been able to find a way to get the CO so i can add items to it. I did see someone getting the last object that returns from everyContainer which made me think last added object would be the last element in that array but that is not the case.

hushed tendon
#

I know if statements only run once but I have it in a function that I'm calling but it still won't run. Should I be using something else?

hushed tendon
#

Nvm

hallow mortar
loud birch
#

setObjectScale works in sp but not on a dedicated server

#

the object just stops existing at all

hallow mortar
hallow mortar
# loud birch setObjectScale works in sp but not on a dedicated server

It does work on DS (source: watched someone do it a few hours ago) but there are specific conditions under which the command works at all.
Also, there can be culling issues. For example, when someone made a giant Miller, he would disappear if you looked at his top half, because some part of his normal model was still somewhere at his feet, no longer in your field of view, and the game therefore assumed he was out of sight.

loud birch
#

maybe putting it in the init field doesn't work?

#

im not quite sure what the problem is with my set up for it

opal ibex
#

For example, I already have a box object that was created with createVehicle, i want to use addBackpackCargoGlobal to add a backpack and get the added backpack object so i can use more add commands on that container (backpack) to add items into the backpack.

#

Although it looks like create"Vehicle" is able to create a backpack object, i could maybe manipulate this, i will try somethings. Thanks.

#

Okay maybe not, I was not able to find a function to move an object into a container. Does such a thing exist?

#

Every function I see creates an object with the classname.

opal ibex
#

Well I figured it out. Last answer on that topic, I wonder why I never thought of substituting new-old uhnHead . I was already doing a count check but I was doing it on total.

tough abyss
#

Okay a question you know the screens and stuff we can place custom images on, is it possible to change them mid mission via script

#

cool thanks

tough abyss
#

haha ha my first custom texture

tough abyss
#

good good the main op center is 90% completed including animations and props

still forum
little raptor
still forum
#

battleye timeout

little raptor
#

I'll just make a ticket then

hushed tendon
#

I have some code running where I'm trying to count the number of players for bluefor and allow to code to repeat itself until turned off keeping the exact number of blufor players until turned off. But I can't find the right code to keep the current number of players. I have this so far

while {readyActive == true} do {
  {
    if (isPlayer _x && playerSide == west) then {
        //Idk what to put here
    };
  } forEach (playableUnits);

  hint format ["players %1",westPlayers]; //testing purposes
};```
still forum
#

readyActive == true that nonsense. Comparing a boolean to true does nothing

#

readyActive == true == true == true == true == true == true == true == true is literally the same as readyActive

#

you want the number of players in blufor?

#

or number of playableUnits in blufor (different things)

#

westPlayers = west countSide playableUnits

hushed tendon
#

I'm looking to count west players that are even just slotted.

#

Yep that works. Thanks

tough abyss
#

sigh combat animations are so nice they allow you to keep a squad grouped together while allowing you to place them naturally around an area instead of standing in a wedge formation like idiots

clever radish
#

Yeah, sure. My image is .jpg, the A3 image converter doesn't work and crashes each time i use it. I'll post my codes on Pastebin

https://pastebin.com/75xWmxNW

cosmic lichen
#

onload = "[] spawn {execVM 'rangeScript.sqf';};";
execVm spawns already

#

@clever radish

#

action = "closeDialog 0;";
You can use IDC = 1 instead

clever radish
cosmic lichen
#

no

#

what image?

clever radish
#

Terra is helping me with GUI not spawning my image. Everything runs as it should, but the image is not showing. No script error will show either

cosmic lichen
#

What't the code?

clever radish
past wagon
#

if I set player locations in init.sqf, will that be a problem if AI is disabled? will it only set the locations of units who have already been occupied by a player in the role selection screen?

#

@ me

#

what i mean is, do those objects exist in the mission before they are selected by a player

spark turret
#

Allplayers only catched players, not unoccupied slots afaik

past wagon
#
player0 setPos selectRandom [[, , ], [, , ], [, , ]];
player1 setPos selectRandom [[, , ], [, , ], [, , ]];
player2 setPos selectRandom [[, , ], [, , ], [, , ]];
player3 setPos selectRandom [[, , ], [, , ], [, , ]];
player4 setPos selectRandom [[, , ], [, , ], [, , ]];
player5 setPos selectRandom [[, , ], [, , ], [, , ]];
player6 setPos selectRandom [[, , ], [, , ], [, , ]];
player7 setPos selectRandom [[, , ], [, , ], [, , ]];
player8 setPos selectRandom [[, , ], [, , ], [, , ]];
player9 setPos selectRandom [[, , ], [, , ], [, , ]];

This is what I have in init.sqf. I have not added in the values yet

#

this is for multiplayer, and AI is disabled. will it still set the position of these objects if they have not been selected by a player?

willow hound
#

@past wagon If AI is enabled for playable units, the unit can obviously exist before the player joins.
Independent of that, init.sqf runs on every client that connects, so if you change the player object position there, already existing objects get teleported.

past wagon
#

wait

willow hound
past wagon
#

so every time a player connects it runs the script again?

willow hound
#

Yes

past wagon
#

should it be in initPlayerLocal instead?

willow hound
#

That's why one should be using initServer.sqf for server stuff and initPlayerLocal.sqf for client stuff.

past wagon
#

okay, im gonna put it in initServer.sqf because i was having problems with it in initPlayerLocal.sqf

willow hound
past wagon
#

the code would run again after the mission started, and teleport players in the middle of the mission when someone connected

#

yea

#

would it be fine in initServer.sqf?

willow hound
#

It's not going to do much good in initServer.sqf as the units probably don't (all) exist when that runs.

past wagon
#

okay

willow hound
#

initPlayerLocal.sqf runs for every client that connects, so you can just place player setPos selectRandom [...]; there.

past wagon
#

but wait

#

isnt that the same problem as before?

willow hound
#

No, it only teleports the player on the client that is running initPlayerLocal.sqf (= the client that is joining).

past wagon
#

okay

#

so I dont need one line of code for every player

willow hound
#

In fact the problem was that you teleported every player from that file.

past wagon
#

i can just have it say player instead of listing player1, player2, player3.....

#

because the units are named player1, player2, player3.....

willow hound
#

Exactly, because you only want to teleport one player - the one that is joining.

past wagon
#

ok

#

thank you

#

but there is one problem with this

#

the way I had it, each unit had one of 3 possible unique spawn locations

#

now everyone will have the same spawn locations, so it is possible that two players will spawn in the same place

willow hound
#

Do your players have different role descriptions?

past wagon
#

im not sure

willow hound
#

That would be the easiest way to get something going.

past wagon
#

i can make them have different role descriptions

willow hound
#

Then one way to get it working is this:

private _spawnLocations = [[0, 0, 0]]; //Can't hurt to have a failsafe / fallback
switch (roleDescription player) do {
  case "Player 1": { _spawnLocations = [...]; };
  case "Player 2": { _spawnLocations = [...]; };
  ...
};
player setPos selectRandom _spawnLocations;
past wagon
#

okay

#

so how do i make this work?

#

i need each player to have different role descriptions?
is that what "Player 1", "Player 2" are?

willow hound
#

Yes

past wagon
#

okay great

#

and this will still work in initPlayerLocal.sqf?

willow hound
#

That switch-statement is basically the same as:

if (roleDescription player == "Player 1") then { _spawnLocations = [...]; };
if (roleDescription player == "Player 2") then { _spawnLocations = [...]; };
past wagon
#

ok

willow hound
past wagon
#

okay nice

#

and what does the top line of code do?

willow hound
#

Well it could in theory somehow happen (somebody messes something up while editing the code, a bug comes along, ...) that roleDescription player does not end up matching any of the options we compare it to ("Player 1", "Player 2", ...), and then player setPos selectRandom _spawnLocations; would throw an error. To avoid that we set a default value for _spawnLocations (ideally not in water, so [0, 0, 0] might not be the best choice), so in case the role description doesn't match any of the role descriptions provided, initPlayerLocal.sqf doesn't get interrupted by an error.

#

If the role description matches "Player 1", then that default value gets overwritten with the correct values for Player 1.

past wagon
#

okay

#
if (roleDescription player == "Player 0") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 1") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 2") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 3") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 4") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 5") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 6") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 7") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 8") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 9") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
player setPos selectRandom _spawnLocations;

I havent added in the values yet, but should this work correctly?

#

I also havent put in the fallback line of code at the beginning yet just for simplicity

willow hound
#

Looks right to me.

wet garden
#

hi guys i'm currently trying to make a scripted function where ai units and both empty and destroyed vehicles are deleted after 2 minutes, they would be inside a trigger area. I wrote this with some help from others, however i don't currently have access to a server to test it on; does this look satisfactory?

scopeName = main;
_counter = 0;
_counterLimit = 120;

while{true} do
{
_counter = _counter + 1;
    
    if (_counter == _counterLimit && ((aiUnits inArea Trig1) || (landVehicles inArea Trig1)) then
    {
        { (landVehicles inArea Trig1) deleteVehicleCrew _x } forEach crew inArea Trig1;
        deleteVehicle aiUnits;
        deleteVehicle landVehicles inArea Trig1;
        
        killAi = allUnits inAreaArray Trig1;
        {deleteVehicle _x} forEach killAi;

        killVeh = vehicles inAreaArray Trig1;
        {deleteVehicle _x} forEach killVeh;
        
        canibal = allDead inAreaArray Trig1;
        {deleteVehicle _x} forEach canibal;
        breakTo main;
    };
    else
    {
        
    } exitWith {};

sleep 1;
};
past wagon
distant oyster
# wet garden hi guys i'm currently trying to make a scripted function where ai units and both...

there are quite a lot of errors.

  1. scopeName syntax is: scopeName "main": https://community.bistudio.com/wiki/scopeName
  2. aiUnits inArea Trig1: if aiUnits is an array then this command will not work (same for landVehicles) https://community.bistudio.com/wiki/inArea
  3. deleteVehicleCrew syntax: vehicle deleteVehicleCrew unit. vehicle is an object, not an array (landVehicles) https://community.bistudio.com/wiki/deleteVehicleCrew
  4. crew inArea Trig1 that is an illegal combination. again, crew only works on objects
  5. deleteVehicle aiUnits; assuming aiUnits is an array this is also wrong
  6. deleteVehicle landVehicles inArea Trig1; see (4) and (5)
  7. killAi = allUnits inAreaArray Trig1; allUnits allUnits returns an array and does not take in any arguments, inAreaArray is similar to inArea (2): https://community.bistudio.com/wiki/inArea
  8. canibal = allDead inAreaArray Trig1; see (7), same goes for allDead: https://community.bistudio.com/wiki/allDead
  9. breakTo requires a string as right argument: breakTo "main";: https://community.bistudio.com/wiki/breakTo
  10. else { } exitWith {}; is not possible. it's either if (condition) then {} else {}; or if (condition) exitWith {};

soo, uuhh nothing of your script will work

still forum
#

instead ob breakTo you can just use break and get rid of scopeName and that mess

idle sierra
#

hey guys, im new to script code, so forgive me if this is a little handholdy

#

how would you write a script where you add a crew to an empty vehicle on init?

#

ive tried customizing vehicle crews from the config.cpp route, and its an insane hassle just to get more than 3 into a vehicle, i was wondering if its any easier using scripts.

past wagon
#

@willow hound I added in some placeholder values to test it and I am getting an error on line 11. it says undefined variable

if (roleDescription player == "Player 0") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 1") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 2") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 3") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 4") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 5") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 6") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 7") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 8") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 9") then { _spawnLocations = [0, 500, 0]; };
player setPos selectRandom _spawnLocations; //ERROR HERE
little raptor
#

_spawnLocations is only defiend inside the scope

past wagon
#

yeah

#

okay

#

do i remove the underscore?

little raptor
#

๐Ÿ™„

past wagon
#

idk

little raptor
#
_spawnLocations = call {
  if (roleDescription player == "Player 0") exitWith {[0, 500, 0];};
  ....
};
#

but better to use arrays

#

or hashmaps

past wagon
#

okay

#
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
};
player setPos selectRandom _spawnLocations;
#

does that look better?

#

@little raptor

little raptor
#

missing ;

past wagon
#

oh

little raptor
#

also it won't work

past wagon
#

why not

little raptor
#

selectRandom _spawnLocations
returns a number

past wagon
#

and its supposed to be an array?

little raptor
#

have you ever seen a position as a number?! (hey go to grid 1 meowsweats )

past wagon
#

no?

#

idk

#

so how do i fix it and make it return as an array instead of a number?

willow hound
#

Fix it by making it an array of positions.

past wagon
#

dont I already have an array of positions??

#
{[0, 500, 0];};
little raptor
#

you have an array of numbers [0, 500, 0] ๐Ÿ™„

past wagon
#

ok

#

do i just need to add another set of brackets? []

little raptor
#

yes

past wagon
#

ok

#
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
};
player setPos selectRandom _spawnLocations;
little raptor
#

now it works

willow hound
#

Now it's an array of one position, selectRandom will always return the same position.

past wagon
#

yay

#

ok

#

so...

#

well yea they are all the same coords

#

oh and i only put in one set of coordinates per player

#

just for testing

willow hound
#

As long as you're aware of that, we're good ๐Ÿ™‚

past wagon
#

yep

#

thanks

#

wait i got undefined variable again

little raptor
#

did you exit the mission or just restart it?

past wagon
#

i went back into the editor

#

and saved it

little raptor
#

there is no undefined variable in that code

#

it's from somewhere else

past wagon
#

well it says line 13

#
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
};
player setPos selectRandom _spawnLocations;
#

and variable _spawnLocations

little raptor
#

there is nothing wrong with that

past wagon
#

lemme try it again

#

it wont let me paste the image of the error message into discord

surreal peak
#

couldnt that be condensed with a forLoop with

roleDescription player == format["Player %1",_x]
willow hound
surreal peak
#

ah

#

have you tried putting selectRandom _spawnLocations; in brackets like (selectRandom _spawnLocations); I know some languages are finiky like that

little raptor
#

read the rules of precedence

willow hound
#

What if we are in the case I described earlier?

past wagon
#

if you guys cant find the error, then I certainly cant ๐Ÿคทโ€โ™‚๏ธ

little raptor
#

there is no error

past wagon
#

im just gonna restart arma

surreal peak
#

post the rest of your code if it still doesnt work

willow hound
#

What if roleDescription player matches none of provided ones?

past wagon
#

WAIT

#

am i a fucking retard

#

nope

#

for a second i thought i might have pasted it into the wrong mission file

past wagon
#

oh

little raptor
#

provide a default pos

past wagon
#

wait

little raptor
#
_spawnLocations = call {
  if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
  if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
  if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
  if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
  if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
  if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
  if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
  if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
  if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
  if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
  [[0, 500, 0]];
};
player setPos selectRandom _spawnLocations;
past wagon
#

that just adds a default pos?

willow hound
#

Where is the money indent Lebowski Leopard?

past wagon
#

i dont understand what the array at the bottom does

spice axle
#

that is a default return value

past wagon
#

okay

#

but how exactly does it work?

spice axle
#

If the role description is not Player 0 to 9 like Player 10 he still needs a spawnLocation and this is the default value

past wagon
#

okay

spice axle
#

I'm not what that script should do

past wagon
#

wait

spice axle
#

That is a very bad coding style

willow hound
#

oof

little raptor
past wagon
#

by any chance do the role descriptions actually have to have quotations?

#

or are they just strings?

willow hound
#

In the Editor?

past wagon
#

yea

#

in the editor

willow hound
#

Don't need quotes there

past wagon
#

ok

spice axle
#

I mean why do u call it and not just taking a normal switch case

past wagon
#

well all the role descriptions match up with the ones in the code

#

so i dont know what the problem is

spice axle
#

Isn't there a break statement now?

little raptor
#

but the fastest solution is hashmaps here

spice axle
#

And to call a script is faster then just execute the script?

little raptor
#

which I'm not in the mood to explain to a newbie

spark turret
#

Its a one time check for 9 players. Performance dont mattee

#

That code looks shite

#

Needs a foreach loop or switch case

past wagon
#

*10 players

#

dont forget about Player 0 you will hurt his feelings

willow hound
#

Modify the end of the script like this and tell me what Arma gives you when you try with that:

systemChat str _spawnLocations;
player setPos selectRandom _spawnLocations;
past wagon
#

ok

willow hound
#

Ah nevermind, it gives you undefined variable lol

spark turret
#

Elegance in coding is the opposite of performance. And when performance doesnt matter, i pick elegance

spice axle
#

I'm not a newbie. Hashmaps would the best solution. But I agree with the faster execution against a switch but why call that function

past wagon
#

ok

little raptor
#

plus call has a very minor performance penalty (<0.0004ms)

spice axle
#
_spawnLocations = call {
  // why do it here
};

and not here

_spawnLocations = [0,0,0];
if (blabla) exitWith{};
little raptor
spice axle
#

Yeah I mean then

#

U could try to just answer my question

spark turret
#

Just put it in a if( true) then
thonk

little raptor
little raptor
spice axle
#

Thanks for just answering the question. I mean that is ugly as hell, not sure if (<0.0004ms) is worth it

spark turret
#

I meant to keep avoid exiting the whole script with exitWith, yoi make an obsolete if statement.
It was a joke

past wagon
#
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
};
player setPos selectRandom _spawnLocations;

any news about wth is wrong with this script?

#

is my arma broken?

spice axle
#

No default at the end

past wagon
#

yea but why do i need a default

#

i know but that wont work when i add in actual arrays with a bunch of coords

#

right?

spice axle
#

if ur roleDescription does not match one of the above u will run into a error

past wagon
#

okay then lets fix the error instead of making a default coordinate

willow hound
#

Is it vanilla Arma @past wagon?

past wagon
#

yes

#

and these coordinate arrays are completely for testing purposes

#

i am going to add in 10 different sets of coords for each player

spice axle
#

Just paste your added coords one

past wagon
#

well i still have to get the coords

#

that will take like an hour to do

spice axle
#

So it works with default, but not without?

past wagon
#

no no no

still forum
#

Just go into your mission

past wagon
#

im so fucking confused

still forum
#

type "roleDescription player" in debug console and see what comes out
You say its correct, but did you actually check?

past wagon
#

the default is basically just "if the script doesnt work then just put them here". right?

spice axle
#

no its if your statement is not true use this

#

And u have 10 if statements

past wagon
still forum
#

Did you check yes?

past wagon
#

not just "player"

still forum
#

Or do you think they should be?

past wagon
#

I am confused

still forum
#

Please just go and check

little raptor
past wagon
#

okay

#

in the editor or in the mission?

little raptor
#

in the mission

past wagon
#

ok

#

i get this:
""

little raptor
#

do you see the problem now?

past wagon
#

not at all

spice axle
#

Did u try in multiplayer?

past wagon
#

not yet

spice axle
little raptor
#

๐Ÿ™„

spice axle
#

Does not work in single player.

past wagon
#

bruh

spice axle
#

Why would u not just want to give the unit a var name

#

It is so much easier

past wagon
#

idk

willow hound
#

It's more complicated to check player == Player1 because you have to pay attention with isNil "Player1" and fun stuff like that

still forum
#

"Does not work in single player." that shouldn't be a problem here

little raptor
#

vehicleVarName

still forum
#

the script is obviously checking multiple players

#

so its obviously intended to be multiplayer

past wagon
#

wait if I host a LAN server will it work

spice axle
#

But if the is execute that stuff in single player

past wagon
#

even if I am the only one on the server

still forum
#

did you test in editor preview?
There is singleplayer and multiplayer Eden editor

#

yes. Multiplayer editor is local hosted LAN

still forum
spice axle
#

no

#

wait

still forum
#

Scrolling up I see so many people making bad recommendations and steering in the wrong direction notlikemeow

spice axle
#

He is just testing that stuff in singleplayer and not multiplayer. He should switch to multiplayer editor

#

That's why it isn't working

still forum
#

Yes. I just wrote that above

spice axle
#

Yeah me too with my comment, u just misunderstood that

willow hound
# little raptor `vehicleVarName`

Smart; I didn't think of that. Only read about the existence of those commands a few days ago in fact.
Either way, I originally proposed using roleDescription, and here we are blobcloseenjoy

past wagon
#

okay it does work in multiplayer

spice axle
#

Yeah

spark turret
#

anyone one what that error means?

22:52:51 Trying to add inventory item with empty name to object [Sharpshooter]
22:52:51 Trying to add inventory item with empty name to object [Heavy Gunner]
22:52:57 [ACRE] (sys_io) INFO: Pipe error: Read CreateFileA WinErrCode: 2
22:53:13 [CBA] (optics) INFO: Scripted camera restarted.
22:53:13 [ACRE] (sys_io) INFO: Pipe error: Read CreateFileA WinErrCode: 2
22:53:22 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
22:53:22 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
22:53:22 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
22:53:22 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'

it goes on for another 200 lines

still forum
#

which

#

there are 5 different messages in there

little raptor
spark turret
#

hm that sounds like an equipement script could cause it ?

#

add local magazine to server owned unit, like that

still forum
#

Isn't 'bis_fnc_objectvar' the function that remoteExec tried to execute? does it make sense to call that via remoteExec? as its basically a getter?

#

also I think that stuff is done by vanilla

#

No 5 @little raptor

little raptor
#

Trying to add inventory item with empty name to object
[ACRE] (sys_io) INFO: Pipe error:
[CBA] (optics) INFO: Scripted camera restarted.
A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
๐Ÿ˜›

#

I'm just messing around tho ๐Ÿ™ƒ

still forum
#

[Sharpshooter]

little raptor
#

but it's the same kind of error ๐Ÿ˜œ

spark turret
#

i got a script that re-equips units into terrorist style, called through cba spawn eventhandler on class "man"

#

maybe that causes it. not really improtant bc some other poop auto disconnects me on serverjoin with no error message

#

Eh arma reboot fixed it. Probably some battleeye crap

grim coyote
#

Does it matter if I use netid array or object array using remoteExec? (network bytes wise)

past wagon
#
sleep 60;
    while { true } do {
      waitUntil { sleep 1; alive player };
      if !(player inArea "EndZone") then
      {
        player setDamage 0.05;
      };
    };
surreal peak
#

while true bad

past wagon
#

i want to give players 60 seconds to get to a specific zone before they start taking damage

#

whats bad about it?

surreal peak
#

Whenever I have had a script with one, it just ends really poorly for performance. You really need an exit condition

#

use triggers

frigid lodge
#

Hey everyone, quick question can you check to see if a door will open inwards or outwards?

past wagon
#

okay

#

what if I want the exit condition to be until there is one player left

#

how would I go about that?

drifting sky
#

Does emptyPositions include in its count seats which have a dead body in them?

past wagon
#
sleep 60;
    while { true } do {
      waitUntil { sleep 1; alive player };
      if !(player inArea "EndZone") then
      {
        player setDamage 0.05;
      };
    };
``` this script doesnt seem to be doing 0.05 damage to players who are not in the zone after 60 seconds. what could be the problem?
past wagon
#

it seems to be able to do 1 damage and instantly kill the player, but cant do smaller increments of damage

willow hound
#

Well, it is setDamage, not addDamage.

past wagon
#

OH

#

if I change it will it work?

past wagon
willow hound
#

There is no addDamage command ๐Ÿ™‚

#

You have to get the current value, add the amount of damage you want to add to that value and then use setDamage with the result.

hallow mortar
#
_currentDamage = damage player;
_newDamage = (_currentDamage + 0.05);
player setDamage _newDamage;```
little raptor
little raptor
broken forge
#

Is there a way in which I can create an option to enable or disable the alarm part of my script before the mission starts? ```sqf
soundAlarm = {
if (isNil "AlarmHasGoneOff") then {
AlarmHasGoneOff = true;

        deleteWaypoint [grp4, 1];
        wp1 = grp4 addWaypoint [getMarkerPos "marker_0", 0];
        [grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;

        // Comment or Delete waitUntil {} Field if an Alarm is Not Needed or Desirable
        waitUntil {
            _alarm = createSoundSource ["Sound_Alarm", getMarkerPos "marker_0", [], 0];
            (EAST knowsAbout player) == 0;
        };
    };
};

{
    _x addEventHandler ["firedMan", {
        _x removeEventHandler ["firedMan", _thisEventHander];
        [] spawn soundAlarm;
    }];
} forEach (units grp0 + units grp1 + units grp2 + units grp3);
hallow mortar
little raptor
drifting sky
#

Is there a script command to order a medic to heal a unit?

little raptor
#

there is an action for healing
but again it won't "order" the unit to do it

broken forge
#

@little raptor how would I fix the spawning of many alarms? For the Disable or Enable the Alarm, I'm looking at like creating a mission param that can be selected before mission start while in the lobby.

drifting sky
#

alright, so i'll have the medic move to the person who needs healing first

drifting sky
#

is there a generic move to (a person whom may be moving)

#

so that they will follow that person until they reach them?

little raptor
#

no

drifting sky
#

fucking hell

little raptor
#

you have to put it in a loop

#

doMove and moveTo (moveTo requires doStop in A3, not sure about A2)

little raptor
#

(EAST knowsAbout player) == 0;
probably will never happen

#

or at least it'll take forever

broken forge
#

What should I use as a condition?

#

Would something along the lines of once the reinforcements, or enemies in the area have been eliminated work?

sacred slate
#

plz help ```sqf
_selection = allGroups select {side _x isEqualTo west};
player hcSetGroup [_selection,""];

little raptor
#
player hcSetGroup (allGroups select {side _x isEqualTo west} apply {[_x, ""]})
sacred slate
#

thx @little raptor

wind hedge
#

I want to create random sounds around the player but I don't want other players to hear these sounds (local to the client only), I should use Say3D right? Because playSound3D says is only local while say3D is marked as both Global and Local on the wiki and so it got me confused...

sacred slate
#

plz halp again ๐Ÿ˜„ ```sqf
player addAction [([getPos player select 0, getpos player select 1, 500]), (random 360), "O_Heli_Attack_02_F", EAST] call BIS_fnc_spawnVehicle;

#

i some how have to wrap

#

well i even dont have a menu item title lol

#

i can do it with a sqf, but i don't wan't too

orchid stone
#

are module functions executed in scheduled or unscheduled?

hollow thistle
#

Scheduled. You can always check by logging output of canSuspend

orchid stone
#

thank you!

sacred slate
#

i got it. player addAction ["a useless action that does nothing", {[([getPos player select 0, getpos player select 1, 500]), (random 360), "O_Heli_Attack_02_F", EAST] call BIS_fnc_spawnVehicle;}];

tidal ferry
#

Question, is it possible to save a loadout to profileNamespace and have a script that can load it up later?

#

Looking into making a script for my guys that would preserve loadouts between missions

#

Nvm, got it, thanks!

cloud thunder
#

Is there a smarter way to detect dense jungle areas or positions in Tanoa?
Trying to hide some IEDs/traps amongst the foliage.

count nearestTerrainObjects [position player, ["FOREST","FOREST BORDER", "FOREST TRIANGLE", "FOREST SQUARE"], 20000, false, true]
```returns 0
```sqf
count nearestLocations [position player, ["VegetationBroadleaf", "VegetationFir", "VegetationPalm", "VegetationVineyard"], 20000]
```returns 0
```sqf
isLush = (count nearestTerrainObjects [position player, ["TREE","SMALL TREE","BUSH"], 15, false, true]) > 14
```Gives me fairly acceptable results. Better alternatives?
cloud thunder
#

hmm so maybe selectBestPlaces?

tough abyss
#

hello! can i give you guys two trigger requirements and you can string them together for me so it only goes off when both are met?

little raptor
#

say3D has local effect

tough abyss
#

@tough abyss what are you trying to do

wet prawn
#

Wanting to set up a trigger that stops firing the tracer module once a target has been shot.

tough abyss
#

shot or dead

wet prawn
#

using the pop up targets, so when they get shot and go down, i would like the tracer module to stop

real tartan
#

is there a way to respawn as enemy? So I start blufor, die, and respawn as opfor without leaving to lobby ?

spark turret
#

onPlayerRespawn.sqf and then set to a different position, new loadout, new side

modern path
#

i need some advise, how can i damage a unit (ace medical) without killing it, but still making it unconsious?

#

(using a script)

manic sigil
#

I tried to pass a vehicle to a script, using [vehiclenamehere] execVM "Script", but the first task is a getpos _this and it's complaining that _this is an array, not an object... but shouldn't it be the vehicle? o.0

manic sigil
#

._.

winter rose
#

you are passing [vehicle], this is the argument itself (you could pass player, "", etc)

use params to name inner array values!

#
// e.g
player execVM "file.sqf"; // _this = player
[player] execVM "file.sqf"; // _this = [player]
``````sqf
// and in file.sqf
params ["_unit"];

_unit setDamage 1; // player is killed
#

the good thing is that params works for both player and [player]

manic sigil
#

I realized it just as you said it... ofc I was adding an extra layer of []'s

#

T_T

winter rose
#

it happens, this is called the rubber duck method ๐Ÿ˜› when explaining to someone, the solution reveals itself

manic sigil
#

This is true.

#

I'm writing a scene, actually a bonus for exploration, where the player can call in supporting fire after destroying a jamming device, but the subsequent chaotic mess of communications and the desperate situation means that everything available gets used - read, randomly select three types of fire support per target, from VLS to mortars to a cluster bomb.

#

So wrapping my head around creating and calling functions.

#

But I couldn't get spawn to work for the life of me, and call doesn't allow for sleep, so it's not useful for mortar or arty, where I want multiple, spaced hits.

#

But I think Spawn may have been failing for the same reason I couldn't get Exec to work think_turtle

#

Yup, just so T_T I thought the [] was required to pass anything to a function

#

So Calls can't suspend, but Spawns can... do Spawns stop the thread they're running on until theyre complete?

For instance, if I had each of my functions generated in the same .sqf that they're called in, and ended with:
target spawn fnc_mortar;
target spawn fnc_bomb;
target spawn fnc_arty;

would fnc_mortar have to finish before fnc_bomb could begin?

#

Think I figured it out, nvm

#

And my random call idea works out :3 This is going to be such a hot mess

still forum
#

public variables yes, otherwise no

manic sigil
#

Ugh... spent all this time making my target jump around randomly, then remembered that BIS_fnc_randomPos exists T_T

#

On the plus side tho, the heli-rocket attack is ๐Ÿ”ฅ

#

Now i just gotta make it look good, since I'm spawning in the rockets instead of relying on the heli to take the shot

wind hedge
#

will this work: SQF _result = surfaceIsWater (getPosWorld player); _result

#

I am asking because I know it works with (getPos player)

#

but getPosWorld is faster so...

still forum
#

It takes a 2D position

#

so whatever height format you use doesn't matter

manic sigil
#

Similar question;

pickle = getpos player; 
[pickle select 0,pickle select 1,(pickle select 2)+15]

is spawning the thing that follows on the ground :/ I've checked each value, and it should be 15 meters above me.

winter rose
manic sigil
#

ASL seems to have done it. Ugh T_T

graceful pewter
#

Do I need a script to get the AI to use a searchlight in a side to side sweep?

#

The item is from CUP

worthy spade
#

BIS_fnc_holdActionAdd has some built in occlusion property, so the action doesn't show up if there's something blocking your view . Is there a way to turn this off?

winter rose
cosmic lichen
#

it's probably part of the addAction command

worthy spade
winter rose
worthy spade
#

It won't.

#

Close proximity is enough.

winter rose
#

kewl! you can even add that proximity thing as action display condition ๐Ÿ™‚

hushed tendon
#

Anyway to remove the players ability to move but allow them to use the map and scroll wheel options while then being able to give them back control? I'm thinking enableSimulation but I can't seem to get it to work for a group of players in MP.

winter rose
hushed tendon
#

Yeah no clue what that means. Still fairly new to scripts

winter rose
#

oh ok! sorry for the deep dive :p

spark turret
#

i have an EH that fires on inventory openend, and i check if the container is a dead man unit, if so i want to close the inv.
closeDialog 602 didnt work, any suggestions?

finite jackal
spark turret
#

as a return value in the eventhandler?

winter rose
#

yes

spark turret
#

thats a new one in arma. ill try that

#

any other EH use that?

winter rose
#

yes

#

๐Ÿ˜

spark turret
#

coolio it works now

finite jackal
#

Inb4 Lou says to look at the wiki

tidal ferry
#

Anyone know how to go about getting the pos of a playable unit in multiplayer, before it's initialized? As in, the position of exactly where it was placed in the 3den editor

#

Looking to make a script where players who are loading in have a choice of either spawning in at their unit's default location on base, or spawning at other locations elsewhere on the map

winter rose
tidal ferry
#

But I mean, before it's initialized on first spawn

#

So like, player's just loaded in, gone through role screen, and is at the first respawn screen to load in at the 3den placed pos or somewhere else

winter rose
#

grab it as soon as the unit is created?

tidal ferry
#

Potentially before the unit is created, like grabbing the data on where the unit was placed in 3den

winter rose
tidal ferry
#

Yeah, but the trick is the position- I'm looking to make a script that can get that position locally, on each player client, so that every playable unit has a respawn unique to that unit on the exact position it was placed in the editor

#

I just don't know how to get the position, or if it's possible

worthy willow
#

You can access the SQM by adding to your description.ext (Credit: KillzoneKid)

class MissionSQM
{
    #include "mission.sqm"
};
#

So you can find all units pos

#

You have to do conversions

#

as they are stored in a different format

tidal ferry
#

Hmmm, okay, sweet

#

Will it break if the missionSQM happens to be binarized?

worthy willow
#

Don't know

tidal ferry
#

Sounds good, I'll do some testing

tidal ferry
#

Darn

hushed tendon
#

Anyway to remove the players ability to move but allow them to use the map and scroll wheel options while then being able to give them back control?

worthy willow
#

KeyDown eventhandler

#

returning true will override key press

hushed tendon
#

I'm not sure I understand.

#

Actually nvm

#

I'm just dumb

tough abyss
#

hmmm would sqf while{goggles _x != "G_Respirator_white_F";} forEach units group player; do { _x setdamage (damage _x + 0.05);} forEach units group player; sleep 1;

work or am i messing up my magic variable placment again

tidal ferry
#

Hey, any way to get the variable name of a certain object? E.g. if I want to get the variable name of the local player's unit

still forum
tidal ferry
#

Forget the command for that

#

Sick, thanks!

tough abyss
#

@still forum since you here can you havce a look at that code i just wrote

#

sorry to bother

still forum
#

I already left

#

I only join for a few seconds to read things, and then move on

#

Eh I mean..
You've reached Dedmens mailbox, please leave your message after the beep. beeeep

tough abyss
#

k sorry man have a good one

tidal ferry
#

Alright, more dumb questions ๐Ÿ˜‚ Trying to figure out what the best way would be to have the function search through the mission.sqm to find the entry for the local player's unit, so that it can pull the pos from that entry

#

What would be the best way to go about searching through a mission.sqm's mission entry for that entity?

#

That reaction doesn't give me a warm fuzzy feeling meowsweats

tidal ferry
#

No clue where to even start, but I'm looking into using select to search config in missionNameSpace, then description.ext, then the missionSQM class and all the way down the tree to entities

#

Just need to figure out how it's structured, any tips would be welcome ๐Ÿ˜‚

hushed tendon
#

To be fully honest I have no clue how to implement a keydown event handler to keep the player from moving. Anyone mind give me some tips?

tidal ferry
#

Okay, what's the function to pull a variable from a config entry? getVariable right?

#

getMissionConfigValue ("MissionSQM" >> "Mission" >> "Entities" >> "Item0" >> "Entities" >> "Item0" >> "Attributes" >> "name");

#

Anyone know what's wrong with my syntax?

tidal ferry
#

I already am, can't figure out what I'm getting wrong

#

Syntax-wise I mean

still forum
#

Read the examples?

#

about everything is wrong

#

>> doesn't take string
getMissionConfigValue doesn't take config

#

thats not at all how that command works

#

See wiki

tidal ferry
#

Okay, so then it'd look more like getMissionConfigValue ("MissionSQM >> Mission >> Entities[etc]")?

#

Or would I be using /'s?

willow hound
#

What are you even trying to do?

still forum
#

Where on tha wiki page does it say anything about "MissionSQM" or using getMissionConfigValue with >>

#

Cuz I don't see it

#

The command takes a string.

tidal ferry
#

No, okay, so from earlier, someone gave me some code that adds the mission.sqm into the description.ext as a class

still forum
#

And as I said >> still doesn't take a string on the left side

tidal ferry
#

I know it takes a string

#

But I don't know how that string needs to be formatted

winter rose
still forum
#

That command is useless for what you're trying to do

#

Would help if people wouldn't only credit a name (and the wrong name at that) but instead link the source so that people can read up on it by themselves.

tidal ferry
#

Thank you, reading through now

#

Hallelujah, finally got it

tough abyss
#

Stupid question from a noob. Is there a mod/way to add triggers(F3 in editor) to zeus? I want to add repair/healing areas on a dedicated vps playing Overthrow Plus. I can get it working in the editor but can't figure out how to recreate it in our current game. I've thought about how I could do it manually in the .pbo(private group -- no key check) but I feel like I'm over complicating this. I'd appreciate any guidance to get me back on track.

spark turret
#

you can edit missions while having their savefiles intact

#

ive done it with liberation

#

no idea how savefiles work tho

willow hound
#

Is Event Handler code (re-) compiled every time the EH fires?

past wagon
#
//PLAYER SPAWN RANDOMIZATION
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 1") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 2") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 3") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 4") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 5") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 6") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 7") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 8") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 9") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
};
player setPos selectRandom _spawnLocations;
#

I am getting an error on line 2: missing ;

#

where do I put the ; ?

slim oyster
#

can't have empty elements in your arrays

#

you can also use a switch statement instead of the call return

past wagon
#

yea im not done putting in the values

#

but why does it say there is a missing ; on line 2? will that be fixed when I finish putting in the values?

slim oyster
#

yes

past wagon
#

okay, thanks

slim oyster
#
private _spawnLocations = switch (roleDescription player) do {
    case "Player 0": {
        [[0, 0, 0], [100, 100, 0]]
    };
    case "Player 1": {
        [[10, 10, 0], [110, 110, 0]]
    };
    default {
        [[0, 0, 0], [100, 100, 0]]
    };
};
player setPosATL selectRandom _spawnLocations;
past wagon
#

is that more efficient than the current script i have?

worthy willow
#

You could use the new HashMap data type

#

๐Ÿ™‚

slim oyster
#

blobcloseenjoy true

worthy willow
#

And yes a Call is faster that a Switch but you are calling roleDescription a lot so the performance gain is probably canceled out.

spark turret
#

i really dont believe that a call is faster in the end. its stated sometimes but it makes zero sense for a compiler to have abstraction be slower.

little raptor
little raptor
little raptor
#

remove the EH to restore the ability to move

little raptor
little raptor
#

call simply executes the code ( {} )

#

for a compiler
meowsweats

#

sqf is never compiled to machine code or something
it is interpreted I believe

past wagon
#

does initPlayerLocal.sqf execute when a player connects to the server or selects a role and joins the mission?

willow hound
#

The latter

tough abyss
#

little help plz sqf while {{goggles _x != "G_Respirator_white_F"} forEach units group player;} do { {_x setdamage (damage _x + 0.1)} forEach units group player }; sleep 10;

#

this is killing the player outright when it triggers instead of damaging over time

little raptor
tough abyss
#
while {{goggles _x != "G_Respirator_white_F"} forEach units group player;}
     do {
        {_x setdamage (damage _x + 0.1)} forEach units group player; sleep 10;
        };```
#

better

little raptor
#

no

#

it's wrong

willow hound
#

That condition looks to me like only the last element of units group player actually has an impact.

little raptor
#

yes

#

it damages everyone if the last guy doesn't have a respirator!

tough abyss
#

well it damages the unit so thats a win considiering i cam up with this code off the top of my head at 4am

#

yeah im stumped a little help on how to get it to only damage the one not wearing the mask

little raptor
#

the loop goes on forever, so if someone takes their mask off later they'll take damage

tough abyss
#

still i was pretty close considering my rather lacking scripting knowledge

glass bridge
#

do you wish to trigger this in a specific area only? Asking as a HAZMAT professional and if a trigger will be used in combination with this.

north plaza
#

hi im trying to get the classnames of some vehicle weapons to use with the addweaponturret command

tough abyss
#

@glass bridge im hoping to use it interchangably in triggers and for entire map

#

probs have to modify for triggers

north plaza
#

and no i cant use the arma wiki because they are from a mod

little raptor
#

I think vehicle weapons are of type 65536
but I don't think you can modify those

#
("getNumber (_x >> 'scope') >= 1 && {getNumber (_x >> 'type') == 65536}" configClasses (configFile >> "CfgWeapons")) apply {configName _x}
#

gives you all weapons defined in the config and of type 65536

past wagon
#
//PLAYER SPAWN RANDOMIZATION
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[12294, 19176, 500], [15415, 22406, 500], [3203, 20058, 500], [10218, 17779, 500], [4071, 20452, 500], [11914, 21564, 500], [4587, 22501, 500], [4207, 17277, 500], [9634, 18172, 500], [3081, 19081, 500]]; };
if (roleDescription player == "Player 1") exitWith {[[4587, 19665, 500], [8522, 19217, 500], [11941, 22596, 500], [6649, 22229, 500], [3990, 21117, 500], [14601, 23179, 500], [6310, 17372, 500], [5102, 20262, 500], [16554, 21863, 500], [7111, 17738, 500]]; };
if (roleDescription player == "Player 2") exitWith {[[7993, 22772, 500], [7002, 19597, 500], [3230, 21008, 500], [7328, 21442, 500], [11018, 17901, 500], [9227, 19692, 500], [6201, 19000, 500], [9974, 21632, 500], [4777, 21374, 500], [8603, 21809, 500]]; };
if (roleDescription player == "Player 3") exitWith {[[7572, 22080, 500], [6595, 20696, 500], [8481, 18457, 500], [11643, 20506, 500], [10353, 21035, 500], [, , 500], [4424, 18606, 500], [6215, 20262, 500], [14424, 20628, 500], [14343, 22283, 500]]; };
if (roleDescription player == "Player 4") exitWith {[[7450, 18715, 500], [5632, 20750, 500], [5591, 18661, 500], [8780, 20397, 500], [9458, 17317, 500], [10109, 19923, 500], [5102, 17969, 500], [12999, 21184, 500], [15089, 21686, 500], [12823, 22392, 500]]; };
#
if (roleDescription player == "Player 5") exitWith {[[6215, 21836, 500], [5998, 19461, 500], [10109, 20547, 500], [15835, 21320, 500], [2972, 21741, 500], [5442, 19855, 500], [8698, 23464, 500], [8291, 20886, 500], [7680, 19258, 500], [12131, 19828, 500]]; };
if (roleDescription player == "Player 6") exitWith {[[5496, 22121, 500], [13596, 22134, 500], [3990, 17982, 500], [9051, 21252, 500], [10245, 19149, 500], [6649, 21347, 500], [6717, 18552, 500], [12606, 20560, 500], [4763, 21904, 500], [8183, 17331, 500]]; };
if (roleDescription player == "Player 7") exitWith {[[3433, 18647, 500], [7911, 20180, 500], [8033, 21564, 500], [12524, 21564, 500], [14044, 19963, 500], [3963, 19543, 500], [11290, 19583, 500], [11168, 21917, 500], [10638, 18620, 500], [3976, 22053, 500]]; };
if (roleDescription player == "Player 8") exitWith {[[13569, 22867, 500], [8793, 17819, 500], [13637, 20615, 500], [5116, 19217, 500], [11208, 21239, 500], [14994, 20913, 500], [7287, 20615, 500], [9567, 22229, 500], [16093, 22039, 500], [5265, 17290, 500]]; };
if (roleDescription player == "Player 9") exitWith {[[9485, 20574, 500], [4641, 20723, 500], [8712, 22772, 500], [9349, 18796, 500], [10856, 20262, 500], [5971, 21171, 500], [7599, 18091, 500], [14112, 21429, 500], [5944, 18091, 500], [11358, 18593, 500]]; };
};
player setPos selectRandom _spawnLocations;
#

this script is not working and i dont know why

#

not even giving me an error message

little raptor
slim oyster
#

@past wagon you have an array with empty elements still

past wagon
#

its in the initPlayerLocal.sqf file

#

wait which array has empty elements

slim oyster
#

player 3

little raptor
#

[, , 500]

past wagon
#

FUCK

#

lol

#

lemme fix that

slim oyster
#

get a linter

noble heart
#

ik this is a basic script but can sombody make me a jet deletion script its name is jet1 and everything i look at dosent make any sense to me cause i dont know shit about coding

noble heart
#

so like once it reaches a trigger it deletes the jet for extra cpu space

#

so i can put more ai if need be

cosmic lichen
#

You can do that inside the waypoint

little raptor
#

CPU space
?! notlikemeow
anyway, you can define an area and use deleteVehicle if the jet runs outside the area

cosmic lichen
#

deleteVehicle <someWPVariableThatIDontRemember>

noble heart
#

so just deleteVehicle jet1?

north plaza
#

im talking about about the classnames like they use in addweaponurret like as an example to add a 6.5mm rcws turret for the driver you would put "this addweaponturret ["lmg_rcws",[-1]]; its the lmg rcws part that im looking for

cosmic lichen
noble heart
#

mk

little raptor
slim oyster
#

waypoint magic var would return the pilot so

#
deleteVehicle vehicle this

in your waypoint onAct

noble heart
#

just that?

glass bridge
#

@tough abyss I'm working on a solution, just give me a moment :)

north plaza
#

do i put that in the init field of the vehicle or the .sqf of the mission

little raptor
slim oyster
#

oh heh, you'd probably also want to delete the pilot blobcloseenjoy

cosmic lichen
#

yes

glass bridge
#

Does spawn work with sleep?

cosmic lichen
#
deleteVehicle vehicle this;
crew vehicle this apply {deleteVehicle _x};
noble heart
slim oyster
#

deleteVehicleCrew?

cosmic lichen
#

is there a command ? ๐Ÿ˜ฎ

#

yeah, right. I used that one before meowfacepalm

#

wait, deleteVehicleCrew can also only delete one crew member at a time. So not so useful afterall

little raptor
little raptor
cosmic lichen
#

Yeah, why not

slim oyster
#

wow no apply

cosmic lichen
#

unused _foreachIndex ๐Ÿ”ฅ

little raptor
slim oyster
#

for "i"

noble heart
#

none of those worked

#

i put them in exactally as stated

cosmic lichen
#

but tbh, isn't it weird deleteVehicleCrew has no alt syntax to just get rid of the entire crew of a vehicle?

slim oyster
#

quite strange

cosmic lichen
noble heart
#

then what am i doing wrong

slim oyster
#

It's probably the waypoint field

noble heart
#

im putting it in as {deleteVehicle _x} forEach ([vehicle this] + crew vehicle this);
under act and it dosent wanna work

cosmic lichen
cosmic lichen
noble heart
cosmic lichen
#

Increase the completion radius under "Transformation" to 50m for testing

slim oyster
#

it's a jet so can probably leave it large

noble heart
#

i dont see anything called completion radius

#

are you talking about the size?

slim oyster
#

are you using a waypoint or a trigger?

noble heart
#

cause its 250 by 250 by -1

cosmic lichen
noble heart
slim oyster
#

ah okay

cosmic lichen
#

....

#

wth

slim oyster
#

haha

noble heart
slim oyster
#

well you can use a trigger as well

#

just a different magic variable

little raptor
#
_area = [_pos1, _pos2, _pos3, _pos4]; //define a polygon
while {true} do {
{
  if (!isPlayer _x && {!(_x inPolygon _area)}) then {
    {deleteVehicle _x} forEach ([vehicle _x ] + crew vehicle _x );
  };
} forEach allUnits;
sleep 10;
}

meowtrash

slim oyster
#

I think in your case best to use a waypoint though

noble heart
#

all i see under transformation is position rotation size

little raptor
#

you have to use it in the right place

noble heart
#

heh

little raptor
#

plus you need to define _pos1, etc.

#

to make a polygon

noble heart
#

wat

#

my brain is melting slowly

little raptor
noble heart
#

that still dosent make sense to me

little raptor
#

each position is a 3D array

#
[x, y, z]
#

only x and y matter

little raptor
slim oyster
#

you could have used just ! inArea with an invisible marker

#

regardless

#

a move waypoint with that onAct would work fine

little raptor
#

example

_pos1 = [1000,2000,0];
_pos2 = [-1000,2000,0];
_pos3 = [-1000,-2000,0];
_pos4 = [1000,2000,0];
_area = [_pos1, _pos2, _pos3, _pos4];
little raptor
noble heart
#

like i said i know nothing about coding/scripting

little raptor
#

or an empty trigger

triggerArea someTrigger
noble heart
#

none of this makes sense i just want a script that i can put into said trigger that deletes the jet that is named jet1

little raptor
cosmic lichen
#

I just went a way for making a ticket and now I see you are drawing polygons. Waypoint isn't fancy enough anymore ? ๐Ÿ˜„

noble heart
#

then how do i even do it

slim oyster
#

I dont think the waypoint was ever utilized

cosmic lichen
#

xD

slim oyster
#

its a tab on the eden editor

cosmic lichen
#

You know what Eden Editor is missing? Away to export unit layout and attributes, to share with others so we can quickly exchange a setup with beginners

slim oyster
#

Hmm yes it's almost like it needs some sort of extension

noble heart
#

wait do i have to have the trigger and waypoint synced or something

cosmic lichen
#

Well it needs to be vanilla so new comers can easily access it

little raptor
#

@noble heart does your jet even have a waypoint?

#

is it just one jet?

#

do you want to delete more units?

noble heart
#

one jet and it has a waypoint to said trigger

slim oyster
#

then in the onActivation field of the waypoint put the aforementioned script

#

now you got me messed up haha

noble heart
#

which one there are like 50 now

cosmic lichen
#

oh btw

#

we should really use deleteVehicleCrew

little raptor
#

I think this is referring to the group tho

cosmic lichen
#

there is some weirdness going on if crew is deleted via deleteVehicle

slim oyster
#

yes

#

no, it refers to group leader

cosmic lichen
#

group leader = pilot

little raptor
slim oyster
#

yup

little raptor
noble heart
cosmic lichen
#

man

#

it works

#

I literally copyied it out of the editor

noble heart
#

it doesent

little raptor
noble heart
past wagon
#

For my mission i need the contents of storage crates to be random. I want half of the crates to be equipment crates (with random equipment) and the other half to be weapon crates (with random weapons). The problem is that I want both of these types of crates to be the same mission object. How can I make it so that it only adds weapons to half of the crates and adds equipment to the other half?

little raptor
noble heart
#

its not

little raptor
#

what is your waypoint type?

noble heart
#

move

slim oyster
#

did you set the waypoint completion radius?

noble heart
past wagon
#

these are the scripts I currently have:

//WEAPON CRATE CONTENTS RANDOMIZATION
private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];

_crates = allMissionObjects "Box_EAF_Wps_F";

{
_weapon_and_mag = selectRandom _weaponArray;

_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;

_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 3];
} forEach _crates;
#
//EQUIPMENT CRATE CONTENTS RANDOMIZATION
private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];

_crates = allMissionObjects "Box_EAF_Equip_F";

{
_item = selectRandom _itemArray;

if isClass (configFile >> "cfgVehicles" >> _item) then
  {
_x addBackpackCargoGlobal [_item, 1];
  }
else
    {

_x addItemCargoGlobal [_item, 1];
    }

} forEach _crates;
cosmic lichen
#

just check out the setup

little raptor
past wagon
#

the way it currently works is that there are separate mission objects for the respective types of crates, but i want to have the same crate types everywhere.

noble heart
cosmic lichen
noble heart
cosmic lichen
#

Upload it to imgur or so

noble heart
cosmic lichen
#

Looks fine ๐Ÿคทโ€โ™€๏ธ

noble heart
#

and the jet has a variable name its jet1 if that means anything

cosmic lichen
#

nope

#

doesn't matter

noble heart
#

AAAAAAA

cosmic lichen
#

B?

little raptor
#

@noble heart also the waypoint must not be offmap

past wagon
#
//WEAPON CRATE CONTENTS RANDOMIZATION
private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];

_crates = allMissionObjects "Box_EAF_Wps_F";

{
_weapon_and_mag = selectRandom _weaponArray;

_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;

_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 3];
} forEach _crates;

//EQUIPMENT CRATE CONTENTS RANDOMIZATION
private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];

_crates = allMissionObjects "Box_EAF_Equip_F";

{
_item = selectRandom _itemArray;

if isClass (configFile >> "cfgVehicles" >> _item) then
  {
_x addBackpackCargoGlobal [_item, 1];
  }
else
    {

_x addItemCargoGlobal [_item, 1];
    }

} forEach _crates;

I would like to get it so that I can have 50% of crates contain weapons and 50% of crates contain equipment, but I want them to be the same type of crate/mission object.

noble heart
past wagon
#

for each crate, could I make it flip a coin, and if it comes up as equipment, it adds random items from the equipment array, and if it comes up as weapons, it adds random weapons from the weapon array?

cosmic lichen
#

@past wagon You have all the crates in the _crates variable

#

so just count them

past wagon
#

yea

cosmic lichen
#

divide by 2 (integer only 0,1,2,3,4,5,6..)

#

and fill half of them with weapons, other half with other stuff

past wagon
#

well yeah but wouldnt it be easier to just have each crate have a 50% chance of being either?

little raptor
#

I don't understand
you want each crate to be half filled with weapon and half filled with ammo?

past wagon
#

no

little raptor
#

or half of the crates to be weapons and the other ammo?

cosmic lichen
#

if (random 1 > 0.5) then {

past wagon
#

i want each crate to either contain weapons + ammo or equipment.

cosmic lichen
#

but that could make you end up with 100% weapons

past wagon
#

i know but there are a fuck ton of crates so odds are that wont happen

#

I want each crate to have a 50% chance of having weapons added to it, and a 50% chance of having equipment added

cosmic lichen
#

Odds were bad for that guy who won 700 million in the lottery, but still

noble heart
#

use arsenal and blacklist some stuff

past wagon
#

well if the luck comes out that way then it isnt the end of the world

noble heart
#

itl take time but better than rng

past wagon
#

no i am making a battle royale game

noble heart
#

either that or select items

#

ah

past wagon
#

so its gotta be rng

cosmic lichen
#

_rng = random 1

if (_rnd <= .33) then {weapons}
if (_rnd > 0.33 && < 0.66) then {equipment}
if (_rnd >= 0.66) then {mags}

#

or you do
_rng = selectRandom [0, 1, 2];

tough abyss
#

okay is call BIN_fnc_CBRNHoseInit a contact only function cause it aint working son

cosmic lichen
#

It's not contact only

austere seal
#

how did everyone begin to learn/understand arma coding? little to no prior experience in scripting or coding. did you just trial and error? or is there a website for basics?

cosmic lichen
glass bridge
tough abyss
#

pain apain and hours of trying code combinations till it sticks

little raptor
#

@past wagon a really simple (but unoptimized solution) is this:

_crates = allMissionObjects "Box_EAF_Wps_F";
_cratesWithWpn = [];
for "_i" from 1 to count _crates /2 do {
_rand = selectRandom _crates;
_cratesWithWpn  pushBack _rand;
_crates = _crates - [_rand];
};
_cratesWithItems = _crates;
cosmic lichen
little raptor
#

now use each for what you want

tough abyss
#

seriously tho that function isnt working for me to link the gas mask to the pack

glass bridge
#

@tough abyss

params["_thisTrg", ["_goggles", ["G_Respirator_white_F"]], ["_eVehicles", []], ["_addTime", 10], ["_addDamage", 0.1]];

while {true} do {
  {
    if (_x isKindOf "CAManBase" && !(goggles _x in _goggles)) then {
      _x setdamage (damage _x + _addDamage);
    };
    if (_x isKindOf "LandVehicle" && !(_x in _eVehicles)) then
    {
        {
            if !(goggles _x in _goggles) then 
            {
                _x setDamage (damage _x + _addDamage);
            };
        }forEach crew _x;
    };
  } forEach list _thisTrg;
  sleep _addTime;
};```

Le script. Save it as sqf and execVM it in the on activation filed. Activation "Anybody" Type "Present".
#

how do i get the syntax highlights working?

little raptor
#

```sqf

#

see the pinned messages

austere seal
#

@cosmic lichen thank you

glass bridge
#

@tough abyss You can give it all the goggles you want that should work, excepted Vehicles (CBRN resistant ones you can define as you like), the time inverval and the damage that should be added each interval

#
[thisTrigger, ["G_AirPurifyingRespirator_02_black_F", "G_Respirator_white_F"], [cbrnTruck1, cbrnTruck2]] execVM "poisonScript.sqf";
cosmic lichen
#

if (_x isKindOf "Man" &&
Change that to "CAManBase" please

past wagon
#
_crates = allMissionObjects "Box_EAF_Wps_F";

private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];

private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];

_weapon_and_mag = selectRandom _weaponArray;
_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;

_item = selectRandom _itemArray;

if (_rnd <= .5) then {
_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 2];
} forEach _crates;

if (_rnd >= .5) then {
if isClass (configFile >> "cfgVehicles" >> _item) then
  {
_x addBackpackCargoGlobal [_item, 1];
  }
else
    {

_x addItemCargoGlobal [_item, 1];
    }

} forEach _crates;
tough abyss
#

yup okay sqf [unit] call BIN_fnc_CBRNHoseInit; isnt working for me

past wagon
#

i highly doubt that will work but is it a start? @little raptor

tough abyss
#

ah screw it i dont need to hose link to work gasmask is fin by its self

past wagon
#

yeah but i wanna use code that im somewhat familiar with

little raptor
#

it won't produce the result you want

past wagon
#

i dont at all understand the code you wrote

cosmic lichen
#

@glass bridge if (_x isKindOf "Man" &&
Change that to "CAManBase" please

#

otherwise it will trigger for snakes and stuff as well

glass bridge
cosmic lichen
#

Animals inherit from Man as well

#

and you don't wanna put a gas mask on a snake or goat

glass bridge
#

that's true :D

slim oyster
#

really makes you think

little raptor
cosmic lichen
past wagon
#

okay

#

why do you abreviate "Weapon" to "Wpn"?

#

that just confused me lol

little raptor
#

shorter variable names = faster

cosmic lichen
#

oh god ๐Ÿ˜„

#

Reminds me of that dude

#

_f =
_d =

#

uz6=

little raptor
#

notlikemeow not that short

cosmic lichen
#

scripts with 50 variables named like this

slim oyster
#

upsmon

cosmic lichen
#

Was fun reading it...not

past wagon
little raptor
#

very little

cosmic lichen
little raptor
#

but at least easier to type!

past wagon
#

ima just call it "Weapon" so i dont get confused

#

what does _cratesWithWpn pushBack _rand; do?

little raptor
#
_crates = allMissionObjects "Box_EAF_Wps_F";
_cratesWithWeapons = [];
for "_i" from 1 to count _crates /2 do {
  _rand = selectRandom _crates;
  _cratesWithWeapons pushBack _rand;
  _crates = _crates - [_rand];
};

{
 ...
} forEach _cratesWithWeapons;

_cratesWithItems = _crates;
{
 ...
} forEach _cratesWithItems;

of course you didn't need to create a separate array for _cratesWithWeapons (you could just do it in the for loop)
but if that confuses you too...notlikemeow

little raptor
past wagon
#

what is _rand? is it half of all _crates?

little raptor
#

a single random crate

past wagon
#

okay

#

so does that mean that there will only be one crate that isnt a weapon crate?

little raptor
#

it does that in a loop meowsweats

#

for "_i" from 1 to count _crates /2 do {

past wagon
#

how many times?

#

ohhhhhh

#

its how many crates there are divided by two

#

okay

#

_cratesWithWeapons = []; what does this line of code do?

little raptor
#

creates an empty array

past wagon
#

am I supposed to put stuff in that array?

little raptor
#

it gets filled meowsweats

#

_cratesWithWeapons pushBack _rand;

past wagon
#

oh

#

wait so where do I put in my array?

#

@little raptor

little raptor
past wagon
#

ok

little raptor
#
_crates = allMissionObjects "Box_EAF_Wps_F";

_cratesWithWeapons = [];
for "_i" from 1 to count _crates /2 do {
  _rand = selectRandom _crates;
  _cratesWithWeapons pushBack _rand;
  _crates = _crates - [_rand];
};
_cratesWithItems = _crates;

private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];

private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
{
  _weapon_and_mag = selectRandom _weaponArray;
  _weapon = _weapon_and_mag select 0;
  _mag = _weapon_and_mag select 1;
  _x addWeaponCargoGlobal [_weapon, 1];
  _x addMagazineCargoGlobal [_mag, 2];
} forEach _cratesWithWeapons;


{
  _item = selectRandom _itemArray;
  if isClass (configFile >> "cfgVehicles" >> _item) then
  {
    _x addBackpackCargoGlobal [_item, 1];
  }
  else
  {
    _x addItemCargoGlobal [_item, 1];
  }
} forEach _cratesWithItems;
#

that's your whole script

past wagon
#
private _weaponArray = [["", ""]];

private _itemArray = [""];

_crates = allMissionObjects "Box_EAF_Wps_F";
_cratesWithWeapons = [];
for "_i" from 1 to count _crates /2 do {
  _rand = selectRandom _crates;
  _cratesWithWeapons pushBack _rand;
  _crates = _crates - [_rand];
};

{
 ...
} forEach _cratesWithWeapons;

_cratesWithItems = _crates;
{
 ...
} forEach _cratesWithItems;
#

and where do I put the code that actually adds the weapons into the crates? just at the end?

little raptor
#

that's your whole script

past wagon
#

oh

#

ok

little raptor
#

just use what I posted above

past wagon
#

thanks

#

but just out of curiosity, can you tell me what would have gone wrong with this script?

_crates = allMissionObjects "Box_EAF_Wps_F";

private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];

private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];

_weapon_and_mag = selectRandom _weaponArray;
_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;

_item = selectRandom _itemArray;

if (_rnd <= .5) then {
_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 2];
} forEach _crates;

if (_rnd >= .5) then {
if isClass (configFile >> "cfgVehicles" >> _item) then
  {
_x addBackpackCargoGlobal [_item, 1];
  }
else
    {

_x addItemCargoGlobal [_item, 1];
    }

} forEach _crates;
little raptor
#

everything meowsweats

#

your foreach doesn't run on anything

past wagon
#

well

little raptor
#

misses {

past wagon
#

ok

little raptor
#

@past wagon and if not that, since you're selecting a random number your crates wouldn't necessarily be divided in 2

past wagon
#

oh

#

yeah thats fine

little raptor
#

you could even end up having all crates with either items or wpns

past wagon
#

that would be astronomically unlikely

#

there are hundreds of crates

#

it would be pretty even

little raptor
past wagon
#

yeah but thats not even a problem

little raptor
#

something like 70% 30% was absolutely likely

past wagon
#

not with hundreds of crates

#

it might be off by a couple

#

randomness is good

#

its for a battle royale

little raptor
#

do you even know probability?

past wagon
#

yes

#

if there are 200 crates, then there would be a 50% chance for it to be off by 1 crate, a 25% chance for it to be off by 2, and a 12.5% chance to be off by 3

#

well regardless of the amount of crates

#

but it would almost always be within 97 - 103 crates of one type

#

at least I think thats how probability works

#

idk

crimson walrus
#

You could put it in a loop, run a bunch of trials, and see what happens.

past wagon
#

yea

little raptor
#

@past wagon ```sqf
_a = [];
for "_i" from 1 to 100 do {
if (random 1 >= 0.5) then {_a pushBack _i};
};
count _a

may give you as low as 27-30
#

an even better test:

_b = [];
for "_j" from 1 to 1000 do {
  _a = [];
  for "_i" from 1 to 100 do {
    if (random 1 >= 0.5) then {_a pushBack _i};
  };
  _b pushBack count _a
};
_b sort true;
_b#0
#

gives you the minimum after 1000 tests

past wagon
#
_crates = allMissionObjects "Box_EAF_Wps_F";

_cratesWithWeapons = [];
for "_i" from 1 to count _crates /2 do {
  _rand = selectRandom _crates;
  _cratesWithWeapons pushBack _rand;
  _crates = _crates - [_rand];
};
_cratesWithItems = _crates;

private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];

private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
{
  _weapon_and_mag = selectRandom _weaponArray;
  _weapon = _weapon_and_mag select 0;
  _mag = _weapon_and_mag select 1;
  _item = selectRandom _itemArray;
  _x addWeaponCargoGlobal [_weapon, 1];
  _x addMagazineCargoGlobal [_mag, 2];
  _x addItemCargoGlobal [_item, 1]
} forEach _cratesWithWeapons;

{
  _item = selectRandom _itemArray;
  if isClass (configFile >> "cfgVehicles" >> _item) then
  {
    _x addBackpackCargoGlobal [_item, 1];
  }
  else
  {
    _x addItemCargoGlobal [_item, 1];
  };

{
  _item = selectRandom _itemArray;
  if isClass (configFile >> "cfgVehicles" >> _item) then
  {
    _x addBackpackCargoGlobal [_item, 1];
  }
  else
  {
    _x addItemCargoGlobal [_item, 1];
  };

} forEach _cratesWithItems;
#

@little raptor would the repeated code at the bottom add multiple random items to the item crates?

little raptor
#

it's wrong

#

misses ;

#

one extra {

#

plus it only adds two random items

#

(if it was corrected, that is)

past wagon
#

ok

#

wait where is it missing the ;?

little raptor
#

if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
} ; <- here

past wagon
#

ok

#

do I also need one on the line below _x addBackPackCargoGlobal [_item, 1];

past wagon
#

oh

#

ok

little raptor
#

it's not needed there because of the else

#

if () then {} else {};

past wagon
#

oh yea

#

ok

little raptor
#

and you didn't remove the extra {

past wagon
#

got it

noble tiger
#

question for you guys, trying to add { #include "RifleTargets\cfgfunctions.hpp"};
to an existing class CfgFunctions, however when i do add it, i get an error code saying something to the effect of encountered "}" instead of "=" Any ideas?

dreamy kestrel
#

Q: is there a call stack?

tough abyss
#

how to check if player is not in a trigger

#

is it sqf player != in list 'trigger'

hollow thistle
#
!(player in list triggerVariable)
tough abyss
#

can i get some help with this sqf if !(player in list shelter1 or shelter2); then { _x setdamage (damage _x + 0.1); } forEach units player;

little raptor
#

you can call a recursive code virtually infinitely

little raptor
tough abyss
#

@little raptor can you show me what you mean by two ins

little raptor
#
!(player in list shelter1) && !(player in list shelter2)
#

or

!(player in list shelter1 || player in list shelter2)
tough abyss
#

second 1 is the one

little raptor
#

both do the same thing

tough abyss
#

&& only return true if both conditions are met

#

right

little raptor
#

yes

tough abyss
#

the player can only be in one of the triggers

little raptor
#

not if they overlap

tough abyss
#

they dont

little raptor
#

plus that's not the same thing

#

it means player is in neither trigger

#

I simply corrected what you were doing blobdoggoshruggoogly
!(player in list shelter1 or shelter2)

tough abyss
#

no i want it to kill the player if there not in one of the shelters

fresh wyvern
#

Anyone who knows how to remove the minigun magazines from the Ghost Hawk? and/or how to add an other turret type to the helicopter?

_veh = "B_CTRG_Heli_Transport_01_tropic_F"createVehicle (player modelToWorld [8,0,0]);  
_veh setUnloadInCombat [true, false];

_veh removeMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Green", [0]];
_veh removeMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Green", [0]];

_veh addMagazineTurret ["2000Rnd_20mm_shells", [2]];
_veh addWeaponTurret ["gatling_20mm", [2]];

_veh addMagazineTurret ["2000Rnd_20mm_shells", [0]];
_veh addWeaponTurret ["gatling_20mm", [0]];

_dirP = getDir player;
_veh setDir _dirP 
tough abyss
#

but wont && kill the player even if he is in one of the shelters

little raptor
#

well it was correct in the first place

tough abyss
#

thanks it works i think i get it now

hushed tendon
# little raptor use `animStateChanged` instead ```sqf _unit addEventHandler ["AnimStateChanged",...

_unit gives off an error, its a MP mission. I have it running in

//initServer.sqf
//All inside if (isServer) then { ...
while {readyActive} do {
  {
    if (isPlayer _x && playerSide == west) then {
      westPlayers = west countSide playableUnits;
      _unit addEventHandler ["AnimStateChanged", {
        params ["_unit", "_anim"];
        if (_anim select [0,4] != "amov" || _anim select [9,3] != "stp") then {
          _unit playMoveNow format ["amovp%1mstpsrasw%2dnon", _anim select [5,3], _anim select [17,3]];
        };
      }];
    };
  } forEach (playableUnits);
};

Would player work instead of _unit if in a remoteExec?

tough abyss
#

finaly got my emissions script done and my gas mask script

drifting sky
#

New Question. (A2OA)... I have ai units that sometimes go prone and then sit there forever. I can detect these situations. But I don't know how to unstick them. Is there a foolproof way? Perhaps a way to reset the ai for that unit entirely?

tough abyss
#
 unit setCombatMode "GREEN";```
hushed tendon
#

Sounds about right

little raptor
drifting sky
#

should i try both those things?

little raptor
#

๐Ÿคท

hushed tendon
#

I honestly think resetting the group should do it but it wouldn't hurt to try both methods separate and together.

tough abyss
#

she may be rough ```sqf
while {alive player} do
{
sleep (selectRandom [5,10,15]);
b1 sideChat "ALL forces be advised, emission detected! Seek shelter immediately!";
sleep 1;
[1] spawn BIS_fnc_earthquake;
sleep 30;
b1 sideChat "Emission will hit in thirty seconds!";
sleep 1;
[2] spawn BIS_fnc_earthquake;
sleep 15;
b1 sideChat "Emission in fifteen seconds!";
sleep 1;
[3] spawn BIS_fnc_earthquake;
sleep 10;
b1 sideChat "FIVE SECONDS! GOD HELP YOU IF YOU ARNT INSIDE YET!";
sleep 1;
[4] spawn BIS_fnc_earthquake;
b1 sideChat " EMISSION INCOMING";
sleep 3;
[4] spawn BIS_fnc_earthquake;
shelter = execVM "shelter.sqf";
[4] spawn BIS_fnc_earthquake;
shelter = execVM "shelter.sqf";
sleep 10;
b1 sideChat "The emission has passed";

};```
im proud of my little script.

#

also is there a limit on sleep times

little raptor
hushed tendon
#

Somewhat. But I'm going to say no

little raptor
tough abyss
#

sweet

little raptor
#

you just add it once

hushed tendon
#

Oh I have to call it. Right?

little raptor
#

no

#

something like this will trigger (get called) every time the unit changes its animation

_unit addEventHandler ["AnimStateChanged", {
        params ["_unit", "_anim"];
        if (_anim select [0,4] != "amov" || _anim select [9,3] != "stp") then {
          _unit playMoveNow format ["amovp%1mstpsrasw%2dnon", _anim select [5,3], _anim select [17,3]];
        };
      }];
hushed tendon
#

ohhhh

#

And this keeps the player from changing stance?

_unit playMoveNow format ["amovp%1mstpsrasw%2dnon", _anim select [5,3], _anim select [17,3]];
little raptor
#

as for issues in your code:

  1. you're adding multiple event handlers meowsweats
  2. no sleep meowsweats
little raptor
#

in this case I'm using a stop animation

hushed tendon
#

Keeping them from moving

hushed tendon
#

However I have learned a lot while making it

leaden haven
#

I have a marker on the map that gives information on amount of players. Should I used a PlayerConnected event handler to update this every time a player connects to the server?

_num1 = worldName; _num2 = serverName; _num3 = playersNumber west; _num4 = playableSlotsNumber blufor; _markerinfo = createMarker ["Info.", [12245.8,18606.6,-3.05176e-005]]; _markerinfo setMarkerShape "ICON"; _markerinfo setMarkerColor "Default"; _markerinfo setMarkerType "lop_flag_Afghan"; _markerinfo setMarkerText format ["Map %1. Server name: %2. Players %3 of %4", _num1, _num2, _num3, _num4];

This is the code. But I am unsure on how to have it automatically update to show the correct amount of players.

little raptor
leaden haven
#

Thanks.

#

This should work.

onPlayerConnected { _num1 = worldName; _num2 = serverName; _num3 = playersNumber west; _num4 = playableSlotsNumber blufor; markerinfo setMarkerText format ["Map %1. Server name: %2. Players %3 of %4", _num1, _num2, _num3, _num4]; };

hushed tendon
leaden haven
#

I guess so , but it works. I can trim it down. It works running from eden. Should work on my server.

tough abyss
#
if (isServer) then
 {
    while {true} do 
     {
        {
            if (goggles _x != "G_AirPurifyingRespirator_01_F") then 
               {
                 _x setdamage (damage _x + 0.1);
               };
        } forEach units player;
        sleep 10;
     };
 };
else
 {
  exitWith {};
 };```

does this look right for use on a multiplayer server