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.
233 lines
5.6 KiB
Plaintext
233 lines
5.6 KiB
Plaintext
//
|
|
//see s1s1.abl for usage - jcem
|
|
//
|
|
|
|
//TEMPLATENAME=<AttackList1>
|
|
//VALUE<attackRange,500>
|
|
//VALUE<withdrawRange,750>
|
|
//VALUE<piloting,50>
|
|
//VALUE<gunnery,50>
|
|
//VALUE<minDelay,1.000000>
|
|
//VALUE<maxDelay,2.000000>
|
|
//VALUE<eliteLevel,60>
|
|
//VALUE<isShotRadius,120>
|
|
//VALUE<takeOffDistance,160>
|
|
//VALUE<attackThrottle,80>
|
|
//VALUE<groupToAttack,12>
|
|
|
|
//------------------------------------------------------------------
|
|
// NOTE: The fsm name below MUST be changed in order for the
|
|
// script to be considered a unique entity!
|
|
|
|
|
|
|
|
|
|
fsm Generic_AttackHero : integer;
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Generic_AttackHero:
|
|
// 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 withdrawRange; // jcem - withdrawRange?
|
|
|
|
static integer noTacTic;
|
|
static integer tactic; // The tactic to use to attack (or defend) my targets
|
|
|
|
static integer attackSound; // The attack sound I play when I first attack
|
|
static integer deathSound; // The sound I play when I die
|
|
|
|
static integer takeOffDistance; // My take-off distance if I'm an airplane (ignored if not an airplane)
|
|
|
|
static locpoint SpawnSpot;
|
|
static integer findTypes; // What kind of enemies to look for
|
|
|
|
static real bot_wakeup_begin;
|
|
static real bot_wakeup_time;
|
|
|
|
static locpoint dummy_hpt;
|
|
static integer DROP_OFFS_Y;
|
|
|
|
//------------------------------------------------------------------
|
|
// Init: my initialization function
|
|
//------------------------------------------------------------------
|
|
|
|
function Init;
|
|
code
|
|
attackRange = 9999; // 900;
|
|
withdrawRange = 9999; // attackRange * 3 / 2;
|
|
//attackRange = 900;
|
|
//withdrawRange = 2000;
|
|
|
|
takeOffDistance = 160;
|
|
|
|
noTacTic = 0;
|
|
tactic = TACTIC_CIRCLE;
|
|
|
|
findTypes = FT_DEFAULT + FT_UNARMED;
|
|
|
|
attackSound = -1; // no sound
|
|
deathSound = -1; // no sound
|
|
|
|
bot_wakeup_begin = 0.0; // will be touched later
|
|
bot_wakeup_time = 1.0;
|
|
|
|
GetLocation(me,SpawnSpot);
|
|
SpawnSpot[1] = SpawnSpot[1] + 1;
|
|
DROP_OFFS_Y = 300;
|
|
endfunction;
|
|
//------------------------------------------------------------------
|
|
// StartState: my initial state
|
|
//------------------------------------------------------------------
|
|
|
|
state StartState;
|
|
|
|
code
|
|
//TeleportToHell(me);
|
|
//SetSensorVisibility (ME,FALSE);
|
|
|
|
trans TeleportState;
|
|
endstate;
|
|
|
|
state TeleportState;
|
|
code
|
|
if GetGlobalTrigger(GetMemoryInteger(ME,31)) == TRUE then
|
|
dummy_hpt[0] = 0;
|
|
dummy_hpt[1] = 1;
|
|
dummy_hpt[2] = 2;
|
|
if GetMemoryInteger(ME,29) < 1 then
|
|
teleportAndLook(ME,dummy_hpt,0,SpawnSpot);
|
|
else
|
|
SpawnSpot[1] = SpawnSpot[1] + DROP_OFFS_Y;
|
|
teleportAndLook(ME,dummy_hpt,1,SpawnSpot);
|
|
endif;
|
|
Startup(ME);
|
|
|
|
SetSensorVisibility(ME,TRUE);
|
|
|
|
trans after_TeleportState
|
|
endif;
|
|
|
|
endstate;
|
|
|
|
state after_TeleportState;
|
|
|
|
code
|
|
|
|
if GetGlobalTrigger(GetMemoryInteger(ME,30)) == TRUE then
|
|
StartExecute(ME);
|
|
if (0.0 < bot_wakeup_time) then
|
|
bot_wakeup_begin = GetTime + bot_wakeup_time;
|
|
trans CheckWakeup;
|
|
else
|
|
trans WaitState;
|
|
endif;
|
|
endif;
|
|
|
|
endstate;
|
|
|
|
state CheckWakeup;
|
|
code
|
|
if (bot_wakeup_begin <= GetTime) then
|
|
trans WaitState;
|
|
endif;
|
|
|
|
if (IsShot(ME) == TRUE) then
|
|
SetTarget(ME, WhoShot(ME));
|
|
trans WaitState;
|
|
endif;
|
|
|
|
trans CheckWakeup;
|
|
endstate;
|
|
|
|
state WaitState;
|
|
|
|
code
|
|
if (orderTakeOff(takeOffDistance) == true) then
|
|
trans AttackState;
|
|
else
|
|
if (FindEnemy(attackRange,findTypes)) then
|
|
trans AttackState;
|
|
endif;
|
|
|
|
//OrderMoveLookOut;
|
|
endif;
|
|
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// AttackState: look for something to shoot
|
|
//------------------------------------------------------------------
|
|
|
|
state AttackState;
|
|
|
|
code
|
|
if (GetTarget(ME) == NO_UNIT) then
|
|
SetTarget(ME, getplayervehicle(epl_player0));
|
|
endif;
|
|
|
|
if (LeaveAttackState(withdrawRange)) then
|
|
OrderStopAttacking;
|
|
SetTarget(ME,NO_UNIT);
|
|
trans WaitState;
|
|
endif;
|
|
|
|
if (attackSound <> -1) then
|
|
PlaySoundOnce(attackSound);
|
|
endif;
|
|
|
|
if (noTacTic <> 0) then
|
|
OrderAttack(true);
|
|
else
|
|
OrderAttackTactic(tactic,TRUE);
|
|
endif;
|
|
|
|
endstate;
|
|
|
|
//------------------------------------------------------------------
|
|
// DeadState: OK, I kicked the bucket.
|
|
//------------------------------------------------------------------
|
|
|
|
state DeadState;
|
|
|
|
code
|
|
if (deathSound <> -1) then
|
|
PlaySoundOnce(deathSound);
|
|
endif;
|
|
|
|
orderDie;
|
|
|
|
endstate;
|
|
|
|
endfsm.
|