Please note that new user registrations disabled at this time.

NPC Area transition

This forum is to be used for all discussions pertaining to BioWare's Neverwinter Nights, its Shadows of Undrentide and Hordes of the Underdark expansion packs, and any user-created or premium modules.
Post Reply
User avatar
Mr Sleep
Posts: 11273
Joined: Thu Oct 19, 2000 10:00 pm
Location: Dead End Street
Contact:

NPC Area transition

Post by Mr Sleep »

I am fairly new (and inexperienced :o ) 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 :)
I'd have to get drunk every night and talk about virility...And those Pink elephants I'd see.
User avatar
Mr Sleep
Posts: 11273
Joined: Thu Oct 19, 2000 10:00 pm
Location: Dead End Street
Contact:

Post 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?
I'd have to get drunk every night and talk about virility...And those Pink elephants I'd see.
User avatar
Xyx
Posts: 3104
Joined: Mon Jun 04, 2001 10:00 pm
Location: The Netherlands
Contact:

Post 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.
[url="http://www.sorcerers.net/Games/BG2/SpellsReference/Main.htm"]Baldur's Gate 2 Spells Reference[/url]: Strategy, tips, tricks, bugs, cheese and corrections to the manual.
User avatar
Mr Sleep
Posts: 11273
Joined: Thu Oct 19, 2000 10:00 pm
Location: Dead End Street
Contact:

Post 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 :)
I'd have to get drunk every night and talk about virility...And those Pink elephants I'd see.
User avatar
garazdawi
Posts: 2563
Joined: Mon Jun 24, 2002 11:00 am
Location: Skövde, Sweden
Contact:

Post 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
"Those who control the past control the future, those who control the present control the past" And I rule the PRESENT!!
I put the 'laughter' back in 'slaughter'
User avatar
Mr Sleep
Posts: 11273
Joined: Thu Oct 19, 2000 10:00 pm
Location: Dead End Street
Contact:

Post 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 :)
I'd have to get drunk every night and talk about virility...And those Pink elephants I'd see.
Post Reply