here it is, with the coordinate changes:
//****************************************************************************************//
//
// This Brain will patrol a defined patrol path
//****************************************************************************************//
//[EDIT]
fsm Test_Patrol_Truck; //EACH BRAIN MUST HAVE AN UNIQUE FSM ID..
//[EDIT END]
var
static WorldPosition startPosition;
static PatrolState PState;
static PatrolPath PPath;
static boolean willRequestHelp;
static real lastHelpRequestTime;
static real helpRequestFrequency;
static integer AttackStateHandle;
// static boolean poweredDown;
static integer scanRange;
//****************************************************************************************
function init;
code
//[EDIT]
//********************************************************************
// Scan Ranges for Unit
scanRange = 500;
//********************************************************************
// Patrol STATE
PState[0] = 1; // This is the Type of Patrol. 0 = Linear. 1 = Looping
//(Linear = Unit will move from 1 to 2 to 3, then 3 to 2 to 1) Assuming there are only 3 points to the Patrol
//(Looping = Unit will move from 1 to 2 to 3, then 1 to 2 to 3) Assuming there are only 3 points to the Patrol
PState[1] = 2; //This is the Amount of Move Points there are listed below. Make sure you Count Patrol Point '0'
PState[2] = -1; //This is How many Times the unit will perform the Patrol.. (-1 = Forever).
//********************************************************************
// Patrol Points below
//Enter the Coordinates of where you want the Unit to Patrol. It will do them in Order Start from 0 and ending at the Last Point
//Make sure you change the Index number (numbers in Brackets [0, 0] to match the correct Patrol Point.
//Also, the number of Mover Points MUST match the number you have entered in the Patrol State.
PPath[0, 0] = 490; //X coordinate found in the editor
PPath[0, 1] = 1941; //Y coordinate found in the editor
PPath[1, 0] = 390;
PPath[1, 1] = 1941;
// PPath[2, 0] = 290;
// PPath[2, 1] = 1941;
//[EDIT END]
//********************************************************************
// DO NOT EDIT BELOW THESE LINES
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PState[3] = PATROL_DIRECTION_FORWARD;
PState[4] = -1; //reset cur point
PState[5] = -1; //reset cur cycle
PState[6] = CONTACT_CRITERIA_ENEMY + CONTACT_CRITERIA_VISUAL_OR_SENSOR + CONTACT_CRITERIA_NOT_DISABLED;
//setDebugWindow(-1, -1);
//---------------------------
// Grab his start position...
getObjectPosition(-1, startPosition);
setTargetPriority(0, TARGET_PRIORITY_CURTARGET, -1, 0, CONTACT_CRITERIA_NONE);
setTargetPriority(1, TARGET_PRIORITY_MOVER, 0, 0, CONTACT_CRITERIA_NONE);
setTargetPriority(2, TARGET_PRIORITY_NONE, 0, 0, 0);
AttackStateHandle = getStateHandle("attack");
willRequestHelp = true; //?true or false
helpRequestFrequency = 20.0; //?in secs
lastHelpRequestTime = -100.0;
setWillHelp(False);
endfunction;
//----------------------------------------------------------------------------------------
function update : integer;
var
boolean processingPilotEvents;
// boolean thinking;
integer pilotEventID;
integer pilotState;
integer[20] pilotEventParams;
integer curTarget;
real curTime;
real[3] myPos;
real[3] attackerPos;
// real distanceToAttacker;
integer curStateHandle;
static integer numFunctionalWeapons;
static integer[20] weaponList;
code
curTime = getTime;
curStateHandle = getCurrentStateHandle;
//--------------------------------------------------
// Process the pilot events since the last update...
numFunctionalWeapons = getWeapons(weaponList, 1);
// if (numFunctionalWeapons == 0) then
// trans noWeapons;
// endif;
processingPilotEvents = TRUE;
while (processingPilotEvents) do
pilotEventID = getNextPilotEvent(pilotEventParams);
if (pilotEventID == PILOT_EVENT_NONE) then
processingPilotEvents = FALSE;
else
switch (pilotEventID)
case PILOT_EVENT_TARGETED:
curTarget = getTarget(-1);
if (lastHelpRequestTime < (curTime - helpRequestFrequency)) then
lastHelpRequestTime = curTime;
if (willRequestHelp) then
//distanceToAttacker = distanceToObject(-1, pilotEventParams[0]);
getObjectPosition(pilotEventParams[0], attackerPos);
getObjectPosition(-1, myPos);
requestHelp(pilotEventParams[0], myPos, 300.0, attackerPos, 300.0, 1);
endif;
endif;
endcase;
endswitch;
endif;
endwhile;
return(0);
endfunction;
//----------------------------------------------------------------------------------------
state start;
code
update;
if (order1) then
corePatrol(PState, PPath);
else
// if (order2) then
// coreRun = False;
// corePatrol(PState1, PPath1);
// else
// coreRun = False;
// corePatrol(PState2, PPath2);
// endif;
objectremove(-1);
endif;
resetOrders(1);
endstate;
//----------------------------------------------------------------------------------------
endfsm.
//****************************************************************************************
[code]