NWN2 Toolset

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

NPC Sitting

 
Post new topic   Reply to topic    NWN2 Toolset Forum Index -> NWN2 Script Vault
View previous topic :: View next topic  
Author Message
Hellcow



Joined: 17 Jan 2007
Posts: 100
Location: Denmark

PostPosted: Sat Feb 24, 2007 2:17 pm    Post subject: NPC Sitting Reply with quote

This is a slightly modified version of the NPC sitting script from the OC. It will make your NPC sit and run random sitting emotes while sitting.

To use it place your NPC in the middle of the chair you want it to sit on; facing the same direction as the chair, place this script in the NPCs OnHeartbeat

Note, the NPC will turn around if clicked by a PC. You can prevent this by locking the NPCs facing in the OnSpawn and OnConversation script

Code:
#include "ginc_misc"
#include "ginc_math"
#include "ginc_wp"

void PlayCustomLoopingAnimation(object oObject, string sAnimationName)
{
   PlayCustomAnimation(oObject, sAnimationName, 1);
}

void PlayCustomOneShotAnimation(object oObject, string sAnimationName)
{
   PlayCustomAnimation(oObject, sAnimationName, 0);
}

void main()
{
   if (GetAILevel(OBJECT_SELF) == AI_LEVEL_VERY_LOW)
   {
      return;
   }

   object oActor = OBJECT_SELF;
   
   if (GetLocalInt(oActor, "SetDefaultAnimation") == 0)
   {
      AssignCommand(oActor, PlayCustomLoopingAnimation(oActor, "sitidle"));
      SetLocalInt(oActor, "SetDefaultAnimation", 1);
   }
   
   int nRandom = RandomIntBetween(1, 9);
   
   switch(nRandom)
   {
      case 1:
         PlayCustomLoopingAnimation(oActor, "sitfidget");
         break;
      case 2:
         PlayCustomLoopingAnimation(oActor, "sittalk01");
         break;
      case 3:
         PlayCustomLoopingAnimation(oActor, "sittalk02");
         break;
      case 4:
         PlayCustomLoopingAnimation(oActor, "sitfidget");
         break;
      case 5:
         PlayCustomLoopingAnimation(oActor, "sittalk01");
         break;
      case 6:
      case 7:
      case 8:
         break;
   }
}
   
   
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    NWN2 Toolset Forum Index -> NWN2 Script Vault All times are GMT
Page 1 of 1

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum





Powered by phpBB © 2001 phpBB Group

Chronicles phpBB2 theme by Jakob Persson (http://www.eddingschronicles.com). Stone textures by Patty Herford.

Abuse - Report Abuse
Powered by forumup.com free forum, create your free forum!
Created by Raulken of Hyarbor S.r.l.
TOS & Privacy.

Page generation time: 0.026