Initial upload. PRC8 has been added. Module compiles, PRC's default AI & treasure scripts have been integrated. Started work on top hak for SLA / Ability / Scripting modifications.
633 lines
24 KiB
Plaintext
633 lines
24 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Improved Waypoint Walking Code
|
|
//:: IMPROVED_WAYPT
|
|
//:: Copyright (c) 2001 Bioware
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This script builds on the basic waypoint walking
|
|
that is present in Bioware's code.
|
|
Parts of NW_I0_GENERIC are included here because
|
|
I want this waypoint code to behave as closely
|
|
as possible to the original. In fact if you use
|
|
IWalkWayPoint() with no extra parameters it will
|
|
work exactly like the original.
|
|
If someone knows how to not be so dodgy and not
|
|
rename the constants so I don't get a scope
|
|
violation, please let me know.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Winternight
|
|
//:: Created On: June 29, 2002
|
|
//:: Email: winternight@evolove.net
|
|
//:://////////////////////////////////////////////
|
|
//Master Constants **DO NOT CHANGE THESE**
|
|
//These are constants required by the code that is brought
|
|
//over from NW_I0_GENERIC
|
|
int INW_FLAG_SHOUT_ATTACK_MY_TARGET = 0x00000002;
|
|
int INW_FLAG_STEALTH = 0x00000004;
|
|
int INW_FLAG_SEARCH = 0x00000008;
|
|
int INW_FLAG_ESCAPE_RETURN = 0x00000020; //Failed
|
|
int INW_FLAG_TELEPORT_LEAVE = 0x00000100;
|
|
int INW_FLAG_AMBIENT_ANIMATIONS = 0x00080000;
|
|
int INW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS = 0x00200000;
|
|
int INW_FLAG_DAY_NIGHT_POSTING = 0x00400000;
|
|
//Waypoint Traversal Constants
|
|
//Add more here if you want
|
|
int WAYPOINT_STANDARD = 1; //Bioware Standard Waypoint Traversal
|
|
int WAYPOINT_ASCENDING = 2; //Ascend through the Waypoints same as standard
|
|
int WAYPOINT_DESCENDING = 3; //Descend through the Waypoints
|
|
int WAYPOINT_CIRCULAR = 4; //Walk the Waypoints in a circle
|
|
//Improved Waypoint Walking Functions
|
|
void IRunCircuit(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0);
|
|
void IRunCircuitD(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0);
|
|
void IRunCircuitC(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0);
|
|
// Causes the calling object to walk a set of way points that are in the format
|
|
// WP_somestring_XX where somestring is the name of the set of WayPoints and XX
|
|
// is a number from 01 - 99
|
|
// If there is a script with the same name as the waypoint it will be
|
|
// executed as the NPC gets to the waypoint.
|
|
// - sSeries: the name of the series of way points. Defaults to the calling
|
|
// object's tag
|
|
// - nTimes: the number of times to walk the set of way points. One traversal
|
|
// is defined as going from one end of a series to the other. So to
|
|
// go back and forth once requires you to go along the set twice.
|
|
// For circular way points it is the number of times to go around
|
|
// and come to the start point again.
|
|
// - nTraversal:The type of traversal to use:
|
|
// WAYPOINT_STANDARD, WAYPOINT_ASCENDING - Go up through the way
|
|
// points (01,02,03,etc)
|
|
// WAYPOINT_DESCENDING - Go down through the way points (03,02,01)
|
|
// WAYPOINT_CIRCULAR - Go to each of the waypoints in turn ending
|
|
// at the first one. (01,02,03,01)
|
|
void IWalkWayPoints(int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0, int nTraversal = 1);
|
|
void IRunNextCircuit(int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0);
|
|
void IRunNextCircuitD(int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0);
|
|
void IRunNextCircuitC(int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0);
|
|
//Carried over from NW_I0_Generic
|
|
void ISetSpawnInCondition(int nCondition, int bValid = TRUE);
|
|
int IGetSpawnInCondition(int nCondition);
|
|
void ISetSpawnInLocals(int nCondition);
|
|
/*
|
|
****** DO NOT ALTER THIS PART ******
|
|
*/
|
|
//::///////////////////////////////////////////////
|
|
//:: Master Local Get and Set
|
|
//:: FileName
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
All On Spawn in conditions in the game are now
|
|
being stored within one local. The get and set
|
|
changed or checks the condition of this one
|
|
Hex local. The NW_FLAG_XXX variables above
|
|
allow for the user of these functions throughout
|
|
the generic scripts.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: Nov 14, 2001
|
|
//:://////////////////////////////////////////////
|
|
void ISetSpawnInCondition(int nCondition, int bValid = TRUE)
|
|
{
|
|
int nPlot = GetLocalInt(OBJECT_SELF, "NW_GENERIC_MASTER");
|
|
if(bValid == TRUE)
|
|
{
|
|
nPlot = nPlot | nCondition;
|
|
ISetSpawnInLocals(nCondition);
|
|
SetLocalInt(OBJECT_SELF, "NW_GENERIC_MASTER", nPlot);
|
|
}
|
|
else if (bValid == FALSE)
|
|
{
|
|
nPlot = nPlot & ~nCondition;
|
|
SetLocalInt(OBJECT_SELF, "NW_GENERIC_MASTER", nPlot);
|
|
}
|
|
}
|
|
int IGetSpawnInCondition(int nCondition)
|
|
{
|
|
int nPlot = GetLocalInt(OBJECT_SELF, "NW_GENERIC_MASTER");
|
|
if(nPlot & nCondition)
|
|
{
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
void ISetSpawnInLocals(int nCondition)
|
|
{
|
|
if(nCondition == INW_FLAG_SHOUT_ATTACK_MY_TARGET)
|
|
{
|
|
SetListenPattern(OBJECT_SELF, "NW_ATTACK_MY_TARGET", 5);
|
|
}
|
|
else if(nCondition == INW_FLAG_ESCAPE_RETURN)
|
|
{
|
|
SetLocalLocation(OBJECT_SELF, "NW_GENERIC_START_POINT", GetLocation(OBJECT_SELF));
|
|
}
|
|
else if(nCondition == INW_FLAG_TELEPORT_LEAVE)
|
|
{
|
|
SetLocalLocation(OBJECT_SELF, "NW_GENERIC_START_POINT", GetLocation(OBJECT_SELF));
|
|
}
|
|
}
|
|
/*
|
|
****** DO NOT ALTER ABOVE HERE ******
|
|
*/
|
|
//************************************************************************************************************************************
|
|
//************************************************************************************************************************************
|
|
//
|
|
//IMPROVED WAY POINT WALK FUNCTIONS
|
|
//
|
|
//************************************************************************************************************************************
|
|
//************************************************************************************************************************************
|
|
//::///////////////////////////////////////////////
|
|
//:: Improved Walk Way Point Path
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Allows specified person walk a waypoint path.
|
|
A number of parameters may be supplied in order
|
|
to alter the way in which the person walks, and
|
|
even the path that they walk.
|
|
Parameters:
|
|
string sSeries
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Aidan Scanlan
|
|
//:: Created On: July 10, 2001
|
|
//:: Originally Modified By: Winternight
|
|
//:: e-mail: winternight@evolove.com
|
|
//:: Last Modified By: Winternight
|
|
//:: e-mail: winternight@evolove.com
|
|
//:://////////////////////////////////////////////
|
|
void IWalkWayPoints(int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0, int nTraversal = 1) //Run first circuit
|
|
{
|
|
//ClearAllActions();
|
|
string DayWayString;
|
|
string NightWayString;
|
|
string DayPostString;
|
|
string NightPostString;
|
|
string sWay;
|
|
string sPost;
|
|
string sWpSeries;
|
|
if (sSeries == "")
|
|
{
|
|
sWpSeries = GetTag(OBJECT_SELF);
|
|
}
|
|
else
|
|
{
|
|
sWpSeries = sSeries;
|
|
}
|
|
//The block of code below deals with night and day cycle for postings and walkway points.
|
|
if(IGetSpawnInCondition(INW_FLAG_DAY_NIGHT_POSTING))
|
|
{
|
|
DayWayString = "WP_";
|
|
NightWayString = "WN_";
|
|
DayPostString = "POST_";
|
|
NightPostString = "NIGHT_";
|
|
}
|
|
else
|
|
{
|
|
DayWayString = "WP_";
|
|
NightWayString = "WP_";
|
|
DayPostString = "POST_";
|
|
NightPostString = "POST_";
|
|
}
|
|
if(GetIsDay() || GetIsDawn())
|
|
{
|
|
SetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX", DayWayString);
|
|
SetLocalString(OBJECT_SELF, "NW_GENERIC_POSTING_PREFIX", DayPostString);
|
|
}
|
|
else
|
|
{
|
|
SetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX", NightWayString);
|
|
SetLocalString(OBJECT_SELF, "NW_GENERIC_POSTING_PREFIX", NightPostString);
|
|
}
|
|
sWay = GetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX");
|
|
sPost = GetLocalString(OBJECT_SELF, "NW_GENERIC_POSTING_PREFIX");
|
|
//I have now determined what the prefixs for the current walkways and postings are and will use them instead
|
|
// of POST_ and WP_
|
|
if(IGetSpawnInCondition(INW_FLAG_STEALTH))
|
|
{
|
|
//MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + "Attempting to Activate Stealth");
|
|
ActionUseSkill(SKILL_HIDE, OBJECT_SELF);
|
|
}
|
|
if(IGetSpawnInCondition(INW_FLAG_SEARCH))
|
|
{
|
|
//MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + "Attempting to Activate Search");
|
|
ActionUseSkill(SKILL_SEARCH, OBJECT_SELF);
|
|
}
|
|
// I think this checks that there is a waypoint with this series.
|
|
string sWayTag = sWpSeries;
|
|
sWayTag = sWay + sWayTag + "_01";
|
|
object oWay1 = GetNearestObjectByTag(sWayTag);
|
|
if(!GetIsObjectValid(oWay1))
|
|
{
|
|
oWay1 = GetObjectByTag(sWayTag);
|
|
}
|
|
if(GetIsObjectValid(oWay1) && IGetSpawnInCondition(INW_FLAG_AMBIENT_ANIMATIONS))
|
|
{
|
|
//turn off the ambient animations if the creature should walk way points.
|
|
ActionDoCommand(ISetSpawnInCondition(INW_FLAG_AMBIENT_ANIMATIONS, FALSE));
|
|
ActionDoCommand(ISetSpawnInCondition(INW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS, FALSE));
|
|
}
|
|
if(GetIsObjectValid(oWay1))
|
|
{
|
|
int nNth = 1;
|
|
int nTens;
|
|
int nNum;
|
|
object oNearest = GetNearestObject(OBJECT_TYPE_WAYPOINT, OBJECT_SELF, nNth);
|
|
while (GetIsObjectValid(oNearest))
|
|
{
|
|
string sNearestTag = GetTag(oNearest);
|
|
//removes the first 3 and last three characters from the waypoint's tag
|
|
//and checks it against his own tag. Waypoint tag format is WP_sWpSeries_XX.
|
|
if( GetSubString( sNearestTag, 3, GetStringLength( sNearestTag ) - 6 ) == sWpSeries )
|
|
{
|
|
string sTens = GetStringRight(GetTag(oNearest),2);
|
|
nTens = StringToInt(sTens)/10;
|
|
nNum= StringToInt(GetStringRight(GetTag(oNearest),1));
|
|
oNearest = OBJECT_INVALID;
|
|
}
|
|
else
|
|
{
|
|
nNth++;
|
|
oNearest = GetNearestObject(OBJECT_TYPE_WAYPOINT,OBJECT_SELF,nNth);
|
|
}
|
|
}
|
|
switch (nTraversal)
|
|
{
|
|
case 1: //WAYPOINT_STANDARD
|
|
IRunCircuit(nTens, nNum, nRun, fPause, sWpSeries, nTimes); //***************************************
|
|
ActionWait(fPause);
|
|
if (nTimes > 0)
|
|
{
|
|
ActionDoCommand(IRunNextCircuit(nRun, fPause, sWpSeries, nTimes - 2));
|
|
}
|
|
else
|
|
{
|
|
ActionDoCommand(IRunNextCircuit(nRun, fPause, sWpSeries, 0));
|
|
}
|
|
break;
|
|
case 2: //WAYPOINT_ASCENDING same as standard
|
|
IRunCircuit(nTens, nNum, nRun, fPause, sWpSeries, nTimes); //***************************************
|
|
ActionWait(fPause);
|
|
if (nTimes > 0)
|
|
{
|
|
ActionDoCommand(IRunNextCircuit(nRun, fPause, sWpSeries, nTimes - 2));
|
|
}
|
|
else
|
|
{
|
|
ActionDoCommand(IRunNextCircuit(nRun, fPause, sWpSeries, 0));
|
|
}
|
|
break;
|
|
case 3: //WAYPOINT_DESCENDING
|
|
IRunCircuitD(nTens, nNum, nRun, fPause, sWpSeries, nTimes); //***************************************
|
|
ActionWait(fPause);
|
|
if (nTimes > 0)
|
|
{
|
|
ActionDoCommand(IRunNextCircuitD(nRun, fPause, sWpSeries, nTimes - 2));
|
|
}
|
|
else
|
|
{
|
|
ActionDoCommand(IRunNextCircuitD(nRun, fPause, sWpSeries, 0));
|
|
}
|
|
break;
|
|
case 4: //WAYPOINT_CIRCULAR
|
|
ActionWait(fPause);
|
|
if (nTimes > 0)
|
|
{
|
|
ActionDoCommand(IRunNextCircuitC(nRun, fPause, sWpSeries, nTimes - 2));
|
|
}
|
|
else
|
|
{
|
|
ActionDoCommand(IRunNextCircuitC(nRun, fPause, sWpSeries, 0));
|
|
}
|
|
break;
|
|
default:
|
|
ActionWait(fPause);
|
|
if (nTimes > 0)
|
|
{
|
|
ActionDoCommand(IRunNextCircuit(nRun, fPause, sWpSeries, nTimes - 2));
|
|
}
|
|
else
|
|
{
|
|
ActionDoCommand(IRunNextCircuit(nRun, fPause, sWpSeries, 0));
|
|
}
|
|
break;
|
|
}
|
|
//ActionDoCommand(SignalEvent(OBJECT_SELF,EventUserDefined(2)));
|
|
}
|
|
else
|
|
{
|
|
//SendMessageToAllDMs(GetName(OBJECT_SELF) + " can't find Waypoint '" + sWayTag + "', trying to force!!");
|
|
sWayTag = sWpSeries;
|
|
sWayTag = sPost + sWayTag;
|
|
oWay1 = GetNearestObjectByTag(sWayTag);
|
|
if(!GetIsObjectValid(oWay1))
|
|
{
|
|
oWay1 = GetObjectByTag(sWayTag);
|
|
}
|
|
if(GetIsObjectValid(oWay1))
|
|
{
|
|
ActionForceMoveToObject(oWay1, nRun, 1.0, 60.0);
|
|
float fFacing = GetFacing(oWay1);
|
|
ActionDoCommand(SetFacing(fFacing));
|
|
}
|
|
}
|
|
if(GetIsObjectValid(oWay1) && IGetSpawnInCondition(INW_FLAG_AMBIENT_ANIMATIONS))
|
|
{
|
|
ISetSpawnInCondition(INW_FLAG_AMBIENT_ANIMATIONS, FALSE);
|
|
ISetSpawnInCondition(INW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS, FALSE);
|
|
}
|
|
}
|
|
void IRunNextCircuit(int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0)
|
|
{
|
|
if (nTimes == 0)
|
|
{
|
|
IRunCircuit(0,1, nRun, fPause, sSeries); //***************************************
|
|
ActionWait(fPause);
|
|
ActionDoCommand(IRunNextCircuit(nRun, fPause, sSeries));
|
|
//ActionDoCommand(SignalEvent(OBJECT_SELF,EventUserDefined(2)));
|
|
}
|
|
else
|
|
{
|
|
while (nTimes > 0)
|
|
{
|
|
IRunCircuit(0,1, nRun, fPause, sSeries, nTimes); //***************************************
|
|
ActionWait(fPause);
|
|
nTimes = nTimes - 2; //-2 because run circuit does up and back
|
|
}
|
|
}
|
|
}
|
|
void IRunNextCircuitC(int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0)
|
|
{
|
|
if (nTimes == 0)
|
|
{
|
|
IRunCircuitC(0,1, nRun, fPause, sSeries); //***************************************
|
|
ActionWait(fPause);
|
|
ActionDoCommand(IRunNextCircuitC(nRun, fPause, sSeries));
|
|
//ActionDoCommand(SignalEvent(OBJECT_SELF,EventUserDefined(2)));
|
|
}
|
|
else
|
|
{
|
|
while (nTimes > 0)
|
|
{
|
|
IRunCircuitC(0,1, nRun, fPause, sSeries, nTimes); //***************************************
|
|
ActionWait(fPause);
|
|
nTimes = nTimes - 2;
|
|
}
|
|
}
|
|
}
|
|
void IRunNextCircuitD(int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0)
|
|
{
|
|
int nTens = GetLocalInt(OBJECT_SELF, "CurWPSeriesMaxTens");
|
|
int nNum = GetLocalInt(OBJECT_SELF, "CurWPSeriesMaxNum");
|
|
if (nTimes == 0)
|
|
{
|
|
IRunCircuitD(nTens, nNum, nRun, fPause, sSeries); //***************************************
|
|
ActionWait(fPause);
|
|
ActionDoCommand(IRunNextCircuitD(nRun, fPause, sSeries));
|
|
//ActionDoCommand(SignalEvent(OBJECT_SELF,EventUserDefined(2)));
|
|
}
|
|
else
|
|
{
|
|
while (nTimes > 0)
|
|
{
|
|
IRunCircuitD(nTens, nNum, nRun, fPause, sSeries, nTimes); //***************************************
|
|
ActionWait(fPause);
|
|
nTimes = nTimes - 2;
|
|
}
|
|
}
|
|
}
|
|
//::///////////////////////////////////////////////
|
|
//:: Improved Run Circuit
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Calculates the proper path to follow along a
|
|
predetermined set of way points
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Aidan Scanlan
|
|
//:: Created On: July 10, 2001
|
|
//:: Originally Modified By: Winternight
|
|
//:: e-mail: winters__night@hotmail.com
|
|
//:: Last Modified By: Winternight
|
|
//:: e-mail: winters__night@hotmail.com
|
|
//:://////////////////////////////////////////////
|
|
void IRunCircuit(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0)
|
|
{
|
|
PrintString(GetTag(OBJECT_SELF) + " " + GetName(OBJECT_SELF) + " Run Circuit");
|
|
// starting at a given way point, move sequentialy through incrementally
|
|
// increasing points until there are no more valid ones.
|
|
if (sSeries == "")
|
|
{
|
|
sSeries = GetTag(OBJECT_SELF);
|
|
}
|
|
string sWay = GetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX");
|
|
object oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
while(GetIsObjectValid(oTargetPoint))
|
|
{
|
|
ActionWait(fPause);
|
|
ActionMoveToObject(oTargetPoint, nRun);
|
|
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
|
|
nNum++;
|
|
if (nNum > 9)
|
|
{
|
|
nTens++;
|
|
nNum = 0;
|
|
}
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
}
|
|
// if we are only doing one traversal of the way points, we finish here
|
|
if (nTimes == 1)
|
|
{
|
|
return;
|
|
}
|
|
// once there are no more waypoints available, decriment back to the last
|
|
// valid point.
|
|
nNum--;
|
|
if (nNum < 0)
|
|
{
|
|
nTens--;
|
|
nNum = 9;
|
|
}
|
|
// start the cycle again going back to point 01
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
while(GetIsObjectValid(oTargetPoint))
|
|
{
|
|
ActionWait(fPause);
|
|
ActionMoveToObject(oTargetPoint, nRun);
|
|
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
|
|
nNum--;
|
|
if (nNum < 0)
|
|
{
|
|
nTens--;
|
|
nNum = 9;
|
|
}
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
}
|
|
}
|
|
//::///////////////////////////////////////////////
|
|
//:: Run Circuit Circular
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Calculates the proper path to follow along a
|
|
predetermined set of way points
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Aidan Scanlan
|
|
//:: Created On: July 10, 2001
|
|
//:: Originally Modified By: Aichpvee
|
|
//:: e-mail: imastatistic@hotmail.com
|
|
//:: Last Modified By: Winternight
|
|
//:: e-mail: winters__night@hotmail.com
|
|
//:://////////////////////////////////////////////
|
|
void IRunCircuitC(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0)
|
|
{
|
|
PrintString(GetTag(OBJECT_SELF) + " " + GetName(OBJECT_SELF) + " IRunCircuitC");
|
|
if (sSeries == "")
|
|
{
|
|
sSeries = GetTag(OBJECT_SELF);
|
|
}
|
|
// starting at a given way point, move sequentialy through incrementally
|
|
// increasing points until there are no more valid ones.
|
|
string sWay = GetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX");
|
|
object oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
while(GetIsObjectValid(oTargetPoint))
|
|
{
|
|
ActionWait(fPause);
|
|
ActionMoveToObject(oTargetPoint, nRun);
|
|
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
|
|
nNum++;
|
|
if (nNum > 9)
|
|
{
|
|
nTens++;
|
|
nNum = 0;
|
|
}
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
}
|
|
// once there are no more waypoints available, return to
|
|
// first point.
|
|
nTens = 0;
|
|
nNum = 1;
|
|
while(!GetIsObjectValid(oTargetPoint))
|
|
{
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
ActionWait(fPause);
|
|
ActionMoveToObject(oTargetPoint, nRun);
|
|
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
|
|
nNum++;
|
|
if (nNum > 9)
|
|
{
|
|
nTens++;
|
|
nNum = 0;
|
|
}
|
|
}
|
|
//This completes a circuit as we are now back at the start of the circuit
|
|
if (nTimes == 1)
|
|
{
|
|
return;
|
|
}
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
while(GetIsObjectValid(oTargetPoint))
|
|
{
|
|
ActionWait(fPause);
|
|
ActionMoveToObject(oTargetPoint, nRun);
|
|
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
|
|
nNum++;
|
|
if (nNum > 9)
|
|
{
|
|
nTens++;
|
|
nNum = 0;
|
|
}
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
}
|
|
nTens = 0;
|
|
nNum = 1;
|
|
while(!GetIsObjectValid(oTargetPoint))
|
|
{
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
ActionWait(fPause);
|
|
ActionMoveToObject(oTargetPoint, nRun);
|
|
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
|
|
nNum++;
|
|
if (nNum > 9)
|
|
{
|
|
nTens++;
|
|
nNum = 0;
|
|
}
|
|
}
|
|
}
|
|
//::///////////////////////////////////////////////
|
|
//:: Run Circuit Descending
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Calculates the proper path to follow along a
|
|
predetermined set of way points then walks
|
|
down through their number
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Winternight
|
|
//:: Created On: June 29, 2002
|
|
//:://////////////////////////////////////////////
|
|
void IRunCircuitD(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0, string sSeries = "", int nTimes = 0)
|
|
{
|
|
PrintString(GetTag(OBJECT_SELF) + " " + GetName(OBJECT_SELF) + " IRunCircuitD");
|
|
if (sSeries == "")
|
|
{
|
|
sSeries = GetTag(OBJECT_SELF);
|
|
}
|
|
// starting at a given way point, move sequentialy through incrementally
|
|
// decreasing points until there are no more valid ones.
|
|
string sWay = GetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX");
|
|
object oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
while(GetIsObjectValid(oTargetPoint))
|
|
{
|
|
ActionWait(fPause);
|
|
ActionMoveToObject(oTargetPoint, nRun);
|
|
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
|
|
nNum--;
|
|
if (nNum < 0)
|
|
{
|
|
nTens--;
|
|
nNum = 9;
|
|
}
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
}
|
|
if (nTimes == 1)
|
|
{
|
|
return;
|
|
}
|
|
// once there are no more waypoints available, incriment back to the last
|
|
// valid point.
|
|
nNum++;
|
|
if (nTens < 0)
|
|
{
|
|
nTens = 0;
|
|
nNum = 1;
|
|
}
|
|
// start the cycle again going back to point the last way point
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
while(GetIsObjectValid(oTargetPoint))
|
|
{
|
|
ActionWait(fPause);
|
|
ActionMoveToObject(oTargetPoint, nRun);
|
|
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
|
|
if (nNum > 9)
|
|
{
|
|
nTens++;
|
|
nNum = 0;
|
|
}
|
|
oTargetPoint = GetWaypointByTag(sWay + sSeries + "_" + IntToString(nTens) +IntToString(nNum));
|
|
}
|
|
nNum--;
|
|
if (nNum < 0)
|
|
{
|
|
nNum = 9;
|
|
nTens--;
|
|
}
|
|
SetLocalInt(OBJECT_SELF, "CurWPSeriesMaxTens", nTens);
|
|
SetLocalInt(OBJECT_SELF, "CurWPSeriesMaxNum", nNum);
|
|
}
|
|
|