#arma3_scripting

1 messages ยท Page 238 of 1

dusk sage
#

So asking if it's less than 0.5

#

Won't work

shadow sapphire
#

Haha, right, it's not working. I'm VERY ignorant of this stuff. I'm trying to get it to not open the doors and all till the chopper is on the ground, at which point, I want it to kick everyone out, then close the doors, fly back to it's origin point and delete.

dusk sage
#

So it seems you're looking for altitude

#

So you want (getPos _GreenPilots) select 2

shadow sapphire
#

What does the select 2 do?

dusk sage
#

So for example

#

if I use

#

getPos player

#

In the debug console (literally right now)

#

I get:

#

[14037.6,18751.2,0.897427]

#

Using select 2, will select the last element of that array, the z component, or altitude

#

By just asking if that array is less than 0.5, is meaning less

#

There is no scalar for it to compare to

shadow sapphire
#

Hmm... How do I find if it's less than a meter off the ground?

dusk sage
#

(getPos _GreenPilots) select 2 < 1

shadow sapphire
#

Oh... I thought that was like an incomplete thing. I must have misunderstood what you were explaining.

dusk sage
#

What do you mean by incomplete ๐Ÿ˜› ?

shadow sapphire
#

Well, if
(getPos _GreenPilots) select 2 <=.5;
doesn't work, I don't understand why
(getPos _GreenPilots) select 2 <1;
will work. I must have just been a page behind your explaination.

#

How do I make a waituntil just sleep a few seconds before continuing the script? It seems like when I do that, it just doesn't run.

dusk sage
#

I would imagine

#

Because the centre of the object is above 0.5m

#

Or just ignore that

native hemlock
#

So for this waitUntil {sleep 10; {_x in _GreenChopper} count _assigned == 0;};
In order for it to reach the code on the lines below the waitUntil must evaluate to true, if it's never true then the code below will never run. So for evaluating the waitUntil it will start by sleeping for 10 seconds, then check this condition {_x in _GreenChopper} count _assigned == 0, if that condition is true it will continue on to the code below, if it's false, then it will start over again by sleeping for 10 seconds

#

I think that {_x in _GreenChopper} count _assigned == 0 is never true

dusk sage
#

If everyone has been ejected

native hemlock
#

_assigned is never defined here

dusk sage
#

That will return true

shadow sapphire
#

@native hemlock, Haha, thanks, but I'm not that far yet. Can't get past the first waituntil yet!

dusk sage
#

Also true

#

Indeed, where is _assigned defined?

shadow sapphire
#

@native hemlock, my goal is to have an immersive respawn for a PVP game mode. All of the dead players will be respawned whenever an objective is siezed, then they will all be assigned to the chopper, which will be locked, so dummies won't jump out, then it will kick them out on the ground. I'm bad at this, so I haven't done the assigning part of the script yet, since that will require clients be on to test.

#

@dusk sage, it isn't defined yet.

native hemlock
#

Do you have -showScriptErrors on?

shadow sapphire
#

I do, yes.

dusk sage
#

Is there AI left in the chopper?

shadow sapphire
#

Just the pilot and copilot.

native hemlock
#

And nothing popped up for this? I would think you would get a complaint for trying to get the position of a group

dusk sage
#

crew _GreenChopper will return an array of objects inside the chopper

#

So using

#

(count crew _GreenChopper) isEqualTo 2

#

Would check if just the pilot and co pilot remained

shadow sapphire
#

@native hemlock, yeah, something popped up, but I couldn't understand what it was trying to get me to fix. It wasn't very clear to me like they sometimes are.

#

@dusk sage, oh! That's a good idea! I phrase it like this?

waitUntil {sleep 10; (count crew _GreenChopper) isEqualTo 2;};

dusk sage
#

yep

#

That will check whether the numer of crew is 2, and return true if it is

shadow sapphire
#

But will that exclude players riding as cargo?

native hemlock
#

waitUntil {sleep 0.5; getPOS _GreenPilots <= 0.5;}; would never be true, as _GreenPilots is a group, not an object which is what getPos requires

dusk sage
#

Should be _GreenChopper

native hemlock
#

_GreenChopper select 0

#

_GreenChopper is equal to the return of BIS_fnc_spawnVehicle

#

So to access the actual vehicle you want to select the 1st element in the array, which is at index 0

dusk sage
#

Good point

shadow sapphire
#

Phrase like this?

waitUntil {sleep 0.5; (getPos _GreenChopper select 0) select 2 <1;};

dusk sage
#
waitUntil {sleep 10; (count crew _GreenChopper) isEqualTo 0;};```
native hemlock
#

^

#

(getPos _GreenChopper select 0) would probably get the position of _GreenChopper and then select the "x" component of the position

dusk sage
#

ARMA is just weird when it comes to parenthesis

native hemlock
#

PEMDAS

dusk sage
#

Does work, doesn't work

native hemlock
#

Middle school math all over again

dusk sage
#

_this select 0 select 2

#

Works

#

It's just a bit of a mess

#

Stick 'em where it looks they are needed

native hemlock
#

I think it makes sense, but it's still easy to overlook sometimes

shadow sapphire
#

I am going to give this a try. BRB.

#

Crap. I changed something and got more errors.

#

I want the doors to stay closed until the chopper has landed.

#

I want them closed before it takes off.

#

Latest version of script:

_GreenChopper = [];

if (isServer) then {

_GreenPilots = creategroup independent;
_GreenChopper = [getMarkerPos "GreenSpawn", 0, "I_Heli_Transport_02_F", _GreenPilots] call BIS_fnc_spawnVehicle;

_WP1 = _GreenPilots addWaypoint [(getmarkerpos "M1"), 0];
_WP1 setWayPointBehaviour "CARELESS";
_WP1 setWaypointType "TR UNLOAD";
_WP1 setWaypointSpeed "FULL";
_WP1 setWayPointCombatMode "BLUE";
_WP1 setwaypointstatements ["true", "(vehicle this) land 'land'"];

waitUntil {sleep 5; (getPos (_GreenChopper select 0)) select 2 < 2;};

_GreenChopper AnimateDoor ['Door_Back_R', 1];
_GreenChopper AnimateDoor ['Door_Back_L', 1];
_GreenChopper AnimateDoor ['CargoRamp_Open', 1];

_GreenChopper land "NONE";{_x action ["Eject", vehicle _x]; unassignVehicle _x;} forEach _assigned;

waitUntil {sleep 25; (count crew _GreenChopper) isEqualTo 2;};

_GreenChopper AnimateDoor ['Door_Back_R', 0];
_GreenChopper AnimateDoor ['Door_Back_L', 0];
_GreenChopper AnimateDoor ['CargoRamp_Open', 0];

_WP2 = _GreenPilots addWaypoint [(getmarkerpos "GreenSpawn"), 0];
_WP2 setWayPointBehaviour "CARELESS";
_WP2 setWaypointType "MOVE";
_WP2 setWayPointCombatMode "BLUE";
_WP2 setWaypointSpeed "FULL";
};```
native hemlock
#

Should be easy

#

I'm not sure if you are aware, but this script also needs to be spawned/run from scheduled environment

shadow sapphire
#

Crud. No, I was not aware.

#

Why is that?

native hemlock
#

Do you know what that measn? ๐Ÿ˜›

shadow sapphire
#

No, I don't.

#

Well, not exactly.

native hemlock
#

Essentially the nonscheduled environment is not allowed to sleep, wait, or pause, everything needs to execute before being able to continue

shadow sapphire
#

That explains why my sleep commands always threw errors.

native hemlock
#

Yup

#

Scripts in the scheduled environment can sleep, wait, and pause. The disadvantage is that the nonscheduled scripts have priority, and there is no guarantee your scheduled script will execute exactly when you want it to, especially if there are a lot of other scripts already running.

#

However, in a majority of cases you won't notice the difference

shadow sapphire
#

Yeah, there isn't going to be much going on in the way of scripts in this iteration of the project, at least.

native hemlock
#

Using [] spawn yourFunction will start that script in the scheduled environment. Any script that starts in the scheduled environment will stay in the scheduled environment

#

Well I shouldn't say any, you can hack your way back into nonscheduled, but this isn't important so I'm going to stop talking about it. If you want to read more about it check out Killzone Kid's blog or ACE3's

shadow sapphire
#

Where can I find info on that? Google didn't give me the BIS Wiki.

shadow sapphire
#

Thanks! I have to go now. My community's session starting soon.

native hemlock
#

There are probably some scattered posts, but back to your issue

shadow sapphire
#

Thank you so much for all of your help. I've never wanted to miss a session more than right now to try and get this thing hammered out, haha.

native hemlock
#

I guess another waitUntil will do, and you'll be waiting till the door is closed (a value of 0)

#

You'll get it sorted, have fun and I'm glad I could help

shadow sapphire
#

Thank you so much! Sorry for having such trouble understanding.

dusk sage
#

Also

#

_GreenChopper AnimateDoor ['Door_Back_R', 1];

#

Needs to be

#

(_GreenChopper select 0) AnimateDoor ['Door_Back_R', 1];

native hemlock
#

^

dusk sage
#

As we already discussed the object scenario

#

Making a variable at the start such as _chopper = _GreenChopper select 0; may save alot of time

native hemlock
#

It'll look a lot cleaner too

shadow sapphire
#

@dusk sage, @native hemlock, people aren't logged in yet, so I have about ten more minutes. What do I do now?

dusk sage
#

See the post above

#

Any place where you wish to refer to the chopper itself

#

needs to be

#

_GreenChopper select 0

#

So making a variable after you create the chopper, such as _chopper = _GreenChopper select 0;

#

And using the _chopper variable, will save time, look cleaner, and be a little easier to understand when writing

shadow sapphire
#

Awesome!

#

In that case, can I just make variables for _Chopper, _Crew, and _Cargo each?

native hemlock
#

You are probably fine with juts the chopper for now

shadow sapphire
#

Do I need to create pilots separately still?

native hemlock
#

I'm not sure if I know what you mean, setting _chopper = _GreenChopper select 0; will not effect the value of _GreenChopper

#

But now instead of using _GreenChopper select 0 everywhere you wanted to use the helicopter object, you can use _chopper.

blissful wind
#

Hello, very simple question here but I cant seem to get it to work.... I just want to spawn a unit that is injured. I looked everywhere for this. Everyone says put setDamage in the unit init line, but I am spawning the unit from a script so its not on the editor. I tried createUnit, and BIS_spawngroup. I manage to spawn the unit but i cant define params like "health" or animation to that specific unit i just spawned in. Any help would be apreciated thanks!

#

p.s I also tried setVehicleInit to no sucess

shadow sapphire
#

@native hemlock, I mean, setting variables like:

_Crew = _GreenChopper select 1;```

etc.
blissful wind
#

I got it to work properly. Step by step debugging the code. was just getting on my nerves. lol cheers

dusk sage
#

yeh when you create the unit, just add setdamage after

#

Using its object

blissful wind
#

my problem was i wasnt defining the group

#

_mygroup = createGroup west;

#

then the init part worked just fine

dusk sage
#

Nice gj ๐Ÿ‘

blissful wind
#

๐Ÿ˜ƒ happy

blissful wind
#

drag, carry, load into vehicle ? any scripts for that? I ve seen it on some servers ans sure I could write it from the ground up but why reinvent the wheel... thanks in advance

blissful wind
#

dont sweat, found something that works perfectly

placid root
#

R3F logistic`?

vagrant badge
#

can add custom buildings to altis life ?

prime valve
#

lol

#

you came to the wrong neighborhood

shadow sapphire
#

Why can 3Den not find my damn scripts that are plainly in the folder? I damn miss the old editor!

lone glade
#

it's not an editor issue

#

3DEN is 100% superior to 2D editor, there's absolutely no feature that 2D has missing from 3DEN

