42 lines
1.5 KiB
Plaintext
42 lines
1.5 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
// ai_merchant - Team Merchant Routine
|
|
//------------------------------------------------------------------------------
|
|
// By Deva B. Winblood. September, 22nd 2008
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void main()
|
|
{
|
|
object oMe=OBJECT_SELF;
|
|
string sTeamID=GetLocalString(oMe,"sTeamID");
|
|
object oWP=GetWaypointByTag(sTeamID+"_MERCHANT");
|
|
if (GetIsObjectValid(oWP))
|
|
{ // destination known
|
|
if (GetArea(oMe)!=GetArea(oWP))
|
|
{ // long distance pathing
|
|
if (GetCurrentAction(oMe)!=ACTION_MOVETOPOINT)
|
|
{ // move
|
|
AssignCommand(oMe,ClearAllActions(TRUE));
|
|
AssignCommand(oMe,ActionForceMoveToObject(oWP,TRUE,3.0,300.0));
|
|
} // move
|
|
} // long distance pathing
|
|
else
|
|
{ // short pathing
|
|
if (GetDistanceBetween(oMe,oWP)>4.0)
|
|
{ // move
|
|
AssignCommand(oMe,ClearAllActions());
|
|
AssignCommand(oMe,ActionForceMoveToObject(oWP,TRUE,3.0,90.0));
|
|
} // move
|
|
else
|
|
{ // lower AI and wait
|
|
SetAILevel(oMe,AI_LEVEL_DEFAULT);
|
|
} // lower AI and wait
|
|
} // short pathing
|
|
} // destination known
|
|
else
|
|
{ // destination unknown
|
|
SpeakString("Unknown destination '"+sTeamID+"_MERCHANT' does not exist.");
|
|
} // destination unknown
|
|
}
|