Author Topic: Stop NPC from Area Transitioning  (Read 540 times)

Legacy_Chris Lefforge

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
Stop NPC from Area Transitioning
« on: September 24, 2010, 01:55:58 am »


               How can I go about stopping an NPC from area transitioning?
               
               

               
            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
Stop NPC from Area Transitioning
« Reply #1 on: September 24, 2010, 04:53:37 pm »


               You need to give a lot more information about when this is happening.
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Stop NPC from Area Transitioning
« Reply #2 on: September 24, 2010, 05:00:01 pm »


               There is a module level setting that you have to set to true to allow npcs to transition areas. You may have that set to true. If your using custom transition scripts you can simply set a check in there to disallow npc using the transition.
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Stop NPC from Area Transitioning
« Reply #3 on: September 28, 2010, 01:06:41 pm »


               ooh ..Baragg could you specify where this module setting is ?
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Stop NPC from Area Transitioning
« Reply #4 on: September 28, 2010, 05:19:56 pm »


               The modules onmodload script there is a switch such as:



// * AI: Activating the switch below will make the creaures using the WalkWaypoint function

  // * able to walk across areas

  // SetModuleSwitch (MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS, TRUE);



Is is in the default script x2_mod_def_load, your module may have a custom script in that handle so whatever is in that module level handle.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Stop NPC from Area Transitioning
« Reply #5 on: September 28, 2010, 09:15:00 pm »


               Just make sure that your onmodule load Event has X2_inc_switches  included at the top.  then add this line to the viod main.



SetModuleSwitch (MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS, FALSE);



It should be false by default.  So if that does not solve your porblem you may need to search for where it is getting set to true at in your scripts and delete it from the script.
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Stop NPC from Area Transitioning
« Reply #6 on: September 28, 2010, 09:26:28 pm »


               Just an FYI on the function.



If the NPC is hostile and the player uses a door transition from one area to the next, as when fleeing, setting that particular module switch will not stop the hostile from going through the area transition as they chase the PC. This is because the above function only stops NPCs from using a transition while processing the walkwaypoint routine where the waypoints are in different areas.



A hostile creature will still follow through a door to door area transition regardless of the TRUE / FALSE setting.



FP!
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Stop NPC from Area Transitioning
« Reply #7 on: September 28, 2010, 10:52:15 pm »


               You will want to alter the default script "nw_g0_transition". This is an example that does currently work that you could try(I just added the parts in red):


////////////////////////////////////////////////////////////
// OnClick/OnAreaTransitionClick
// NW_G0_Transition.nss
// Copyright © 2001 Bioware Corp.
////////////////////////////////////////////////////////////
// Created By: Sydney Tang
// Created On: 2001-10-26
// Description: This is the default script that is called
//              if no OnClick script is specified for an
//              Area Transition Trigger or
//              if no OnAreaTransitionClick script is
//              specified for a Door that has a LinkedTo
//              Destination Type other than None.
////////////////////////////////////////////////////////////
//:: Modified By: Deva Winblood
//:: Modified On: Apr 12th, 2008
//:: Added Support for Keeping mounts out of no mount areas
//::////////////////////////////////////////////////////////


#include "x3_inc_horse"
#include "x0_inc_henai"


void main()
{
    object oClicker=GetClickingObject();
    if (GetIsInCombat(oClicker) && !GetIsPC(oClicker))
        {
        AssignCommand(oClicker, ClearAllActions(TRUE));
        AssignCommand(oClicker, ActionMoveAwayFromObject(OBJECT_SELF, FALSE, 5.0));
        return;
        }
    object oTarget=GetTransitionTarget(OBJECT_SELF);
    location lPreJump=HORSE_SupportGetMountLocation(oClicker,oClicker,0.0);


Hope that helps.
Note: I did not post the whole script. I just posted the first little bit of it to show what I added to it.
               
               

               


                     Modifié par GhostOfGod, 28 septembre 2010 - 09:55 .
                     
                  


            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Stop NPC from Area Transitioning
« Reply #8 on: September 29, 2010, 02:04:37 pm »


               Nice because having monsters follow you thru transitions isnt what I want them to do.