Server Totals
Le'Or - (1)
Wilderness - (1)
Ferrell - (0)
Elysia - (0)
M'Chek - (0)
Deglos - (0)
Visimontium - (0)
Underdark - (0)
Mikona - (0)
Total players: 2
Gallery

Links Menu

Guard Patrol

Moderators: Nighthawk4, Dungeon Masters

Guard Patrol

PostAuthor: 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.
User avatar
Silk
Co-Founder
 
Posts: 6665
Joined: Fri Sep 14, 2001 6:47 pm

Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Kosjixen, slow feet