Page 1 of 1
NPC Area transition
Posted: Fri Aug 30, 2002 6:34 am
by Mr Sleep
I am fairly new (and inexperienced

) with scripting, i have a scripting tutorial from the nwn forums but i was wondering if someone could give me a hand with NPC area transitions.
Basically i am trying to get an NPC to move from one area to a house on a seperate area when he has finished the conversation. I can't recall the exact script i have placed in there, but it is in the "actions taken" tab and it uses a transition script but i can't get him to actually use it.
I had tried getting him to go to the area transition waypoint but he just stands on it and doesn't move to the other area.
Any help is appreciated

Posted: Mon Sep 02, 2002 1:52 pm
by Mr Sleep
Just a little update. I decided to alter the module so he didn't have to walk to another location and rather i am now trying to script it so he does the disappearing act by using the nearest exit...any help?
Posted: Mon Sep 09, 2002 4:47 am
by Xyx
Here's the disappearing act Captain Mung does in the Dockhouse in Port Llast if you piss him off (taken from his onHeartbeat script). His onConversationEnd script sets the local.
object oDoor = GetObjectByTag("M2Q1M_M2Q1A");
if (GetLocalInt(GetModule(),"M2Q1A00SAILPLOT") >= 20 &&
GetLocalInt(OBJECT_SELF,"NW_L_Leave") == 0)
{
SetLocalInt(OBJECT_SELF,"NW_L_Leave",10);
ActionMoveToObject(oDoor,FALSE,1.9);
ActionDoCommand(AssignCommand(oDoor,ActionOpenDoor(oDoor)));
ActionDoCommand(AssignCommand(oDoor,DelayCommand(2.0,ActionCloseDoor(OBJECT_SELF))));
DelayCommand(10.0,DestroyObject(OBJECT_SELF));
SetCommandable(FALSE);
}
Waaay cheesy since you cannot go after him (which I wanted to).
I haven't a clue why this is in his onHearbeat script and not in a script fired from his conversation.
Posted: Mon Sep 09, 2002 7:11 am
by Mr Sleep
I was wondering how one does the generic walk away and dissapear like was often used in the BG series, i checked a few of the NPC's in the game, but they didn't seem to have the script anywhere that i could see.
Thanks for your help Xyx

Posted: Mon Sep 09, 2002 8:41 am
by garazdawi
you would probably need to use something like actionforcemoveto(locatio/object) and then do a destroyobject on the NPC
so
void main ()
{
object oNPC=OBJECT_SELF;
location lDest=GetLocation(GetNearestObjectByTag("tag"));
AssignCommand(oNPC,ActionForceMoveToLocation(oNPC,lDest));
AssignCommand(oNPC,DestroyObject(oNPC));
}
not sure about the grammar as I did it on the top of my head but it looks ok
Posted: Mon Sep 09, 2002 9:00 am
by Mr Sleep
Originally posted by garazdawi
AssignCommand(oNPC,DestroyObject(oNPC));
That's the bit that i am missing, I got the ActionForceMoveToLocation bit fine just not the destroy...cheers
