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!

Courageous' Random Encounter Engine

Courageous

Wanderer
delay is how often it checks for a new spawn??

No. That's how long the system waits after server start up.

interval is how often it interacts if there is a check for spawn??

Interval is the timer rate. Every so and so seconds, it checks qualifying players to see if they're going to have an encounter.

clean up is how often it will clear what its spawn and then check back to delay??

After every actual spawn, a 'delete encounter timer' is started. Once the timer is up, it will delete the items and mobiles from the spawn, depending on the circumstances (won't delete tamed beasts, won't delete monsters in combat).

ok also.. ive been tryin to add to wilderness.. well a second wilderness..

There is only one standard wilderness on every facet, the default one. This, technically, is the area between all other regions. If, using a region editor, you add your own region (of type "Region"), and then give it a name, you will then (and only then) have a new named Wilderness region.

but no troll will spawn.. even if i put p=1


Unless you are manually creating your own REAL regions, using a region editor, the only "Wilderness" region you want in your RandomEncounters.xml file is the default, one each per facet. If this doesn't answer your question, then I'm not sure what is wrong, and I think I'll need to see your .xml file. Which I'll be happy to diagnose if you PM it to me.

...the effect of blue on the mobiles.. i just wanted to comment .. might be cool ...

Sure. I can see how some might like that. I know I do. I think it should probably be configurable, though. For example, one might not want the subtle scenery uses of the spawner in cities and in the country side to be so flashy.

C//
 

MoreBeer

Sorceror
ok thx for the quick responce.. and thx for explaining it a lil better.. i do now understand..

as far as the wilderness goes.. so if there is only 1.. and you want some monsters and animals.. have to be all in the same tag.. i understand.. and yes for now im usin the standard regions.. till i can get things worked out..


cool this is all makin more sence after 4 days .. lol thx
 

Chinook

Wanderer
Courageous said:
Hey, a pet peeve of mine. That Orc brute is so ugly and obviously out of place in the 2D client. I say delete 'em from you .mul file, ha.

I'm not to happy with the art either but I do plan on having other mobs use that style of secondary spawning. So I'll still would need to find a way to clean up the spawned mobs. I was thinking of maybe handling this in the base mobile in the on death do clean up of all spawn or on delete, Any suggestions?


Courageous said:
Anyway, I don't think RandomEncounters will be able to handle this issue well at all. I can think of a general technology, called "aspect oriented programming," that could perhaps intercept calls to methods and then do something like log them (or record them for later cleanup), but I'm thinking that even if it could do this in this case, the technology is too heavyweight for runuo.

That I can see to be an overkill for this problem, there should be other ways to fix this.


Courageous said:
I recall reading some time a while back something about the world saver (a mod? a suggestion?) where the feature mentioned was "saving nothing that is spawned". This was recommended on the grounds that it would speed up world saves, that the spawners could always respawn the spawned things, and that if you had a crash and needed to restore, no biggie. This is somewhat topical, maybe there's something here.

The other option is to look at the sector activator/deactivator in the core, and hook it. When a sector deactivates, delete everything that was spawned, excepting special conditions (animal is still tame, etc). This would mean that if you were to recall out of an area, and then recall back, you might lose your entire pile of gold on the ground and what not... but, I'll leave that open to discussion.

C//


Wondering if we could just do this on the cleanup.cs. It already cleans up items, what if we were to make it clean up mobs as well? This way like for items we can specify what mobs should be excluded from the list. What do you think?
 

Courageous

Wanderer
Well I'll have to peer into that code later; I'm not at home at the moment. However the idea does sound good. There's probably some good reason to have the cleanup code be more aggressive than it is for a good variety of reasons. "Once every hour, delete everything that's temporary, except if..."

C//
 

Courageous

Wanderer
...cool this is all makin more sence after 4 days...

Do read the instructions very carefully, particularly the notes on the options and what they mean. There's a bunch of stuff there. All that said, I'm glad to help, any more questions, just please ask.

C//
 

Greystar

Wanderer
there are a couple ways to find out what a mob is attached to. I think mobs have some identifier stored on them to tell what spawner they belong to.

do a series check like check if ControlMaster == null, Combatant == null, !mobile.Player, !Summoned and do a check to see if it doesnt belong to a spawner if all are true then delete item/mobile. Just a thought, without peering at the code while typing this im not sure what checking you already do. I still think leaving it as an option to spawn on boats would be cool. Would really like to annoy those players who think its safe to macro at sea. But anyway just some random thoughts i'd like to throw out there.
 

Courageous

Wanderer
I've been toying around with the static tiles. I do already have to query them to figure out what's what. That means that, in theory, I can determine whether or not a player is in a 'boat' region. So it's a possibility. The system is currently down being refactored, to make the central encouter dictionary a bit more managemeable, and to account for the multiple region timers. After that, I might begin to think about special zone spawns. Another thing I'd like to think about would be recognizing other special things about the player; i.e., if the player belong to the Chaos faction, then...