vagrant kite
#

Show Object IDs?

lone glade
#

You know why it was removed, cmon :p

shadow sapphire
#

Does 3Den have hidden folders somewhere? Why doesn't it save to the same folder?

lone glade
#

What do you mean hidden folders? it works the same way the 2D editor did

#

documents -> arma - other profiles -> yourProfile -> missions / mpmissions

shadow sapphire
#

No, that I can absolutely, positively say is incorrect.

#

If it is loading from those folders, it is NOT like the 2D editor.

#

My 2D missions loaded their scripts from documents/A3/mpmissions, not from documents/A3otherprofiles/yourprofile/missions/mpmissions.

lone glade
#

when was the last time you installed the game ?

shadow sapphire
#

I don't think I'm infallible, if you say I'm wrong, I'll believe you, I am just irritated.

vagrant kite
#

if you use default profile, it's documents/A3/missions

shadow sapphire
#

I installed it the last time six months ago.

lone glade
#

Afaik the main A3 folder in documents it's the default profile

#

are you using your default profile or a different one?

#

because that might be your issue

shadow sapphire
#

I'm using my default profile.

lone glade
#

it's in the main folder then.

shadow sapphire
#

Which is what I've always used, never had an alternate.

#

Haha, maybe I need to stream my issue to you. Wait one, screenshots inbound.

lone glade
#

just check in other profiles if you don't have one with the name of your default profile

shadow sapphire
#

There is no other profiles folder.

lone glade
#

create a new mission and save it under missions,, check if it's present

shadow sapphire
#

Check if what's present?

lone glade
#

The mission folder

shadow sapphire
#

Check if the mission folder is present where? I'm looking at the mission folder with all of my projects in it. I didn't move them into here, this is just where they go by default when I save from the editor.

You want me to create a mission and make sure it goes to this folder I have open? I'm just trying to understand so we are on the same page.

lone glade
#

Let me explain:
Your missions are saved in folders under either documents/A3/missions or documents/A3/mpmissions

#

the folder should bear the name of the mission you, saved

#

that's where your functions and scripts go

shadow sapphire
#

It's hard not to be sarcastic in response to that one, @lone glade, haha. That is exactly where my scripts are.

split coral
#

Wait, you only have the default profile? So no "other profiles" at all. How do you know the editor is looking for scripts in "documents/A3otherprofiles/yourprofile/missions/mpmissions"

shadow sapphire
#

I've found the problem, there is apparently a working copy and a saved copy of the folder. My guess is so that things like "undo" are possible.

lone glade
#

๐Ÿ‘

split coral
#

yeah, the ~folders, right?

shadow sapphire
#

Yeah, those!

#

Well, actually, no. That makes three copies of the folder.

split coral
#

i have a huge bunch of them because I always quit the editor with alt+f4 and the game doesn't remove them. ๐Ÿ˜ƒ

shadow sapphire
#

The ~ folders and the normal named folders are both in A3/MPMissions. Then, there is another copy of the folder in A3/UserSaved/MPMissions.

#

Crap.

split coral
#

isn't usersaved just a cache folder? You shouldn't have to worry about that.

shadow sapphire
#

Okay, thank goodness. Then it's the ~folders.

lone glade
#

don't worry about those

shadow sapphire
#

Dammit. There isn't a ~folder for this mission, only the last mission I was working on.

#

The usersaved folder didn't acknowledge my sqf and the normal A3/Missions folder didn't acknowledge the sqf and I don't have a ~folder for it... Is it a prerequisite to have another profile for this to work for me??

lone glade
#

no but it makes it easier to naviguate

#

the ~folders shouldn't be touched

#

just make changes in the normal mission folder

shadow sapphire
#

I have been, but in Eden, if I place a trigger to test an sqf, it says that the sqf can't be found, it says it 100% of the time. So, to test my scripts, I have to paste in the code every time, which as much as I have to tweak and test means that I'm wasting a bunch of time doing that. Not to mention, I don't think I can possibly test certain things in that environment.

lone glade
#

why not use the debug console ?

#

and what are you typing exactly

shadow sapphire
#

It's whatever, I'll figure it out or get over it. I don't use the deug console because I am ignorant of its use.

#

What do I do with the debug console? Just paste the code in and click execute?

split coral
#

yeah

shadow sapphire
#

I'm trying to write a script for immersive respawns in a PVP environment, but it's tough, because the friggin editor isn't even reading my description.ext, so whenever I kill myself, it just respawns me right on top of my body instantly, which is odd to me, because I don't know where that setting got switched on.

#

I'm trying to make it where onplayerkilled, players are moved into spectate mode, then onplayerrespawn, players are assigned as cargo on a chopper that will drop off the players that recently died all together at their base.

#

@lone glade, using the debug console is WAY better. Thanks for the tip. The problem still looms that whenever I have to use scripts that depend on each other, I have no idea what I'll do.

lone glade
#

description.ext and scripts changes need a mission restart

shadow sapphire
#

Haha, I've been working on this for a week, even if I didn't know that, I still have been shutting down Arma and starting it back up.

#

I know you're just covering all of your bases, but I'm not that much of an amatuer. I'm definitely not skilled enough to be called a scripter, but it's not my first outting, either. I've got a few successes under my belt.

lone glade
#

just make sure you're using the right path with execVM and spawn

shadow sapphire
#

Haha, I am as far as all of everyone's advice goes. I may just start an alternate profile to see if I can work it that way.

#

Is 1.60 dropping right now?

split coral
#

seems so

lone glade
#

Pretty much what you need to know:

  • Mission restart required to reload changes in description.ext
  • Mission restart required for changes in functions and scripts
  • Scripts path start at mission folder, example scripts\derp.sqf will be documents\A3\missions\yourmission.island\scripts\derp.sqf
shadow sapphire
#

@lone glade, yep, I'm covered in all of those fronts.

#

C:\Users\DEL-J\Documents\Arma 3\mpmissions\AltisPVPPrototype.Altis

lone glade
#

also: description.ext changes don't reload when you don't leave the lobby in multiplayer preview

#

you have to leave the lobby and come back to have the changes reload.

shadow sapphire
#

@lone glade, I've been testing from an Eden placed trigger, remember? I've had to leave the lobby every single time anyway. It still never found my deploy.sqf script.

lone glade
#

what were you typing exactly ?

shadow sapphire
#

I have tried:

[] execVM "Deploy.sqf";
[this] execVM "Deploy.sqf";
nul = execVM "Deploy.sqf";```

All of which except nul= wouldn't let me close the trigger saying "type trigger expected nothing." When I used nul=, it let me close the trigger, but upon executing the trigger, it told me no trigger was found or some ish like that.
lone glade
#

should be [] execVM "yourfile.sqf"

#

you don't have to specify a handle

shadow sapphire
#

I have tried [] execVM "Deploy.sqf"; and got the same error as the others.

split coral
#

trigger code expects a return so you need nul = ... or something. same thing with init fields

shadow sapphire
#

@split coral, check two messages up. I already did that.

#

We aren't supposed to drop screenshots in here, right?

split coral
#

oh, I was just referring to: "All of which except nul= wouldn't let me close the trigger saying"

lone glade
#

triggers don't expect a return nor does init fields

#

only trigger conditions do

#

(and the rest of the things that do ofc)

shadow sapphire
#

My script location:
C:\Users\DEL-J\Documents\Arma 3\mpmissions\AltisPVPPrototype.Altis\Deploy.sqf

I just loaded up my mission fresh in Eden just now, it was called AltisPVPPrototype.Altis, if I remember correctly. I tried placing [] execVM "Deploy.sqf"; I got "type trigger expected nothing," indicating that it did not find a script named that.

split coral
#

sorry, I meant it expects nothing, not something

lone glade
#

oh right it returns the handle

shadow sapphire
#

Yeah, I tried nul= just to get it to let me close the trigger and try something else.

split coral
#

[] execVM "Deploy.sqf"; creates an error like it's supposed to. It doesn't mean the script can't be found

shadow sapphire
#

Why is that supposed to be an error? Unless I'm mistaken, I was just told that's exactly what I'm supposed to do to call my script from an Eden placed trigger.

split coral
#

just put nul = or 0 = in front of it

lone glade
#

it returns the handle of the script to the trigger

#

Trigger expects nothing

split coral
#

the trigger just can't handle the handle

shadow sapphire
#

Haha, makes sense.

#

Okay, nul= worked, but that makes me wonder why it didn't work before and it makes me wonder why my description isn't working. More questions than answers. I am much relieved. Thank you both very much.

lone glade
#

because the trigger expect nothing and execVM returns the script handle , which the trigger isn't expecting

#

description.ext changes need mission reload.

shadow sapphire
#

No, I mean, I wonder why last time I used nul= it still said nothing expected when I triggered it. I must have mistyped the name of the sqf the one time I tried it. Just my luck. Anyway, once again, I am regularely reloading the mission, man.

lone glade
#

what exactly doesn't work ?

shadow sapphire
#

My respawn settings. Let me triple check for typos and such, then I'll send it on.

#

Yeah, I don't see the issue, but I'm sure it's something simple that I'm not seeing.

respawndelay = 3;
respawnOnStart = -1;
respawnButton = 0;```

I have the respawn points properly placed and properly named, I copied the appropriate names straight from the wiki. However, whenever I kill myself, I respawn right where I died, standing over my body.

I restart the mission every time completely from Eden.
lone glade
#

try placing a respawn module

shadow sapphire
#

I don't think that a respawn module will have the flexibility for my eventual goal, but I shall do as you say anyway.

lone glade
#

you respawning on the spot means that the game couldn't find a proper respawn marker and respawned you on your last pos

shadow sapphire
#

I have now placed a respawn module, it was visible on map when I was in my multiplayer server, so I know it was placed. It was the appropriate color, so I know it was for the right faction. When I killed myself, I stil respawned directly on my last position.

lone glade
#

what version of the game are you running ?

shadow sapphire
#

Whatever version just dropped. 1.60

lone glade
#

might be broken.

shadow sapphire
#

Haha, I agree, but I don't think that came in the latest version. I've been working this scenario for a week. Anyway, I don't want to waste your time on that anymore for now. If I have your attention, I'd rather be learning and moving forward with the project, I can get that stuff figured out on my own later. Upon deletion of the respawn portion of the description.ext, it doesn't respawn me at all, it just ends the mission, so I know it's reading the description.ext file.

#

@lone glade, in this script:


