Full Version : SmartSpawner Xml question
xmlspawner >>XMLSpawner - Discussion >>SmartSpawner Xml question


<< Prev | Next >>

Erica- 07-05-2006
Hi again im still learning how to use your xml spawner which its spawned world question is was curious in how to make the smart spawner where staff if hidden and i go in a dungeon want it where it wont spawn for staff only if hidden but if staff unhides want it to spawn in those dungeons is there a command that will do this? also how would i use the smart spawner where npc stays actived only and dont get deactived by the smart spawner just want the dungeons to do this if possible if theres a command for this as well would like to know what they are Thank You.

ArteGordon- 07-06-2006
you would have to make a slight change to the smartspawning detection algorithm to allow it to trigger for unhidden staff.
By default, any staff administrator or below will trigger it whether hidden or not.

If you set the trigger level to player only using the

[smartstat Player

then it will not trigger for staff, but only for players.
If you make the mod below then any unhidden staff will also trigger it, regardless of their level.

Around line 614 in xmlspawner2.cs

QUOTE

      // confirm that players with the proper access level are present
      foreach (Mobile m in s.Players)
      {

      if (m.AccessLevel <= SmartSpawnAccessLevel || !m.Hidden)
      {
        return true;
      }
      }


I would recommend using the

[optimalsmartspawning

command to configure smartspawning. It will automatically disable smartspawning on spawners that have basevendors on them.
If you have other spawners that you dont want to smartspawn, just set the SmartSpawning property on them to false.

Erica- 07-06-2006
ok so let me get this if i already put smart spawning on true with a command i said much earlier the maps fron nerun that i use on all the npc were diable to true now by saying [optimalsmartspawning will make only the npc of every town come back to false or do i gotta do something else so only monsters go true and not npc of all towns like bankers ect ect cause everying i already had set it to true with a command. hmm just tryed the [optimalsmartspawning and the npc are still not showing and just noticed it that i did the editing on (!m.Hidden thing restarted server and hidden as accessLevel owner went to dungeons hidden and unhidden no creatures didnt come out at all now i got on my other character and went to the dungeons but that character not owner access is administrator access and even when i was hidden they spawned out as admin but for owner access they dont spawn out at all for owner want it where im hidden nothing in dungeons spawn out but if i unhide then would like the monsters to spawn out any ideas ?

ArteGordon- 07-06-2006
QUOTE (Erica @ July 06, 2006 06:38 am)
ok so let me get this if i already put smart spawning  on true with  a command i said much earlier the maps fron nerun that i use on all the npc were diable to true now by saying [optimalsmartspawning will make only the npc of every town come back to false or do i gotta do something else so only monsters go true and not npc of all towns like bankers ect ect cause everying i already had set it to true with a command. hmm just tryed the [optimalsmartspawning and the npc are still not showing and just noticed it that i did the editing on (!m.Hidden thing restarted server and hidden as accessLevel owner went to dungeons hidden and unhidden no creatures didnt come out at all now i got on my other character and went to the dungeons but that character not owner access is administrator access and even when i was hidden they spawned out as admin but for owner access they dont spawn out at all for owner want it where im hidden nothing in dungeons spawn out but if i unhide then would like the monsters to spawn out any ideas ?

the default setting for smartspawning is that anyone with administrator accesslevel or LOWER will trigger smartspawning when they enter an area. So owners will never trigger it.

If you want to make it so that staff dont activate the spawners unless they are unhidden,
then add the !Hidden mod above, and set the smartspawning level to Player with

[smartstat accesslevel Player

that will temporarily set the smartspawning triggering level to Player, so that only players will activate them, but staff will not (unless they are unhidden).

If you want to make that setting permanent, then go into xmlspawner2.cs around line 100 and change this

CODE

 // specifies the level at which smartspawning will be triggered.  Players with AccessLevel above this will not trigger smartspawning.
 public static AccessLevel SmartSpawnAccessLevel = AccessLevel.Administrator;


to this

CODE

 // specifies the level at which smartspawning will be triggered.  Players with AccessLevel above this will not trigger smartspawning.
 public static AccessLevel SmartSpawnAccessLevel = AccessLevel.Player;


then, any player will activate it, and any staff (including owners) will activate it when unhidden but not when hidden.

The mod that I posted above was incomplete which is why it wasnt working exactly as it should.
I am going to add the !Hidden mod to the next release and change the default triggering level to Owner.
You can get it in the beta_20_v313.zip package. It is the modified xmlspawner2.cs

Erica- 07-06-2006
Hi again ok i don't know what im doing wrong but here it is ok i did what you told me on changing this code to this
CODE
// specifies the level at which smartspawning will be triggered.  Players with AccessLevel above this will not trigger smartspawning.
public static AccessLevel SmartSpawnAccessLevel = AccessLevel.Player;
made code that way plus got this code this way as well
CODE
// confirm that players with the proper access level are present
     foreach (Mobile m in s.Players)
     {

     if (m.AccessLevel <= SmartSpawnAccessLevel || !m.Hidden)
     {
       return true;
     }
     }
and still when im hidden nothing spawns out which that part is right but when i unhide as owner still nothing spawns out then i went and changed this part only again this code
CODE
// specifies the level at which smartspawning will be triggered.  Players with AccessLevel above this will not trigger smartspawning.
public static AccessLevel SmartSpawnAccessLevel = AccessLevel.Owner;
as you see accesslevel from player was changed to owner and what happens here is when im hidden everything spawns out while hidden or unhidden what am i doing wrong thank you.

Erica- 07-06-2006
Never mind was using xml 312 and updated to xml 313 so now it works one more question ok how do i delete lets say for instince theres SeaLife.map and TerathanKeep.map how can i delete those maps dont want those spawners there any way that if i say a command can delete those 2 maps.

ArteGordon- 07-07-2006
If they were imported and saved to separate xml files like terathankeep.xml and sealife.xml, then you could just

[xmlunload sealife.xml

but since you probably imported them all at once and didnt make separate xml files corresponding to the different .map files, what you will need to do is to select them based on their names.
When the spawners were imported, they were named based on the name of the .map file that they came from. So all of the sealife.map spawners will have names like

sealife#1
sealife#2
etc.

You can use [xmlfind to find and delete them.

1. start up [xmlfind
2. check the 'name' checkbox and enter 'sealife' into the text field below it.
3. Do a search by pressing the 'Search' button. This should bring up a list of all xmlspawners that start with the string 'sealife'
4. click the 'Select all' button in the lower right corner of the gump.
5. Press the 'Delete' button at the bottom of the gump.

(edit)

note that for step 5, instead of Deleting them, you could also save them out to an xml file like sealife.xml using the 'Save' button and entering in a filename. Then you could use the '[xmlunload sealife.xml' approach to get rid of them.
The advantage of doing it like that is that you could later load them back in with '[xmlload sealife.xml' if you wanted, or open up the .xml file in the Spawn Editor and view or modify them, and reload them, etc.

Gembone- 10-01-2006
hey Arte qick question for you on this. RunUO 2.0 RC1 and XMLspawner ver 3.16
I have set smart spawn levle to player at this line
CODE
public static AccessLevel SmartSpawnAccessLevel = AccessLevel.Player;
and have checked this section
CODE
foreach (Mobile m in s.Players)
     {

      if (m.AccessLevel <= SmartSpawnAccessLevel)
      {
       return true;
      }
     }
     _TraceEnd(2);
to bee sure it didn't have the || !m.Hidden

because I am still getting spawn activation when Owner is visible. I want it so that only player level will activate the spawners. I have this working fine in 1.0 not sure why its not working in 2.0
is there something I missed the setting on?

ArteGordon- 10-01-2006
if you want to completely remove the test for unhidden staff, then you need to mod one more spot around line 10800 in xmlspawner.cs

QUOTE

                    foreach (NetState state in NetState.Instances)
                    {
                        Mobile m = state.Mobile;

                        if (m != null && (m.AccessLevel <= SmartSpawnAccessLevel || !m.Hidden))
                        {
                            // activate any spawner in the sector they are in
                            if (m.Map != null && m.Map != Map.Internal)

Gembone- 10-01-2006
ok I did a search for
CODE
foreach (NetState state in NetState.Instances)
in xmlspawner2.cs and this line does not exist

ArteGordon- 10-01-2006
look again. I just double checked the xmlspawner2.cs in the v3.16 zip package and it is line 10794

Gembone- 10-01-2006
ok must have been looking in the one I have for 1.0
found the line and am I supposed to remove the || !m.Hidden section ?

ArteGordon- 10-01-2006
QUOTE (Gembone @ October 01, 2006 01:48 pm)
ok must have been looking in the one I have for 1.0
found the line and am I supposed to remove the  || !m.Hidden section ?

Yes, if you remove the stuff in red, then unhidden staff will no longer activate smartspawning.

Gembone- 10-01-2006
thanks working great now