Author Sticky: Post Working Scripts Here
bonkey2 Posted: Wednesday, 26 June 02:00AM
Script Name: nw_c3_escort1 (modified)

What it does: A basic escort NPC to a location quest.

Notes: In the NPC coversation set the variable NW_L_MADEITTOEXIT to 10. Then change the variable declaration from GetPCSpeaker() to OBJECT_SELF. You will also need to create a waypoint at the detination with the waypoint TAG = NW_WAY_<NPC TAG> Once the NPC reaches this location he will set NW_L_MADEITTOEXIT to 30 and initiate conversation. Then the NPC will set NW_L_MADEITTOEXIT to 40. This script can be placed in the OnHeartbeat of the NPC.

NWScript:
//::///////////////////////////////////////////////

//::

//:: Escort by player

//::

//:: NW_C3_Escort1.nss

//::

//:: Copyright (c) 2001 Bioware Corp.

//::

//::

//:://////////////////////////////////////////////

//::

//::

//:: Follows player.  If gets close to a waypoint

//:: named NW_WAY_<MyTag> then says thank you text

//:: and escapes area.

//::

//:://////////////////////////////////////////////

//::

//:: Created By: Brent

//:: Created On: May 16, 2001

//::

//:://////////////////////////////////////////////

#include "NW_I0_PLOT"

void main()

{

    ClearAllActions();

//SpeakString(IntToString(GetLocalInt(OBJECT_SELF,"NW_L_MADEITTOEXIT")));

    // * made it to waypoint in time

    if (GetIsObjectValid(GetNearestPC()) == TRUE)

    {

    if ((GetDistanceToObject(GetNearestObjectByTag("NW_WAY_"+GetTag(OBJECT_SELF))) < 7.0)&& (GetLocalInt(OBJECT_SELF,"NW_L_MADEITTOEXIT") == 10))

    {

        SetLocalInt(OBJECT_SELF,"NW_L_MADEITTOEXIT",30);

        ActionStartConversation(GetNearestPC());

        SetLocalInt(OBJECT_SELF,"NW_L_MADEITTOEXIT",40);

    }

    else

    // * follow, if players accepted

    if ((GetLocalInt(OBJECT_SELF,"NW_L_MADEITTOEXIT") == 10) && (GetDistanceToObject(GetNearestPC()) > 4.0))

    {

        ActionMoveToObject(GetNearestPC(),TRUE);

    }

    else

    // * timer expired

    if (FALSE)

    {

        SetLocalInt(OBJECT_SELF,"NW_L_MADEITTOEXIT",20);

        ActionStartConversation(GetNearestPC());

    }

    } // PC object is valid

    else

    {

        SpeakString("TEMP NO PC");

    }

}



Enjoy!

--Bonkey