madmedic 0 Posted February 20, 2006 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
Matthijs 40 Posted February 20, 2006 Quote[/b] ]obj1 distance obj2Operand 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
madmedic 0 Posted February 20, 2006 Quote[/b] ]obj1 distance obj2Operand 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
XCess 0 Posted March 1, 2006 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 Share this post Link to post Share on other sites