Guard Patrol

Moderator: Event DM

Post Reply
User avatar
Silk
Co-Founder
Posts: 6662
Joined: Fri Sep 14, 2001 6:47 pm
Contact:

Guard Patrol

Post by Silk » Thu Aug 01, 2002 4:24 am

Code: Select all

object GetNextPatrolWaypoint(object oCreature, string sWPName){
    int iDelPos = FindSubString(sWPName, "|");
    string sWPRoot = GetSubString(sWPName, 0, iDelPos);
    int iWPCount = StringToInt(GetSubString(sWPName, iDelPos + 1, GetStringLength(sWPName) - iDelPos)) + 1;

    object oNextWP = GetNearestObjectByTag(sWPRoot + "_" + IntToString(iWPCount), oCreature);

    if (!GetIsObjectValid(oNextWP)){
        oNextWP = GetNearestObjectByTag(sWPRoot + "_1");
    }

    return oNextWP;
}


void CheckStuck(object oCreature)
{
    int iCurrentAction = GetLocalInt(oCreature, "CurrentAction");
    int iTimeOut = GetLocalInt(oCreature, "ActionStartTime");
    int iCurrentTime = StringToInt(IntToString(GetTimeHour()) + IntToString(GetTimeMinute()) + IntToString(GetTimeSecond()));
    object oCurrentWaypoint = GetLocalObject(oCreature, "CurrentWaypoint");

    if (iCurrentAction = 1 && (iCurrentTime > iTimeOut)){
        object oNextWaypoint = GetNextPatrolWaypoint(oCreature, GetName(oCurrentWaypoint));
        if (GetIsObjectValid(oNextWaypoint)){
            ClearAllActions();
            ActionJumpToObject(oNextWaypoint);
        }
    }
}

void main()
{

}
Silk

Member of the MadK@t lover's group.
Post Reply