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.
198 lines
6.8 KiB
Smarty
198 lines
6.8 KiB
Smarty
|
|
//------------------------------------------------------------------
|
|
// NOTE: The fsm name below MUST be changed in order for the
|
|
// script to be considered a unique entity!
|
|
|
|
UIFIELDS
|
|
{
|
|
FIELD< INT,attackRange,"Attack Range",500>; // At what range do I start shooting?
|
|
FIELD< INT,withdrawRange,"Withdraw Range",750>; // At what range do I withdraw from combat entirely?
|
|
|
|
FIELD< INT,path,"Path",-1>; // My path
|
|
FIELD< INT,moveType,"Nocycle = 1, Circle = 2, Seesaw = 3",2>; // How I move along the path
|
|
|
|
FIELD< INT,piloting,"Piloting Skill",50>; // Piloting skill
|
|
FIELD< INT,gunnery,"Gunnery Skill",50>; // Gunnery skill/chance to hit
|
|
FIELD< FLOAT,minDelay,"Minimum fire Delay",1.0>; // Minimum amount of time I will wait between shots once a weapon is reloaded
|
|
FIELD< FLOAT,maxDelay,"Maximum fire Delay",2.0>; // Maximum amount of time I will wait between shots once a weapon is reloaded
|
|
FIELD< INT,eliteLevel,"Elite Level",60>; // Elite level. This helps determine tactics, defensive manuevers, opportunity fire
|
|
// and other things. It indicates a general level of combat experience.
|
|
FIELD< INT,isShotRadius,"Is Shot Radius",120>; // How far away from me will I detect an enemy shot?
|
|
|
|
FIELD<INT, speed,"Movement Speed",600>;
|
|
FIELD<INT, takeOffDistance,"Take Off Distance (ignored if not a plane)",160>;
|
|
FIELD<INT, attackThrottle,"Percent throttle when in combat",80>;
|
|
FIELD<INT, groupNumber,"What group has this unit been placed in? (in mission script)",11>;
|
|
FIELD<INT, formationType,"What formation type? (from ai.formations in content\ai)",1>;
|
|
}
|
|
|
|
fsm Generic_ArmedConvoy : integer;
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Generic_ArmedConvoy:
|
|
// Follows a path but breaks off to attack enemies.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
// 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 attacking?
|
|
static integer withdrawRange; // At what range do I withdraw from combat?
|
|
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 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 findTypes; // What kind of enemies to look for
|
|
|
|
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
|
|
|
|
// Variables set by editor
|
|
attackRange = <attackRange>;
|
|
withdrawRange = <withdrawRange>;
|
|
path = <path>;
|
|
moveType = <moveType>;
|
|
speed = <speed>;
|
|
takeOffDistance = <takeOffDistance>;
|
|
piloting = <piloting>;
|
|
gunnery = <gunnery>;
|
|
minDelay = <minDelay>;
|
|
maxDelay = <maxDelay>;
|
|
eliteLevel = <eliteLevel>;
|
|
isShotRadius = <isShotRadius>;
|
|
attackThrottle = <attackThrottle>;
|
|
groupNumber = <groupNumber>;
|
|
formationType = <formationType>;
|
|
|
|
|
|
formationDensity= formtype_sparse;
|
|
|
|
// driver settings
|
|
attackSound = -1; // no sound
|
|
deathSound = -1; // no sound
|
|
mood = NEUTRAL_START;
|
|
findTypes = FT_DEFAULT;
|
|
|
|
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(attackRange,findTypes)) then
|
|
trans AttackState;
|
|
endif;
|
|
|
|
if (path <> -1) then
|
|
OrderFormationMove((groupobjectid(groupNumber)),path,speed,moveType,formationType,formationDensity,false);
|
|
else
|
|
OrderMoveLookOut;
|
|
endif;
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// AttackState: attack my target
|
|
//------------------------------------------------------------------
|
|
|
|
state AttackState;
|
|
code
|
|
if (LeaveAttackState(withdrawRange)) then
|
|
OrderStopAttacking;
|
|
SetTarget(ME,NO_UNIT);
|
|
trans FollowPathState;
|
|
endif;
|
|
|
|
if (attackSound <> -1) then
|
|
PlaySoundOnce(attackSound);
|
|
endif;
|
|
|
|
OrderAttack(true);
|
|
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// DeadState: OK, I kicked the bucket.
|
|
//------------------------------------------------------------------
|
|
|
|
state DeadState;
|
|
code
|
|
if (deathSound <> -1) then
|
|
PlaySoundOnce(deathSound);
|
|
endif;
|
|
|
|
orderDie;
|
|
|
|
endstate;
|
|
|
|
|
|
endfsm.
|
|
|