fsm EasyBot : integer; const #include_ type #include_ var static integer attackRange; // At what range do I start shooting? static integer withdrawRange; // At what range do I withdraw? static ObjectID mymech; static integer mytactic; static integer pilotskill; static integer gunneryskill; static integer commandskill; static integer hits; static ObjectID shooter; static integer bot_activated_timer; static integer death; static integer deathbucket; static integer kills; static integer killsbucket; static integer adjust; function Init; code // Editable Settings. // // 10 can't hit the barn // 100 deadly shot // 999 never miss pilotskill = 80; gunneryskill = 10; // 70 is Average commandskill = 30; // End of Editable Settings // script-specific variables hits = 0; adjust = 0; attackRange = 9999; withdrawRange = 9999; // driver settings SetFiringDelay (ME,0.0,0.0); SetIgnoreFriendlyFire (ME,true); SetIsShotRadius (ME,200); SetEntropyMood (ME,AGRESSIVE_END); SetCurMood (ME,AGRESSIVE_END); SetSkillLevel (ME,pilotskill,gunneryskill,commandskill); SetAttackThrottle (ME,100); SetMinSpeed (ME,100); EnablePerWeaponRayCasting (ME,TRUE); bot_activated_timer = gti_Timer_1; endfunction; function getmechsettactic; var integer i; code mymech = GetMechType(me); mytactic = TACTIC_PICK_BEST; switch (mymech) Case FirstMechID: mytactic = TACTIC_PICK_BEST; Endcase; Case M_ArcticWolf: mytactic = TACTIC_HIT_AND_RUN; Endcase; Case M_Ares: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Argus: mytactic = TACTIC_FAST_CIRCLE; Endcase; Case M_Atlas: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Awesome: mytactic = TACTIC_SNIPE; Endcase; Case M_BlackKnight: mytactic = TACTIC_SNIPE; Endcase; Case M_BlackLanner: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Brigand: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Bushwacker: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Catapult: mytactic = TACTIC_SNIPE; Endcase; Case M_CauldronBorn: mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Chimera: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Commando: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Cougar: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Cyclops: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Daishi: mytactic = TACTIC_SNIPE; Endcase; Case M_Deimos: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Dragon: mytactic = TACTIC_SNIPE; Endcase; Case M_Flea: mytactic = TACTIC_HIT_AND_RUN; Endcase; Case M_Fafnir: mytactic = TACTIC_SNIPE; Endcase; Case M_Gladiator: mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Grizzly: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Hauptmann : mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Hellhound: mytactic = TACTIC_HIT_AND_RUN; Endcase; Case M_Hellspawn: mytactic = TACTIC_HIT_AND_RUN; Endcase; Case M_Highlander: mytactic = TACTIC_SNIPE; Endcase; Case M_HollanderII: mytactic = TACTIC_SNIPE; Endcase; Case M_Hunchback: mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Kodiak: mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Loki: mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Longbow: mytactic = TACTIC_SNIPE; Endcase; Case M_Madcat: mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Madcat_MKII: mytactic = TACTIC_JUMP_AND_SHOOT; Endcase; Case M_Masakari: mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Mauler: mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Novacat: mytactic = TACTIC_SNIPE; Endcase; Case M_Osiris: mytactic = TACTIC_HIT_AND_RUN; Endcase; Case M_Owens : mytactic = TACTIC_HIT_AND_RUN; Endcase; Case M_Puma: mytactic = TACTIC_JUMP_AND_SHOOT; Endcase; Case M_Raven: mytactic = TACTIC_HIT_AND_RUN; Endcase; Case M_Ryoken: mytactic = TACTIC_HIT_AND_RUN; Endcase; Case M_Shadowcat: mytactic = TACTIC_JUMP_AND_SHOOT; Endcase; Case M_Solitaire: mytactic = TACTIC_PICK_BEST; Endcase; Case M_Sunder: mytactic = TACTIC_SNIPE; Endcase; Case M_Templar: mytactic = TACTIC_SNIPE; Endcase; Case M_Thanatos: mytactic = TACTIC_JUMP_AND_SHOOT; Endcase; Case M_Thor: mytactic = TACTIC_JUMP_AND_SHOOT; Endcase; Case M_Uller: mytactic = TACTIC_HIT_AND_RUN; Endcase; Case M_Uziel: mytactic = TACTIC_JUMP_AND_SHOOT; Endcase; Case M_Victor: mytactic = TACTIC_SNIPE; Endcase; Case M_Vulture: mytactic = TACTIC_SNIPE; Endcase; Case M_Wolfhound: mytactic = TACTIC_CIRCLE_OF_DEATH; Endcase; Case M_Zeus: mytactic = TACTIC_SNIPE; Endcase; Case NoMechID: mytactic = TACTIC_PICK_BEST; Endcase; Endswitch; endfunction; state StartState; code StartTimer(bot_activated_timer); trans CheckTimer; endstate; state CheckTimer; code //--------------------------------------------- // Time before Bot Wakes up and starts Shooting //--------------------------------------------- if (TimeGreater(bot_activated_timer,5.0)) then getmechsettactic; trans WaitToAmbushState; endif; //--------------------------------------------- // Firing upon/near before timer up lets the bot go play //--------------------------------------------- if (IsShot(ME) == TRUE) then SetTarget(ME,WhoShot(ME)); getmechsettactic; trans WaitToAmbushState; endif; trans CheckTimer; endstate; state WaitToAmbushState; code if (Bot_FindEnemy(attackrange)) then trans AttackState; endif; if ((isshot(me)) == true) then hits = hits + 1; if (hits > 100) then hits = 100; endif; shooter = Whoshot(me); SetTarget (me,shooter); SetTargetDesirability(shooter, hits); endif; OrderMoveLookOut; endstate; state AttackState; code if (LeaveAttackState(withdrawRange)) then trans WaitToAmbushState; endif; if ((isshot(me)) == true) then hits = hits + 1; if (hits > 100) then hits = 100; endif; shooter = Whoshot(me); SetTarget (me,shooter); SetTargetDesirability(shooter, hits); endif; OrderAttackTactic(TACTIC_STARE,TRUE); endstate; state DeadState; code shooter = WhoDestroyed(me); SetTargetDesirability(shooter, 20); orderDie; endstate; endfsm.