So I guess I need a way for monsters to drop "aggro" once no PC's are in the area. I already have a area cleanup script that runs in my OnExit for each area. So they will despawn in time if I can simply get them to not go through transitions, and even worse somehow teleport across my world into town to continue fighting someoen who died. Thanks to anyone who helps me
Help! Monsters follow through transitions
#1
Posté 02 mars 2011 - 10:53
So I guess I need a way for monsters to drop "aggro" once no PC's are in the area. I already have a area cleanup script that runs in my OnExit for each area. So they will despawn in time if I can simply get them to not go through transitions, and even worse somehow teleport across my world into town to continue fighting someoen who died. Thanks to anyone who helps me
#2
Posté 02 mars 2011 - 11:01
add this under line object oClicker=GetClickingObject();
Then monsters stop before the transition so its a good idea to clean them otherwise they ambush other PC comming in...if(!GetIsPC(oClicker))
{
return;
}
#3
Posté 02 mars 2011 - 11:16
#4
Posté 02 mars 2011 - 11:34
Player spams AoE spells
Player dies to mobs
player returns to town and rests
about 15 seconds later all the monsters show up in town that he was fighting.
#5
Posté 03 mars 2011 - 12:25
When did this start happening?
Have you installed any new content that could have caused it to start happening?
Have you modified any af the default henchman scripts?
What AoE spells are being spammed.
#6
Posté 03 mars 2011 - 04:45
#7
Posté 03 mars 2011 - 07:13
from "x2_inc_switches"
// * 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);
Make sure it is false if you do not want monsters to follow players through transitions.
As despite what the function says, it is not limited to just waypoints, but allows hostiles to transition in pursuit.
This is likely if you are using X2_mod_def_load.
Edit*
Another thing to check would be to make sure your Onheartbeat is not using the command: GetNearestEnemy, always make sure you use NearestPercievedEnemy (or its variants: seen or heard.)
Modifié par Xovian, 03 mars 2011 - 07:20 .
#8
Posté 03 mars 2011 - 12:39
#9
Posté 04 mars 2011 - 05:46
//------------------------------------------------------------------------------
// * Setting this switch to TRUE will enable the allow NPCs running between waypoints using the WalkWaypoints
// * function to cross areas, like they did in the original NWN. This was changed in 1.30 to use only
// * waypoints in one area.
//------------------------------------------------------------------------------
const string MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS = "X2_SWITCH_CROSSAREA_WALKWAYPOINTS";
but it dosent say true of false anywhere for me to edit. I'm confused do i make a mod varible with the string FALSE ?
#10
Posté 04 mars 2011 - 06:55
#11
Posté 04 mars 2011 - 03:53
P.S. This is my current OnExit script if anyone could show me how and where to put in the effect i'm looking for that would be handy.
// Area OnExit script to clean up the area.
//:://///////////////////////////////////////
// Function to determine if any PCs are in an area.
int GetIsPCInArea( object oArea = OBJECT_SELF)
{ if( !GetIsObjectValid( oArea) || (GetArea( oArea) != oArea)) return FALSE;
object oInArea = GetFirstObjectInArea( oArea);
if( !GetIsObjectValid( oInArea)) return FALSE;
if( GetIsPC( oInArea)) return TRUE;
return GetIsObjectValid( GetNearestCreature( CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oInArea));
}
// Function to destroy BodyBags, Encounter creatures, and Items left laying around. Plot items will be left alone.
// Also closes all open doors in the area and locks ones that have a lock on them.
// Only does all this if the area has no PCs in it.
void CleanArea( object oArea = OBJECT_SELF)
{ if( !GetIsObjectValid( oArea) || (GetArea( oArea) != oArea) || GetIsPCInArea( oArea)) return;
object oObject = GetFirstObjectInArea( oArea);
while( GetIsObjectValid( oObject))
{ switch( GetObjectType( oObject))
{ case OBJECT_TYPE_CREATURE:
if( GetIsEncounterCreature( oObject) && !GetPlotFlag( oObject)) DestroyObject( oObject, 0.1f);
break;
case OBJECT_TYPE_PLACEABLE:
if( GetTag( oObject) == "BodyBag")
{ int bPlotFound = FALSE;
object oObjectInside = GetFirstItemInInventory( oObject);
while( GetIsObjectValid( oObjectInside))
{ if( GetPlotFlag( oObjectInside)) bPlotFound = TRUE;
else DestroyObject( oObjectInside, 0.1f);
oObjectInside = GetNextItemInInventory( oObject);
}
if( !bPlotFound) DestroyObject( oObject, 0.2f);
}
break;
case OBJECT_TYPE_ITEM:
{ int bPlotFound = GetPlotFlag( oObject);
if( !bPlotFound && GetHasInventory( oObject))
{ object oObjectInside = GetFirstItemInInventory( oObject);
while( GetIsObjectValid( oObjectInside))
{ if( GetPlotFlag( oObjectInside)) bPlotFound = TRUE;
else DestroyObject( oObjectInside, 0.1f);
oObjectInside = GetNextItemInInventory( oObject);
}
}
if( !bPlotFound) DestroyObject( oObject, 0.2f);
}
break;
case OBJECT_TYPE_AREA_OF_EFFECT:
DestroyObject( oObject, 0.1f);
break;
case OBJECT_TYPE_DOOR:
if( GetIsOpen( oObject)) AssignCommand( oObject, ActionCloseDoor( oObject));
if( !GetLocked( oObject) && GetLockLockable( oObject)) AssignCommand( oObject, ActionDoCommand( SetLocked( oObject, TRUE)));
break;
case OBJECT_TYPE_ENCOUNTER:
// Nothing to clean up with these.
break;
case OBJECT_TYPE_STORE:
// Nothing to clean up with these.
break;
case OBJECT_TYPE_TRIGGER:
// Nothing to clean up with these.
break;
case OBJECT_TYPE_WAYPOINT:
// Nothing to clean up with these.
break;
}
oObject = GetNextObjectInArea( oArea);
}
}
// Area OnExit main function.
void main()
{ object oExiting = GetExitingObject();
if( !GetIsPC( oExiting)) return;
DelayCommand( 300.0f, CleanArea());
}
#12
Posté 04 mars 2011 - 04:53
0pie wrote...
How about an OnExit script that either puts monsters in limbo ( no loot left behind is why limbo and not death )
This script doesnt put a monster anywhere, it simply destroys them Irrevocably, and entierly.
The script also only destroys encounter creatures, that are not plot, so those that were not done from an encounter are not destroyed.
However, this is not the script causing your problem.
It has to be coming from somewhere else.
#13
Posté 04 mars 2011 - 05:15
When did it start hapening?
What AoE spells where the PC spamming?
Does it only happen when the PC was Spaming the AoE spell?
If It only Happens when the AoE spells are used. Do you have a spell Hook in place?
Have any of the Default NPC scripts been modified?
AreYou useing any Haks.
Did it start happening after installing any Haks or ERF's
Without answers to at least some of the questions. The places to look for the solution to your problem are just way to many.
#14
Posté 04 mars 2011 - 05:29
Use this for the OnEnter script to the town, or at least add it to the top of your script:
void main()
{
object oPC = GetEnteringObject();
if (GetIsPC(oPC) || GetIsPossessedFamiliar(oPC) || GetIsDM(oPC) || GetIsDMPossessed(oPC))
{
//If it is a Player, DM, or DM with a possessed creature, or possessed familiar do nothing
return;
}
else if(GetIsObjectValid(oPC))
{
DestroyObject(oPC, 0.1);
}
The above script is very simple, it destroys anything that is not a player, dm, or possessed familiar coming through the transition. Since only creatures can use transitions, defining the type (object =creature) is not needed.
#15
Posté 04 mars 2011 - 07:08
Ok, so we place this on enter of the area?Xovian wrote...
I agree Lightfoot, but there is a simply way to remedy this.
Use this for the OnEnter script to the town, or at least add it to the top of your script:
void main()
{
object oPC = GetEnteringObject();
if (GetIsPC(oPC) || GetIsPossessedFamiliar(oPC) || GetIsDM(oPC) || GetIsDMPossessed(oPC))
{
//If it is a Player, DM, or DM with a possessed creature, or possessed familiar do nothing
return;
}
else if(GetIsObjectValid(oPC))
{
DestroyObject(oPC, 0.1);
}
The above script is very simple, it destroys anything that is not a player, dm, or possessed familiar coming through the transition. Since only creatures can use transitions, defining the type (object =creature) is not needed.
Problem solved there are no monsters to folow the PC in the first place. Every single creature will fire the onEnter event.
#16
Posté 04 mars 2011 - 07:28
Lightfoot8 wrote...
We still do not have enough information to solve you problem. To help us find an answer for you, We need more information:
When did it start hapening?
What AoE spells where the PC spamming?
Does it only happen when the PC was Spaming the AoE spell?
If It only Happens when the AoE spells are used. Do you have a spell Hook in place?
Have any of the Default NPC scripts been modified?
AreYou useing any Haks.
Did it start happening after installing any Haks or ERF's
Without answers to at least some of the questions. The places to look for the solution to your problem are just way to many.
- Only noticed it recently ( a week perhaps )
- Grease & Cloud of Bewildermint
- yes only when AoE's are around and player dies.
- not sure what a spell hook is
- yes "x2_def_spawn"
- no no Haks
- no, at least I didnt notice it or it didnt happen until recently.
Here is my alterd OnSpawn script
//:://///////////////////////////////////////////////:: Name x2_def_spawn//:: Copyright © 2001 Bioware Corp.//::///////////////////////////////////////////////* Default On Spawn script
2003-07-28: Georg Zoeller:
If you set a ninteger on the creature named "X2_USERDEFINED_ONSPAWN_EVENTS" The creature will fire a pre and a post-spawn event on itself, depending on the value of that variable 1 - Fire Userdefined Event 1510 (pre spawn) 2 - Fire Userdefined Event 1511 (post spawn) 3 - Fire both events
2007-12-31: Deva Winblood Modified to look for X3_HORSE_OWNER_TAG and if it is defined look for an NPC with that tag nearby or in the module (checks near first). It will make that NPC this horse's master.
*///::////////////////////////////////////////////////:: Created By: Keith Warner, Georg Zoeller//:: Created On: June 11/03//:://////////////////////////////////////////////
const int EVENT_USER_DEFINED_PRESPAWN = 1510;const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
#include "x2_inc_switches"void main(){ string sTag; object oNPC; // User defined OnSpawn event requested? int nSpecEvent = GetLocalInt(OBJECT_SELF,"X2_USERDEFINED_ONSPAWN_EVENTS");
// Pre Spawn Event requested if (nSpecEvent == 1 || nSpecEvent == 3 ) { SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_PRESPAWN )); }
sTag=GetLocalString(OBJECT_SELF,"X3_HORSE_OWNER_TAG"); if (GetStringLength(sTag)>0) { // look for master oNPC=GetNearestObjectByTag(sTag); if (GetIsObjectValid(oNPC)&&GetObjectType(oNPC)==OBJECT_TYPE_CREATURE) { // master found AddHenchman(oNPC); } // master found else { // look in module oNPC=GetObjectByTag(sTag); if (GetIsObjectValid(oNPC)&&GetObjectType(oNPC)==OBJECT_TYPE_CREATURE) { // master found AddHenchman(oNPC); } // master found else { // master does not exist - remove X3_HORSE_OWNER_TAG DeleteLocalString(OBJECT_SELF,"X3_HORSE_OWNER_TAG"); } // master does not exist - remove X3_HORSE_OWNER_TAG } // look in module } // look for master
/* Fix for the new golems to reduce their number of attacks */
int nNumber = GetLocalInt(OBJECT_SELF,CREATURE_VAR_NUMBER_OF_ATTACKS); if (nNumber >0 ) { SetBaseAttackBonus(nNumber); }
// Execute default OnSpawn script. ExecuteScript("nw_c2_default9", OBJECT_SELF);
//Post Spawn event requeste if (nSpecEvent == 2 || nSpecEvent == 3) { SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_POSTSPAWN)); } // Set Locals to support Wolfie's Return Home Scriptlet in HeartbeatSetLocalLocation(OBJECT_SELF, "WHERE_I_SPAWNED", GetLocation(OBJECT_SELF));SetLocalInt(OBJECT_SELF, "NPC_FUNCTIONSTATE",0);}
Thanks for all the help guys 8)
#17
Posté 05 mars 2011 - 06:36
#18
Posté 06 mars 2011 - 03:50
NW_S0_GreaseA
NW_S0_GreaseB
NW_S0_GreaseC
X2_S0_CldBewldA
****
X2_S0_CldBewldC





Retour en haut






