Jump to content
Sign in to follow this  
Dr. Mojo- PhD

Spawn in choppers if player x is present

Recommended Posts

I'm trying to only create a chopper if there's players present to ride in it. I'm using three little birds to transport three loads of up to four SpecFor each.

What I want is for LB2 and LB3 (the 2nd and 3rd little birds, obviously) to only spawn if there are players there at the start of the game to use them. I set a trigger where condition of presence is set to SpareBird1=true; SpareBird1 is set to true if (alive SpecForX) or (alive SpecForY) ... etc.

Clearly I wouldn't be posting here if this worked. What am I screwing up?

Share this post


Link to post
Share on other sites

You don't even need a trigger. If you edit the chopper unit, you'll see the Condition of Presence field way at the bottom. When you put a condition in that field the unit will only be present at the start of the mission if it is true.

A good condition to use is probably count.

Btw, your trigger doesn't sound like it does anything to me. It has a condition, but what does it do On Activation? There's no command to actually remove the choppers, at least according to what you said. Anyway, like I said you don't even need a trigger, just use the above method and it'll save you some work.

Share this post


Link to post
Share on other sites

Yeah, I'm using it as the condition of presence.

The trigger checks to see if anybody is present, and then loads them into their designated chopper. It's on activation is to flag a boolean as true (A1=true), and the condition of presence is A1=true.

Basically, there's 12 SpecFor units, Specfor0 - SpecFor11.

SpecFor0-3 are in MainBird. SpecFor4-7 are in SpareBird1. SpecFor8-11 are in SpareBird2.

I'd actually love to use a count (so that it will load the choppers as full as possible) but how do I reassign them if the chopper is full in that case?

Let's say, for example, players choose SpecFors 0, 5, 6, 8,10,11.

This would require two little birds. Now, how would I make sure they all get on the little birds with a count? Would I have to do another count where if assignascargo MainBird = 4 then assignascargo SpareBird1, or what?

Share this post


Link to post
Share on other sites

Ah, now I see. I think your problem is that triggers have a slight delay after the mission starts before firing, and the condition of presence needs to be true at the exact moment the mission initializes.

For your second question, count isn't helpful for actions, just conditions, but you can still do what you want with some clever use of the commands (possibly foreach), but really the best way I can think of is with a short script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_players = [SpecFor0,SpecFor1,SpecFor2,SpecFor3,SpecFor4,SpecFor5,SpecFor6,SpecFor7,SpecFor8,SpecFo

r9,SpecFor10,SpecFor11];

_c = 0;

{

if(!isnull _X)then{

if(_c < 4)then{

_X assignAsCargo MainBird;

};

if(_c >= 4 && _c < 8)then

{

_X assignAsCargo SpareBird1;

};

if(_c >= 8)then{

_X assignAsCargo SpareBird2;

};

_c = _c + 1;

};

} foreach _players;

Share this post


Link to post
Share on other sites

dont you need to make sure that it is actually players playing as the units with the "isPlayer specOp1" command?

Share this post


Link to post
Share on other sites
dont you need to make sure that it is actually players playing as the units with the "isPlayer specOp1" command?

Dr. Mojo, PhD never specified wether or not AI were enabled, if they weren't then they'd have to be players.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×