if (isServer) then {
_GreenChopper = [getMarkerPos "GreenSpawn", 270, "I_Heli_Transport_02_F", independent] call BIS_fnc_spawnVehicle;
_Chopper = _GreenChopper select 0;
_GreenPilots = _GreenChopper select 2;

_WP1 = _GreenPilots addWaypoint [(getmarkerpos " respawn_guerrila"), 0];
_WP1 setWayPointBehaviour "CARELESS";
_WP1 setWaypointType "TR UNLOAD";
_WP1 setWaypointSpeed "FULL";
_WP1 setWayPointCombatMode "BLUE";
_WP1 setwaypointstatements ["this land 'land'"];


WaitUnitil {};

_WP2 = _GreenPilots addWaypoint [(getmarkerpos "GreenSpawn"), 0];
_WP2 setWayPointBehaviour "CARELESS";
_WP2 setWaypointType "MOVE";
_WP2 setWayPointCombatMode "BLUE";
_WP2 setWaypointSpeed "FULL";

DeleteVehicleCrew _GreenPilots;
DeleteVehicle _Chopper;
};```

How do I set the waituntil to find when the helicopter is less than one meter above the ground and how do I get it to delete the helicopter and crew once it returns to WP2? I know that my problem is not understanding the syntax, but the wiki is even over my head. I've made plenty of working scripts, but it's been nearly a year since I've done this as well as, none of the other scripts had this many moving parts.
#

My previous scripts were all just spawning, regearing, and putting AI on patrol.

lone glade
#

don't use spawnVehicle, use createUnit

shadow sapphire
#

Ah, man. Dammit, see, I was doing it that way, but someone VERY skilled advised me to use spawnvehicle.

lone glade
#

since you're new to SQF i'm not going to bother teaching you scheduled / unscheduled, just gimme a sec

shadow sapphire
#

Without knowing how to schedule it, I won't be able to let it sleep.

#

Take your time. I've got all day and when you're out of time, I'm sure someone else will be around, haha.

lone glade
#

currently your waitUntil does nothing, you need to have what you want as a condition in it

shadow sapphire
#

Right. I know it does nothing. I'm trying to ask what do I put in there to make sure the chopper gets all the way to the ground.

lone glade
#

WaitUnitil {(getPos _greenChopper) select 2 <= 1};

#

also no need to delete the crew before deleting the vehicle, it's going to delete them

shadow sapphire
#

Thanks a bunch! The phrasing for waypoinstatements to delete "this" is kind of odd, right? It's like (vehicle this) this?

lone glade
#

this is a magic variable

#

it's an internal command to reference whatever was passed to the command / init field / trigger field

#

you can also see it written as _this inside functions and scripts

shadow sapphire
#

But _WP2 setwaypointstatements ["DeleteVehicle _GreenChopper;"]; won't work, right? How do I make that work?

lone glade
#

no because _greenChopper wouldn't be defined in this scope

#

use vehicle this

shadow sapphire
#

So I say _WP2 setwaypointstatements ["DeleteVehicle (vehicle this);"];?

lone glade
#

"deleteVehicle vehicle this"

#

no need for brackets, vehicle this will resolve before deleteVehicle

shadow sapphire
#

Thanks!

#

Okay, this is what I've got so far:


if (isServer) then {
_GreenChopper = [getMarkerPos "GreenSpawn", 270, "I_Heli_Transport_02_F", independent] call BIS_fnc_spawnVehicle;
_Chopper = _GreenChopper select 0;
_Cargo = _GreenChopper select 1;
_GreenPilots = _GreenChopper select 2;

_WP1 = _GreenPilots addWaypoint [(getmarkerpos " respawn_guerrila"), 0];
_WP1 setWayPointBehaviour "CARELESS";
_WP1 setWaypointType "TR UNLOAD";
_WP1 setWaypointSpeed "FULL";
_WP1 setWayPointCombatMode "BLUE";
_WP1 setwaypointstatements ["this land 'land'"];

WaitUnitil {(getPos _GreenChopper) select 2 <= 1};

_Chopper AnimateDoor ["Door_Back_R",1];
_Chopper AnimateDoor ["Door_Back_L",1];
_Chopper AnimateDoor ["CargoRamp_Open",1];

WaitUnitil {_Cargo == 2};

_Chopper AnimateDoor ["Door_Back_R",0];
_Chopper AnimateDoor ["Door_Back_L",0];
_Chopper AnimateDoor ["CargoRamp_Open",0];

_WP2 = _GreenPilots addWaypoint [(getmarkerpos "GreenSpawn"), 0];
_WP2 setWayPointBehaviour "CARELESS";
_WP2 setWaypointType "MOVE";
_WP2 setWayPointCombatMode "BLUE";
_WP2 setWaypointSpeed "FULL";
_WP2 setwaypointstatements ["DeleteVehicle vehicle this;"];
};```

I'll test and see what goes wrong.
#

It's always the waituntils that give me this much trouble.

indigo snow
#

WaitUnitil

#

Spellinngggg

shadow sapphire
#

Holy. Shit. THANK YOU!

indigo snow
#

See the little <, thats where it runs into the error

zealous solstice
#

waitUntililililililililil

