View Single Post
Old 01-07-2004, 10:13 PM   #3
Darkman
Avatar
 

Join Date: July 11, 2001
Location: Austin, Texas
Age: 44
Posts: 525
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.
__________________
There more of it there is,<br />The less you see.
Darkman is offline   Reply With Quote