Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
133 lines
3.4 KiB
Plaintext
133 lines
3.4 KiB
Plaintext
|
|
fsm DodgeBot : integer;
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// SniperBot: Level 5
|
|
// Very good aim, but not very good at maneuvering.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
// Constants
|
|
//------------------------------------------------------------------
|
|
|
|
const
|
|
#include_ <content\ABLScripts\mwconst.abi>
|
|
|
|
//------------------------------------------------------------------
|
|
// Types
|
|
//------------------------------------------------------------------
|
|
|
|
type
|
|
#include_ <content\ABLScripts\mwtype.abi>
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
// Variables
|
|
//------------------------------------------------------------------
|
|
|
|
var
|
|
static integer attackRange; // At what range do I start shooting?
|
|
static integer withdrawRange; // At what range do I withdraw?
|
|
static integer bot_activated_timer;
|
|
|
|
//------------------------------------------------------------------
|
|
// Init: my initialization function
|
|
//------------------------------------------------------------------
|
|
|
|
function Init;
|
|
code
|
|
// script-specific variables
|
|
attackRange = 9999;
|
|
withdrawRange = 9999;
|
|
|
|
// driver settings
|
|
SetFiringDelay (ME,0.0,2.5);
|
|
SetIgnoreFriendlyFire (ME,true);
|
|
SetIsShotRadius (ME,160);
|
|
SetEntropyMood (ME,NEUTRAL_START);
|
|
SetCurMood (ME,NEUTRAL_START);
|
|
SetSkillLevel (ME,75,110,60);
|
|
SetAttackThrottle (ME,60);
|
|
|
|
bot_activated_timer = gti_Timer_1;
|
|
|
|
endfunction;
|
|
|
|
//------------------------------------------------------------------
|
|
// StartState: my initial state
|
|
//------------------------------------------------------------------
|
|
|
|
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
|
|
trans WaitToAmbushState;
|
|
endif;
|
|
//---------------------------------------------
|
|
// Firing upon/near before timer up lets the bot go play
|
|
//---------------------------------------------
|
|
if (IsShot(ME) == TRUE) then
|
|
SetTarget(ME,WhoShot(ME));
|
|
trans WaitToAmbushState;
|
|
endif;
|
|
trans CheckTimer;
|
|
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// WaitInAmbushState: wait for someone to come close enough to attack
|
|
//------------------------------------------------------------------
|
|
|
|
state WaitToAmbushState;
|
|
code
|
|
if (Bot_FindEnemy(attackrange)) then
|
|
trans AttackState;
|
|
endif;
|
|
|
|
OrderMoveLookOut;
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// AttackState: the ambush is over -- let's kick some ass!
|
|
//------------------------------------------------------------------
|
|
|
|
state AttackState;
|
|
code
|
|
if (LeaveAttackState(withdrawRange)) then
|
|
trans WaitToAmbushState;
|
|
endif;
|
|
|
|
OrderAttackTactic(TACTIC_LOCAL_PATROL,TRUE);
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// DeadState: OK, I kicked the bucket.
|
|
//------------------------------------------------------------------
|
|
|
|
state DeadState;
|
|
code
|
|
orderDie;
|
|
|
|
endstate;
|
|
|
|
|
|
endfsm.
|
|
|