Jump to content
Sign in to follow this  
frederf

Mutually exclusive spawns?

Recommended Posts

I wanted one barrel in a mission to have a PoP (probability of presence of 0.5 and the other barrel only to show up if the other one isn't going to spawn.

How can I do this simply without create unit or destroy unit? If I have one unit initialize with a boolean true variable, it doesn't seem to matter if the unit materializes via PoP or not, the same initialization code is run regardless, so the second barrel with condition !(first_barrel) is never satisfied.

I know this seems like a dumb question, but having "mutually exclusive" spawns is a rather basic premise.

Share this post


Link to post
Share on other sites

Even though I have a huge brain I can't think of any way other than camcreate or createvehicle. Why isn't creating or deleting possible?

Share this post


Link to post
Share on other sites

Name the first barrel (the one with probability of presence at 0.5), then in the condition of presence for the 2nd barrel do this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">isNull barrel1

Share this post


Link to post
Share on other sites
Nope, doesn't work.

Well that's some helpful information... was the 2nd barrel there every time or not there at all?

Share this post


Link to post
Share on other sites

first one is set to pop 0.5

the second condition of presence is set to "!alive first" and pop 1

this works for me with a leader and some squad members I just use

alive leader instead for the other units in the squad

Share this post


Link to post
Share on other sites

I think the problem is, when the Barrel with the probability setting is not created, then:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">!first_barrel

Returns an error because the variable\object was never initialised. If that is the case you can try this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Call {_T=False; If !IsNull first_barrel Then {_T=True}; !_T}

This will return True, if the first barrel was not created in the misison. In this example, first_barrel has to be the name you give the object in the mission editor.

Share this post


Link to post
Share on other sites

barrel1

pop 50%

Init: deleteVehicle barrel2;

barrel2

pop 100%

barrel1 does only execute Init if its present and if isnt then

the second barrel is present

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  

×