C//
 

Greystar

Wanderer
Courageous said:
I've been toying around with the static tiles. I do already have to query them to figure out what's what. That means that, in theory, I can determine whether or not a player is in a 'boat' region. So it's a possibility. The system is currently down being refactored, to make the central encouter dictionary a bit more managemeable, and to account for the multiple region timers. After that, I might begin to think about special zone spawns. Another thing I'd like to think about would be recognizing other special things about the player; i.e., if the player belong to the Chaos faction, then...

C//

so as to make it so you could add maybe chaos/order guard spawns gotcha. looking forward to seeing what everyone does with this.
 

Courageous

Wanderer
Updated to 0.9.5B. This includes multiple timers for regions.

Your prior xml file will continue to work as is, because the system will "clone" your values across the three supported regions. This is also true if you only mention two. The last most gets cloned to the next most, from left to right.

interval="1800" means interval="1800:1800:1800"
interval="1800:2400" means interval="1800:2400:2400"

The three values are for dungeons, wilderness, and guarded areas; so for example, interval="1800:2400:3600" means "spawn every 1800 seconds in dungeons, every 2400 seconds in wilderness, and every 3600 seconds in guarded areas."

The timers for housing and jails work, but currently do not spawn for reasons related to the UO CanSpawn() support method.

C//
 

Chinook

Wanderer
Courageous said:
Updated to 0.9.5B. This includes multiple timers for regions.

Your prior xml file will continue to work as is, because the system will "clone" your values across the three supported regions. This is also true if you only mention two. The last most gets cloned to the next most, from left to right.

interval="1800" means interval="1800:1800:1800"
interval="1800:2400" means interval="1800:2400:2400"

The three values are for dungeons, wilderness, and guarded areas; so for example, interval="1800:2400:3600" means "spawn every 1800 seconds in dungeons, every 2400 seconds in wilderness, and every 3600 seconds in guarded areas."

The timers for housing and jails work, but currently do not spawn for reasons related to the UO CanSpawn() support method.

C//


Awesome!! update, can't wait to test this out.

*runs off for his copy*
 

orpheus

Sorceror
this is a great system, I just have a few issues...
animals spawn in houses... houses!? green acres, and when trying to run an event its really a pain in the ass, now I haven't messed with anything yet because I just wanted to see how it worked. but shouldn't these things be turned off on default?
 

Courageous

Wanderer
I'm sorry. I'm confused. I've actually tried to make things spawn in houses, and have failed. Are you saying that it's doing it in your release?

Right now the system allows one to specify spawns for housing zones, and jail. Neither seems to be working. The idea here was to allow a remote chance of a rat, or perhaps an intruder, if the GM wanted to do such a thing. If you're telling me that Wilderness spawns are spawing in Player houses, then I need to know, because I haven't seen that phenomenon before.

As far as Green Acres, if you are using it, you can get the system to not recognize green acres as Wilderness by adding the following block of code to the region at or near line 893 in RandomEncounters.cs

Code:
else if (currentRegion is GreenAcres)
    {
        regionType = "GreenAcres";
        if( m_Debug ) Console.WriteLine( "GreenAcres region, named \"{0}\"", currentRegion.Name );
    }

That code was removed from a previous version on the grounds it was cruft; I see know that it also served the additional accidental purpose of making GreenAcres "not wilderness".

C//

p.s. this change will be in the next release.
 

orpheus

Sorceror
Ah thanks, I will get back to you about the player housing issue, some of my staff mentioned that some players said there were encounters in their homes. once some players are on I will test this rumor, they may have heard the players wrong.
 

Courageous

Wanderer
I can see how it might be possible; but do know that I'm using what comes with UO itself. This is the CanSpawnMobile() method. I could be either misusing it, or it could be imperfect. Either is possible. However, when I was attempting to implement the encounters made specifically for houses, I had thought I'd discovered that CanSpawnMobile() always returns false there. Same with Jail.

If you determine that it is indeed happening, let me know. Meanwhile, I'll put this on my list of things to test.

