home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2002 January / maximum-cd-2002-01.iso / Files / Mechwarrior 4 Mapping / MW4Editor.exe / content / ABLScripts / Bots / RookieBot.abl < prev    next >
Encoding:
Text File  |  2001-07-16  |  2.8 KB  |  107 lines

  1.  
  2. fsm RookieBot : integer;
  3.  
  4.  
  5. //------------------------------------------------------------------
  6.  
  7. // RookieBot:
  8. //   A moderately easy opponent, less of a pushover than the EasyBot
  9. //   but less of a challenge than the KillerBot.
  10.  
  11. //------------------------------------------------------------------
  12.  
  13.  
  14. //------------------------------------------------------------------
  15. //     Constants
  16. //------------------------------------------------------------------
  17.  
  18.     const
  19.         #include_ <content\ABLScripts\mwconst.abi>
  20.  
  21. //------------------------------------------------------------------
  22. //     Types
  23. //------------------------------------------------------------------
  24.  
  25.     type
  26.         #include_ <content\ABLScripts\mwtype.abi>
  27.     
  28.  
  29. //------------------------------------------------------------------
  30. //     Variables
  31. //------------------------------------------------------------------
  32.  
  33.     var
  34.         static integer            attackRange;        // At what range do I start shooting?
  35.         static integer            withdrawRange;        // At what range do I withdraw?
  36.  
  37. //------------------------------------------------------------------
  38. //     Init: my initialization function
  39. //------------------------------------------------------------------
  40.  
  41. function Init;
  42.     code
  43.         // script-specific variables
  44.         attackRange        = 9999;
  45.         withdrawRange    = 9999;
  46.  
  47.         // driver settings
  48.         SetFiringDelay            (ME,1.0,4.0);
  49.         SetIgnoreFriendlyFire    (ME,true);
  50.         SetIsShotRadius            (ME,120);
  51.         SetEntropyMood            (ME,NEUTRAL_START);
  52.         SetCurMood                (ME,NEUTRAL_START);
  53.         SetSkillLevel            (ME,30,35,30);
  54.         SetAttackThrottle        (ME,60);
  55.  
  56. endfunction;
  57.  
  58. //------------------------------------------------------------------
  59. //    StartState: my initial state
  60. //------------------------------------------------------------------
  61.  
  62. state StartState;
  63.     code
  64.         trans WaitToAmbushState;
  65.  
  66. endstate;
  67.  
  68. //------------------------------------------------------------------
  69. //    WaitInAmbushState: wait for someone to come close enough to attack
  70. //------------------------------------------------------------------
  71.  
  72. state WaitToAmbushState;
  73.     code
  74.         if (Bot_FindEnemy(attackrange)) then
  75.             trans AttackState;
  76.         endif;
  77.  
  78.         OrderMoveLookOut;
  79. endstate;
  80.  
  81. //------------------------------------------------------------------
  82. //    AttackState: the ambush is over -- let's kick some ass!
  83. //------------------------------------------------------------------
  84.  
  85. state AttackState;
  86.     code
  87.         if (LeaveAttackState(withdrawRange)) then
  88.             trans WaitToAmbushState;
  89.         endif;
  90.  
  91.         OrderAttack(TRUE);
  92. endstate;
  93.  
  94. //------------------------------------------------------------------
  95. //    DeadState: OK, I kicked the bucket.
  96. //------------------------------------------------------------------
  97.  
  98. state DeadState;
  99.     code
  100.         orderDie;
  101.  
  102. endstate;
  103.  
  104.  
  105. endfsm.
  106.  
  107.