Difference between revisions of "MissileAI"

From Elite Wiki
m
(script example from Oolite -> scripting page)
 
Line 41: Line 41:
 
[[AI|BACK]]
 
[[AI|BACK]]
   
[[Category:Oolite]]
+
[[Category:Oolite scripting]]

Latest revision as of 13:13, 2 January 2011

Will intercept it's target, detonates when in reach (25m) of target. Will harmlessly explode when (a) message 'ECM' is recieved, (b) gone beyond range of 30000.0m travelled, (c) Target is lost or destroyed.


Defined states:

  • GLOBAL: ->ATTACK_SHIP
  • ATTACK_SHIP: ->EXPLODE, ->DETONATE
  • DETONATE: becomeExplosion, dealDamageInRange (250.0m)
  • EXPLODE: becomeExplosion



{
   "ATTACK_SHIP" = {
       "DESIRED_RANGE_ACHIEVED" = ("setStateTo: DETONATE"); 
       ENTER = ("setDesiredRangeTo: 25.0", performIntercept); 
       EXIT = (); 
       "TARGET_DESTROYED" = ("setStateTo: EXPLODE"); 
       "TARGET_LOST" = ("setStateTo: EXPLODE"); 
       "ECM" = ("setStateTo: EXPLODE"); 
       "GONE_BEYOND_RANGE" = ("setStateTo: EXPLODE"); 
       UPDATE = ("setDesiredRangeTo: 30000.0", checkDistanceTravelled, "setDesiredRangeTo: 25.0", "pauseAI: 5.0");     }; 
   DETONATE = {
       ENTER = ("setDesiredRangeTo: 250.0", dealEnergyDamageWithinDesiredRange, becomeExplosion); 
       EXIT = (); 
       UPDATE = ();     }; 
   EXPLODE = {
       ENTER = (becomeExplosion); 
       EXIT = (); 
       UPDATE = ();     }; 
   GLOBAL = {
       ENTER = ("setSpeedFactorTo: 1.0", "setStateTo: ATTACK_SHIP"); 
       EXIT = (); 
       UPDATE = (); 
   }; 
}

BACK