Module commit
Module commit.
This commit is contained in:
33
_module/nss/npc_sit_chair.nss
Normal file
33
_module/nss/npc_sit_chair.nss
Normal file
@@ -0,0 +1,33 @@
|
||||
void main()
|
||||
{
|
||||
// * May 2002 (Brent): Don't do this if I am in combat or conversation
|
||||
if (!GetIsInCombat() && !IsInConversation(OBJECT_SELF))
|
||||
if (GetCurrentAction() != ACTION_SIT)
|
||||
{
|
||||
ClearAllActions();
|
||||
int i = 1;
|
||||
// * find first free chair
|
||||
object oChair = GetNearestObjectByTag("NW_CHAIR", OBJECT_SELF,i);
|
||||
int bFoundChair = FALSE;
|
||||
while (bFoundChair == FALSE && GetIsObjectValid(oChair) == TRUE)
|
||||
{
|
||||
// * This chair is free
|
||||
if (GetIsObjectValid(GetSittingCreature(oChair)) == FALSE)
|
||||
{
|
||||
bFoundChair = TRUE;
|
||||
ActionSit(oChair);
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
oChair = GetNearestObjectByTag("NW_CHAIR", OBJECT_SELF,i);
|
||||
}
|
||||
}
|
||||
if (bFoundChair == FALSE)
|
||||
{
|
||||
// SpeakString("This sucks I have no place to sit");
|
||||
ClearAllActions();
|
||||
ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user