Author Topic: NPC Teleports player. Scripting help.  (Read 321 times)

Legacy_Obleus

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
NPC Teleports player. Scripting help.
« on: December 04, 2010, 01:30:40 pm »


               Hello there! I would need help with a few script commands.
 
I looked over the old BioWare NWN forums, but I didn't find anything, I tried to do it myself, but an error always pops-up. I also went thorugh a few scripting tutorials, but still I failed.

I would need a script where the player talks to an NPC and the NPC teleports the PC to a certain location (a waypoint if possible), if asked.

This is what I got so far, please tell me what am I doing wrong:


void main()

{
             OBJECT_SELF;
    JumpToObject(object,(GetObjectByTag(string ("BLK"), int nNth=0)int nWalkStraightLineToPoint=1);
}

This is only one of the many things I tried to do. BLK is the TAG of the waypoint.
               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
NPC Teleports player. Scripting help.
« Reply #1 on: December 04, 2010, 02:06:47 pm »


               

void main()
{
    AssignCommand(GetPCSpeaker(),JumpToLocation(GetLocation(GetObjectByTag("YOUR_TARGET_TAG_HERE"))));
}



change YOUR_TARGET_TAG_HERE to match the tag of the waypoint.

name the script whatever you like

place this script in the action tab of the convo where you want the PC to be ported.



NOTE not tested the above script, report any error please.



Be well. Game on.

GM_ODA
               
               

               
            

Legacy_Psyammy

  • Jr. Member
  • **
  • Posts: 83
  • Karma: +0/-0
NPC Teleports player. Scripting help.
« Reply #2 on: December 04, 2010, 02:08:12 pm »


               this should work for you

//Put this on action taken in the conversation editor
void main()
{

object oPC = GetPCSpeaker();

object oTarget;
location lTarget;
oTarget = GetWaypointByTag("BLK");

lTarget = GetLocation(oTarget);

//only do the jump if the location is valid.
//though not flawless, we just check if it is in a valid area.
//the script will stop if the location isn't valid - meaning that
//nothing put after the teleport will fire either.
//the current location won't be stored, either

if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

AssignCommand(oPC, ClearAllActions());

DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));

oTarget = oPC;

//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead

int nInt;
nInt = GetObjectType(oTarget);

if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget));

}


you should also grab Lilac Soul's script generator, here is the link for it


http://nwvault.ign.c...comment_page=16

hope this helps

Psyammy
               
               

               


                     Modifié par Psyammy, 04 décembre 2010 - 02:14 .
                     
                  


            

Legacy_Obleus

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
NPC Teleports player. Scripting help.
« Reply #3 on: December 04, 2010, 05:44:13 pm »


               Thank you so much for the reply. I've been dying to find this out! Thank you! '<3'