BioWare Atari
BioWare Info BioWare Games Support Forums Visit the BioWare Store
Neverwinter Nights Home
Neverwinter Nights Home

Sitting In Chairs and Sleeping

Intended Audience: For Builders
By David Gaider

[Printer Friendly / Syntax Highlight]

How do I get my PC to sit on a chair?
There is currently no emote to sit in a chair. Until one is added for PC characters to use, the script to make a PC sit down in a chair has to be on the object, itself.

If you put down a useable placeable object chair (the chair has the Useable box checked, and make sure the PC will have room to manoever while sitting), put this script in the OnUsed event in the Scripts tab:

NWScript:

When I place an NPC in the toolset, they just stand there. Is there no way I can have them sitting down?

Not in the toolset, no... the creature must be standing. The creature would have to be scripted so that when the game begins it finds a chair and performs the ActionSit command.

Create a placeable object chair and give it the tag "CHAIR". Place the NPC next to the chair. Copy and save their OnSpawn script under another name, and add this line at the bottom:

ActionSit (GetNearestObjectByTag ("CHAIR", OBJECT_SELF));

Note that when a PC speaks the the NPC, they will stand up. To get them to sit back down, you will need to go to the 'Other Files' tab in their dialogue. You will see spots for two scripts there, which activate when dialogue is either ended or aborted. Make a script that calls the above line and they will sit back down once dialogue is over.

This is all fine and well, but what if I want the NPC to sit on the chairs already in the tileset?

Some users have reported success by following the same process as sitting in a chair... except find the 'invisible object' placeable object and place that on the seat of the chair. Give that object the tag "CHAIR" and use the same ActionSit line as above and they should sit down for you just the same.

What if I want my NPC sleeping on a bed?

There is no way currently to actually get a creature into a placeable object bed or a tileset bed. A placeable object body can be placed onto a bed, but not a creature.

A creature can, however, sleep on a placeable object bedroll or on the floor. If you wanted your NPC to start off the game sleeping, you need to copy the creature's OnSpawn script, save it under a different name, and then add this to the bottom of that script:

effect eLieDown = EffectSleep();
effect eSnore = EffectVisualEffect (VFX_IMP_SLEEP);
effect eSleep = EffectLinkEffects (eLieDown, eSnore);
ApplyEffectToObject (DURATION_TYPE_PERMANENT, eSleep, OBJECT_SELF);


Waking Up Your NPC

If you want the NPC to wake up at some point, you must use the RemoveEffect command. An effect, once applied, cannot simply have another variable defined as EffectSleep, however, and removed by the command. The 'pointer' must be on that particular effect. If the effect is the same variable in the same script as when it was applied, you could simply use this:

RemoveEffect (OBJECT_SELF, eSleep);

Normally, however, you must scan through an object's effects and find the one you're looking for through the effect type. The following is a simple script to remove an object's sleep effect (this one in the OnHeartbeat of the creature should any hostile come within 5 metres):

NWScript:

 

 

New Mass Effect PC Content Available
Neverwinter Nights 2 Forums
Hide/Show

English
Deutsch
Français
Español
Italiano

Hide/Show

View Latest Screenshots 

View Latest Screenshots
Hide/Show

Multiplayer Games at Neverwinter Connections

Today
Schedule a Game...



Current time is: (set time)
Tue, 07 October 2008 07:00AM

Hide/Show

Buy Premium Modules

Top NWN: HotU Modules:
1. Shadewood
2. More...

Top NWN: SoU Modules:
1. Shadewood
2. More...

Top CEP Modules:
1. The Lord of Terror The Diablo Campa...
2. More...

Top Modules - NWVault:
1. Hall of Fame
2. More...

Total Modules: 4423

Hide/Show

4,189,533 BioWare Users:
  22 Logged In
  7 Hidden
  167 Guests

788 Playing Online
  100% NWN
  100% NWN: SoU
  99% NWN: HotU

512 Registered Guilds

7,841,069 posts in forums

Newest Forum Topics:
1. Script compiling problems (NWN 1: Scripting)

2. is there any mod/patch to bring ... (Baldur's Gate Gameplay (Spoilers!))

3. Mass Effect 2 Rumors (Mass Effect General Discussion (No spoilers allowed))

4. Cleric or Druid? (Baldur's Gate II: SoA and ToB General Discussion)

5. Sadness (NWN2: Builders - NWN2 Toolset)