Aller au contenu

Photo

Stop NPC from Area Transitioning


  • Veuillez vous connecter pour répondre
8 réponses à ce sujet

#1
Chris Lefforge

Chris Lefforge
  • Members
  • 7 messages
How can I go about stopping an NPC from area transitioning?

#2
Mudeye

Mudeye
  • Members
  • 126 messages
You need to give a lot more information about when this is happening.

#3
Baragg

Baragg
  • Members
  • 271 messages
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.

#4
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
ooh ..Baragg could you specify where this module setting is ?

#5
Baragg

Baragg
  • Members
  • 271 messages
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.

#6
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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.

#7
Fester Pot

Fester Pot
  • Members
  • 1 394 messages
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!

#8
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
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 .


#9
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Nice because having monsters follow you thru transitions isnt what I want them to do.