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!

Hardcoded spawners

Matt Coatney

Wanderer
I want to be able to [clearfacet and not lose spawns. I've looked at spawner systems but they seem to rely on the default maps... mine is custom.

How can I automatically load spawns via script when the server is started, if the spawner isn't already there? I just want to hard code them all.

Thanks in advance!
 

Matt Coatney

Wanderer
Here is my idea, please tell me if this will cause problems down the way.

Simple idea:
1. An object is created that reads spawn data from a simple file, activating on dbl clk.
2. a Spawner object is created for each entry and placed at the X Y Z
only if a Spawner does not exist at that location.

In this example, we're not reading from file yet.
This works... but will it WORK? (or give me trouble)
Code:
        public override void OnDoubleClick(Mobile from)
        {
            List<Server.Mobiles.Spawner> spawners = new List<Server.Mobiles.Spawner>();
            Point3D start = new Point3D(3230,2510,0);
 
            spawners.Add(new Server.Mobiles.Spawner("Orc"));
 
            // Populate world with spawners
            Server.Map map = from.Map;
 
            foreach (Server.Mobiles.Spawner s in spawners)
            {
                Item i = (Item)s;
                i.MoveToWorld(new Point3D(start.X, start.Y, start.Z), map);
            }
 
        }
 

Matt Coatney

Wanderer
Yes, I forgot to mention but I did do that at first. But I don't want a crash or something to cause me to lose the spawns permanently, so modifying the command only half solves the problem.

I'm working with a better version of the code I posted and it seems to be working for mobiles. I still haven't investigated systems like crops and mining so I'm hoping those systems can be spawned like mobiles or i'll have another headache :)
 

Soteric

Knight
I can be mistaken but I believe I saw [export command for spawners long time ago. Probably it was part of Nerun's Distro.
 

Matt Coatney

Wanderer
I have been working on a simple system that is pretty robust. I created a new command, instead of an object, that records spawn data. If anyone is interested I'll post it for the community, but probably most people want more features/options.

The idea, now, is a graphical utility allows you to choose what to spawn, then click on points of the map to record a spawn of that type at that location. Then use the command to populate the world with the spawners.
 

Mortis

Knight
I use to use an old system that spawned from .xml. Without using any spawner objects. Of course you could by looking at the region spawn system currently in RunUo and expand upon that. Then all spawn would be by file and not by an ingame added object. So using the [clearfacet command would not stop your shard from respawning as no spawners would be present to delete.

If your interested in the old system I used made by a member named Clemens.
I re-posted it here once for another member to look at. I will most likely need some updating.
http://www.runuo.com/community/threads/help-with-spawn.86929/#post-741852

Though expanding the build in region spawns would probably be easier.
 

Pure Insanity

Sorceror
Why not just do [facet remove where static != Spawner
Or something similar?

Sure seems a lot easier, and less of a headache.
 

Matt Coatney

Wanderer
Pure Insanity -

Yes, but i'm building the world from scratch. With this simple system I can make region changes easily, and apply the spawners to different facets as I edit the map files and core and not fear losing hours of work laying eggs.

Good answer though. Thanks for contributing :)
 

Pure Insanity

Sorceror
Well my point is that it's fairly easy to condition the remove/delete commands. Making it easy to save one item, and wipe all of another. Or to wipe all of one item that is a specific color. Or...remove by a static's name, ect.

If you're worried about what will be removed in a query such as the one I listed above, do this first.

[facet interface remove where static != Spawner

This would open a gump interface showing all the types that your command found.

Any time I usually need to do a mass wipe/area command, I usually do interface first to make sure I'll get the results i want.
 
Top