(I'm currently working on LOS, and won't return in force to RandomEncounters until LOS is done, or definitive bugs are documented in RE, in which case I'll fix them immediately).

C//
 

orpheus

Sorceror
Okay, I have confirmed that it was just animals following the player into their house instead of them spawning there. which is good.
thank you very much for creating such a great system, I consider it a must have for new shards. my shards beta testers love it.
 

RavonTUS

Sorceror
Greetings,

I notice something that bugged me a little - forgive me I haven't had time to look through your script for a solution or even if it possible.

When a group of items are picked, they are all placed in the same spot. For example, by using the following, I end up with a pile of 5 items....

Code:
<Encounter p="1" distance="7:14">
	<Item n="5" pick="SmallWebEast,SmallWebWest,SmallWebSouth,SmallWebNorth,SmallWebLeft,SmallWebRight,EggCaseWeb,Cocoon,SmallWebHole"/>
</Encounter>

If I want to have 5 spider webs randomly place in a dungeon I would have to create 5 encounters like this one...

Code:
<Encounter p="1" distance="7:14">
	<Item n="1" pick="SmallWebEast,SmallWebWest,SmallWebSouth,SmallWebNorth,SmallWebLeft,SmallWebRight,EggCaseWeb,Cocoon,SmallWebHole"/>
</Encounter>
(repeat 5 times)

It's probably one of those debatable things. I think each item should be randomly placed.

-Ravon
 

RavonTUS

Sorceror
Greetings,

I am sure you all are having fun with this script like myself. I thought I would post a few XML that I have been working on...(you may need to tweak them a little for your own XML file).

Escortables Creates escortable in the Wilderness..
Code:
		<!--WILDERNESS Region-->
		<Region type="Wilderness" name="default">
			<!-- Decorum -->
			<!-- Creatures -->
			<Encounter p=".1" distance="7:14">
				<Mobile n="1:1" pick="SeekerOfAdventure,BaseEscortable,EscortableMage"/>
			</Encounter>
			<!-- Mobs -->
			<!-- Treasure -->
		</Region>


Dungeon Vendor Spawn This will create a room of lights, the banker's camp and several random vendors.
Code:
		<Region type="Dungeon" name="Default">
			<!-- Decorum -->
			<Encounter p="1" distance="7:14">
				<Item n="5:10" pick="LampPost1,CandleLarge,CandleSkull"/>
			</Encounter>
			<Encounter p=".50" distance="7:14">
				<Item n="1" pick="BankerCamp"/>
			</Encounter>
			<!-- Creatures -->
			<Encounter p="1" distance="7:14">
				<Mobile n="3:6" pick="Alchemist,AnimalTrainer,Architect,Armorer,Baker,Bard,Barkeeper,Beekeeper,Blacksmith,Bowyer,Butcher,Carpenter,Cobbler,Cook,CustomHairstylist,Farmer,Fisherman,Furtrader,Glassblower,GolemCrafter,GypsyAnimalTrainer,GypsyBanker,GypsyMaiden,HairStylist,Herbalist,HolyMage,InnKeeper,IronWorker,Jeweler,KeeperOfChivalry,LeatherWorker,Mage,Mapmaker,Miner,Provisioner,Rancher,Ranger,RealEstateBroker,Scribe,Shipwright,StoneCrafter,Tailor,Tanner,TavernKeeper,Thief,Tinker,Vagabond,VarietyDealer,Veterinarian,Waiter,Weaponsmith,Weaver"/>
			</Encounter>
			<!-- Mobs -->
			<!-- Treasure -->
		</Region>

Camps This is similar to the first XML, it creates random camps - orc, rat, ect, so your players can resue them. These are multi and will take a few minutes to decay. Deleting this manually in the world doesn't work.

Code:
		<!--WILDERNESS Region-->
		<Region type="Wilderness" name="default">
			<!-- Decorum -->
			<!-- Creatures -->
			<Encounter p=".1" distance="7:14">
				<Mobile n="1:1" pick="RatCamp,OrcCamp,MageCamp,HealerCamp,BankerCamp"/>
			</Encounter>
			<!-- Mobs -->
			<!-- Treasure -->
		</Region>

Have fun!

-Ravon
 

Courageous

Wanderer
It's probably one of those debatable things.

Ravon:

Actually, what you're seeing is not really the way it's supposed to be. I'll look into it. I can also imagine a "stack" tag on Item that makes this do it one way or the other...

Orpheus:

Thank you for your kind words. Believe it or not, this code is what piqued my interest in RunUO. Someone I know said something about the typical spawner implementation being very static and inadequate in just about any emu, and then I started looking around at emu maturity. A fairly systematic review led me here.

C//
 

Courageous

Wanderer
<Mobile n="1:1" pick="RatCamp,OrcCamp,MageCamp,HealerCamp,BankerCamp"/>

Well, now, that's clever.

An OrcCamp is hardly a mobile, but then you've discovered that in truth the system doesn't care, in so far as what is being constructed can be placed in the world, and has a null constructor.

I'd not thought of this one.

Very nice.

C//
 

stormwolff

Knight
Using an unedited 5b as a player I can get the orcs in fel to spawn in my house. I am fine in the house, but if I am running towards my house when the spawn event happens the orcs can appear in the house. It doesn't happen every time they appear, but it does happen.
 

Attachments

  • house.jpg
    house.jpg
    29.1 KB · Views: 18
Top