ActionSit(object)
Causes a creature to attempt to sit on something.
void ActionSit( object oChair );
Parameters
oChair
Object to sit on (typically a chair or couch).
Description
Calling object (PC, NPC) will attempt to sit in or on oChair. oChair represents the target of the script and is usually set to OBJECT_SELF as the script is put on the objects OnUse Event handler.
Remarks
Not all creatures will sit, and not all the placeables will give good results.
You can use the invisible object placeable to let creatures sit on tileset items.
On an invisible object or any object other than a chair or couch the creature always sits facing east (direction 90.0). This is due to the "use01" dummy located close to the model's center (the "use01" dummy is used to determine which direction the sitting creature will face). By modifying the invisible object model in a hak pak (i.e. moving the "use01" dummy forward 5 units), the sitting creature will now face the direction the arrow points.
Such a hakpak is made available on the Vault by Tom Aman. You can find it here:
http://nwvault.ign.com/Files/hakpacks/data/1070925245570.shtml
Version
1.62
Example
// the following script will allow the PC to sit in a chair void main() { object oPlayer = GetLastUsedBy(); object oChair = OBJECT_SELF; if (GetIsPC(oPlayer)) { if (GetIsObjectValid(oChair) && !GetIsObjectValid (GetSittingCreature(oChair))) { AssignCommand(oPlayer, ActionSit(oChair)); } } }
See Also
categories: | Action on Object Functions |
author: Dan Spezzano, editor: Lilac Soul, additional contributor(s): Dave Figueroa, François Guimond, Lilac soul
Send comments on this topic.