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.
140 lines
3.5 KiB
Plaintext
140 lines
3.5 KiB
Plaintext
|
|
//------------------------------------------------------------------
|
|
// NOTE: The fsm name below MUST be changed in order for the
|
|
// script to be considered a unique entity!
|
|
|
|
fsm Gun_Turret : integer;
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Generic_Turret:
|
|
// This shoots anything that comes near, but never moves.
|
|
// It can be used for turrets.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
// 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 stop attacking?
|
|
|
|
static integer piloting; // Piloting skill
|
|
static integer gunnery; // Gunnery skill/chance to hit
|
|
static integer eliteLevel; // Elite level. This helps determine tactics, defensive manuevers, opportunity fire
|
|
|
|
//------------------------------------------------------------------
|
|
// Init: my initialization function
|
|
//------------------------------------------------------------------
|
|
|
|
function Init;
|
|
code
|
|
// script-specific variables
|
|
attackRange = 900;
|
|
withdrawRange = 901;
|
|
|
|
// driver settings
|
|
piloting = 100;
|
|
gunnery = 999;
|
|
eliteLevel = 100;
|
|
|
|
EnablePerWeaponRayCasting (ME,TRUE);
|
|
|
|
endfunction;
|
|
|
|
//------------------------------------------------------------------
|
|
// StartState: my initial state
|
|
//------------------------------------------------------------------
|
|
|
|
state StartState;
|
|
|
|
code
|
|
SetFiringDelay (ME,0.0,0.0);
|
|
SetIgnoreFriendlyFire (ME,true);
|
|
SetIsShotRadius (ME,120);
|
|
SetEntropyMood (ME,AGRESSIVE_END);
|
|
SetCurMood (ME,AGRESSIVE_END);
|
|
SetSkillLevel (ME,100,999,100);
|
|
|
|
trans WaitState;
|
|
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// WaitState: wait for someone to come near
|
|
//------------------------------------------------------------------
|
|
|
|
state WaitState;
|
|
code
|
|
if (IsShot(ME) == TRUE) then
|
|
SetTarget(ME,WhoShot(ME));
|
|
trans AttackState;
|
|
endif;
|
|
|
|
if (Bot_FindEnemy(attackrange)) then
|
|
trans AttackState;
|
|
endif;
|
|
|
|
SetSensorVisibility(ME,TRUE);
|
|
OrderMoveLookOut;
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// AttackState: let's see what's around, and destroy it
|
|
//------------------------------------------------------------------
|
|
|
|
state AttackState;
|
|
code
|
|
if (LeaveAttackState(withdrawRange)) then
|
|
OrderStopAttacking;
|
|
SetTarget(ME,NO_UNIT);
|
|
trans WaitState;
|
|
endif;
|
|
|
|
if (IsShot(ME) == TRUE) then
|
|
SetTarget(ME,WhoShot(ME));
|
|
endif;
|
|
|
|
SetSensorVisibility(ME,TRUE);
|
|
OrderAttackTactic(TACTIC_SHOOT_ONLY,true);
|
|
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// DeadState: OK, I kicked the bucket.
|
|
//------------------------------------------------------------------
|
|
|
|
state DeadState;
|
|
code
|
|
orderDie;
|
|
|
|
endstate;
|
|
|
|
|
|
endfsm.
|
|
|
|
|
|
|
|
|
|
|