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!

Treasure Chests w/ Treasure Map Loot

warduke

Wanderer
Treasure Chests w/ Treasure Map Loot

Summary:
System that uses the treasue map loot and BaseCamp.cs decay time to help create treasure boxes around dungeons ext. Works well with Megaspawner system.

Description:
I have created level 1-6 treasure boxes that spawn everthing from magic jewerly to 8th level mage scrolls. I have not tested levesl 7-10 tho I may here soon. The default decay time is 30mins unless you have changed it. Once the box/chest decays the spawner will then respawn after delay time. You can also make differnt monster spawn along with the chest if you so choose. For an example check the orccamp.cs. Please alter this scrip in anyway and repost with improvements.

UPDATE 6/22/04:
I went ahead and made it so random boxes appear for each level of treasure! Just download and overwrite all files.

UPDATE 6/23/04:
Added my custome camp that uses this treasure system. The camp has a firepit and campfire along with a treasure box. You can add new items or mobs to this camp. All important script lines have comments for easy script changes. Enjoy!

UPDATE 7/1/04:
I created a locked door that can spawn with one or more key holders. It has comments to help you customize. The door will spawn with the key holder every 30mins. The old key will not work on the new doors. Also in the zip has the updated BaseCamp.cs that shoud replace the original one. Just remove BaseCamp.cs and add this to your custome scripts folder. Enjoy!

This was created by my expert cut and paste skills. All credit goes to the creators of RunUO 1.0 RC0.

Installation:
Just place folder into custom scripts folder. The default decay time is in folcer RunUO 1.0 RC0\Scripts\Multis\Camps file named BaseCamp.cs. Add the treasure#camp to a spawner and your set.
 

Attachments

  • TreasureSystem.zip
    7.5 KB · Views: 698
  • Camp.zip
    1.4 KB · Views: 520
  • GateKeeper&BaseCamp.zip
    2.2 KB · Views: 483

Randis

Wanderer
Nice!

Thanks! I was looking for a treasure system that has magic jewerly.. It was easy to install and works great. Thanks for the great "Cut and Paste" lol
 

panther

Sorceror
warduke said:
Works well with Megaspawner system.

From what I've seen MegaSpawner has a problem with the Camp system where mobiles and items aren't properly removed but end up stuck in a void in the system somewhere and filling your world with massive items/mobiles that don't really exist. Are you certain this problem doesn't occur with the treasure chests? It seems a great script.
 

warduke

Wanderer
Humm I do not seem to have this problem. Im also makeing some differnt camps like a brigand camp ect. I will post one when im done and it should be fully customizable. I have been running this system on my server for the last week and have not seen any problems yet..

Thanks for the input!
 

steamin

Wanderer
I have the same problem as panther. Not only with the MegaSpawner but also with the Distro Spawner. It does 500000 Items and mobiles spawn at all in 7 days which do not exist.
 

steamin

Wanderer
I believe i found the evil author for the memory theft. A TreasureChest Spawner was too closely at a wall placed. After I continued to set the Spawner away was repaired the problem. I do not know however why.
 

ArteGordon

Wanderer
I dont believe this is a spawner problem but rather a BaseCamp problem.

The problem would be in the way in which the camps clean up their components after being deleted.
This is done in the OnAfterDelete() override in BaseCamp.cs

What seems to be going on is the multi gets deleted, but the components dont. Because the multi is gone, the spawner will respawn it. The spawner doesnt know anything about the components which are the responsibility of the multi.

Without some dev input as to why it is done here rather than in OnDelete() I cant really say what might be going on, but this mod should fix it.

Around line 94 in BaseCamp.cs try this change

Code:
/*
		public override void OnAfterDelete()
		{
			base.OnAfterDelete();

			for ( int i = 0; i < m_Items.Count; ++i )
				((Item)m_Items[i]).Delete();

			for ( int i = 0; i < m_Mobiles.Count; ++i )
				((Mobile)m_Mobiles[i]).Delete();

			m_Items.Clear();
			m_Mobiles.Clear();
		}
		*/
		
		public override void OnDelete()
		{


			for ( int i = 0; i < m_Items.Count; ++i )
				((Item)m_Items[i]).Delete();

			for ( int i = 0; i < m_Mobiles.Count; ++i )
				((Mobile)m_Mobiles[i]).Delete();

			m_Items.Clear();
			m_Mobiles.Clear();

			base.OnDelete();
		}

