NWScript:
void MyWalkToStandPoint()
{
string myquestname = "M1_PLOTQUEST";
object wpobj = GetObjectByTag(GetLocalString(OBJECT_SELF,"M1_WP_STAND"));
float objface = GetLocalFloat(OBJECT_SELF, "M1_WP_STAND_FACE");
int myint1 = GetLocalInt(OBJECT_SELF, "M1_WP_STAND_QTO");
int myint2 = GetLocalInt(OBJECT_SELF, "M1_WP_STAND_RUN");
int myint3 = GetLocalInt(OBJECT_SELF, "M1_WP_STAND_JUMP");
if (((!IsInConversation(OBJECT_SELF)) || (myint3 == 1)) && (!GetIsInCombat(OBJECT_SELF)) && (GetLocalString(OBJECT_SELF,"M1_WP_STAND") != "")) {
if (GetIsObjectValid(wpobj)) {
int questnum = GetLocalInt(OBJECT_SELF, myquestname);
location myloc1 = GetLocation(OBJECT_SELF);
location myloc2 = GetLocation(wpobj);
float disdif = 0.6;
if (GetObjectType(wpobj) == OBJECT_TYPE_PLACEABLE) {
disdif = 2.0;
}
if ((GetDistanceBetweenLocations(myloc1,myloc2) < -0.6) || (GetDistanceBetweenLocations(myloc1,myloc2) > disdif)) {
if (myint3 == 0) {
ActionDoCommand(ActionForceMoveToObject(wpobj,myint2,0.5));
} else {
ActionDoCommand(ActionJumpToObject(wpobj));
SetLocalInt(OBJECT_SELF,"M1_WP_STAND_JUMP",FALSE);
}
} else {
if (objface != 0.0) {
if (GetFacing(OBJECT_SELF) != objface) {
SetFacing(objface);
}
} else {
if (GetFacing(OBJECT_SELF) != GetFacing(wpobj)) {
SetFacing(GetFacing(wpobj));
}
}
if (myint1 != 0) {
SetLocalInt(OBJECT_SELF,myquestname,myint1);
SetLocalInt(OBJECT_SELF, "M1_WP_STAND_QTO",0);
}
if (GetObjectType(wpobj) == OBJECT_TYPE_PLACEABLE) {
if (!GetIsObjectValid(GetSittingCreature(wpobj)))
{
AssignCommand(OBJECT_SELF, ActionSit(wpobj));
}
}
}
}
}
}