Jump to content
Sign in to follow this  
Somerville

Empty unit spawn

Recommended Posts

Hi there,

I've got an empty tank that I want to be randomly positioned in a marker. Then when it dies, I want it to be randomly positioned again, but on full health. I could probably manage the second bit, but the first bit is really winding me up ><

Any ideas?

Share this post


Link to post
Share on other sites

Okay, I'm a bit unsure of how to actually put this down in the editor..

I've got the placement radius sorted, but what about the other bit? Could you possibly do a step-by-step thing for me? Pweeeese?

Share this post


Link to post
Share on other sites

Place invisible H pads as to where you want the tank to spawn. Then use an even handler...

this addEventHandler ["killed", {[] exec "killed.sqs"}]

;Killed.sqs

; a few seconds delay to acknowledge that its been destroyed.

~7

_rand = random 3

? _ rand <= 1 : tank setdammage 0; tank setpos getpos Hpad1

? _ rand > 1 or _rand <= 2 : tank setdammage 0; tank setpos getpos Hpad2

? _ rand > 3: tank setdammage 0; tank setpos getpos Hpad3

exit

That should do the trick nicely.

Btw you might need to add the event handler once its been killed not sure really, presumably you would since when its been killed there would be no need of the EH since its dead but a quick test should show you.

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  

×