RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

XmlSpawner2

manofwar

Sorceror
Like the new props gump!

Well i was messing around and laying some new spawns after eirlier happenings and man to my surprise the props gump idea was excellent,dont have to go to each page to find what ya need! Man this thing is the best spawner i have seen yet for us newbs,even if i dont understand some of the concepts of it yet. I also read earlier post was wondering if the help book will be coming out someday soon,would really like to get into the other aspects of this thing? Thanks for such a great script!

Manofwar
 

BlackNova

Sorceror
I have an unusual situation. A few of my spawns will not stay spawned. In otherwords, I will reset and turn on the spawn, then Respawn. A few minutes later (about 2 with the following spawn below), the spawn will disappear and the current count shown in the gump will be zero and the items will never spawn again.

I can replicate this with the following xml:

Code:
<?xml version="1.0" standalone="yes"?>
<Spawns>
  <Points>
    <Name>Solen</Name>
    <UniqueId>29afd6e5-3aba-4861-8128-c69c3f83669c</UniqueId>
    <Map>Trammel</Map>
    <X>5888</X>
    <Y>1841</Y>
    <Width>0</Width>
    <Height>0</Height>
    <CentreX>5888</CentreX>
    <CentreY>1841</CentreY>
    <CentreZ>-20</CentreZ>
    <Range>2</Range>
    <MaxCount>2</MaxCount>
    <MinDelay>1</MinDelay>
    <MaxDelay>4</MaxDelay>
    <DelayInSec>False</DelayInSec>
    <Duration>0</Duration>
    <DespawnTime>0</DespawnTime>
    <ProximityRange>-1</ProximityRange>
    <ProximityTriggerSound>0</ProximityTriggerSound>
    <TriggerProbability>1</TriggerProbability>
    <InContainer>False</InContainer>
    <ContainerX>0</ContainerX>
    <ContainerY>0</ContainerY>
    <ContainerZ>0</ContainerZ>
    <MinRefractory>0</MinRefractory>
    <MaxRefractory>0</MaxRefractory>
    <TODStart>0</TODStart>
    <TODEnd>0</TODEnd>
    <TODMode>0</TODMode>
    <KillReset>1</KillReset>
    <ExternalTriggering>False</ExternalTriggering>
    <SequentialSpawning>-1</SequentialSpawning>
    <RegionName />
    <AllowGhostTriggering>False</AllowGhostTriggering>
    <SmartSpawning>True</SmartSpawning>
    <Team>0</Team>
    <Amount>0</Amount>
    <IsGroup>False</IsGroup>
    <IsRunning>True</IsRunning>
    <IsHomeRangeRelative>False</IsHomeRangeRelative>
    <Objects2>antlion:MX=2:SB=0:RT=0:TO=0:KL=0</Objects2>
  </Points>
</Spawns>
 

ArteGordon

Wanderer
I'll check it out.

(edit)

it is your z placement of -20 that is the problem. That is below the actual surface. What happens is that it cannot find a valid location within the spawn range so it spawns it at the location of the spawner (that is below the surface of -18). So the spawns are there, they are just below the surface. Move the spawner up to -18 and respawn it.

I have to check the placement code that allowed you to put that there. Did you import that?
 

BlackNova

Sorceror
ArteGordon said:
it is your z placement of -20 that is the problem. That is below the actual surface. What happens is that it cannot find a valid location within the spawn range so it spawns it at the location of the spawner (that is below the surface of -18). So the spawns are there, they are just below the surface. Move the spawner up to -18 and respawn it.

I have to check the placement code that allowed you to put that there. Did you import that?

When I'm standing at the location, it says: You are at 5888 1841 -20 in Trammel. I actually tried moving it up on Z and it did the same thing. The antlions will spawn and they will move around correctly on the surface for around two mintues and then disappear. I did notice that the mobs will be at -18 at that location which is different from the [where command when I'm standing there.
 

ArteGordon

Wanderer
ah, ok. you are right. It is a problem with having smart spawning on when the spawn range is set to zero. When it reaches full spawn it deactivates, but then doesnt reactivate because of the zero spawnrange.
I'll fix it. Thanks for pointing that out.

(edit)

fixed for the next release.
 

BlackNova

