Script: NPC Forces PC to sit Working but need Help!
I just want to say thanks to all that have posted here I have know idea what I'm
doing with scripting and you have all been a great help
I know you have all seem this script before that makes a chair that a PC can sit
on. I discovered this by accident when I placed this script on a throne in the
same room I had a chair in when the PC clicked on the throne he ran to the chair
and sat down ...lol(I got this fixed ...LOL)
void main()
{
object oPlayer = GetLastUsedBy ();
object oChair;
if (GetIsPC (oPlayer))
{
oChair = GetNearestObjectByTag ("Chair", oPlayer, 0);
if (GetIsObjectValid(oChair) && !GetIsObjectValid (GetSittingCreature (oChair)))
{
AssignCommand (oPlayer, ActionSit (oChair));
}
}
}
So I thought what if you placed this script in a conversation under the action
taken tab with a small change in this line.
object oPlayer = GetLastUsedBy (); {change this to} object oPlayer =
GetPCSpeaker(); and you can force the PC to sit down.
void main()
{
object oPlayer = GetPCSpeaker();
object oChair;
if (GetIsPC (oPlayer))
{
oChair = GetNearestObjectByTag ("Chair", oPlayer, 0);
if (GetIsObjectValid(oChair) && !GetIsObjectValid (GetSittingCreature (oChair)))
{
AssignCommand (oPlayer, ActionSit (oChair));
}
}
}
In my test room I put this script in the first line of Dialog of my NPC Dragon
so when the PC clicks on him and the room auto rotates and zooms the PC doesn't
ended up talking to the dragons feet. The PC instead runs half way across the
room and sits down.
The first line of Dialog goes like this
"Greeting friend you have no need to fear me why don't you have a seat so you
don't strain your neck"
(script runs under action taken and PC sits down)
But there are two things I would like to add first would be a cool visual effect
so it looks like the dragon cast a control person spell on the PC and second I
want to zoom the room back out. If you can help please post it here....Thanks