User Tools

Site Tools


features:sinfar_supporter_housing:npcbehaviour

NPC Behaviors

In addition to generating NPC behavior with scripts and conversations, there are a few variables that have been enabled to short cut NPC behavior as well. NW_GENERIC_MASTER and NW_ANIM_CONDITION will not work natively however, just append the P_ to them and you're good to go:

P_NW_GENERIC_MASTER

Webpage with description and variable values is here. https://nwn.sinfar.net/nwn_spawncond.php

P_NW_ANIM_CONDITION

Webpage with description and variable values is here. https://nwn.sinfar.net/nwn_animcond.php

Each of those webpages will describe a variety of behaviors available through this variables that can be used to give NPC's more “life” in your homes. At the time of this writing, many of them have been tested, but you should experiment to make sure the ones you want will work for you.

Also at the time of this writing, interacting with objects/placables still requires a script or so.

void main()
{
    ActionSit(GetNearestObject(OBJECT_TYPE_ALL, OBJECT_SELF,1));
}

Note, testing still required for all scripts, but the above works fine.

Want an NPC to spot a player and walk over and start their conversation script with them?

//Courtesy Bioware. Edited by TheUglyOne.
//This is an OnHeartbeat Script
//This searches for a PC within visual range who this NPC hasn't initiated
//dialogue with.  If one is present, the NPC will display a one line string
//overhead.
//Once conversation is initiated and the PC has hit continue at least once,
//The local int "Stop_Convo" + <tag of this character> should be set to TRUE

void main()
{
    if(IsInConversation(OBJECT_SELF) == FALSE)
    {
        int bFound = FALSE;
        int nNth = 1;
        object oPlayerInSight = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,
                                                   PLAYER_CHAR_IS_PC,
                                                   OBJECT_SELF,
                                                   nNth,
                                                   CREATURE_TYPE_PERCEPTION,
                                                   PERCEPTION_SEEN);
        while (GetIsObjectValid(oPlayerInSight) && bFound == FALSE)
        {
            if(GetLocalInt(oPlayerInSight,"Stop_Convo" + GetTag(OBJECT_SELF)) == FALSE)
            {
                bFound = TRUE;
            }
            else
            {
                nNth++;
                oPlayerInSight = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,
                                                    PLAYER_CHAR_IS_PC,
                                                    OBJECT_SELF,
                                                    nNth,
                                                    CREATURE_TYPE_PERCEPTION,
                                                    PERCEPTION_SEEN);
            }
        }
        if(bFound)
        {
         SpeakString("Well, Well Well!  Wot do we ave ere!");
         ActionMoveToObject(oPlayerInSight);
         ActionStartConversation (oPlayerInSight);
         }
    }
}

Need to make an NPC hate the player so that they can fight (testing required). Create the following script and set it to the Actions Taken tab on the line of dialogue when the conversation specifically goes south:

#include "nw_i0_plot"
#include "NW_I0_GENERIC"
void main()
{
   object oTarget = GetPCSpeaker();
   SetIsTemporaryEnemy(object oTarget, object oSource=OBJECT_SELF, int bDecays=FALSE, float fDurationInSeconds=180.0f)
}

These and many other actions await. If you discover something new, or something better to add to the list above, please add it here!

authpdo: Statement did not return 'mail' attribute [auth.php:522]
features/sinfar_supporter_housing/npcbehaviour.txt · Last modified: 2019/05/31 05:02 by LockOn

phpBB Appliance - Powered by TurnKey Linux