Files
firestorm/Gameleap/mw4/Content/ABLScripts/GenericScripts/Generic_UnarmedConvoy.abl
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
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.
2026-06-24 21:28:16 -05:00

175 lines
5.4 KiB
Plaintext

//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_UnarmedConvoy : integer;
//------------------------------------------------------------------
// Generic_UnarmedConvoy:
// Follows a path and but breaks off to run from enemies.
// NOTE: this script requires a CombatAI (or MechAI) to work properly!!!
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer fleeRange; // At what range do I start running?
static integer withdrawRange; // After I've started to flee, at what range can I forget about my enemy and return to the convoy?
static integer groupNumber; // What's my group -- i.e. I will use GroupObjectID(groupNumber) to identify my group
static integer speed; // The speed at which I move along the path
static integer formationType; // What kind of formation am I in?
static integer formationDensity; // How densely are we packed?
static integer path; // My path
static integer moveType; // How I move along the path
static integer fleeSpeed; // How fast I flee
static integer piloting; // Piloting skill
static integer gunnery; // Gunnery skill/chance to hit
static real minDelay; // Minimum amount of time I will wait between shots once a weapon is reloaded
static real maxDelay; // Maximum amount of time I will wait between shots once a weapon is reloaded
static integer eliteLevel; // Elite level. This helps determine tactics, defensive manuevers, opportunity fire
// and other things. It indicates a general level of combat experience.
static integer attackThrottle; // My attack throttle
static integer isShotRadius; // How far away from me will I detect an enemy shot?
static integer attackSound; // The attack sound I play when I first attack
static integer deathSound; // The sound I play when I die
static integer mood; // My default mood.
static integer takeOffDistance; // My take-off distance if I'm an airplane (ignored if not an airplane)
//------------------------------------------------------------------
// Init: my initialization function
//------------------------------------------------------------------
function Init;
code
// script-specific variables
fleeRange = 500;
withdrawRange = fleeRange * 3 / 2;
groupNumber = 0;
path = -1;
moveType = move_nocycle;
speed = 50;
formationType = 1;
formationDensity= formtype_sparse;
fleeSpeed = 600;
takeOffDistance = 150;
// driver settings
piloting = 50;
gunnery = 30;
minDelay = 1.5;
maxDelay = 3.0;
eliteLevel = 30;
attackThrottle = 80;
isShotRadius = 120;
attackSound = -1; // no sound
deathSound = -1; // no sound
mood = NEUTRAL_START;
endfunction;
//------------------------------------------------------------------
// StartState: my initial state
//------------------------------------------------------------------
state StartState;
code
SetFiringDelay (ME,minDelay,maxDelay);
SetIgnoreFriendlyFire (ME,true);
SetIsShotRadius (ME,isShotRadius);
SetEntropyMood (ME,mood);
SetCurMood (ME,mood);
SetSkillLevel (ME,piloting,gunnery,eliteLevel);
SetAttackThrottle (ME,attackThrottle);
if (orderTakeOff(takeOffDistance) == true) then
trans FollowPathState;
endif;
endstate;
//------------------------------------------------------------------
// FollowPathState: follow our path, but keep an eye out for enemies
//------------------------------------------------------------------
state FollowPathState;
code
if (FindEnemy(fleeRange,FT_DEFAULT)) then
trans FleeState;
endif;
if (path <> -1) then
OrderFormationMove((groupobjectid(groupNumber)),path,speed,moveType,formationType,formationDensity,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// FleeState: run away from my target
//------------------------------------------------------------------
state FleeState;
code
if (LeaveAttackState(withdrawRange)) then
ClearMoveOrder(ME);
SetTarget(ME,NO_UNIT);
trans FollowPathState;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderMoveFlee(GetTarget(ME),fleeSpeed);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.