Jump to content
Sign in to follow this  
Vartan

Random crashsite, how?

Recommended Posts

How can i make a helicopter crash in a random place every time but in side the primiter defined by me ?

thank you for your time in advance

-vartan

Share this post


Link to post
Share on other sites

this should help:

create an object or a game logic and give it a name like "center" and place it anywhere on the map. the get it's x,y coordinates with the "getpos" command.

the create a random number that would represent the radius of the area you want it to crash "x_random = random(200) - random(200)". That should produce 2 random numbers and their subtraction another random number to ensure that it won't always be a positive number (sometimes + and some -).

now add the random number to your original coordinate, and you have your crash x coord "x1=x+x_random".

repeat for y coord and then use this "my_helicopter setpos (x1,y1)". use the "setdammage" command, and you have a nice lil helicopter crashing anywhere up to 200 meters from the "center" object.

simple, yes? biggrin.gif

Share this post


Link to post
Share on other sites

yes, i believe so. thanks

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  

×