it seems to work for me. But again, I dont know why this wasnt done in the first place. This is something that the devs would have to clarify.

(edit)
note, this would apply to all camps like the ratcamps, orccamps, bankercamps etc. that have reported similar spawning issues.
 

warduke

Wanderer
Thanks

Wow thanks...

I did test these scropts for a full day on an empty server and didnt see any problems. Maybe I didnt test it properly or long enough. I have noticed in the past few days my save time has increased. I added the new scripts to the BaseCamp.cs and seems to work fine. Thanks again!

Im also happy becuase I have yet anouther cut and paste idea! I made a locked door spawn with monsters who hold the key. These doors can be placed in dungeons where you would like a treasure room ect. Just place a spawner and a new door will spawn every 30mins with a new key/s and key holder/s. The old keys will not work on this new door. This prevents them from lureing the boss away then returning to loot. The script has comments to help out with customizeing this script.

Enjoy!
 

steamin

Wanderer
@ArteGordon the script supplement looks like good but it does not what we want. At some days the treasurecamp works fine at another day it dont spawn correct. As a Rule i have only one of the treasurecamps that goes wrong. In one day the only one produce 35000 items. Normaly one it holds round about 50 items with 1/2 hour for despawn results in 50 item * 48 turns = 2400 items. But it produce 35000 items. It seems that there is a endless loop. I also cant see a treasurecamp but the spawner says there is one. If i update the spawner i see the treasurecamp and endless loop is stopt.
 

ArteGordon

Wanderer
I would really be interested in trying to reproduce this since I think that it might relate to other camp spawner problems that people have reported that has always puzzled me. Could you give me the exact information on the spawner that is misbehaving, in particular the exact location and spawn time parameters of the spawner (I assume you dont have a custom map).
 

steamin

Wanderer
No custom map:
Felucca [5386 685 20]
Type: Treasure3Camp
Spawn Range: 2
Walk Range: 2
Amount to Spawn: 1
Min Delay To Next Spawn: 1 Hour 5 Minutes
Max Delay To Next Spawn: 1 Hour 10 Minutes
Min Delay To Next Despawn: 30 Minutes
Max Delay To Despawn: 1 Hour
Activated: On
Spawn In Group: Off
Event Ambush: Off
Movable: Off
Use Despawn: Off
Despawn in Group: Off
Spawn Type: Regular
 

steamin

Wanderer
I have made a loogging mechnism for both intressted function.

public override void OnAfterDelete()
{

StreamWriter op = new StreamWriter( "Logs/BaseCampOnAfterDelete.log", true ) ;
op.WriteLine ( "{0}: {1} {2}", DateTime.Now, Location, m_Items.Count );
base.OnAfterDelete();

for ( int i = 0; i < m_Items.Count; ++i )
((Item)m_Items).Delete();

for ( int i = 0; i < m_Mobiles.Count; ++i )
((Mobile)m_Mobiles).Delete();

m_Items.Clear();
m_Mobiles.Clear();
op.Close(); }

public override void OnDelete()
{

StreamWriter op = new StreamWriter( "Logs/BaseCampOnDelete.log", true ) ;
op.WriteLine ( "{0}: {1} {2}", DateTime.Now, Location, m_Items.Count );
for ( int i = 0; i < m_Items.Count; ++i )
((Item)m_Items).Delete();

for ( int i = 0; i < m_Mobiles.Count; ++i )
((Mobile)m_Mobiles).Delete();

m_Items.Clear();
m_Mobiles.Clear();

base.OnDelete();
op.Close(); }

But in the moment all spawners run fine. Look at in the attachement how it looks like.
 

Attachments

  • BaseCampLogs.zip
    2.9 KB · Views: 74

ArteGordon

Wanderer
ah excellent. I havent had any luck in reproducing this yet, so if you can catch it that would be very helpful. You might also try logging calls to AddComponents in camp.cs
 

Igon

