FANDOM


These sit on spawn and sit on conversation scripts will cause an NPC to sit when it spawns and keep it seated during a conversation. In addition, the NPC will not rotate to follow the PC after the conversation is over. These scripts assume there is a placeable (chair) for the NPC to sit on, where the tag of the placeable is "CHAIR_" followed by the tag of the NPC. For example, if the NPC's tag is "Ralph", the chair tag should be "CHAIR_Ralph".

Spawning Edit

This first script handles the NPC's OnSpawn event. (One descriptive name for the script is sitonspawn.) Also, if the NPC has a conversation file, this script should be the Normal and Aborted scripts for that file (under the Current File tab in the conversation editor). Otherwise the NPC will stand up at the end of the conversation.


#include "nw_o2_coninclude"
#include "x0_i0_walkway"
 
void main()
{
    // ***** BEGIN DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ***** //
    SetListeningPatterns();
    WalkWayPoints();
    GenerateNPCTreasure();
    // ***** END DEFAULT GENERIC BEHAVIOR ***** //
 
    // Sit in the assigned chair.
    string sChairTag = "CHAIR_" + GetTag(OBJECT_SELF);
    object oChair = GetNearestObjectByTag(sChairTag);
    ActionSit(oChair);
}

Conversing Edit

This second script handles the OnConversation event of the NPC. (One descriptive name for the script is sitonconvers.)


void main()
{
    if(GetCommandable(OBJECT_SELF))
    {
        // Standard response, but clear actions *after* the conversation starts.
        BeginConversation();
        ClearAllActions();
 
        // Sit in the assigned chair.
        string sChairTag = "CHAIR_" + GetTag(OBJECT_SELF);
        object oChair = GetNearestObjectByTag(sChairTag);
        ActionSit(oChair);
    }
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.