shadow sapphire
#
_WP2 setWaypointSpeed "FULL"; 
_WP2 setwaypointstatements ["DeleteVehicle ve>
Error position: <setwaypointstatements ["DeleteVehicle ve>
Error 1 elements provided, 2 expected```

I'm also getting this.
lone glade
#

forgot the completion part

#

should be an array of 2 strings

daring geyser
#

disableChannels[]={0}; doesn't disable Global text channel. Anyone know how to fix that?

zealous solstice
#

xqk6c

#

ololol

lone glade
#

we broke joko

zealous solstice
#

๐Ÿ˜ฆ i know

shadow sapphire
#

@daring geyser, yes! I do.

#

Wait one, I have to look up the link.

lone glade
#

disableChannels[] = {0, 2, 6}; // 0 = Global, 1 = Side, 2 = Command, 3 = Group, 4 = Vehicle, 5 = Direct, 6 = System. Admin/server/BattlEye can still use Global.

shadow sapphire
#

Dammit, @lone glade, I was going to be useful.

daring geyser
#

That's how it was before the update

split coral
#

(getPos _GreenChopper) should be (getPos _Chopper)

shadow sapphire
daring geyser
#

disableChannels[] = {0, 2, 6}; Doesn't work for chat now I sippose

shadow sapphire
#

You can now enable and disable channel voice and text separately.

zealous solstice
#

@lone glade why we broke ๐Ÿ˜ฆ what did i wrong i treated you well(only 2 punches per day)

daring geyser
#

That is scripting command. I was talking about the parameter in description.ext

shadow sapphire
#

@split coral, thanks!

#

Eh, then I don't know. I know that my server will have to update for that now, too.

split coral
#

Also: WaitUnitil {_Cargo == 2}; will never be true, because _cargo is an array and it never gets changed from what it was in the beginning

shadow sapphire
#

How do I get it to figure out when only the pilot and copilot are remaining on board?

#

@lone glade, how do I make deletevehicle this into two things?

lone glade
#

deleteVehicle will delete the vehicle and it's crew

#

you don't need to delete the crew first

shadow sapphire
#

Right, but you said "should be an array of 2 strings," and the errors I am getting indicate you were correct.

lone glade
#

that's the waypoint command

shadow sapphire
#

Oh! I forgot the "true" part, I think.

daring geyser
#

@lavish ocean disableChannels[]={0}; in Description.ext doesn't disable Global text channel for some reason. Any suggestions, David?

shadow sapphire
#

Without the waituntils, the script is working perfectly, except that it deletes the chopper and two pilots fall into the ocean.

lone glade
#

because it's executed all at once

shadow sapphire
#

@lone glade, what do you mean?

lone glade
#

waitUntil forces the script to wait until the condition is true

#

in your case if you remove waitUntil it's going to run all at once (except sleeps)

shadow sapphire
#

Right... I'm running it without the waituntils to make sure that deletevehicle was working. Without the waituntils, the chopper spawns, flies to it's waypoint, lands for a moment, then takes off, flies back out to it's spawn point and deletes itself, but when it deletes, the pilots aren't deleting. That's what I'm trying to fix right now.

lone glade
#

if you don't use createUnit you need to delete the crew too then

shadow sapphire
#

Okay, roger that, I'd prefer to keep using spawnvehicle, because I just got everything working with it and deleted my old createunit version.

#

_WP2 setwaypointstatements ["true","DeleteVehicle vehicle this; DeleteVehicleCrew vehicle this;"]; This is throwing an error that I don't know how to fix. The error is:Error in expression <Vehicle vehicle this; DeleteVehicleCrew vehicle this;> Error position: <vehicle this;> Error Missing ; Which I think in this case is because I need some parenthesis?

lone glade
#

missing "

#

oh wait nope it's here

#

probably because you're deleting the crew after the vehicle ?

shadow sapphire
#

I entertained that thought for a moment, thought to myself no way, but I'll try it!

#
Error position: <vehicle this; DeleteVehicle vehicle this>
Error Missing ;```
#

Nope.

#

@native hemlock, any thoughts on this?

native hemlock
#

Busy atm sorry

#

Need to get a CUP terrains update finished

shadow sapphire
#

@native hemlock, don't apologize!!

indigo snow
#

wrong syntax for deleteVehiclecrew

#

also vehicle looks wierd if youve looked at it for some time

#

It seems this note might help you:

Posted on April 10, 2015 - 13:43 (UTC)
Tankbuster
Using the following code will remove ALL crew from the given vehicle.
{_myvehicle deleteVehicleCrew _x} forEach crew _myvehicle;
shadow sapphire
#

@indigo snow, thanks a bunch! How might I apply this to _WP2 setwaypointstatements ["true","DeleteVehicleCrew vehicle this; DeleteVehicle vehicle this;"];

My syntax stat is under-leveled.

#

Surely _WP2 setwaypointstatements ["true","DeleteVehicleCrew vehicle this;{_myvehicle deleteVehicleCrew _x} forEach crew _myvehicle;"]; won't work, right?

indigo snow
#

you replaced the wrong thing

shadow sapphire
#
_WP2 setwaypointstatements ["true","DeleteVehicle vehicle this;{vehice this deleteVehicleCrew _x} forEach crew vehicle this;"];``` Might work?

Haha, thanks, I sure did.
indigo snow
#
{(vehicle this) deleteVehicleCrew _x} forEach (crew (vehicle this));
deleteVehicle vehicle this;

Turn that into the string you need

mossy lion
shadow sapphire
#

@lone glade, if I use createUnit, rather than spawnvehicle, what all would need to change in my script?


if (isServer) then {
_GreenChopper = [getMarkerPos "GreenSpawn", 270, "I_Heli_Transport_02_F", independent] call BIS_fnc_spawnVehicle;
_Chopper = _GreenChopper select 0;
_Cargo = _GreenChopper select 1;
_GreenPilots = _GreenChopper select 2;

_WP1 = _GreenPilots addWaypoint [(getmarkerpos " respawn_guerrila"), 0];
_WP1 setWayPointBehaviour "CARELESS";
_WP1 setWaypointType "TR UNLOAD";
_WP1 setWaypointSpeed "FULL";
_WP1 setWayPointCombatMode "BLUE";
_WP1 setwaypointstatements ["this land 'land'"];



_Chopper AnimateDoor ["Door_Back_R",1];
_Chopper AnimateDoor ["Door_Back_L",1];
_Chopper AnimateDoor ["CargoRamp_Open",1];



_Chopper AnimateDoor ["Door_Back_R",0];
_Chopper AnimateDoor ["Door_Back_L",0];
_Chopper AnimateDoor ["CargoRamp_Open",0];

_WP2 = _GreenPilots addWaypoint [(getmarkerpos "GreenSpawn"), 0];
_WP2 setWayPointBehaviour "CARELESS";
_WP2 setWaypointType "MOVE";
_WP2 setWayPointCombatMode "BLUE";
_WP2 setWaypointSpeed "FULL";
_WP2 setwaypointstatements ["true","{(vehicle this) DeleteVehicleCrew _x} forEach (crew (vehicle this));
DeleteVehicle vehicle this;"];
};```
#

@indigo snow, I am getting odd behavior with your solutions. If I deletevhicle first, then the crew doesn't get deleted. If I deletevehiclecrew first, then the crew fall out of the chopper and the chopper crashes.

indigo snow
#

theres more issues like what the variable this is in this case

#

youre getting into territory where tis easier for you to make and call a function so you can use some local variables

#

this is the vehicle group leader, aka the pilot most likely

#

you need to save both the heli object and the crew objects to some variable and then delete them

#

mind you i just stepped into this so i have no clue about what youre trying to do but you need some organization

#
private _chopper = (vehicle this);
{_chopper  deleteVehicleCrew _x} forEach (crew _chopper) ;
deleteVehicle _chopper ;
shadow sapphire
#

How would I use the last bit of code that you pasted? I call it at the end of my script or I define it in the beginning and call it later?

indigo snow
#

that bit you can turn into the string you need

#

you save yourself headache by simply saving the helicopter to a variable and then using that

shadow sapphire
#

Okay, will try. Syntax may as well be hieroglyphics to me, though.

indigo snow
#

its something you can plain learn and study

shadow sapphire
#

Haha, I didn't think it was an innate talent, I'm just still really, really bad at it.

#

@indigo snow, how would I save it to a variabe? I think I've already done that, but it can't be used in waypoint statements.

indigo snow
#

the string is basically a code block

#

you can define variables in there

shadow sapphire
#

Isn't this making my variables?

_Chopper = _GreenChopper select 0;
_Cargo = _GreenChopper select 1;
_GreenPilots = _GreenChopper select 2;```
indigo snow
#

"a = 1; b = 2; hint (a+b);"

#

these are local variables that belong to your sqf file, imagine it like having its own desk

#

the waypoints have their own desks and cant see the stuff other scripts have on theirs

shadow sapphire
#

I see. Will it cause this freak out on all clients if I make the variables global?

indigo snow
#

if will freak out if you run it more than once at the same time

#

but i already did the work for you

#
private _chopper = (vehicle this);
{_chopper  deleteVehicleCrew _x} forEach (crew _chopper) ;
deleteVehicle _chopper ;
#

turn that into the string you need and voila

shadow sapphire
#

Haha, I know that you've done the work, but I don't understand it or its use. I'm pretty ignorant of this stuff. I'm trying to learn it, so that I don't have to bug people anymore.

#

I'm going to just try messing with your code there a bunch.

indigo snow
#

this refers to the group leader of the group that completed the waypoint

#

in the case of your script, what object/unit is this?

shadow sapphire
#

OH! So I am just using your code there inside of the waypointstatement?? My this is a chopper spawned using BIS_fnc_spawnVehicle that is completing a waypoint.

indigo snow
#

wrong

#

this is the group leader of the group that completed the waypoint

#

a helicopter object itself can never be in a group, be a group leader, or complete waypoints

#

who did you assign the waypoint to?

shadow sapphire
#

Oh! Sorry, you JUST said that, too. The waypoint is assigned to the chopper pilot.

#

I thought I defined that as _GreenPilots, but I guess that isn't so, since that's more than one AI.

indigo snow
#

right so when you get to the waypooint statement, all those earlier local variables have been cleared and youre left with just your global variables and this.

#

now you first delete the crew of the vehicle (this and his compatriot) but then you try to delete the vehicle by referring to it as this's vehicle

#

when this doesnt exist anymore, nor is in a vehicle

shadow sapphire
#

That makes perfect sense. That's awesome.

#

So, I use private _chopper = (vehicle this); {_chopper deleteVehicleCrew _x} forEach (crew _chopper) ; deleteVehicle _chopper ; inside of the waypoint statement to define everything that's about to be deleted, so that the script can delete it?

indigo snow
#

you save a reference to the actual chopper since it gets deleted after this, yes. You need some way of pointing at it

shadow sapphire
#

Awesome! It worked perfectly!

#

I don't understand what it is going wrong here:

_GreenPilots allowDamage false; 
_GreenPilots disable>
Error position: <allowDamage false; 
_GreenPilots disable>
Error allowdamage: Type Group, expected Object
Error in expression <hopper allowDamage false; 
_GreenPilots allowDamage false; 
_GreenPilots disable>
Error position: <allowDamage false; 
_GreenPilots disable>
Error Generic error in expression``` It's probably also something simple that just isn't clicking.
lone glade
#

You're referencing the group not the vehicle

#

you also have to disable damage for all crew membrs otherwise they'll die

shadow sapphire
#

In some cases, yes. Because it's the group whose behavior I want to modify, or so I thought.

lone glade
#

just make the helo invincible right ?

shadow sapphire
#

Yes.

#
_Chopper = _GreenChopper select 0;
_Cargo = _GreenChopper select 1;
_GreenPilots = _GreenChopper select 2;

_Chopper setVehicleLock "LOCKED";
_Chopper allowDamage false;
_GreenPilots allowDamage false;
_GreenPilots disableAI "TARGET";
_GreenPilots disableAI "AUTOTARGET";
_GreenPilots disableAI "FSM";
_GreenPilots setBehaviour "Careless";
_GreenPilots setCombatMode "Blue";
_GreenPilots enableAttack false;```
lone glade
#
{_x allowDamage false} foreach (crew _chopper)```
shadow sapphire
#

I don't understand why yours will work and mine won't. I am trying to understand why these things are happening, too.

#

Nevermind. Looking back at my errors and comparing that to your code told me wha tI need to know.

indigo snow
#

computers are very strict in what you tell them

#

they dont interpret like humans do

shadow sapphire
#

Right, they don't think, they just follow instructions.

#

(driver _Chopper) allowDamage false; worked perfectly.

#

Okay! Now I have to get my dang waituntils working.

#

This is why I thought I needed to run a scheduled script:

Error in expression < 
WaitUntil {(getPos _Chopper) select 2 <= 2}; 
 
_Chopper AnimateDoor ["Door_Ba>
Error position: <<= 2}; 
 
_Chopper AnimateDoor ["Door_Ba>
Error Generic error in expression```
#

Every time I run a waituntil, I am told suspending is now allowed in this context, but I am unsure how to give it the proper context.

indigo snow
#

how are you firing that script? theres also a script error in there

shadow sapphire
#

Rats! I want to focus on the script errors first, if that's possible. I am firing it from the debug console in a hosted server from my machine using the server exec button.

indigo snow
#

that calls the script you need to spawn it

#

or use a different scheduled context

shadow sapphire
#

Can I use a waituntil without running a scheduled script or whatever?

indigo snow
#

Suspending not allowed in this context

#

0 = [] spawn { ...code here ... };

shadow sapphire
#

@indigo snow, things are working perfectly with the script for now.

vagrant badge
#

i have problem i add UAV "class Item720
{
position[]={15045.713,17.91,16822.574};
azimut=140.328;
id=775;
side="EMPTY";
vehicle="I_UAV_02_F";
isUAV=1;
leader=1;
skill=0.60000002;
init="_nul = [this, 60, 1] execVM ""Scripts\vehicle.sqf"";";
};"

#

i add to mission but cant use uav

#

i must brake in to use how to fix this ?

little latch
#

I believe UAV classes have changed

vagrant badge
#

?

#

how to fix ?

#

side - west ?

little eagle
#

player assignItem "ItemGPS"
doesn't work anymore. Can anyone confirm?

#

NVM, was thinking of linkItem

lavish ocean
#
Bohemia Interactive Forums

Page 3 of 3 - Line Drawing - posted in ARMA 3 - DEVELOPMENT BRANCH: Line drawing is an awesome feature that Im really looking foward to. Should it also happen to come with a set of script commands along the lines of what the ALiVE team requested...well, thatd be just incredible
ย 
EDIT: Might be out of scope for your task, but since youre already working on the map: Would it be possible to get an optional toggle for icons so that they have the same scaling behaviour as the lines? (I.e...

vagrant badge
#

how to drop bomb from zeus ?

#

cursorTarget setDamage 1;its only make damage one object

prime valve
#

Place bomb => Select it => Press END

#

Or place fire support modules such as mortar, etc.

vagrant badge
#

try _toSpawn = "Bo_GBU12_LGB" createVehicle position player; and work

grizzled cliff
#

why did KK suggest using a trigger for that?

#

frame handlers work on servers

#

and have for years

carmine galleon
#

He did it fast after the update, probably made it as he thought at that moment

grizzled cliff
#

i guess... makes him look like a rookie

carmine galleon
#

Well... After what he did for arma modding, I can forgive him for that ๐Ÿ˜‰

grizzled cliff
#

meh, he's been hit or miss most of the time

carmine galleon
#

That's true

#

(Like 1.60 update BTW)

#

lmao

shadow sapphire
#

Anyone willing to help me troubleshoot my issue I'm having getting a normal respawn to work in a mission? I swear, it's probably something simple, but I can't for the life of me figure it out today.

lone glade
#

You're not the only one reporting issues like this

#

Let me check the feedback tracker but I think it's a known issue

shadow sapphire
#

Really??

lone glade
#

yep

shadow sapphire
#

Even when I exported the mission and tested on a dedicated server it wasn't respawning me like I thought it should. Very odd.

lone glade
#

The fix around this is using respawn position modules set to your side

#

markers seems borked atm.

shadow sapphire
#

I've tried using the respawn modules, it didn't work. Do I need to clear out my description.ext parts that are related or something?

lone glade
#

don't use 3DEN attributes AT ALL

#

those are broken as fuck

#

mark respawn disabled on 3DEN attributes and use description.ext entries

shadow sapphire
#

I haven't been. I use only my description.ext.

lone glade
#

Create a repro mission (barebone stuff) and create a feedback tracker ticket

vagrant kite
#

mark respawn disabled on 3DEN attributes and use description.ext entries
Eden respawn settings overwrite description.ext now

lone glade
#

the fuuuck

#

Why does my mission respawn works then? my respawn system ?

vagrant kite
#

because you use addRespawnPosition?

lone glade
#

nah

#

that's for pilots only

vagrant kite
#

I have 2 missions on the same map with similar settings. Both with respawn markers and respawn=3 in description.ext

lone glade
#

Can you try enabling respawnPosition in the templates ?

vagrant kite
#

and first one has "no respawn" in mission.sqm (from Eden) and second one doesn't

#

guess on which one you can respawn ๐Ÿ˜ƒ

lone glade
#

:facepalm:

#

I'm damn happy I wrote my revive system

shadow sapphire
#

@vagrant kite, how do I do this? Where does this magic code go?

vagrant kite
#

to be safe, setup your respawn in Eden: it's in Settings -> Multiplayer

shadow sapphire
#

@lone glade, how did you write your system? I am wanting to write a system here, I'm just getting the baseline stuff squared away first. I don't want a revive script, what I am wanting is to have an immersive respawn script where whenever an objective is seized all dead players respawn and are assigned to a helicopter that drops off the respawns at base as reinforcements.

#

Okay, I'll set up 3Den stuff first and BRB.

lone glade
#

It's a revive system more like a respawn one

#

You get shot -> moved into revive state

#

people can drag / carry you around and revive you

#

Can someone please check in MP (with someone else)

moveOut _unit;
[_unit, _animation] remoteExec ["switchMove", 0];

while _unit is in a vehicle and then respawn.

shadow sapphire
#

@lone glade, that's similar to the revive script that my community made. For ours, we made the players become immobilized at 95% damage, instead of 100% damage, which I think is abnormal, but we did it that way to avoid some other issues.

lone glade
#

I think this causes duplication issues across clients

#

I kill the unit and place the new respawned one where the previous one was del

shadow sapphire
#

If I had anyone to test it with, I would. Can you host a server and I'll join it and you can just test the script that way?

lone glade
#

yes del, gimme a sec

shadow sapphire
#

@lone glade, that's how the BIS revive works. We had many, many issues with it, so we made our own. We are working on getting a bit added to where we can load the wounded into vehicles. Ours also has a feature where when players are down, they bleed out if they don't get treated in time, which isn't rare, but the neat part is that anyone can stabilize the wounded and stop their bleeding, but after that the wounded has to recieve trauma care every two to three minutes until the medic arrives to fix them, but eventually, they have to have care so often that it takes two people, then eventually they just bleed out and nothing can be done about it, but with two attendants, the wounded person can last twenty or so minutes.

lone glade
#

Thing is, mine works better than BIS :p

#

I ironed out the issues from yesterday's release, now it's gud.

#

176.148.92.210:2302

shadow sapphire
#

Sure, but our community couldn't work with any script that lets the player die first, because we have too many scripts that have to run again when the player respawns. We play in a completley vanilla sandbox that's persistent and has custom uniforms, custom radio channels, and custom ranks and rank textures, as well as whenever players are respawned, our company loses money, so if players were to die and then be moved back to the place they died for the script to work, then we'd have money leaving our account or we'd have to write a script to check those conditions and add the person back their custom rank, uniform, and radio channels.

#

Connecting now.

lone glade
#

:facepalm: I forgot to enable the debug console

#

gimme a sec

#

do you see two people standing ?

shadow sapphire
#

Standing where?

lone glade
#

in front of the vehicle

shadow sapphire
#

Oh, yep!

#

I was in back.

lone glade
#

hm :/

#

welp no idea why this bug happens

#

thanks for the check

shadow sapphire
#

No problem!

#

@vagrant kite, setting the settings in Eden/attributes/multiplayer worked perfectly... but I much prefer the old description.ext method, I believe. How do I make it choose the old way?

#

@lone glade, would you have any idea where to start with a spectator script or with scripting the helicopter wave respawn that I'm talking about?

lone glade
#

nope, too busy atm

vagrant kite
#

@shadow sapphire How do I make it choose the old way?
just don't touch multiplayer settings in Eden - ever ๐Ÿ˜‰

shadow sapphire
#

@vagrant kite, dammit, what if it's too late? Why is there no way to fix it, dammit!?

hasty pond
#

Anyone else having problems with executing code with debug console as an admin on a server?

torpid oxide
#

can anyone help me with a arma 3 altis life server looking for a dev/scripter i dont mind paying

little eagle
#

Anyone else having problems with executing code with debug console as an admin on a server?
it's broken in 1.60

carmine galleon
#

Seems OK at my side

little eagle
#

the debug console uses remoteExec for "SERVER EXEC"

#

depends on your white listing

#

It's either call or BIS_fnc_call

hasty pond
#

Yeap yeap noticed that in the log afterwards, needs to be fixed in the future

lone glade
#

The debug console use call for local exec

#

only watch fields can execute local stuff if you have remoteExec protections.

shadow sapphire
#

Can someone spot the difference between these two loadout scripts? I made a switch case for a loadout script for a PVP game mode and when I went to test it today with multiple clients, I have found that it isn't equipping some units, but I cannot figure out why. It's removing all of their gear, so I know that it's getting it started, but it's not applying the new gear.

This one does NOT work:

_unit forceAddUniform "U_I_OfficerUniform"; 
for "_i" from 1 to 6 do {_unit addItemToUniform "SmokeShell";}; 
for "_i" from 1 to 2 do {_unit addItemToUniform "SmokeShellYellow";}; 
for "_i" from 1 to 2 do {_unit addItemToUniform "SmokeShellGreen";}; 
_unit addVest "V_PlateCarrierIA1_dgtl"; 
for "_i" from 1 to 9 do {_unit addItemToVest "30Rnd_65x39_caseless_mag";}; 
_unit addHeadgear "H_HelmetIA"; 
 
_unit addWeapon "arifle_MXC_Black_F"; 
_unit addPrimaryWeaponItem "optic_Aco"; 
_unit addWeapon "Binocular"; 
 
_unit linkItem "ItemMap"; 
_unit linkItem "ItemCompass"; 
_unit linkItem "ItemWatch"; 
_unit linkItem "ItemRadio";
};```

This one does work. I can't find the difference. They are found one right after the other in the switch and it seems random which ones are working and which aren't. I know it's something I've done wrong, but I don't know what it was. 

```case "I_support_Mort_F": {
_unit forceAddUniform "U_I_OfficerUniform"; 
for "_i" from 1 to 6 do {_unit addItemToUniform "SmokeShell";}; 
for "_i" from 1 to 2 do {_unit addItemToUniform "SmokeShellYellow";}; 
for "_i" from 1 to 2 do {_unit addItemToUniform "SmokeShellGreen";}; 
_unit addVest "V_PlateCarrierIA1_dgtl"; 
for "_i" from 1 to 9 do {_unit addItemToVest "30Rnd_65x39_caseless_mag";}; 
_unit addHeadgear "H_HelmetIA"; 
 
_unit addWeapon "arifle_MXC_Black_F"; 
_unit addPrimaryWeaponItem "optic_Aco"; 
_unit addWeapon "Binocular"; 
 
_unit linkItem "ItemMap"; 
_unit linkItem "ItemCompass"; 
_unit linkItem "ItemWatch"; 
_unit linkItem "ItemRadio";
};```
lone glade
#

use get/setUnitLoadout

#

getUnitLoadout output is an array with all you need.

shadow sapphire
#

I don't understand how that will help. Can you explain? The wiki on getunitloadout doesn't say anything relevant to this situation.

lone glade
#

instead of having a big list of loadout stuff you have a single array of arrays and you use setUnitLoadout

shadow sapphire
#

Where do I use getunitloadout that will give me what I need?

little eagle
#

debug console

shadow sapphire
#

So, using getunitloadout on units that the script failed on will give me some sort of information?

little eagle
#

no, you make a quick debug mission with the virtual arsenal and debug console

#

then you equip yourself

#

and use copyToClipboard str getUnitLoadout player

#

Takes a while to set up, but if you've done that it's super fast

shadow sapphire
#

Haha, okay, that's what I thought you guys were getting at. Not helpful, since I've already done that part. All of these units already have a loadout. For some reason my switch case is failing on certain units and I can't figure out why that's happening.

little eagle
#

oh know

#

switch is case sensitive

shadow sapphire
#

?

#

There we go! That is the issue. Thank you!

little eagle
#

switch (toLower _unit)

#

etc.

shadow sapphire
#

Holy cow... dang it. Okay, that definitely explains the problem, I had a hunch that was the case, but did NOT think it was a reasonable thought. Dammit.

rancid ruin
#

can anyone ELI5 this cfgPatches change in 1.60?

shadow sapphire
#

I would if I could, but I am plainly terrible at all of this stuff.

shadow sapphire
#

Why doesn't this work?

case west:{
["Initialize", [player, [west], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};

case east:{
["Initialize", [player, [east], false, true, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};

case independent:{
["Initialize", [player, [independent], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};
};```
carmine galleon
#

Give error pls

shadow sapphire
#

It isn't throwing any error that I can see. It's just not doing anything.

rancid ruin
#

add some debug hints and a default case

shadow sapphire
#

It's in onplayerkilled.sqf. When I have just:

["Initialize", [player, [west], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator; it works fine.

#

@rancid ruin, okay, will do.

rancid ruin
#

and remember player doesn't exist on servers

shadow sapphire
#

Player doesn't exist on servers? Dammit, that's probably it. How do I fix that?

carmine galleon
#

Man

#

Player is a variable on player side only

shadow sapphire
#

@carmine galleon, yeah, double checked the .rpt, it's throwing no errors.

carmine galleon
#

Why don't you run script client side ?

shadow sapphire
#

Haha, I guess because I don't know how to run clientside from onplayerkilled.

carmine galleon
#

Ok

#

Use evenhanlder

#

in initPlayerLocal.sqf

indigo snow
#

_this = [<oldUnit>, <killer>, <respawn>, <respawnDelay>]

carmine galleon
#

player addEventHandler ["Killed",test_fnc_yourfunction];

rancid ruin
#

you have fun times ahead of you del-j ๐Ÿ‘

indigo snow
#

_player = _this select 0;

carmine galleon
#

@indigo snow Will work, but for what he wants, he should do client side

indigo snow
#

oh yes, but if he wants to handle it all from the server side it would certainly be possible

carmine galleon
#

Yes it would ๐Ÿ˜‰

shadow sapphire
#

@indigo snow ```_player = _this select 0;

switch (side _player) do {```?

carmine galleon
#

Will work

indigo snow
#

ya but now the issue will be the function

#

im not sure if its global

carmine galleon
#

Yes, you must change every player by _player

#

@shadow sapphire If you want it clean, use it client side

rancid ruin
#

privatise it too? or not?

carmine galleon
#

Don't handle that from server

indigo snow
#

better to keep on trucking until the entire concept is there. relatively easy to move it around after

#

if hes new and still learning everything it can be benificial

carmine galleon
#

It could, but increase traffic

indigo snow
#

but hes obviously still in the learning how2code phase, he shouldnt be worried about stuff like that

#

no offense btw

carmine galleon
#

Okay, I agree with you, you're right ๐Ÿ˜ƒ

rancid ruin
#

is private["_var","_var2"] still the best way to privatise vars?

carmine galleon
#

Can be

#

But can also private _var = 2;

#

(2 is juste example)

rancid ruin
#

did i imagine a new command recently?

carmine galleon
#

About ?

rancid ruin
#

something to do with private, or maybe params

carmine galleon
#

Well it's not the same

rancid ruin
#

sorry, i've not sqf'd in months, last few patches seemed to be pretty big

carmine galleon
#

params is intended to get parameters passed to the funtion

#

private privatise variables on script

#

private is interesting when you call script from inside another script that uses same variables names

#

So you can privatise the variables inside the other script

#

According to wiki :

#

_foo = 10;
if (true) then
{
private ["_foo"];
_foo = 5;
player sideChat format ["%1", _foo];
};
player sideChat format ["%1", _foo];

#

In this example, the first sidechat (innermost) returns 5 while the second sidechat (outermost) returns 10.

rancid ruin
#

ja i understand the concept

shadow sapphire
#

@indigo snow
In onplayerkilled.sqf, this works:

["Initialize", [player, [], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;

This doesn't:


switch (side _player) do {
case west:{
["Initialize", [_player, [west], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};

case east:{
["Initialize", [_player, [east], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};

case independent:{
["Initialize", [_player, [independent], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};
};```

Nor does:

```_player = _this select 0;

switch (side _player) do {
case west:{
["Initialize", [player, [west], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};

case east:{
["Initialize", [player, [east], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};

case independent:{
["Initialize", [player, [independent], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};
};```

What'd I miss?
rancid ruin
#

i think i was just thinking of params, which privatises vars anyway according to the wiki

carmine galleon
#

Yep of course

lone glade
#

because onPlayerKilled first arg is the dead body

#

those are all side empty

#

use playerSide

indigo snow
#

this is on the server tho ๐Ÿ˜‰

lone glade
#

doesn't matter

#

onPlayerKilled event script is local only

shadow sapphire
#

Thanks, @lone glade! Will try!

#

@lone glade

case west:{
["Initialize", [player, [west], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};

case east:{
["Initialize", [player, [east], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};

case independent:{
["Initialize", [player, [independent], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};
};``` This works perfectly! Thank you so much!!
#

Is there something like onjoininprogress.sqf or latejoin.sqf?

lone glade
#

it's a param in initPlayerLocal or init

#

The word you're looking for is JIP (Join In Progress)

shadow sapphire
#

It's a param! Awesome!

zealous solstice
#

why so much shit load of code?
["Initialize", [player, [playerside], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;

#

this do 99% the same

#

and is just one line of code

shadow sapphire
#

@zealous solstice, hahaha, because you weren't here to give advice. Will try your version now.

#

@zealous solstice, your version works perfectly. Thank you!

shadow sapphire
#

I can't find any "for dummies" information on how to gather and apply the didJIP portion of the initplayerlocal. Anyone have a tip?

lone glade
#

initPlayerLocal is executed the same whether you JIP or not.

shadow sapphire
#

_unit = _this select 0;
_JIP = _this select 1;```
lone glade
#

it's either false or true.

shadow sapphire
#

I am trying to force players who join in progress to be spectators until the next wave of respawns.

#

How do I gather that true or false and/or apply it in a code. I'm not sure if it's like an argument or condition or what the right term is.

lone glade
#

it's an argument

#

just use params instead of select too:

params ["_unit", "_JIP"];
carmine galleon
#

if(_JIP) then {
// SPECATOR CODE
};

shadow sapphire
#

Will it hurt anything if I leave this in the initplayerlocal?

[player:Object, didJIP:Boolean]
I can comment it out, but I want to leave it in as a note so I can understand what's going on.

carmine galleon
#

Do //[player:Object, didJIP:Boolean]

shadow sapphire
#

Okay, commented out! Thanks!

carmine galleon
#

np

prime valve
#

if(moricky) then {_biCommunity setDamage 1;};

#

if(apex) then {_arma3Life addWeapon "arifle_thousand_dollars";};

carmine galleon
#

if(apex) exitWith {altisLifeEasyMoneyJetSki};

shadow sapphire
#

Hmm... Okay, getting some odd behavior from initplayerlocal:

enableSentences false;

//[player:Object, didJIP:Boolean]
params ["_unit", "_JIP"];

if (_JIP) then {
["Initialize", [player, [playerSide], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};```

Maybe it's because I have the server and three clients all running from the same machine, but when clients join in progress, they are spawning as normal, but with the camera widgets on and no ability to look around.
lone glade
#

aaaaaand someone is going to be put in @muted_trolls

#

@shadow sapphire because spawning happens after init.

shadow sapphire
#

Ugh! Always something, haha.

#

I knew init happened first, but I guess I assumed that the camera would prevent that from happening.

lone glade
#

hahaha no

#

If you have respawn on start enabled you can use onPlayerRespawn

shadow sapphire
#

That's okay, though, because now I need a check to prevent them from spawning until conditions are right. I need to add them to an array.

#

What I want is all dead players and all JIP players to be in camera spectating, but be added to an array and whenever an objective is captured, all players in the array are assigned as cargo to a helicopter that will drop them off. I've got the helicopters working perfectly, thanks to you guys here, but that was probably the easier part of the battle. I thougth the spectator script was going to be super hard, but thankfully BIS had their own already, and it's good!

winged thistle
#

Is there a way to detect the IDD of the active display?

#
//List of menu IDDs
_menuSystemIDDs = [60541,60542,60543,60544,60545,60546,60547,60548];

//Attempt to capture display
{
        if (!isNull (findDisplay _x)) then { uiNamespace setVariable ["RscFORNavMenu", (findDisplay _x)];};
} forEach _menuSystemIDDs;
#

I'm not having a lot of luck with this. It doesn't seem to work reliably.

little eagle
#

Is there a way to detect the IDD of the active display?
no

jade abyss
#

You can show all active ones

winged thistle
#

Then I could check if the display is in allDisplays for each display in a defined array of displays?

jade abyss
#

yerp

winged thistle
#

Thank you very much @jade abyss

jade abyss
#
_Display = findDisplay 12345;
{
if(_x isEqualTo _Display)then{hint "You won the lottery"};
}forEach allDisplays;
#

should work, not tested

winged thistle
#

Can I do this?

_menuSystemIDDs = [60541,60542,60543,60544,60545,60546,60547,60548];
{
    if ((findDisplay _x) in allDisplays) then { uiNamespace setVariable ["RscFORNavMenu", (findDisplay _x)];};
} forEach _menuSystemIDDs;
#

More particularly, will it actually save to the uiNamespace?

#

Welp, YOLO. Testing it now...

#

Nope ๐Ÿ˜›

vapid frigate
#

if ((findDisplay _x) in allDisplays)

#

if (!isNull (findDisplay _x))

#

second is a lot quicker way of doing that

#

and yeah, it should save to uinamespace

winged thistle
#

I had !isNull originally but couldn't get that to save either. Probably wasn't the condition's fault.

vapid frigate
#

so you've put uiNamepace getVariable ["RscForNavMenu", "nope"]; or similar in the debug console and nothing's coming up?

winged thistle
#

Yeah

#

Nil

#
uiNamespace getVariable ["RscFORNavMenu", "NIL"]

returns "NIL"

vapid frigate
#

i don't think there's an issue saving a display to a variable in uinamespace.. but maybe i'm wrong

#

in which case you could save the IDD instead

winged thistle
#

I'm going to try a thing. I am wondering if it's the disableSerialization

vapid frigate
#

uiNamespace setVariable ["RscFORNavMenu", _x];

winged thistle
#

Guess not. Trying capturing the IDD now

winged thistle
#

Welp, I may have found the problem. I think I'm loading the wrong display...

winged thistle
#

6,000 random issues later, my navigation bar works. Thanks for your help guys! ๐Ÿ˜„

native hemlock
#

In the 6+ months or however long this discord has been around, I've never seen post that many messages, that quickly, in one channel

prime valve
#

life players do cocaine

winged thistle
#

In a chat application with a chat history that displays your question practically indefinitely, asking once is enough.

#

Not to mention New Message notifications...

plucky beacon
#

Anyone have any idea why respawns are broken? :/

thin pine
#

@winged thistle tbh I'd hardly ever reply to some question that was posted days ago because there's a high chance the person already got the answer and I'd end up wasting my time. Repeatedly asking a question, especially when there's other questions overlapping yours is totally fine in my opinion...as long as it isn't spammed each half-hour or sumn spammy like that

#

I also have muted this channel so I don't get notifications...may be useful to you

marsh storm
#

Hey gang, looking to remove the "move inside" option from the RHS C-130s, any idea how I might do that?

thin pine
marsh storm
#

thanks @thin pine

#

much appreciated

shadow sapphire
#

Why doesn't this work?

enableSentences false;

//[player:Object, didJIP:Boolean]
//params ["_unit", "_JIP"];

waitUntil {
    time > 0 &&
    !isNull player &&
    player == player
};

if param[1] then {
    ["Initialize", [player, [side player], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};```
little eagle
#

param[1] is NOT valid SQF

shadow sapphire
#

Thank you!

little eagle
#

also player == player is pointless after !isNull player

shadow sapphire
#

Okay, going to try: ```enableRadio false;
enableSentences false;

//[player:Object, didJIP:Boolean]

params ["_unit", "_JIP"];

waitUntil {
time > 0 &&
!isNull player
};
if (_JIP) then {
["Initialize", [player, [side player], false, false, true, false, false, false, false, false]] call BIS_fnc_EGSpectator;
};```

shadow sapphire
#

Okay, that didn't work either. What's happening is that the JIP is spawning a character. I need to prevent the character from spawning or something. Also, the camera is initializing wrong somehow.

little eagle
#

IDK how BIS_fnc_EGSpectator works internally. It probably has problems with JIP

shadow sapphire
#

If I kill the JIP player, then they initialize the camera perfectly. Maybe what I should do is just have it where when players JIP, they are instantly killed and corpse deleted. Would that work?

little eagle
#

try it.

#

_unit setDamage 1; deleteVehicle _unit;

#

sry, "deleteVehicle"

shadow sapphire
#

Trying now with deleteVehicle

#

@little eagle, It kinda worked! It's not deleting the corpse, but I think maybe because of the way it's ordered or something.

little eagle
#

oh I know

#

you probably are losing locality of the object so deleteVehicle fails

#

just setPos it into the ocean before killing it

shadow sapphire
#

Yeah, so if I put deleteVhicle first, might taht work?

little eagle
#

I have no idea

#

just setPos it into the ocean before killing it

shadow sapphire
#

I will do that when this fails. I just want to sate my curiosity.

little eagle
#

you probably can remove the setDamage after deleteVehicle.

shadow sapphire
#

@little eagle, Okay, so if I do;

 deleteVehicle _unit;
};```

Then it does nothing, the JIP spawns as normal.

If I do;
```if (_JIP) then {
 deleteVehicle _unit;
_unit setDamage 1;
};```

Then it kills the player, deletes their clothing, but doesn't delete their body. Odd!

I have one more thing I want to try before setting position to nowhere.

Can't I just do.... hideobjectglobal some way?
little eagle
#

no, hideobjectglobal only works on the server

shadow sapphire
#

Rats!

#

Is there a similar client side capability?

dusk sage
#

hideObject

#

But it won't sync with all clients

shadow sapphire
#

Double dammit.

little eagle
#

It also will fail when other people JIP

#

i don't get why deleteVehicle wouldn't work ...

dusk sage
#

For locality, see the icons at the top of pages on the BI wiki

little eagle
#

just do the setPos thing

dusk sage
shadow sapphire
#

@dusk sage, do you have any ideas other than the setpos thing? I don't mind doing it, but only as a last resort or as a placeholder. I feel like it's a bit... hacky, but I guess it's no more hacky than killing someone as they join the game, hahaha.

little eagle
#

It was my idea. And no. I don't know any other way

west lantern
#

respawnOnStart = 1; ?

#

which respawn type do you have in a mission?

shadow sapphire
#

@little eagle, I know it was your idea, but since Boguu was around, I thought I'd ask.

west lantern
#
If you are using a respawn type different then 1 ("Bird"), you may want to execute the spectator mode when a player dies, then stop the spectator when the player respawns, this could be achieved in many ways, such as the one bellow, which will make every player start spectating when dead, and stop spectating when he respawns, 60 seconds after:```

```Description.ext
respawn = 3;
respawnDelay = 60;```
```onPlayerKilled.sqf
["Initialize", [player, [], true]] call BIS_fnc_EGSpectator;```
```onPlayerRespawn.sqf
["Terminate"] call BIS_fnc_EGSpectator;```
#

do you use respawn = 3; or BASE?

shadow sapphire
#

@west lantern, I have respawn=3;

west lantern
#

and with this you want to disable JIP from playing but joinging spectator insead?

shadow sapphire
#

@little eagle, I am now using your idea of dumping them in the ocean. Works perfectly!

#

@west lantern, yes, I want JIP players to start off spectating, because I don't want players appearing at base mid objective. My next task is writing a respawn template, I guess. My goal is to have all of the dead and JIP players to only be able to spectate until an objective is captured. When the objective is captured, all of the dead players will respawn and will be assigned as cargo to a respawn chopper, which will drop them off at their respective bases.

#

The goal is immersion, haha.

little eagle
#

yw

west lantern
#

nice plan, well this above I quoted might help, I thought you would disable respawn altogether in a mission but I see its a bit more complex than what I proposed.

#

maybe better to set respawn as bird or 1 init spectator and this would fix ( hopefully ) character appearing

#

for the rest do your thing with your template

shadow sapphire
#

I can combine respawn=1 and a template?

#

What I am wanting to do is add all players that are dead into an array, I think.

west lantern
#

1 is spectator basically

#

1 is respawn type not template so you can use it in description.ext along with custom repawn template

#

if you use 3 but dont allow respawn that would cause side effects IMO

#
{
    // Class used in respawnTemplates entry
    class myTag_beacon
    {
        // Function or script executed upon death. Parameters passed into it are the same as are passed into onPlayerKilled.sqf file
        onPlayerKilled = "\myAddon\scripts\respawnBeacon.sqf";
        // Function or script executed upon respawn. Parameters passed into it are the same as are passed into onPlayerRespawn.sqf file
        onPlayerRespawn = "\myAddon\scripts\respawnBeacon.sqf";
        // Default respawn delay (can be overwitten by description.ext entry of the same name)
        respawnDelay = 20;
        // 1 to respawn player when he joins the game. Available only for INSTANT and BASE respawn types
        // Can be overridden by description.ext attribute of the same name
        respawnOnStart = 0;
    };
    class Spectator
    {
        onPlayerRespawn = "BIS_fnc_EGSpectator";
    };
};```
shadow sapphire
#

@west lantern, I think you're onto something good here... Is there a command that can respawn players? I've only been using respawn=3 because I didn't know if there was any other way to get them to respawn.

west lantern
#

that is respawn type, there are several to choose from, and 3 or base is as it says respawn on defined marker named respawn_east or west or whatever

#

it is commonly used respawn type fro mission that allow it

shadow sapphire
#

Right, I am using base type respawns with proper markers. The normal respawn is working fine.

west lantern
#

you are using mixed type of respawn, not really true respawn in base or at least that is what you want to achieve

shadow sapphire
#

What I'm wondering is if I can use respawn=1 and still have players spawn into the game later, instead of just be stuck spectating.

west lantern
#

for that part I am not sure you will have to test that

shadow sapphire
#

Ah, I see. That's what I was asking is if you knew of a command that would be able to spawn the players who were currently spectating.

west lantern
#

I dont think there is one, must do custom scripting there.

shadow sapphire
#

That's fine. I'll get it figured out. Thanks a bunch!

west lantern
#

But if this works what you have now, carry on, I bited quite more than I can chew myself ๐Ÿ˜„

shadow sapphire
#

Either way, thanks for the input!

west lantern
#

pleasure

shadow sapphire
#

Could somethine like this be made to work?

_unit remoteExec ["hideObjectGlobal", 2];
_unit remoteExec ["enableSimulationGlobal", 2];
_unit setDamage 1;
};```
torpid oxide
#

looking for someone to set up my server pls msg me for details

west lantern
#

@shadow sapphire hideobjectGlobal must be executed on server so it wont work

shadow sapphire
#

That's what the remoteExec is for...

west lantern
#

but you are trying to hide a vehicle I dont think it will work? Tried?

shadow sapphire
#

This is similar to the method we use in my sandbox. It works there. They remoteExec these commands somehow to create a custom respawn. When someone dies, they respawn at base, but their simulation is disabled, they are hidden, and their camera is forced into a UAV view until conditions are right for a respawn.

west lantern
#

might have quirks with that and its very hacky

#
Units that have been previously subjected to enableSimulation false; or enableSimulationGlobal false; may stay unrecognised for a long time even after simulation was re-enabled, returning objNull as cursorTarget. Force revealing units with reveal command usually solves the problem. For example:```
`{player reveal _x} forEach allUnits;`
shadow sapphire
#

Yeah, but there isn't a respawn command or anything. My group's sandbox is a bit abnormal, but it is becoming VERY professional. Bugs being squashed all the time as new features are added. I'm involved with the development of that very little, though. This project of mine is nothing compared to the complexity of the sandbox.

#

So, you're saying I need ot force reveal the players when it comes time to "respawn" them? Can do !

west lantern
#

just a heads up in case of bugs, if it works without it no need to, but this is failsafe I guess

shadow sapphire
#

Thanks a ton!

west lantern
#

Also this

#
_obj setPosATL [getPosATL _obj select 0, getPosATL _obj select 1, (getPosATL _obj select 2)-100];
And to unhide:
_obj setPosATL [getPosATL _obj select 0, getPosATL _obj select 1, (getPosATL _obj select 2)+100];```
#

if it all fails switch to that one

shadow sapphire
#

Will do!

#

Currently I'm moving them into the ocean.

kindred kayak
#

With the latest patches, in MP / dedicated server, has anyone had issues with the debug console not executing commands for logged in admins?

#

I'm probably missing something, but debug console is refusing to execute anything, even with description.ext's enableDebugConsole=1 (or 2).

#

Any chance the console pays attention to the CfgRemoteExec settings, even for simple Local commands like Hint ?

jaunty drift
#

I think you need to whitelist the call command in CfgRemoteExec for the debug console to work now.

kindred kayak
#

Thanks @jaunty drift , that worked.

shadow sapphire
#

Anyone have any guidance on how I can add players killed to an array?

Something like this onplayerrespawn:


_reinforcements pushback;```
little eagle
#

don't use those shitty event scripts.

if (isServer) then {
  My_DeathCount = 0;
  publicVariable "My_DeathCount";

  addMissionEventHandler ["EntityKilled", {
    My_DeathCount  = My_DeathCount  + 1;
    publicVariable "My_DeathCount";
  }];
};
#

(untested, might have typos)

shadow sapphire
#

@little eagle, how will this build my array of players waiting to respawn?

jaunty drift
#

It doesn't. You will want to use pretty much what you posted earlier except within the event handler: ```if (isServer) then {

yourtag_reinforcements = [];

addMissionEventHandler ["EntityKilled", {
params ["_killed"];

if (isPlayer _killed) then {
    yourtag_reinforcements pushBack _killed;
};

}];

};```

#

I didn't test it so isPlayer _killed might always return false (and not push the player into the respawn queue) because the unit might not be a player anymore. Depends on how your mission is set up.

shadow sapphire
#

@jaunty drift, thanks for the tips! Will look into it!

#

@jaunty drift, I am actually trying to add recently respawned players to the array, not recently killed ones. How might I phrase that?

jaunty drift
#

use the EntityRespawned event

shadow sapphire
#

@jaunty drift, thanks so much! Does this look sound? Can I just put it in my mission init.sqf?

_reinforcements  = [];
addMissionEventHandler ["EntityRespawned", 
{params ["_spawned"];
if (isPlayer _spawned) then 
{_reinforcements pushBack _spawned;};
}];
};```
jaunty drift
#

It looks hard to read :P. It should be good to just go into your init.sqf

shadow sapphire
#

Thanks for the input!

fresh hornet
#

Hey guys, anyone on here think they could help me add some stuff to my planes Electronic warfare script? Our script is 50% done but our scripter went dark!!

shadow sapphire
#

What does the script do?

lavish ocean
#

new performance binaries (1.60.136493) in #perf_prof_branch (with fixes for oPC/oPD event-handlers)

little eagle
#

@shadow sapphire
Yeah, sorry I skimmed over it. I was asked something similar on Slack.
You might want to drop the isPlayer check if that proves to be unreliable (could be that these respawned units aren't considered players at that point in MP)
AI's don't usually respawn anyway.

#

Also your script won't work. _reinforcements is a local variable and never defined inside the scope of your event handler. Use a global variable.

If you want to access the variable on client machines, you have to pubVar it every time you append the array. Arrays are pointers only locally, but are copied when send over the network. If you only need the variable on the server machine, then ignore what I just wrote.

shadow sapphire
#

@little eagle, thanks for the input! I already got everything else figured out, like making the array global, but I did not know about the public variable. That explains why my array stays empty, I think. How might I do that? Any guidance or links?

rancid ruin
#

globalVariable = 100;
_localVariable = 100;

shadow sapphire
#

@rancid ruin, I'm using a global variable for my array now, but I am unsure of where to call the publicvariable. I have it declared in the mission init, but that doesn't work alone.

fresh hornet
#

The script redirects missiles to hit somewhere else and not any blufor aircraft within a radius of the Growler. We have it so it redirects anything coming to the Growler so far. Our last scripter was Andrew Rindfleisch from the USAF team. He has been busy with real life and hasnt even logged in to skype in weeks.

rancid ruin
#

@shadow sapphire i think you'd publicvar it here

#

{_reinforcements pushBack _spawned; here}

#

it's been months since i was deep in to any sqf but i recall that you need to pubvar a variable any time it changes, it doesn't automatically update with any changes

shadow sapphire
#

Ah! Thank you!

#

I'll try it and let you know!

rancid ruin
#

also it might need to be a global var to begin with, e.g replace _reinforcements with delj_reinforcements

#

it's generally a good idea to put your tag in front of variable names

shadow sapphire
#

I already made it a global variable. I've seen people tag variables like that, I don't understand the purpose.

rancid ruin
#

multiple scripters using obvious var names like "reinforcements" and "money" = scripts get fucked up

shadow sapphire
#

Oh, I see. I'm the sole scripter on this project, so I don't think it will be a major issue.

shadow sapphire
#

@rancid ruin, that fixed it! Thanks so much!

rancid ruin
#

nice, no problem

lone glade
#

It makes absolutely no sense, i'm confused.

#

_pos being a location's position.

tough abyss
#

In the Intro Mission, after I call end. How do I start the mission with the same units where they inserted by helicopter.

At the moment I have had to copy and paste their exact position from where they dismount into the scenario. I tried looking at the BIS missions but couldn't see anything special they are doing.

agile pumice
#

Two trigger related questions:

  1. Can empty vehicles be used with triggers that detect Anybody?
  2. Can thislist be used in a trigger's onactivation?
vapid frigate
#

@lone glade Are you changing the _pos array in any of those other scripts without duplicating it? ie _unitpos = _this select 0; _unitpos set [0,100]; should be _unitpos = +(_this select 0); ...

#

also, if you have _pos in one of those other scripts where it's not marked private, it will change.

little eagle
#

@lone glade
put diag_log _pos everywhere, also check if derp_fnc_sideMissionSelection or any other global function redefines _pos without private

jade abyss
#

*diag_log str _pos

native hemlock
#

diag_log doesn't require it to be a string so technically he is not wrong

little eagle
#

I'm sure he can figure it out

#

; )

vagrant kite
#

@agile pumice 1) Not sure about this one. I had it once activate for empty, another time it didn't, so you need to check
2) yes

lone glade
#

_pos is a location position that is stored in an array

#

I've come to the conclusion that locations are simply fucked

vagrant kite
#

try chaning the var name to _xyzabc123

#

and see if it happens

lone glade
#

doesn't matter, the pos change whenever I spawn the first unit

#

if I place the markers and tasks first it doesn't

#

it's simply location fuckery.

#

or var corruption

vagrant kite
#

maybe it's a problem with 'private'

lone glade
#

i'm using params, var is privatized

#

issue started appearing after 1.60 as well.

vagrant kite
#

maybe params is broken and not loacations

lone glade
#

.............

vagrant kite
#

just change the var name to something unique

lone glade
#

I swear if that's the case....

vagrant kite
#

then you're gonna do nothing? ๐Ÿ˜‰

lone glade
#

changing it to an other var fixes it, so var corruption it is

#

dafuq, soooooo It's weird.

#

let me count how many calls and scope deep it is.

#

1 call then 4 scopes then 1 call again and 3 other scopes

little eagle
#

Does BIS_fnc_listPlayers report headless clients?

#

Is isPlayer true for "HeadlessClient_F" ?

lone glade
#

yes it is

little eagle
#

Is it possible to have a headless client object that is not: HeadlessClient_F

lone glade
#

no idea.

little eagle
#

It said: "Check if given person is a human player."

#

which is confusing considering headless clients are bots

lone glade
little eagle
#

Yes, but not in isPlayer

#

Also, does player report the headless client object on the HC machine?

lone glade
#

I think it return isNull

#

I use profileName to sort my HC

smoky crane
#

player does report the headless client object

dull parrot
#

What's the diff between the above two segements.

#

Do they function the same? I am thinking the answer is yes, but I wan't to be sure.

#

Which is more reliable to use in a continously looped segment that updates UI, looped once every 6 seconds.

lone glade
#

it's coded like ass

#

that's what I can tell you

#

define a max hunger and min hunger, then set the color based on a percentage using those values

little eagle
#

The first one is written by someone who doesn't know that switch exists

#

The second one is written by someone who doesn't know how switch works.

shadow sapphire
#

Okay, today, I need help gathering data from an array. This is my array:

reinforcements = [];
addMissionEventHandler ["EntityRespawned",{params ["_spawned"];
if (isPlayer _spawned) then {reinforcements pushBack _spawned; publicvariable "reinforcements";};
}];};```

Now, I need to learn how to grab the elements placed in this array. Sort them by side and stuff them into helicopters. I already have the helicopter script working nearly perfectly, but now I need to stuff bodies onto it.
little eagle
#

Now, I need to learn how to grab the elements placed in this array.
reinforcements select 0
???

lone glade
#

reinforcements is a global var, just use select

shadow sapphire
#

I'm just super ignorant of all of this stuff. I really am way in over my head, guys. I know that's not your responsibility, but I'm very appreciative of all the help you've given so far.

#

May I trouble you a bit more for an explanation of how this works? I am looking up select now, hopefully that will shed some understanding on how it works.

little eagle
#
arr = [unit0, unit1, unit2];
arr select 0
-> unit0
vagrant kite
#
-> unit2```
#

<array> select <index> -> take element from the <array> that sits at position <index>

#

(indices start from 0)

shadow sapphire
#

Ah! @little eagle, that for some reason clicked in my brain. Thanks much! What I need to do is grab the first sixteen units of each side in the array, assignascargo to a named helicopter, then if there are more than sixteen in a side in the array, then I need to run the script again until the array is empty. So, as I select the units, sort them by side, and assignascargo them, I also need to delete the units from the array, so that the same units aren't grabbed again.

#

I'm thinking something like alternative syntax 3 of select is what I need to be using.

little eagle
#

use a forEach loop that exits if _forEachIndex reaches 16

shadow sapphire
little eagle
#

you could do that, but then you are no step closer to your goal

shadow sapphire
#

Haha, indeed. Okay, so, is any forEach a loop?

#

Or do you make it a loop somehow?

little eagle
#

all forEach are loops

#

I mean, you could also use a different kind of loop

shadow sapphire
#

I think I'll go with forEach, since that's the kind I've seen before.

little eagle
#

but forEach works pretty good in arma

#

just keep one thing in mind...

#

don't modify the size of the array you are iterating through

#

behaviour is undefined

shadow sapphire
#

Modify the size of the array?

little eagle
#

like append it or remove stuff from it via deleteAt

dusk sage
#
{
    _array deleteAt _x;
} forEach _array;
shadow sapphire
#

It's an array that will be changing constantly throughout the game. It has to.

dusk sage
#

^ zero divisor

shadow sapphire
#

There have to be players being added to and deleted from the array. What's my next move?

little eagle
#

yes. and that's one of the reasons why I never use the scheduled env. haha

dusk sage
#

Dont add and delete to it while looping through it

little eagle
#

^

shadow sapphire
#

OH! Okay, so loop through, then delete them after the loop?

little eagle
#

yes. you can do stuff like:

#
{
  // do stuff
   my_units set [_forEachIndex, objNull];
} forEach my_units;

my_units = my_units - [objNull];
shadow sapphire
#

Okay, I don't understand that one much.

vagrant kite
#

@shadow sapphire do you have a list of choppers too?

#

or do you want to create them on the fly? (no pun intended)

shadow sapphire
#

I don't have a list, because the choppers are created on the fly.

#
_GreenChopper = []; 

if (isServer) then {
_GreenChopper = [getMarkerPos "GreenSpawn", 270, "I_Heli_Transport_02_F", independent] call BIS_fnc_spawnVehicle; 
_Chopper = _GreenChopper select 0; 
_Cargo = _GreenChopper select 1; 
_GreenPilots = _GreenChopper select 2; 
 
_Chopper setVehicleLock "LOCKED"; 
_Chopper allowDamage false; 
(driver _Chopper) allowDamage false; 
(driver _Chopper) disableAI "TARGET"; 
(driver _Chopper) disableAI "AUTOTARGET"; 
(driver _Chopper) disableAI "FSM"; 
(driver _Chopper) setBehaviour "Careless"; 
(driver _Chopper) setCombatMode "Blue"; 
_GreenPilots enableAttack false;```
little eagle
#

Okay, I don't understand that one much.
Instead of modifying the size of the array while looping through it, it replaces single elements with "objNull"
and at the end, it removes all "objNull" from the array

shadow sapphire
#

@little eagle, that's incredible!

vagrant kite
#
{
  if(_forEachIndex % 16 == 0) then {
    _chopper = <create_chopper>
  };
  _x moveInCargo _chopper;
} forEach _units;```
dusk sage
#

_driver allowDamage false; 
_driver  disableAI "TARGET"; 
_driver  disableAI "AUTOTARGET"; 
_driver  disableAI "FSM"; 
_driver  setBehaviour "Careless"; 
_driver  setCombatMode "Blue"; 
lone glade
#

why that random modulo yours ?

vagrant kite
#

for new chopper every 16 passengers

shadow sapphire
#

@vagrant kite, that's awesome!

lone glade
#

why not just compare the index to 16 ?

thin pine
#

Every 16...

vagrant kite
#

if you have 50 units

thin pine
#

32 means two choppas

vagrant kite
#

you have new chopper for 0, 16, 32, 48

lone glade
#

oh right, missed that part :p

thin pine
#

Lol

#

Ah right

shadow sapphire
#

@vagrant kite, where does this fit within my script? Right at the beginning or after _chopper has been defined?

vagrant kite
#

try to understand what the script I gave you does

#

cuz you put your code in the middle of mine

shadow sapphire
#

I am, haha, it looks like I have to change some names, at least.

#

I have a bit of a to do list for the moment.

#

May I paste in the whole script to get some guidance? I've got one other issue. So, I have two different scripts running two different choppers, they are nearly identical, but they come from different points, belong to different factions, land at different bases, so I need to sort out which faction someone in the array belongs to at some point before the script runs, I believe. Should I just create two different arrays and have them sorted before I even get started on the deployment parts of the script?

#

So I would make this into two arrays and sort them as they go into the arrays for the sake of making the deployment portions of the script easier?

reinforcements = [];
addMissionEventHandler ["EntityRespawned",{params ["_spawned"];
if (isPlayer _spawned) then {reinforcements pushBack _spawned; publicvariable "reinforcements";};
}];};```
lone glade
#

make a gist or pastebin del, easier to paste and read

shadow sapphire
#

Okay!

lone glade
#

I would prefer a gist if I were you, there's sqf highlighting with it.

shadow sapphire
#

Where do I set the SQF highlighting? Is it just done automagically?

lone glade
#

the name of the file need the .sqf extension

thin pine
#

There's sqf highlighting on pastebin too fyi but it's basic

shadow sapphire
#

Is there a verdict?

little eagle
#

gist > pastebin imo

drowsy hollow
lone glade
#

it's the showhud that's the issue here shado

#

draw commands are disabled too

#

You cannot remove the action menu icons without removing draws too.

drowsy hollow
#

@lone glade but i tried this with showhud and without it

lone glade
#

Don't know for custom cameras but showHud remove draw rendering if it's set to false.

shadow sapphire
#

@little eagle, any guidance or advice on getting the gisted script to work as I need?

#

I know I have most or all of the tools here to do it, but I don't know how to assemble things.

shadow sapphire
#

Okay, I know that there is something wrong with my parameter here, but I am not creative enough to know how to fix it.

What is wrong with this?
https://gist.github.com/DEL-J/d89d3a8bcc6f7f1749761d76a37fd4a2

or found here:

GreenReinforcements = [];
RedReinforcements = [];
addMissionEventHandler ["EntityRespawned",{params ["_spawned"];
if (playerside == independent && isPlayer _spawned) then {GreenReinforcements pushBack _spawned; publicvariable "GreenReinforcements";};
if (playerside == east && isPlayer _spawned) then {RedReinforcements pushBack _spawned; publicvariable "RedReinforcements";};
}];};```
west lantern
#

_spawned undefined?

shadow sapphire
#

I was trying to get it to sort the arrays based on player's side, but it's putting both sides into the GreenReinforcements array.

west lantern
#

got only ind and east in mission? Players?

shadow sapphire
#

Yeah, players can only be AAF or CSAT.

west lantern
#

try with else instead of two if

marsh lodge
#

@DEL-J there is no player on the server

lone glade
#

could also use a switch

shadow sapphire
#

@marsh lodge, crud! That's right, I think you taught me that before. How do I get around that?

marsh lodge
#

Is this for a mod or a script in a mission?

shadow sapphire
#

Script in mission.

#

It works at pushing back into the array, but it doesn't do any sorting.

@lone glade, @west lantern, thank you for the input, will consider both using else or a switch.

marsh lodge
#

Are you using ACE?

shadow sapphire
#

@marsh lodge, zero mods.

marsh lodge
#

Use side

shadow sapphire
#

side rather than playerside?

marsh lodge
#

IIRC it is side _unit == east

#

Yes

shadow sapphire
#

Where do I define _unit? Sorry for my ignorance...

marsh lodge
#

_ unit is just the variable for the unit that spawned

#

So instead of playerSide

shadow sapphire
#

So the engine will understand that one without needing it defined?

marsh lodge
#

Use side _spawned in your case

shadow sapphire
#

Could I do...

if (side _spawned == east) then {RedReinforcements pushBack _spawned; publicvariable "RedReinforcements";};

marsh lodge
#

Since that is what you called the unit in Params[]

shadow sapphire
#

Or do I need the isPlayer part?

#

I can just trial and error that much, maybe.

marsh lodge
#

If you want to make sure that the unit that spawned is an actual player then yes

#

Idk all the conditions that the event handler will be called under

#

I am also on mobile atm so my answers might not be the most coherent

shadow sapphire
#

@marsh lodge, no sweat! I'm super glad for your help!

#

Yeah, the only slots in AAF and CSAT are players, so I don't think it's needed, but I'll keep it anyway, just to make sure that corpses or something stupid doesn't get added to my helicopters.

marsh lodge
#

No problem, idk if this is intended, but if a unit respawns again, the old and new unit will both be in the list

shadow sapphire
#

@marsh lodge, it is not intended, I believe we are already addressing that issue. Would you like to see the script I am working on in whole or just that snippet?

marsh lodge
#

I have the time to look at it if you want

shadow sapphire
#

My next concern is if players disconnect after they have died. I want onplayerdisconnect to remove them from the array, but I am unsure of how to do that.

marsh lodge
#

What is your intent of this list?

#

How do you plan on using it?

shadow sapphire
#

@marsh lodge, using the script or the array?

marsh lodge
#

The array

shadow sapphire
#

The array will be a queue for a reinforcement chopper for an immersive respawn in a PVP mission.

marsh lodge
#

Instead of creating an event handler, you could check if they are still a player before you put them in the helicopter

shadow sapphire
#

Oh? That sounds like what I need. How might I do that? I haven't even gotten the arrays loading into the chopper yet.

marsh lodge
#

Whenever your script decides it wants to spawn a wave, as it loops though each unit in the list, moving them into the helicopter, you have a condition that the unit is Player

shadow sapphire
#

That sounds good, but now that I am thinking on it, the array is meant to grab JIP players as well, so we could end up with a player being on the array twice if someone high up the role selection screen rage quits and someone fills in that same spot again.

marsh lodge
#

Unless you want to use the list size as the condition for spawning units, extra units in the list should be ok

shadow sapphire
#

Even if they are the same unit?

#

If a client drops and rejoins in the same respawn cycle, I get this.

marsh lodge
#

It might, but what you can do is make sure the list is valid before you do anything with it

#

So if you decide you want it to spawn when 10 people are on the list, you go though the list checking for duplicates and making sure that all the units are players

#

It is probably easier to make sure that a unit is not already on the list when you try to add it

shadow sapphire
#

@marsh lodge, that sounds perfect, but it's a bit over my head, haha. I will definitely try to go that direction with it.

marsh lodge
#

Glad I could help

shadow sapphire
#

@marsh lodge, are you still around? I could use more guidance. Both of my arrays are being filled properly now, but I don't understand how to assembly my deployment scripts to grab the arrays, much less to check for duplicates, etc.

winged thistle
#

@shadow sapphire Heya ๐Ÿ˜„ Was just starting to browse the script you posted.

shadow sapphire
winged thistle
#

In lines 7/8 in the link, you could add ``` && !(_spawned in (ColorReinforcements))

#

for each color you have

#

That would prevent duplicates

#

Yeah, that one.

shadow sapphire
#

Could you explain how it works, so I can wrap my head around its use?

winged thistle
#

It just checks if _spawned is already in the array

#

Then, checks the opposite with the !

#

So if _spawned is already in the array, it skips adding them and broadcasting the array over the network.

shadow sapphire
#

@winged thistle, thanks a bunch!

winged thistle
#

Sure. Now, you're having problems pulling from those arrays?

shadow sapphire
#

Not so much problems as I just don't even know how to start, haha.

winged thistle
#

Well, to start, you're already broadcasting the arrays from the server to every client.

#

So you're good there.