Wanderer
I cant seem to get the locked door to respawn. Here are the spawner details.
Location: Green Acres
MegaSpawner Version: 3.52
Spawn Range: 0
Walk Range: 0
Amount To Spawn: 1
Min Delay To Next Spawn: 10 sec
MaxDelay To Next Spawn: 20 sec


Do you have to use the Despawn option because of the door?
 

steamin

Wanderer
After one Day i have now the same situation but with another TreasureChest.
The CountItemsInMaps http://www.runuo.com/forum/showthread.php?p=289414#post289414 output is:
Map Feluca: 48560 items
Map Trammel: 1716 items
Map Ilshenar: 4452 items
Map Internal: 1017 items
Map Malas: 0 items
Map Other: 4730 items
0x40008963 "ChestLevel2", 40 items at (627, 1487, 0)
0x400088E1 "ChestLevel2", 40 items at (637, 1486, 0)
0x40008891 "ChestLevel2", 40 items at (635, 1485, 0)
0x4000881F "ChestLevel2", 39 items at (634, 1484, 0)
0x400087A9 "ChestLevel2", 40 items at (631, 1482, 0)
0x40008750 "ChestLevel2", 39 items at (628, 1479, 0)
0x40008703 "ChestLevel2", 40 items at (637, 1486, 0)
0x40008691 "ChestLevel2", 40 items at (627, 1479, 0)
0x40008210 "ChestLevel2", 40 items at (627, 1480, 0)
0x4000860F "ChestLevel2", 39 items at (630, 1485, 0)


In BaseCamp.cs i have added a logging mechanism:
public virtual void AddItem( Item item, int xOffset, int yOffset, int zOffset )
{
m_Items.Add( item );

item.MoveToWorld( new Point3D( X + xOffset, Y + yOffset, Z + zOffset ), Map );
StreamWriter op = new StreamWriter( "Logs/BaseCampAddItem.log", true ) ;
op.WriteLine ( "{0}: {1}", DateTime.Now, item.Location );
op.Close();
}

The output is:
13.07.2004 20:49:55: (629, 1487, 0)
13.07.2004 20:50:24: (634, 1488, 0)
13.07.2004 20:50:52: (635, 1483, 0)
13.07.2004 20:51:20: (630, 1487, 0)
13.07.2004 20:51:49: (636, 1485, 0)
13.07.2004 20:52:54: (637, 1485, 0)
13.07.2004 20:53:22: (628, 1488, 0)
13.07.2004 20:53:51: (627, 1486, 0)
13.07.2004 20:54:20: (632, 1484, 0)
13.07.2004 20:54:48: (634, 1486, 0)
13.07.2004 20:55:17: (633, 1485, 0)
13.07.2004 20:55:46: (630, 1486, 0)
and so on ...


The BaseCamp OnDelete Log is:
13.07.2004 20:49:55: (629, 1487, 0) 0
13.07.2004 20:50:24: (634, 1488, 0) 0
13.07.2004 20:50:52: (635, 1483, 0) 0
13.07.2004 20:51:20: (630, 1487, 0) 0
13.07.2004 20:51:49: (636, 1485, 0) 0
13.07.2004 20:52:54: (637, 1485, 0) 0
13.07.2004 20:53:22: (628, 1488, 0) 0
13.07.2004 20:53:51: (627, 1486, 0) 0
13.07.2004 20:54:20: (632, 1484, 0) 0
13.07.2004 20:54:48: (634, 1486, 0) 0
13.07.2004 20:55:17: (633, 1485, 0) 0
13.07.2004 20:55:46: (630, 1486, 0) 0
and so on...

It creates every 30 Seconds a TreasureCamp with 0 Items to delete.
In one Hour it will produce ~5000 items
 

ArteGordon

Wanderer
very interesting and puzzling. Could you add a printout of the identity of the camp for each entry to see which addition goes with which deletion.
 

ArteGordon

Wanderer
it looks to me as though the callback for deletion is getting called before the callback for addition, so what you are seeing is delete has zero items and then the items are added. This would explain how they could be piling up and why the logs look the way they do.
The question is why the delete callback is getting called immediately.
It would be in the RefreshDecay method and would have to do with a zero span DecayDelay. Try logging that as well.
 
Top