Jump to content
Sign in to follow this  
madmedic

please help with jet bomber no-crash script

Recommended Posts

How do I write a line that determines when a plane gets closer than a certain distance from its target?

(i.e. I am writing a script that will cause the plane to dis-engage and "pull up" when it gets too close)

Share this post


Link to post
Share on other sites
Quote[/b] ]obj1 distance obj2

Operand types:

obj1: Object

obj2: Object

Type of returned value:

Number

Description:

Compute distance between two objects.

Example:

player distance leader player

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@(myBomber distance myTarget < 200)

myBomber move [0,0,0]

myBomber flyinheight 1000

Share this post


Link to post
Share on other sites
Quote[/b] ]obj1 distance obj2

Operand types:

   obj1: Object

   obj2: Object

Type of returned value:

   Number

Description:

   Compute distance between two objects.

Example:

   player distance leader player

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@(myBomber distance myTarget < 200)

myBomber move [0,0,0]

myBomber flyinheight 1000

[Mr. Withers]EXCELLENT[/Mr. Withers]

But...will that work with AI units? (I noticed it says "mytarget")

Share this post


Link to post
Share on other sites

myTarget is the name of the target aircraft.. ypu know, what you put in the name field when creating the unit, and yes, it will work with AI.

I know the threads like a week old, just thought it should be answered wink_o.gif

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  

×