| Author |
Sticky:
Post Working Scripts Here |
|
Severun
|
Posted: Saturday, 20 July 02:05AM
|
Script Name: npc_escort_user 1.0
What It Does: Allows you to have NPC's that want to be escorted to a waypoint. Once they get there they will reward the player, then run off and dissapear. This also supports multiple Areas, and glues to the PC that accepted the quest (Not the nearest PC as in the original).
Notes: Be sure to check the comments, this is the main script, but you have to cut and paste several other short scripts from the comments that become part of your conversation tree on your NPC (Don't forget to remove those //:: things before saving and compiling) =:)
Aside from that, you scripters are Uber Geeks, I love you all and just wanted to post this little tidbit to give back some Love..
NWScript:
void main()
{
int nUser = GetUserDefinedEventNumber();
if(nUser == 1001)
{
ClearAllActions();
int iEscStatus = GetLocalInt(OBJECT_SELF,"EscStatus");
if (iEscStatus > 0)
{
object oMyEscort = GetLocalObject(OBJECT_SELF,"MyEscort");
if(!(GetIsObjectValid(oMyEscort)== TRUE)) {
SetLocalInt(OBJECT_SELF,"EscStatus",0);
return;
}
float fDistance = GetDistanceToObject(GetNearestObjectByTag("E_WAY_"+GetTag(OBJECT_SELF)));
if ((fDistance < 10.0)&& (iEscStatus == 10) && (fDistance > -1.0))
{
SetLocalInt(OBJECT_SELF,"EscStatus",30);
ActionStartConversation(oMyEscort);
} else {
if ((GetLocalInt(OBJECT_SELF,"EscStatus") == 10))
{
float fEscDist= GetDistanceToObject(oMyEscort);
if(fEscDist > 4.0){
ActionMoveToObject(oMyEscort,TRUE,1.0);
}
if(fEscDist < 0.0) {
location lMyEscort = GetLocation(oMyEscort);
ClearAllActions();
JumpToLocation(lMyEscort);
}
}
}
}
}
}
|
|