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.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
@@ -0,0 +1,197 @@
//------------------------------------------------------------------
// 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.
@@ -0,0 +1,199 @@
//------------------------------------------------------------------
// 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,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, takeOffDistance,"Take Off Distance (ignored if not a plane)",160>;
FIELD<INT, attackThrottle,"Percent throttle when in combat",80>;
FIELD<INT, groupToAttack,"what group of objects am I attacking?",12>;
}
fsm Generic_AttackList : integer;
//------------------------------------------------------------------
// Generic_AttackList:
// This script can be used to attack (or defend) a series of targets
// contained in a group. The unit will use a specified tactic
// on the first living target in the group, and if that unit is
// destroyed, it will switch to the next one. When there are no
// units left in the group, it will go on a rampage, attacking
// any enemies it can find.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer AttackRange; // When all my targets are destroyed, at what range do I start shooting?
static integer myGroupID; // The ID of my group ... i.e. this script will
// call GroupObjectID(groupID)
static integer tactic; // The tactic to use to attack (or defend) my targets
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
// Variables set by editor
attackRange = <attackRange>;
withdrawRange = <withdrawRange>;
takeOffDistance = <takeOffDistance>;
piloting = <piloting>;
gunnery = <gunnery>;
minDelay = <minDelay>;
maxDelay = <maxDelay>;
eliteLevel = <eliteLevel>;
isShotRadius = <isShotRadius>;
attackThrottle = <attackThrottle>;
myGroupID = <groupToAttack>;
tactic = TACTIC_PICK_BEST;
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 AttackFirstLivingTargetState;
endif;
endstate;
//------------------------------------------------------------------
// AttackFirstLivingTargetState: get the first object in my group, set
// it as my target, and issue the attack order with my tactic
//------------------------------------------------------------------
state AttackFirstLivingTargetState;
var
ObjectID next_target;
code
if (GetTarget(ME) == NO_UNIT) then
next_target = GroupGetFirstObject(GroupObjectID(myGroupID));
if (next_target == NO_UNIT) then
trans RampageState;
endif;
SetTarget(ME,next_target);
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttackTactic(tactic,TRUE);
endstate;
//------------------------------------------------------------------
// RampageState: no targets remain -- let's kick some ass!
//------------------------------------------------------------------
state RampageState;
code
if (GetTarget(ME) == NO_UNIT) then
FindEnemy(AttackRange,FT_DEFAULT);
endif;
if (GetTarget(ME) <> NO_UNIT) then
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(TRUE);
endif;
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,155 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_Ambush : integer;
//------------------------------------------------------------------
// Generic_Ambush:
// Shuts down, waits until an enemy comes near, and then attacks.
//------------------------------------------------------------------
//------------------------------------------------------------------
// 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 from combat entirely?
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
attackRange = 500;
withdrawRange = 2000;
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 WaitToAmbushState;
endif;
endstate;
//------------------------------------------------------------------
// WaitInAmbushState: wait for someone to come close enough to attack
//------------------------------------------------------------------
state WaitToAmbushState;
code
Shutdown(ME);
if (FindEnemy(attackrange,FT_DEFAULT)) then
trans AttackState;
endif;
endstate;
//------------------------------------------------------------------
// AttackState: the ambush is over -- let's kick some ass!
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
trans WaitToAmbushState;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
Startup(ME);
OrderAttack(TRUE);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,171 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
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
// script-specific variables
attackRange = 500;
withdrawRange = attackRange * 3 / 2;
groupNumber = 0;
path = -1;
moveType = move_nocycle;
speed = 50;
formationType = 1;
formationDensity= formtype_sparse;
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;
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.
@@ -0,0 +1,179 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_AttackList : integer;
//------------------------------------------------------------------
// Generic_AttackList:
// This script can be used to attack (or defend) a series of targets
// contained in a group. The unit will use a specified tactic
// on the first living target in the group, and if that unit is
// destroyed, it will switch to the next one. When there are no
// units left in the group, it will go on a rampage, attacking
// any enemies it can find.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer rampageAttackRange; // When all my targets are destroyed, at what range do I start shooting?
static integer myGroupID; // The ID of my group ... i.e. this script will
// call GroupObjectID(groupID)
static integer tactic; // The tactic to use to attack (or defend) my targets
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
rampageAttackRange = 1200;
myGroupID = 0;
tactic = TACTIC_PICK_BEST;
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 AttackFirstLivingTargetState;
endif;
endstate;
//------------------------------------------------------------------
// AttackFirstLivingTargetState: get the first object in my group, set
// it as my target, and issue the attack order with my tactic
//------------------------------------------------------------------
state AttackFirstLivingTargetState;
var
ObjectID next_target;
code
if (GetTarget(ME) == NO_UNIT) then
next_target = GroupGetFirstObject(GroupObjectID(myGroupID));
if (next_target == NO_UNIT) then
trans RampageState;
endif;
SetTarget(ME,next_target);
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttackTactic(tactic,TRUE);
endstate;
//------------------------------------------------------------------
// RampageState: no targets remain -- let's kick some ass!
//------------------------------------------------------------------
state RampageState;
code
if (GetTarget(ME) == NO_UNIT) then
FindEnemy(rampageAttackRange,FT_DEFAULT);
endif;
if (GetTarget(ME) <> NO_UNIT) then
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(TRUE);
endif;
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,253 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_Defend : integer;
//------------------------------------------------------------------
// Generic_Defend:
// Defend a target, staying near it at all times.
// If it is destroyed, just go on a bloody rampage and attack whoever.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static ObjectID defendTarget1; // First target to defend
static ObjectID defendTarget2; // Second target to defend
static ObjectID defendTarget3; // Third target to defend
static ObjectID defendTarget4; // Fourth target to defend
static ObjectID defendTarget5; // Fifth target to defend
static integer rampageAttackRange; // What is my attack range when my target is destroyed?
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
// script-specific variables
rampageAttackRange = 1200;
// defendTarget*: Specifies the targets to defend, and the order in which
// to defend them. Fill in as many as appropriate,
// Fill "defendTarget1" first, and proceed from there, in order,
// and fill the rest with NO_UNIT. You must fill in at least the first
// defend target; the others are optional.
defendTarget1 = NO_UNIT;
defendTarget2 = NO_UNIT;
defendTarget3 = NO_UNIT;
defendTarget4 = NO_UNIT;
defendTarget5 = NO_UNIT;
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;
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
SetTarget(ME,defendTarget1);
trans Defend1State;
endif;
endstate;
//------------------------------------------------------------------
// Defend1State: defend the first target
//------------------------------------------------------------------
state Defend1State;
code
if (GetTarget(ME) == NO_UNIT) then
if (defendTarget2 <> NO_UNIT) then
SetTarget(ME,defendTarget2);
trans Defend2State;
else
trans RampageState;
endif;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttackTactic(TACTIC_DEFEND,true);
endstate;
//------------------------------------------------------------------
// Defend2State: defend the second target (if it exists)
//------------------------------------------------------------------
state Defend2State;
code
if (GetTarget(ME) == NO_UNIT) then
if (defendTarget3 <> NO_UNIT) then
SetTarget(ME,defendTarget3);
trans Defend3State;
else
trans RampageState;
endif;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttackTactic(TACTIC_DEFEND,true);
endstate;
//------------------------------------------------------------------
// Defend3State: defend the third target (if it exists)
//------------------------------------------------------------------
state Defend3State;
code
if (GetTarget(ME) == NO_UNIT) then
if (defendTarget4 <> NO_UNIT) then
SetTarget(ME,defendTarget4);
trans Defend4State;
else
trans RampageState;
endif;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttackTactic(TACTIC_DEFEND,true);
endstate;
//------------------------------------------------------------------
// Defend4State: defend the fourth target (if it exists)
//------------------------------------------------------------------
state Defend4State;
code
if (GetTarget(ME) == NO_UNIT) then
if (defendTarget5 <> NO_UNIT) then
SetTarget(ME,defendTarget5);
trans Defend5State;
else
trans RampageState;
endif;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttackTactic(TACTIC_DEFEND,true);
endstate;
//------------------------------------------------------------------
// Defend5State: defend the fifth target (if it exists)
//------------------------------------------------------------------
state Defend5State;
code
if (GetTarget(ME) == NO_UNIT) then
trans RampageState;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttackTactic(TACTIC_DEFEND,true);
endstate;
//------------------------------------------------------------------
// RampageState: I will have my revenge, in this life or the next!
//------------------------------------------------------------------
state RampageState;
code
if (FindEnemy(rampageAttackRange,findTypes)) then
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(TRUE);
endif;
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,168 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_Patrol : integer;
//------------------------------------------------------------------
// Generic_Patrol:
// Follows a path. If anything comes near, it goes off and attacks it,
// and then comes back to the path when there's nothing left to attack.
//------------------------------------------------------------------
//------------------------------------------------------------------
// 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 from combat entirely?
static integer path; // My path
static integer moveType; // How I move along the path
static boolean canLeavePath; // Can I leave the path if attacked? (TRUE by default)
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 speed; // The speed at which I move along the path
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
attackRange = 500;
withdrawRange = attackrange * 3 / 2;
path = -1;
moveType = move_circle;
canLeavePath = true;
speed = 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;
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
OrderMoveResumePatrol(path,speed,moveType,true,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// AttackState: attack my current target, or return to path if done
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowPathState;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(canLeavePath);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,191 @@
//------------------------------------------------------------------
// 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>;
}
fsm Generic_Patrol : integer;
//------------------------------------------------------------------
// Generic_Patrol:
// Follows a path. If anything comes near, it goes off and attacks it,
// and then comes back to the path when there's nothing left to attack.
//------------------------------------------------------------------
//------------------------------------------------------------------
// 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 from combat entirely?
static integer path; // My path
static integer moveType; // How I move along the path
static boolean canLeavePath; // Can I leave the path if attacked? (TRUE by default)
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 speed; // The speed at which I move along the path
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
attackRange = <attackrange>;
withdrawRange = <withdrawrange>;
path = <path>;
moveType = <movetype>;
canLeavePath = true;
speed = <speed>;
takeOffDistance = <takeoffdistance>;
// driver settings
piloting = <piloting>;
gunnery = <gunnery>;
minDelay = <mindelay>;
maxDelay = <maxdelay>;
eliteLevel = <elitelevel>;
attackThrottle = 80;
isShotRadius = <isshotradius>;
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
OrderMoveResumePatrol(path,speed,moveType,true,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// AttackState: attack my current target, or return to path if done
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowPathState;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(canLeavePath);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,219 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_PatrolAlly : integer;
//------------------------------------------------------------------
// Generic_PatrolAlly:
// Follow a path. Move to attack anything that comes within range,
// and return to the path when done.
// Whenever we get within a certain range of a target unit,
// we follow that unit, and continue to attack any enemies.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer attackRange1; // At what range do I start shooting?
static integer withdrawRange1; // At what range do I withdraw from combat completely?
static integer path; // What path do I follow?
static integer moveType; // How I move along the path
static integer speed; // The speed at which I move along the path
static ObjectID whoToJoin; // Who do I want to join?
static integer joinRange; // At what range do I join my leader?
static integer followXOffset; // My follow X offset
static integer followYOffset; // My follow Y offset
static integer attackRange2; // At what range do I start shooting (after joining)?
static integer withdrawRange2; // At what range do I stop shooting (after joining)?
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 findTypes; // What kind of enemies to look for
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
attackRange1 = 500;
withdrawRange1 = attackRange1 * 3 / 2;
path = -1;
moveType = move_circle;
speed = 600;
whoToJoin = NO_UNIT;
joinRange = 500;
followXOffset = 0;
followYOffset = 50;
attackRange2 = attackRange1;
withdrawRange2 = attackRange2 * 3 / 2;
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;
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: wait for something to shoot
//------------------------------------------------------------------
state FollowPathState;
code
if (IsWithin(ME,whoToJoin,joinRange)) then
trans FollowState;
endif;
if (FindEnemy(attackRange1,findTypes)) then
trans Attack1State;
endif;
if (path <> -1) then
OrderMoveResumePatrol(path,speed,moveType,true,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// Attack1State: look for something to shoot
//------------------------------------------------------------------
state Attack1State;
code
if (LeaveAttackState(withdrawRange1)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowPathState;
endif;
if (IsWithin(ME,whoToJoin,joinRange)) then
trans Attack2State;
endif;
OrderAttack(true);
endstate;
//------------------------------------------------------------------
// FollowState: follow the chosen unit
//------------------------------------------------------------------
state FollowState;
code
if (FindEnemy(attackRange2,findTypes)) then
trans Attack2State;
endif;
OrderMoveFollow(whoToJoin,followXOffset,followYOffset);
endstate;
//------------------------------------------------------------------
// Attack2State: look for something to shoot
//------------------------------------------------------------------
state Attack2State;
code
if (LeaveAttackState(withdrawRange2)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowState;
endif;
OrderAttack(true);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,238 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_PatrolRespond : integer;
//------------------------------------------------------------------
// Generic_PatrolRespond:
// Follows a path. If anything comes near, it goes off and attacks it,
// and then comes back to the path when there's nothing left to attack.
// When a specific trigger is set, it goes to another point or path
// and does the same thing.
// I.e. this is the same as Generic_Patrol, except that it
// goes to a second point or path upon firing of a trigger.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer attackRange1; // The range at which I start attacking if in the original patrol
static integer withdrawRange1; // The range at which I withdraw from combat entirely
static integer path1; // My original path
static integer moveType1; // How I move along the path
static boolean canLeavePath1; // Can I leave the path if attacked? (TRUE by default)
static integer speed1; // The speed at which I move along the path
static integer triggerID; // The trigger that will move me from my original patrol state to my new patrol state
static integer attackRange2; // The range at which I start attacking after the trigger has fired
static integer withdrawRange2; // The range at which I withdraw from combat entirely
static integer path2; // My path after the trigger fires
static integer moveType2; // How I move along the second path
static boolean canLeavePath2; // Can I leave the second path if attacked? (TRUE by default)
static integer speed2; // The speed at which I move along the second 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 findTypes; // What kind of enemies to look for
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
attackRange1 = 500;
withdrawRange1 = attackRange1 * 3 / 2;
path1 = -1;
moveType1 = move_circle;
canLeavePath1 = true;
speed1 = 600;
triggerID = 1;
attackRange2 = 500;
withdrawRange2 = attackRange2 * 3 / 2;
path2 = -1;
moveType2 = move_circle;
canLeavePath2 = true;
speed2 = 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;
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 FollowPath1State;
endif;
endstate;
//------------------------------------------------------------------
// FollowPath1State: follow the original path, but keep an eye out for enemies
//------------------------------------------------------------------
state FollowPath1State;
code
if (GetGlobalTrigger(triggerID)) then
trans FollowPath2State;
endif;
if (FindEnemy(attackRange1,findTypes)) then
trans Attack1State;
endif;
if (path1 <> -1) then
OrderMoveResumePatrol(path1,speed1,moveType1,true,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// Attack1State: attack my current target, or return to original path if done
//------------------------------------------------------------------
state Attack1State;
code
if (GetGlobalTrigger(triggerID)) then
trans Attack2State;
endif;
if (LeaveAttackState(withdrawRange1)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowPath1State;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(canLeavePath1);
endstate;
//------------------------------------------------------------------
// FollowPath2State: follow the second path, but keep an eye out for enemies
//------------------------------------------------------------------
state FollowPath2State;
code
if (FindEnemy(attackRange2,findTypes)) then
trans Attack2State;
endif;
if (path2 <> -1) then
OrderMoveResumePatrol(path2,speed2,moveType2,true,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// Attack2State: attack my current target, or return to second path if done
//------------------------------------------------------------------
state Attack2State;
code
if (LeaveAttackState(withdrawRange2)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowPath2State;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(canLeavePath2);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,207 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_Reinforcement : integer;
//------------------------------------------------------------------
// Generic_Reinforcement:
// Shuts down, waits until a trigger, powers up, moves to a specific
// point (if specified) and attacks anything that comes near
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer attackRange1; // At what range do I start shooting (as I'm moving to the point)?
static integer attackRange2; // At what range do I start shooting (as a reinforcement)?
static integer withdrawRange; // At what range do I stop shooting (as a reinforcement)?
static integer triggerID; // The index of my global trigger
static LocPoint destination; // The destination to move to when ready
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 speed; // What speed so I move at?
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 findTypes; // What kind of enemies to look for
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
attackRange1 = 500;
attackRange2 = 500;
withdrawRange = attackRange2 * 3 / 2;
triggerID = 1;
destination[0] = -1;
destination[1] = -1;
destination[2] = -1;
takeOffDistance = 150;
// driver settings
piloting = 50;
gunnery = 30;
minDelay = 1.5;
maxDelay = 3.0;
elitelevel = 30;
attackThrottle = 80;
speed = 600;
isshotradius = 80;
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);
trans ShutdownAndWaitState;
endstate;
//------------------------------------------------------------------
// ShutdownAndWaitState: shut down and wait for the trigger to be set, then go
//------------------------------------------------------------------
state ShutdownAndWaitState;
code
Shutdown(ME);
if (GetGlobalTrigger(triggerID)) then
if (orderTakeOff(takeOffDistance) == true) then
Startup(ME);
if ((destination[0] == -1) and (destination[1] == -1) and (destination[2] == -1)) then
trans AttackState;
endif;
trans MoveToPointState;
endif;
endif;
endstate;
//------------------------------------------------------------------
// MoveToPointState: go to the destination, and attack when we get there
//------------------------------------------------------------------
state MoveToPointState;
code
if (OrderMoveToLocPoint(destination,speed,true,true)) then
orderstopattacking;
SetTarget(ME,NO_UNIT);
trans WaitAtPointState;
else
if (FindEnemy(attackRange1,findTypes)) then
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(false);
endif;
endif;
endstate;
//------------------------------------------------------------------
// WaitAtPointState: I got to the point; let's look around
//------------------------------------------------------------------
state WaitAtPointState;
code
if (FindEnemy(attackRange2,findTypes)) then
trans AttackState;
endif;
endstate;
//------------------------------------------------------------------
// AttackState: let's find someone and hurt them
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans MoveToPointState;
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.
@@ -0,0 +1,151 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_Sentry : integer;
//------------------------------------------------------------------
// Generic_Sentry:
// Stands still. Moves to attack anything that comes near.
//
//------------------------------------------------------------------
//------------------------------------------------------------------
// 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 from combat completely?
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 findTypes; // What kind of enemies to look for
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
attackRange = 500;
withdrawRange = attackRange * 3 / 2;
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;
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 WaitState;
endif;
endstate;
//------------------------------------------------------------------
// WaitState: wait for something to shoot
//------------------------------------------------------------------
state WaitState;
code
OrderMoveLookOut;
if (FindEnemy(attackRange,findTypes)) then
trans AttackState;
endif;
endstate;
//------------------------------------------------------------------
// AttackState: look for something to shoot
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans WaitState;
endif;
OrderAttack(true);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,208 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_SentryAlly : integer;
//------------------------------------------------------------------
// Generic_SentryAlly:
// Stands still. Move to attack anything that comes within range.
// Whenever we get within a certain range of a target unit,
// we follow that unit, and continue to attack any enemies.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer attackRange1; // At what range do I start shooting?
static integer withdrawRange1; // At what range do I withdraw from combat completely?
static ObjectID whoToJoin; // Who do I want to join?
static integer joinRange; // At what range do I join my leader?
static integer followXOffset; // My follow X offset
static integer followYOffset; // My follow Y offset
static integer attackRange2; // At what range do I start shooting (after joining)?
static integer withdrawRange2; // At what range do I stop shooting (after joining)?
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 findTypes; // What kind of enemies to look for
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
attackRange1 = 500;
withdrawRange1 = attackRange1 * 3 / 2;
whoToJoin = NO_UNIT;
joinRange = 500;
followXOffset = 0;
followYOffset = 50;
attackRange2 = attackRange1;
withdrawRange2 = attackRange2 * 3 / 2;
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;
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 Wait1State;
endif;
endstate;
//------------------------------------------------------------------
// Wait1State: wait for something to shoot
//------------------------------------------------------------------
state Wait1State;
code
OrderMoveLookOut;
if (IsWithin(ME,whoToJoin,joinRange)) then
trans FollowState;
endif;
if (FindEnemy(attackRange1,findTypes)) then
trans Attack1State;
endif;
endstate;
//------------------------------------------------------------------
// Attack1State: look for something to shoot
//------------------------------------------------------------------
state Attack1State;
code
if (LeaveAttackState(withdrawRange1)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans Wait1State;
endif;
if (IsWithin(ME,whoToJoin,joinRange)) then
trans Attack2State;
endif;
OrderAttack(true);
endstate;
//------------------------------------------------------------------
// FollowState: follow the chosen unit
//------------------------------------------------------------------
state FollowState;
code
if (FindEnemy(attackRange2,findTypes)) then
trans Attack2State;
endif;
OrderMoveFollow(whoToJoin,followXOffset,followYOffset);
endstate;
//------------------------------------------------------------------
// Attack2State: look for something to shoot
//------------------------------------------------------------------
state Attack2State;
code
if (LeaveAttackState(withdrawRange2)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowState;
endif;
OrderAttack(true);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,210 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_SentryReinforcement : integer;
//------------------------------------------------------------------
// Generic_SentryReinforcement:
// Performs sentry, attacking anything that comes near.
// Once a trigger is set, goes to a predefined point and
// attacks anything within range at that point.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer attackRange1; // At what range do I start shooting when I'm attacking?
static integer withdrawRange1; // At what range do I give up?
static integer attackRange2; // At what range do I start shooting (as a reinforcement)?
static integer withdrawRange2; // At what range do I stop shooting (as a reinforcement)?
static integer triggerID; // The index of my global trigger
static LocPoint destination; // The destination to move to when ready
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 speed; // What speed so I move at?
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 findTypes; // What kind of enemies to look for
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
attackRange1 = 500;
withdrawRange1 = attackRange1 * 3 / 2;
attackRange2 = 500;
withdrawRange2 = attackRange2 * 3 / 2;
triggerID = 1;
destination[0] = -1;
destination[1] = -1;
destination[2] = -1;
takeOffDistance = 150;
// driver settings
piloting = 50;
gunnery = 30;
minDelay = 1.5;
maxDelay = 3.0;
elitelevel = 30;
attackThrottle = 80;
speed = 600;
isshotradius = 80;
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 WaitState;
endif;
endstate;
//------------------------------------------------------------------
// WaitState: wait something to happen (my original state)
//------------------------------------------------------------------
state WaitState;
code
if (GetGlobalTrigger(triggerID)) then
trans MoveToPointState;
endif;
if (FindEnemy(attackRange1,findTypes)) then
trans Attack1State;
endif;
OrderMoveLookOut;
endstate;
//------------------------------------------------------------------
// Attack1State: attack someone (before I'm called as a reinforcement)
//------------------------------------------------------------------
state Attack1State;
code
if (LeaveAttackState(withdrawRange1)) then
trans WaitState;
endif;
if (GetGlobalTrigger(triggerID)) then
trans Attack2State;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(TRUE);
endstate;
//------------------------------------------------------------------
// MoveToPointState: go to the destination, and attack when we get there
//------------------------------------------------------------------
state MoveToPointState;
code
if (OrderMoveToLocPoint(destination,speed,true,true)) then
OrderStopAttacking;
if (FindEnemy(attackRange2,findTypes)) then
trans Attack2State;
endif;
endif;
endstate;
//------------------------------------------------------------------
// Attack2State: attack a target (after I'm called as a reinforcement)
//------------------------------------------------------------------
state Attack2State;
code
if (LeaveAttackState(withdrawRange2)) then
trans MoveToPointState;
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.
@@ -0,0 +1,168 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_SentryReturn : integer;
//------------------------------------------------------------------
// Generic_SentryReturn:
// Stands still. Moves to attack anything that comes near.
// It will go as far as necessary, but when it runs out of enemies,
// it returns to its original position.
//------------------------------------------------------------------
//------------------------------------------------------------------
// 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 from combat completely?
static integer speed; // My movement speed
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 LocPoint originalPosition; // My original position
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
attackRange = 500;
withdrawRange = attackRange * 2 / 3;
speed = 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
GetLocation(ME,originalPosition);
trans WaitState;
endif;
endstate;
//------------------------------------------------------------------
// WaitState: wait for a target to approach
//------------------------------------------------------------------
state WaitState;
code
if (FindEnemy(attackRange,FT_DEFAULT)) then
trans AttackState;
endif;
if (IsWithinLocPoint(ME,originalPosition,20)) then
OrderMoveLookOut;
else
OrderMoveToLocPoint(originalPosition,speed,true,false);
endif;
endState;
//------------------------------------------------------------------
// AttackState: look for something to shoot
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans WaitState;
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.
@@ -0,0 +1,185 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_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 ObjectID turretTower; // My control tower: if destroyed, I stop firing
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 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
// script-specific variables
attackRange = 500;
withdrawRange = attackRange * 3 / 2;
turretTower = NO_UNIT;
takeOffDistance = 150;
// driver settings
piloting = 50;
gunnery = 30;
minDelay = 1.5;
maxDelay = 3.0;
eliteLevel = 30;
isShotRadius = 120;
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);
if (orderTakeOff(takeOffDistance) == true) then
trans WaitState;
endif;
endstate;
//------------------------------------------------------------------
// WaitState: wait for someone to come near
//------------------------------------------------------------------
state WaitState;
code
if (FindEnemy(attackRange,findTypes)) then
trans AttackState;
endif;
if (turretTower <> NO_UNIT) then
if (IsDead(turretTower) == true) then
trans TowerGoneState;
endif;
endif;
SetSensorVisibility(ME,FALSE);
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 (turretTower <> NO_UNIT) then
if (IsDead(turretTower) == true) then
trans TowerGoneState;
endif;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
SetSensorVisibility(ME,TRUE);
OrderAttackTactic(TACTIC_SHOOT_ONLY,true);
endstate;
//------------------------------------------------------------------
// TowerGoneState: my control tower is destroyed; I can do nothing
//------------------------------------------------------------------
state TowerGoneState;
code
SetTarget(ME,NO_UNIT);
OrderStopAttacking;
ClearMoveOrder(ME);
SetTargetDesirability(ME,-1);
SetSensorVisibility(ME,FALSE);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,174 @@
//------------------------------------------------------------------
// 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.
@@ -0,0 +1,169 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_UnarmedPatrol : integer;
//------------------------------------------------------------------
// Generic_UnarmedPatrol:
// Follows a path and runs 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 stopFleeingRange; // At what range do I consider myself out of danger?
static integer fleeSpeed; // How fast I flee
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 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 speed; // The speed at which I move along the path
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;
stopFleeingRange = fleeRange + 500;
path = -1;
moveType = move_circle;
speed = 600;
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
OrderMoveResumePatrol(path,speed,moveType,true,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// FleeState: run away from my target
//------------------------------------------------------------------
state FleeState;
code
if (LeaveAttackState(stopFleeingRange)) then
ClearMoveOrder(ME);
SetTarget(ME,NO_UNIT);
trans FollowPathState;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderMoveFlee(GetTarget(ME),600);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,159 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_UnarmedSentry : integer;
//------------------------------------------------------------------
// Generic_UnarmedSentry:
// Stands still and runs 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 stopFleeingRange; // After I've fled, at what range can I forget about my enemy and return to sentry duty?
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 fleeSpeed; // How fast I flee
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;
stopFleeingRange = 1000;
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 WaitState;
endif;
endstate;
//------------------------------------------------------------------
// WaitState: wait for someone to come near
//------------------------------------------------------------------
state WaitState;
code
OrderMoveLookOut;
if (FindEnemy(fleeRange,FT_DEFAULT)) then
ClearMoveOrder(ME);
trans FleeState;
endif;
endstate;
//------------------------------------------------------------------
// FleeState: run away from my target
//------------------------------------------------------------------
state FleeState;
code
if (LeaveAttackState(stopFleeingRange)) then
ClearMoveOrder(ME);
SetTarget(ME,NO_UNIT);
trans WaitState;
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.
@@ -0,0 +1,189 @@
//------------------------------------------------------------------
// 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,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, takeOffDistance,"Take Off Distance (ignored if not a plane)",160>;
FIELD<INT, attackThrottle,"Percent throttle when in combat",80>;
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, speed,"Movement Speed",600>;
}
fsm Generic_Patrol : integer;
//------------------------------------------------------------------
// Generic_Patrol:
// Follows a path. If anything comes near, it goes off and attacks it,
// and then comes back to the path when there's nothing left to attack.
//------------------------------------------------------------------
//------------------------------------------------------------------
// 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 from combat entirely?
static integer path; // My path
static integer moveType; // How I move along the path
static boolean canLeavePath; // Can I leave the path if attacked? (TRUE by default)
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 speed; // The speed at which I move along the path
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>;
takeOffDistance = <takeOffDistance>;
piloting = <piloting>;
gunnery = <gunnery>;
minDelay = <minDelay>;
maxDelay = <maxDelay>;
eliteLevel = <eliteLevel>;
isShotRadius = <isShotRadius>;
attackThrottle = <attackThrottle>;
path = <path>;
moveType = <moveType>;
speed = <speed>;
canLeavePath = true;
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
OrderMoveResumePatrol(path,speed,moveType,true,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// AttackState: attack my current target, or return to path if done
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowPathState;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(canLeavePath);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,267 @@
//------------------------------------------------------------------
// 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,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, takeOffDistance,"Take Off Distance (ignored if not a plane)",160>;
FIELD<INT, attackThrottle,"Percent throttle when in combat",80>;
FIELD< INT,path,"First Path",-1>; // My path
FIELD< INT,path2,"Second Path",-1>; // My path
FIELD< INT,moveType,"Nocycle = 1, Circle = 2, Seesaw = 3",2>; // How I move along the path
FIELD<INT, speed,"Movement Speed",600>;
FIELD< INT,attackRange2,"Attack Range on second path",500>; // At what range do I start shooting?
FIELD< INT,withdrawRange2,"Withdraw Range on second path",750>; // At what range do I withdraw from combat entirely?
FIELD< INT,moveType2,"(path 2) Nocycle = 1, Circle = 2, Seesaw = 3",2>; // How I move along the path
FIELD<INT, trigger,"ID of trigger that makes the unit swap paths",1>;
FIELD<INT, trigger,"ID of trigger that makes the unit wake up",1>;
}
fsm Generic_PatrolRespond : integer;
//------------------------------------------------------------------
// Generic_PatrolRespond:
// Follows a path. If anything comes near, it goes off and attacks it,
// and then comes back to the path when there's nothing left to attack.
// When a specific trigger is set, it goes to another point or path
// and does the same thing.
// I.e. this is the same as Generic_Patrol, except that it
// goes to a second point or path upon firing of a trigger.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer attackRange1; // The range at which I start attacking if in the original patrol
static integer withdrawRange1; // The range at which I withdraw from combat entirely
static integer path1; // My original path
static integer moveType1; // How I move along the path
static boolean canLeavePath1; // Can I leave the path if attacked? (TRUE by default)
static integer speed1; // The speed at which I move along the path
static integer triggerID; // The trigger that will move me from my original patrol state to my new patrol state
static integer attackRange2; // The range at which I start attacking after the trigger has fired
static integer withdrawRange2; // The range at which I withdraw from combat entirely
static integer path2; // My path after the trigger fires
static integer moveType2; // How I move along the second path
static boolean canLeavePath2; // Can I leave the second path if attacked? (TRUE by default)
static integer speed2; // The speed at which I move along the second 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 findTypes; // What kind of enemies to look for
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
// Variables set by editor
attackRange1 = <attackRange>;
withdrawRange1 = <withdrawRange>;
takeOffDistance = <takeOffDistance>;
piloting = <piloting>;
gunnery = <gunnery>;
minDelay = <minDelay>;
maxDelay = <maxDelay>;
eliteLevel = <eliteLevel>;
isShotRadius = <isShotRadius>;
attackThrottle = <attackThrottle>;
path1 = <path>;
path2 = <path2>;
moveType1 = <moveType>;
speed1 = <speed>;
attackRange2 = <attackRange>;
withdrawRange2 = <withdrawRange>;
moveType2 = <moveType>;
speed2 = <speed>;
triggerID = <trigger>;
// script-specific variables
canLeavePath1 = true;
canLeavePath2 = true;
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 FollowPath1State;
endif;
endstate;
//------------------------------------------------------------------
// FollowPath1State: follow the original path, but keep an eye out for enemies
//------------------------------------------------------------------
state FollowPath1State;
code
if (GetGlobalTrigger(triggerID)) then
trans FollowPath2State;
endif;
if (FindEnemy(attackRange1,findTypes)) then
trans Attack1State;
endif;
if (path1 <> -1) then
OrderMoveResumePatrol(path1,speed1,moveType1,true,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// Attack1State: attack my current target, or return to original path if done
//------------------------------------------------------------------
state Attack1State;
code
if (GetGlobalTrigger(triggerID)) then
trans Attack2State;
endif;
if (LeaveAttackState(withdrawRange1)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowPath1State;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(canLeavePath1);
endstate;
//------------------------------------------------------------------
// FollowPath2State: follow the second path, but keep an eye out for enemies
//------------------------------------------------------------------
state FollowPath2State;
code
if (FindEnemy(attackRange2,findTypes)) then
trans Attack2State;
endif;
if (path2 <> -1) then
OrderMoveResumePatrol(path2,speed2,moveType2,true,false);
else
OrderMoveLookOut;
endif;
endstate;
//------------------------------------------------------------------
// Attack2State: attack my current target, or return to second path if done
//------------------------------------------------------------------
state Attack2State;
code
if (LeaveAttackState(withdrawRange2)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans FollowPath2State;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(canLeavePath2);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,236 @@
//------------------------------------------------------------------
// 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,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, takeOffDistance,"Take Off Distance (ignored if not a plane)",160>;
FIELD<INT, attackThrottle,"Percent throttle when in combat",80>;
FIELD<INT, trigger,"ID of trigger that makes the unit wake up",1>;
FIELD<INT, speed,"Movement Speed",600>;
FIELD<INT, DestX,"X coordinate of destination (-1 = none)",-1>;
FIELD<INT, DestY,"Y coordinate of destination (-1 = none)",-1>;
FIELD<INT, DestZ,"Z coordinate of destination (-1 = none)",-1>;
}
fsm Generic_Reinforcement : integer;
//------------------------------------------------------------------
// Generic_Reinforcement:
// Shuts down, waits until a trigger, powers up, moves to a specific
// point (if specified) and attacks anything that comes near
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer attackRange1; // At what range do I start shooting (as I'm moving to the point)?
static integer attackRange2; // At what range do I start shooting (as a reinforcement)?
static integer withdrawRange; // At what range do I stop shooting (as a reinforcement)?
static integer triggerID; // The index of my global trigger
static LocPoint destination; // The destination to move to when ready
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 speed; // What speed so I move at?
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 findTypes; // What kind of enemies to look for
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
// Variables set by editor
attackRange1 = <attackRange>;
withdrawRange = <withdrawRange>;
takeOffDistance = <takeOffDistance>;
piloting = <piloting>;
gunnery = <gunnery>;
minDelay = <minDelay>;
maxDelay = <maxDelay>;
eliteLevel = <eliteLevel>;
isShotRadius = <isShotRadius>;
attackThrottle = <attackThrottle>;
speed = <speed>;
triggerID = <trigger>;
destination[0] = <DestX>;
destination[1] = <DestY>;
destination[2] = <DestZ>;
// script-specific variables
attackRange2 = attackrange1;
// 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);
trans ShutdownAndWaitState;
endstate;
//------------------------------------------------------------------
// ShutdownAndWaitState: shut down and wait for the trigger to be set, then go
//------------------------------------------------------------------
state ShutdownAndWaitState;
code
Shutdown(ME);
if ((GetGlobalTrigger(triggerID)) or (isshot(me))) then
if (orderTakeOff(takeOffDistance) == true) then
Startup(ME);
if ((destination[0] == -1) and (destination[1] == -1) and (destination[2] == -1)) then
trans AttackState;
endif;
trans MoveToPointState;
endif;
endif;
endstate;
//------------------------------------------------------------------
// MoveToPointState: go to the destination, and attack when we get there
//------------------------------------------------------------------
state MoveToPointState;
code
if (OrderMoveToLocPoint(destination,speed,true,true)) then
orderstopattacking;
SetTarget(ME,NO_UNIT);
trans WaitAtPointState;
else
if (FindEnemy(attackRange1,findTypes)) then
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(false);
endif;
endif;
endstate;
//------------------------------------------------------------------
// WaitAtPointState: I got to the point; let's look around
//------------------------------------------------------------------
state WaitAtPointState;
code
if (FindEnemy(attackRange2,findTypes)) then
trans AttackState;
endif;
endstate;
//------------------------------------------------------------------
// AttackState: let's find someone and hurt them
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans MoveToPointState;
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.
@@ -0,0 +1,244 @@
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Sample_FriendlyFireWarn : integer;
//------------------------------------------------------------------
// Sample_FriendlyFireWarn:
// This script encapsulates the code you need to copy into a
// script to get it to do a friendly fire warning -- and
// eventually attack -- when the player shoots it.
// INSTRUCTIONS FOR USE:
// 1. Copy the static integers in the "var" section of this script
// into your existing script.
// 2. Copy the variable initialization stuff from the Init function
// of this script into your existing script. You will need to
// specify the correct sound IDs, and you may need to set custom
// timer IDs as well to avoid timer ID conflicts (see below).
// 3. Copy the CheckIfPlayerShotMe function to your existing script.
// 4. Add a call to CheckIfPlayerShotMe to the beginning of each
// state in your existing script.
// 5. Copy the KillPlayerState into your existing script.
// Be sure to also ...
// -Add the sound files to Content\Audio, and check them in!
// -Add the sound file names to the mission's .table & .audio files!
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer friendlyFireFrustrationLevel; // An integer indicating how frustrated I am with the player
static integer frustration_timer; // A timer I use to wait after I'm hit by friendly fire before calling IsShot() again
static integer attack_player_timer; // A timer I use when I'm really pissed off to give the "OK, you die now" sound enough time to play before I attack
static integer warn_sound_1; // Sound ID: "Hey, watch the friendly fire."
static integer warn_sound_2; // Sound ID: "I warned you, now knock it off."
static integer warn_sound_3; // Sound ID: "One more friendly fire incident and you're toast."
static integer warn_sound_4; // Sound ID: "OK, that's it, I'm taking you out, traitor."
//------------------------------------------------------------------
// Init: my initialization function
//------------------------------------------------------------------
function Init;
code
friendlyFireFrustrationLevel = 0;
// NOTE: replace the following with the warning sound IDs ...
// such as "eso_FFWarn1" or "eso_FFWarn2".
warn_sound_1 = -1;
warn_sound_2 = -1;
warn_sound_3 = -1;
warn_sound_4 = -1;
// NOTE: try to give each friendly unit its own timer IDs; if you can't,
// it's no problem, but then try to make sure each friendly unit script
// is using a unique pair of timers.
// These timers MUST be different from any timers you are using
// elsewhere in your scripts for a given mission!!
frustration_timer = gti_Timer_25;
attack_player_timer = gti_Timer_26;
StartTimer(frustration_timer);
SetTimer(frustration_timer,100);
endfunction;
//------------------------------------------------------------------
// CheckIfPlayerShotMe: this function checks to see if I took
// friendly fire from the player and responds appropriately.
// You should call this function at the beginning of every state in
// your script.
//------------------------------------------------------------------
function CheckIfPlayerShotMe : integer;
var
ObjectID who_shot;
code
// cool down for at least 8 seconds after I'm shot to give IsShot() a chance to reset
if (Not TimeGreater(frustration_timer,8)) then
return (0);
endif;
// Have I been shot?
if (Not IsShot(ME)) then
return (0);
endif;
who_shot = WhoShot(me);
// OK, I was shot -- was it the player that did it?
if (who_shot <> getplayervehicle(epl_player0)) then
return (0);
endif;
ResetTimer(frustration_timer);
// Level 1: "Knock off the friendly fire."
if (friendlyFireFrustrationLevel == 0) then
if (warn_sound_1 <> -1) then
PlaySound(warn_sound_1);
endif;
friendlyFireFrustrationLevel = 1;
return (1);
endif;
// Level 2: "Hey! I warned you, knock it off."
if (friendlyFireFrustrationLevel == 1) then
if (warn_sound_2 <> -1) then
PlaySound(warn_sound_2);
endif;
friendlyFireFrustrationLevel = 2;
return (1);
endif;
// Level 3: "What we've got here is a failure to communicate."
if (friendlyFireFrustrationLevel == 2) then
if (warn_sound_3 <> -1) then
PlaySound(warn_sound_3);
endif;
friendlyFireFrustrationLevel = 3;
return (1);
endif;
// Level 4: "OK, you're gonna die now."
if (warn_sound_4 <> -1) then
PlaySound(warn_sound_4);
endif;
StartTimer(attack_player_timer);
ResetTimer(attack_player_timer);
trans KillPlayerState;
return (1);
endfunction;
//------------------------------------------------------------------
// StartState: my initial state
//------------------------------------------------------------------
state StartState;
code
// IMPORTANT!!! -- You must turn off friendly-fire-ignoring
// for this to work!
SetIgnoreFriendlyFire(me,FALSE);
CheckIfPlayerShotMe;
endstate;
//------------------------------------------------------------------
// StartState: my initial state
//------------------------------------------------------------------
state SitState;
code
CheckIfPlayerShotMe;
// other state stuff here ...
endstate;
state AttackState;
code
CheckIfPlayerShotMe;
// other state stuff here ...
endstate;
state EveryOtherStateInTheWholeGoddamnScript;
code
CheckIfPlayerShotMe;
// other state stuff here ...
endstate;
//------------------------------------------------------------------
// KillPlayerState: too much friendly fire -- get pissed, turn into
// an UberBot, and attack the player
//------------------------------------------------------------------
state KillPlayerState;
code
if (TimeGreater(attack_player_timer,6)) then
SetFiringDelay (ME,0.0,0.0);
SetSkillLevel (ME,100,999,100);
SetAutoTargeting(ME,FALSE);
SetTarget(ME,getplayervehicle(epl_player0));
OrderAttack(TRUE);
endif;
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
orderDie;
endstate;
endfsm.
@@ -0,0 +1,168 @@
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,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, takeOffDistance,"Take Off Distance (ignored if not a plane)",160>;
FIELD<INT, attackThrottle,"Percent throttle when in combat",80>;
}
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_Sentry : integer;
//------------------------------------------------------------------
// Generic_Sentry:
// Stands still. Moves to attack anything that comes near.
//
//------------------------------------------------------------------
//------------------------------------------------------------------
// 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 from combat completely?
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 findTypes; // What kind of enemies to look for
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
// Variables set by editor
attackRange = <attackRange>;
withdrawRange = <withdrawRange>;
takeOffDistance = <takeOffDistance>;
piloting = <piloting>;
gunnery = <gunnery>;
minDelay = <minDelay>;
maxDelay = <maxDelay>;
eliteLevel = <eliteLevel>;
isShotRadius = <isShotRadius>;
attackThrottle = <attackThrottle>;
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 WaitState;
endif;
endstate;
//------------------------------------------------------------------
// WaitState: wait for something to shoot
//------------------------------------------------------------------
state WaitState;
code
OrderMoveLookOut;
if (FindEnemy(attackRange,findTypes)) then
trans AttackState;
endif;
endstate;
//------------------------------------------------------------------
// AttackState: look for something to shoot
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
OrderStopAttacking;
SetTarget(ME,NO_UNIT);
trans WaitState;
endif;
OrderAttack(true);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,236 @@
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,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, takeOffDistance,"Take Off Distance (ignored if not a plane)",160>;
FIELD<INT, attackThrottle,"Percent throttle when in combat",80>;
FIELD<INT, speed,"Movement Speed",600>;
FIELD<INT, DestX,"X coordinate of destination (-1 = none)",-1>;
FIELD<INT, DestY,"Y coordinate of destination (-1 = none)",-1>;
FIELD<INT, DestZ,"Z coordinate of destination (-1 = none)",-1>;
FIELD<INT, trigger,"ID of trigger that makes the unit wake up",1>;
}
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_SentryReinforcement : integer;
//------------------------------------------------------------------
// Generic_SentryReinforcement:
// Performs sentry, attacking anything that comes near.
// Once a trigger is set, goes to a predefined point and
// attacks anything within range at that point.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
// Variables
//------------------------------------------------------------------
var
static integer attackRange1; // At what range do I start shooting when I'm attacking?
static integer withdrawRange1; // At what range do I give up?
static integer attackRange2; // At what range do I start shooting (as a reinforcement)?
static integer withdrawRange2; // At what range do I stop shooting (as a reinforcement)?
static integer triggerID; // The index of my global trigger
static LocPoint destination; // The destination to move to when ready
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 speed; // What speed so I move at?
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 findTypes; // What kind of enemies to look for
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
// Variables set by editor
attackRange = <attackRange>;
withdrawRange = <withdrawRange>;
takeOffDistance = <takeOffDistance>;
piloting = <piloting>;
gunnery = <gunnery>;
minDelay = <minDelay>;
maxDelay = <maxDelay>;
eliteLevel = <eliteLevel>;
isShotRadius = <isShotRadius>;
attackThrottle = <attackThrottle>;
triggerID = <trigger>;
destination[0] = <DestX>;
destination[1] = <DestY>;
destination[2] = <DestZ>;
attackRange2 = attackRange1;
withdrawRange2 = withdrawrange1;
// 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 WaitState;
endif;
endstate;
//------------------------------------------------------------------
// WaitState: wait something to happen (my original state)
//------------------------------------------------------------------
state WaitState;
code
if (GetGlobalTrigger(triggerID)) then
trans MoveToPointState;
endif;
if (FindEnemy(attackRange1,findTypes)) then
trans Attack1State;
endif;
OrderMoveLookOut;
endstate;
//------------------------------------------------------------------
// Attack1State: attack someone (before I'm called as a reinforcement)
//------------------------------------------------------------------
state Attack1State;
code
if (LeaveAttackState(withdrawRange1)) then
trans WaitState;
endif;
if (GetGlobalTrigger(triggerID)) then
trans Attack2State;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
OrderAttack(TRUE);
endstate;
//------------------------------------------------------------------
// MoveToPointState: go to the destination, and attack when we get there
//------------------------------------------------------------------
state MoveToPointState;
code
if (OrderMoveToLocPoint(destination,speed,true,true)) then
OrderStopAttacking;
if (FindEnemy(attackRange2,findTypes)) then
trans Attack2State;
endif;
endif;
endstate;
//------------------------------------------------------------------
// Attack2State: attack a target (after I'm called as a reinforcement)
//------------------------------------------------------------------
state Attack2State;
code
if (LeaveAttackState(withdrawRange2)) then
trans MoveToPointState;
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.
@@ -0,0 +1,206 @@
//------------------------------------------------------------------
// 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,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,takeOffDistance,"Take off distance",150>;
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,attackThrottle,"Percent throttle when in combat",80>;
FIELD< INT,tower,"Unit ID of the Turret Tower",-1>;
}
fsm Generic_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 ObjectID turretTower; // My control tower: if destroyed, I stop firing
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 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)
static integer attackThrottle; // 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>;
takeOffDistance = <takeOffDistance>;
piloting = <piloting>;
gunnery = <gunnery>;
minDelay = <minDelay>;
maxDelay = <maxDelay>;
eliteLevel = <eliteLevel>;
isShotRadius = <isShotRadius>;
attackThrottle = <attackThrottle>;
turretTower = <tower>;
// takeOffDistance = 150;
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);
if (orderTakeOff(takeOffDistance) == true) then
trans WaitState;
endif;
endstate;
//------------------------------------------------------------------
// WaitState: wait for someone to come near
//------------------------------------------------------------------
state WaitState;
code
if (FindEnemy(attackRange,findTypes)) then
trans AttackState;
endif;
if (turretTower <> NO_UNIT) then
if (IsDead(turretTower) == true) then
trans TowerGoneState;
endif;
endif;
SetSensorVisibility(ME,FALSE);
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 (turretTower <> NO_UNIT) then
if (IsDead(turretTower) == true) then
trans TowerGoneState;
endif;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
SetSensorVisibility(ME,TRUE);
OrderAttackTactic(TACTIC_SHOOT_ONLY,true);
endstate;
//------------------------------------------------------------------
// TowerGoneState: my control tower is destroyed; I can do nothing
//------------------------------------------------------------------
state TowerGoneState;
code
SetTarget(ME,NO_UNIT);
OrderStopAttacking;
ClearMoveOrder(ME);
SetTargetDesirability(ME,-1);
SetSensorVisibility(ME,FALSE);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,178 @@
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,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, takeOffDistance,"Take Off Distance (ignored if not a plane)",160>;
FIELD<INT, attackThrottle,"Percent throttle when in combat",80>;
}
//------------------------------------------------------------------
// NOTE: The fsm name below MUST be changed in order for the
// script to be considered a unique entity!
fsm Generic_Ambush : integer;
//------------------------------------------------------------------
// Generic_Ambush:
// Shuts down, waits until an enemy comes near, and then attacks.
//------------------------------------------------------------------
//------------------------------------------------------------------
// 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 from combat entirely?
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
// Variables set by editor
attackRange = <attackRange>;
withdrawRange = <withdrawRange>;
speed = <speed>;
takeOffDistance = <takeOffDistance>;
piloting = <piloting>;
gunnery = <gunnery>;
minDelay = <minDelay>;
maxDelay = <maxDelay>;
eliteLevel = <eliteLevel>;
isShotRadius = <isShotRadius>;
attackThrottle = <attackThrottle>;
// driver settings
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 WaitToAmbushState;
endif;
endstate;
//------------------------------------------------------------------
// WaitInAmbushState: wait for someone to come close enough to attack
//------------------------------------------------------------------
state WaitToAmbushState;
code
Shutdown(ME);
if (FindEnemy(attackrange,FT_DEFAULT)) then
trans AttackState;
endif;
endstate;
//------------------------------------------------------------------
// AttackState: the ambush is over -- let's kick some ass!
//------------------------------------------------------------------
state AttackState;
code
if (LeaveAttackState(withdrawRange)) then
trans WaitToAmbushState;
endif;
if (attackSound <> -1) then
PlaySoundOnce(attackSound);
endif;
Startup(ME);
OrderAttack(TRUE);
endstate;
//------------------------------------------------------------------
// DeadState: OK, I kicked the bucket.
//------------------------------------------------------------------
state DeadState;
code
if (deathSound <> -1) then
PlaySoundOnce(deathSound);
endif;
orderDie;
endstate;
endfsm.
@@ -0,0 +1,172 @@
//*********************************************************************************
fsm GENERIC : integer;
//------------------------------------------------------------------
//
// Constant Definitions
//
//------------------------------------------------------------------
const
#include_ <content\ABLScripts\mwconst.abi>
//------------------------------------------------------------------
//
// Type Definitions
//
//------------------------------------------------------------------
type
#include_ <content\ABLScripts\mwtype.abi>
//------------------------------------------------------------------
//
// Variable Declarations
//
//------------------------------------------------------------------
var
eternal integer playermech;
static integer cinema_cut;
//------------------------------------------------------------------
//
// Init Function (automatically run first time through)
//
//------------------------------------------------------------------
function init;
var
integer i;
code
playermech = getplayervehicle(epl_player0);
GroupAddObject(GroupObjectId(1),playermech);
//GroupAddObject(GroupObjectId(X),eve_SOMETHING);
//SetGroupAI(groupobjectid(X),GROUPAI_MOODSQUAD);
cinema_cut = 0;
endfunction;
//------------------------------------------------------------------
//
// Main Code
//
//------------------------------------------------------------------
state startState;
code
//playsound(eso_start);
//setactivationdistance(6800);
//trans opening;
trans sit;
endstate;
state deadState;
code
endstate;
//------------------------------------------------------------------
//
// Sit state : description
//
//------------------------------------------------------------------
state sit;
code
//Reveal the objectives
//Fail the mission when the player dies
if (isdead(playermech)) then
failobjectiveall(9);
endif;
endstate;
//-----------------------------------------
//HERE THERE BE CINEMAS
//-----------------------------------------
state opening;
code
switch (cinema_cut)
case 0:
endcase;
case 1:
endcase;
case 2:
endcase;
case 3:
endcase;
endswitch;
endstate;
state won;
code
switch cinema_cut
case 0:
endcase;
case 1:
endcase;
endswitch;
endstate;
state lost;
code
switch cinema_cut
case 0:
endcase;
case 1:
endcase;
endswitch;
endstate;
endfsm.
//******************************************************************