Full Version : Mobiles not moving
xmlspawner >>XMLSpawner Mods and Tips >>Mobiles not moving


<< Prev | Next >>

olsyke- 04-20-2006
hello

im currently setting up a town invasion of several monster spawns, i already got al my spawners ready but there is one problem

when there is no player in range the spawned monsters dont move towards their waypoints - you can actually walk away and wait for ages and when you return the mobs are still at their last location

is there any way to solve that ?

ArteGordon- 04-20-2006
QUOTE (olsyke @ April 20, 2006 06:57 am)
hello

im currently setting up a town invasion of several monster spawns, i already got al my spawners ready but there is one problem

when there is no player in range the spawned monsters dont move towards their waypoints - you can actually walk away and wait for ages and when you return the mobs are still at their last location

is there any way to solve that ?

that is because of the way in which the default AI works when you have the PlayerRangeSensitive flag for the creatures set to true. This default is set in basecreature.cs

CODE

public virtual bool PlayerRangeSensitive{ get{ return true; } }


If you set this to false, then the AI runs whether or not players are around. When it is true, then it only runs when players are around.

I do not recommend setting this to false by default unless you have a powerful machine because running all creature AI all the time is very cpu intensive.

What you can do is configure it so that you can determine the PlayerRangeSensitive setting at spawn time. This will let you turn it on and off for individual creatures.

Just make this mod around line 4490 in basecreature.cs

CODE

 public virtual bool PlayerRangeSensitive{
  get
  {
   // ARTEGORDONMOD
   // allow creatures player range sensitivity to be disabled by
   /// attaching an xmldata attachment named EnableAI
   if (XmlAttach.FindAttachment(this, typeof(XmlData), "EnableAI") != null) return false;

   return true;
  }
 }


and then make sure that you have this at the beginning of the script

CODE

using Server.Engines.XmlSpawner2;


and then spawn your creatures like this

orc/ATTACH/xmldata,EnableAI

and when they spawn, their AI will continue to run whether or not players are around.

You could also just install my PlayerRangeSensitiveMod which allows creature AI to run for some period of time even after players are not around, basically simulating having a default of PlayerRangeSensitive=false for all creatures but without the cpu load. This also prevents things like creatures piling up at dungeon entrances which is a consequence of having the AI shut off when players are not around.

olsyke- 04-20-2006
QUOTE

You could also just install my PlayerRangeSensitiveMod



where would i find that ? search feature diddnt do it for me ^^

ArteGordon- 04-20-2006
here is a link.
http://runuo.com/forums/showthread.php?t=47439