Sorceror
It might also happen when you set the spawn x1y1x2y2 values manually, spawnrange -1, but not quite as often.
Code:
<?xml version="1.0" standalone="yes"?>
<Spawns>
  <Points>
    <Name>#WindCaves</Name>
    <UniqueId>362dae40-bf60-40cf-b7af-dc182a608159</UniqueId>
    <Map>Trammel</Map>
    <X>5126</X>
    <Y>146</Y>
    <Width>12</Width>
    <Height>15</Height>
    <CentreX>5132</CentreX>
    <CentreY>151</CentreY>
    <CentreZ>0</CentreZ>
    <Range>5</Range>
    <MaxCount>2</MaxCount>
    <MinDelay>10</MinDelay>
    <MaxDelay>30</MaxDelay>
    <DelayInSec>True</DelayInSec>
    <Duration>0</Duration>
    <DespawnTime>0</DespawnTime>
    <ProximityRange>-1</ProximityRange>
    <ProximityTriggerSound>0</ProximityTriggerSound>
    <TriggerProbability>1</TriggerProbability>
    <InContainer>False</InContainer>
    <ContainerX>0</ContainerX>
    <ContainerY>0</ContainerY>
    <ContainerZ>0</ContainerZ>
    <MinRefractory>0</MinRefractory>
    <MaxRefractory>0</MaxRefractory>
    <TODStart>0</TODStart>
    <TODEnd>0</TODEnd>
    <TODMode>0</TODMode>
    <KillReset>1</KillReset>
    <ExternalTriggering>False</ExternalTriggering>
    <SequentialSpawning>-1</SequentialSpawning>
    <RegionName />
    <AllowGhostTriggering>False</AllowGhostTriggering>
    <SmartSpawning>True</SmartSpawning>
    <Team>0</Team>
    <Amount>0</Amount>
    <IsGroup>False</IsGroup>
    <IsRunning>True</IsRunning>
    <IsHomeRangeRelative>True</IsHomeRangeRelative>
    <Objects2>daemon:MX=2:SB=0:RT=0:TO=0:KL=0</Objects2>
  </Points>
</Spawns>
 

ArteGordon

Wanderer
yes, it is possible to create the problem by manually setting X1Y1 X2Y2 so that it has zero width as well. What happens is that when reactivating it looks for active sectors within the spawning region (x1y1 x2y2) and when that region has zero width it incorrectly calculates that it occupies zero sectors.

The fix is in HasActiveSectors

