Ironworks Gaming Forum

Ironworks Gaming Forum (http://www.ironworksforum.com/forum/index.php)
-   Neverwinter Nights 1 & 2 Also SoU & HotU Forum (http://www.ironworksforum.com/forum/forumdisplay.php?f=16)
-   -   Something I've never learned to do...sitting (http://www.ironworksforum.com/forum/showthread.php?t=35826)

Larry_OHF 01-07-2004 09:54 PM

<font color=skyblue>Can somebody teach me how to get NPCs and also PCs to sit in chairs that are in a tavern?</font>

[ 01-07-2004, 09:55 PM: Message edited by: Larry_OHF ]

SpiritWarrior 01-07-2004 10:09 PM

Throw this in the Onused field of your chair. This is for PC's. Make sure you make the object usable!

Quote:

void main()
{
object oChair = OBJECT_SELF;
if(!GetIsObjectValid(GetSittingCreature(oChair)))
{
AssignCommand(GetLastUsedBy(), ActionSit(oChair));
}
}
For NPC's It's a lil bit more complicated, the creature would have to be scripted so that when the game begins it finds a chair and performs the ActionSit command.

Create a chair and give it the tag "CHAIRNPC" or whatever you want (keep it simple). 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 ("CHAIRNPC", OBJECT_SELF));

If your gonna call it something else make sure the tag "CHAIRNPC" of the actual chair matches that in the script like I have done above.
Note that when a PC speaks to 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.

[ 01-07-2004, 10:14 PM: Message edited by: SpiritWarrior ]

Darkman 01-07-2004 10:13 PM

You can put this script in the On Used spot of a bench/chair to have your players sit in it. Make sure the bench/chair is marked as Useable.

void main()
{
object oPlayer=GetLastUsedBy();

if(GetIsPC(oPlayer))
{
object oChair = OBJECT_SELF;
if (GetIsObjectValid(oChair) && !GetIsObjectValid(GetSittingCreature(oChair)))
{
AssignCommand(oPlayer, ActionSit(oChair));
}
}
}

This code was taken from the Halls of Advanced Training module.
-----------------------------

As for NPC's, here are scripts I used in one of my modules that makes the NPC sit down upon being spawned and remain seated when talked to.

Put this one in the On Spawned spot of the NPC:

void main()
{
//Sits the NPC down
int nChair = 1;
object oChair;
//"DROW_THRONE" is the tag name of the chair to be used
oChair = GetNearestObjectByTag("DROW_THRONE", OBJECT_SELF, nChair);
ActionSit(oChair);
}


And this one in the On Conversation:

void main()
{
//Set the NPC as the speaker
if(GetCommandable(OBJECT_SELF))
{
//Start the conversation script
BeginConversation();
ClearAllActions();
// Clear the actions so the NPC will not follow you with his/her eyes
int nChair = 1;
object oChair;
oChair = GetNearestObjectByTag("DROW_THRONE", OBJECT_SELF, nChair);
//Sit the NPC down
ActionSit(oChair);
}
}


Let me know if you have any questions.

Larry_OHF 01-08-2004 02:54 AM

wow!

Thanks guys!


All times are GMT -4. The time now is 09:51 AM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
©2024 Ironworks Gaming & ©2024 The Great Escape Studios TM - All Rights Reserved