this
Code:
                    for(int x = x1; x < x1 + width; x += Map.SectorSize)
                    {
                        for(int y = y1; y < y1 + height; y += Map.SectorSize)
                        {

needs to be changed to this

Code:
                    for(int x = x1; x <= x1 + width; x += Map.SectorSize)
                    {
                        for(int y = y1; y <= y1 + height; y += Map.SectorSize)
                        {
 

ArteGordon

Wanderer
did you actually notice that the second spawner you posted (#windcaves) was also not reactivating when you approached it? It should not have had any problems.
 

BlackNova

Sorceror
ArteGordon said:
did you actually notice that the second spawner you posted (#windcaves) was also not reactivating when you approached it? It should not have had any problems.

Let me get the fix in and then I'll check it out.
 

Ingvarr

Wanderer
I doubt this is the prob only with zero size. Because on our shard a lot of dungeons spawns were gone permanently inactive after SmartSpawning was set to true, and most of these spawns had no zero sizes. So I had do disable smartspawning.
 

ArteGordon

Wanderer
Ingvarr said:
I doubt this is the prob only with zero size. Because on our shard a lot of dungeons spawns were gone permanently inactive after SmartSpawning was set to true, and most of these spawns had no zero sizes. So I had do disable smartspawning.
If you have one that isnt reactivating, if you could do a

[xmlget ActiveSectorCount

and

[xmlget IsInactivated

when it is inactivated and let me know what it says that would be helpful.

(edit)

and if you could post one of the spawners that is doing this that would also be helpful. Did you notice if this was something that happened after a server restart?

(edit)

Ok, I believe I have identified the problem. After a server restart, it is possible that spawners with smartspawning set could remain inactivated given certain timing conditions involving players just entering a sector at the time of saving.

The fix is to modify this bit of code in the Initialize method in XmlSpawner2.cs

Code:
// check for smart spawning and restart timers after deser if needed
					// note, HasActiveSectors will recalculate the sector list and UseSectorActivate property
					bool recalc_sectors = spawner.HasActiveSectors;
					if(spawner.SmartSpawning && spawner.IsInactivated && !spawner.UseSectorActivate)
					{
					   spawner.DoSectorTimer(TimeSpan.FromSeconds(1));
					   timercount++;
					}

If you get the chance, test this fix out and see if it resolves your problem.
 

Elementi

Wanderer
Hey Arte. Had another idea last night. As I've said in the past I'm working on creating my own shard which uses a level, class, race system. For those of us that use these systems it would be real nice to have 2 options added into the xml spawner system. I should say 2 fields. The first being EXP = True / False. If set to false then when killed it does like a normal UO Mob, but if set to true then it looks at the next field. The second being EXPValue. This field would allow you set the amount of xp that the player would recieve upon the creatures death. This way when the mob is killed the player gets the appropriate amount of xp off the creature. Would save considerable time for creators of custom worlds such as this if they could assign the xp value of the monster at the spawner instead of having to go into each and every creature script and modify it.
 

ArteGordon

Wanderer
Elementi said:
Hey Arte. Had another idea last night. As I've said in the past I'm working on creating my own shard which uses a level, class, race system. For those of us that use these systems it would be real nice to have 2 options added into the xml spawner system. I should say 2 fields. The first being EXP = True / False. If set to false then when killed it does like a normal UO Mob, but if set to true then it looks at the next field. The second being EXPValue. This field would allow you set the amount of xp that the player would recieve upon the creatures death. This way when the mob is killed the player gets the appropriate amount of xp off the creature. Would save considerable time for creators of custom worlds such as this if they could assign the xp value of the monster at the spawner instead of having to go into each and every creature script and modify it.

If those are properties on the mob to begin with (added in BaseCreature.cs) which I assume they would have to be in order for your level system to keep track of XP, then you could easily assign them at spawn time using something like

orc/EXP/true/EXPValue/100

where EXP and EXPValue are the names of the properties on the mob.
 

ArteGordon

Wanderer
updated to version 2.56a

from the changelog

Version 2.56a
updated 8/24/04
- fixed a problem with spawners not reactivating when smartspawning was true and spawnrange was zero. (thanks to BlackNova for pointing that out) or when players just entered an activating sector at the time of world saves (thanks to Ingvarr for pointing that out).

To activate the fix, just install the new xmlspawner2.cs script from xmlspawner2-v256a-1of2.zip and then do a

[global xmlset isinactivated false where xmlspawner

to refresh any smartspawning spawners that might be inactivated.
 

Elementi

Wanderer
Unfortunately Arte I have the standard RunUo Mobs. I am still learning to script so I at this point dont have any idea how to add an exp field to a mob. Having it assign the xp value at the spawner instead of going through each and every mob to add / change the xp value would take alot of time. Where as if we could assign the xp amount at the spawner for each creature spawned it would make world building and life much easier. Then one could say assign 150 xp to this goblin (standard) , and 250 to the beefed up one next to him. Ill continue looking into how to add an exp field to the mobs scripts themselves, but just thought this would be a good option for those who want to run a shard but have a hard time learning to script.
 

ArteGordon

Wanderer
no need to add it to every mobs script, just put it in BaseCreature.cs, that way all monsters will have it. Then you would also want to serialize/deserialize it so that the values would remain after server saves/restarts.
Up at the top of the BaseCreature class definition where you see something like this (around line 200 in BaseCreature.cs)

Code:
private bool		m_IsStabled;

private bool		m_HasGeneratedLoot; // have we generated our loot yet?

just add your new properties and the public accessors for them

Code:
private bool		m_IsStabled;

private bool		m_HasGeneratedLoot; // have we generated our loot yet?

private bool m_EXP;
private int m_EXPValue;

public bool EXP
{
			get{ return m_EXP; }
			set{ m_EXP= value; }
}

public int EXPValue
{
			get{ return m_EXPValue; }
			set{ m_EXPValue= value; }
}


and now you can set them on any monster using the spawner entry that I described.

(edit)

you could test it out like this, and if you liked it you could put in the serialization/deserialization to save/restore the values on each mob.

If you just put in the changes above, it is completely safe and you dont have to worry about messing up your world saves and it is completely reversible (just take it out if you dont like it). When you do the serialization/deserialization, you have to make sure you do it properly in order to avoid problems restarting your server after a save.
 

Elementi

Wanderer
Thanks for the advice Arte. Didnt realize it was that simple. Learn something new each day. I will test this out tonight after i get home from work.
 

ArteGordon

Wanderer
Elementi said:
Unfortunately Arte I have the standard RunUo Mobs. I am still learning to script so I at this point dont have any idea how to add an exp field to a mob. Having it assign the xp value at the spawner instead of going through each and every mob to add / change the xp value would take alot of time. Where as if we could assign the xp amount at the spawner for each creature spawned it would make world building and life much easier. Then one could say assign 150 xp to this goblin (standard) , and 250 to the beefed up one next to him. Ill continue looking into how to add an exp field to the mobs scripts themselves, but just thought this would be a good option for those who want to run a shard but have a hard time learning to script.

yeah, I do this sort of thing all the time with various mob properties to make individualized custom mobs at spawn time.
 

Elementi

Wanderer
Ok Arte another question for you. I have read the previous threads in here, and read where you can add custom locks / traps to a chest. My question is using xml spawner would it be possible to create a door that can be destroyed (bashed), that can have multiple lock types and trap types set on it. I'm wanting to implement destroyable doors into the world im creating. Where if a fighter type player bashes a door until it has 0 hp left it vanishes and all traps go off at once on that player (or anyone around if it is set as an area effect spell). Im trying to implement multiple crafter occupations in my world. For example if a person has carpentry they can create the door, and if they also have tinkering they can create the locks / traps and set them to the door. Would it be possible to do this with the xml script so that they basically go through the steps of the script but the spawn controlling the stats of the door / locks / and traps are automatically set to the door upon completion of said steps. This way when they place the door in a door frame the door and the controlling spawner is all set into place.

*** edit ***

The reason I'm asking if this is possible (thought I better add this) is that with the npc army option we talked about a while back it would be nice to have this. Say army A is invading Town b, and beat them pretty good. The ruler of Town B can they issue an order to fall back to the castle / keep with in town b. Once inside the army of town b can then lock the gates to the castle / keep, can continue to fight from within. Now Army A has to bash down the gates of the castle / keep in order to conquere the town by using cannons , ballista's, etc. This would bring the wars a new factor and more life to the battles. Especially if the objective to end the war is to kill the king and control the keep for a certain amount of time. Upon which if successful then Town B is now under the control of Race B and its ruler.
 
Top