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!

[2.0] Guard Spawner

David

Moderate
[2.0] Guard Spawner

Guard Spawner
There is an alternative version of this script posted here -> [2.0] Guard Spawner - Alternative (requires distro edits). The alternative version does not drop the GuardKey until the creature is killed thus preventing any stealing or snooping of the key, however it does require editing a key RunUO file. Unless you are experienced with editing RunUO distro scripts, it is strongly recommended that you use this version. There is no other functional difference between the two versions.

Summary:
Spawns a creature with a special key in it's pack. The key unlocks certain doors or chests that you designate.

Description:
The spawner works just like a regular spawner with a few exceptions. First, it will only spawn a BaseCreature which is not a BaseVendor or a BaseMount. Meaning, it will spawn nearly any critter that could possibly have loot. Next, it will add to that critter's pack a GuardKey. The GuardKey will open a nearby door or chest, but after only a few uses the key will break.

A GuardKey is a key that has a given KeyValue set in the GuardSpawner props gump. In the GuardSpawner gump you may also set how many times the GuardKey will work (default 5), and the time delay until the door or chest is locked again (default 20 seconds.) Finally, the GuardSpawner's props gump will allow you to "ReKey" any lockable door(s) or chest(s)--meaning it will set that locks KeyValue to match the GuardKey which the spawner spawns. Note that you can rekey any number of doors or chests to the same key value.

I like to set a noble or two in a locked room with a bunch of orcs outside. One or two orcs will have a key to the doors. It is entirely possible, even likely, that some players will get locked behind the doors. I consider that an opportunity for role-play, but you may want to allow an emergency exit.

Update Notes:
Mar 2010, Combined 3 scripts into one file, changed SpawnRange property to WalkingRange to be consistent with distro spawners, when rekeying a door the door will be locked, and if there is a linked door it will also be rekeyed and locked.

Installation:
Copy into your Scripts/Custom folder and restart the server. Ingame [Add GuardSpawner and double-click the spawner item. Various settings are available with the [Props command. Don't forget to ReKey the doors you want the key to open using the GuardSpawner Props gump.
 

Attachments

  • GuardSpawner.cs
    31.2 KB · Views: 99
Alain Delocke said:
Your scripts are like picassos in the RunUO museum.

I could not agree more. Thank you for the wonderful scripts and for the unbelievable sense of reality you bring to the game....
 

David

Moderate
This script is updated, tested under 2.0 Final, and moved from Archives.

I combined the three scripts into one file and changed the SpawnRange property to a WalkingRange property to be in line with the distro spawners. HomeRange defines the area in which the creature may spawn, WalkingRange determines how far the creature can wander. Note that WalkingRange does what HomeRange used to do and HomeRange now does what SpawnRange used to do. The first World Load with the new version will set WalkingRange to the old HomeRange value.

When a door is rekeyed by the GuardSpawner, it will also rekey the linked door (if any) and it will lock both doors.
 

milva

Sorceror
Thank You for updating and sharing this, so many things can be done with this guard spawner!
 

milva

Sorceror
I tested this and it works great, so easy to use David. Just quick question, would there be a way to add weight to the key in the script? Reason I'm thinking so that it can't be stolen out of the pack.
Not sure exactly where in the script it could be added maybe here?
Or are there are sections of the script which all work off this?

i_KeyVal = KeyVal;
i_Description = Desc;
i_Max = MaxUsage;
i_Delay = DelayTime;
 

David

Moderate
You are in the right place (line 1023), but the key already weighs one stone... does it need to weigh more? I confess it has been a while since I have messed with thieving.
Code:
        public GuardKey(uint KeyVal, string Desc, int MaxUsage, TimeSpan DelayTime) : base(0x1013)
        {
            [COLOR="Blue"]Weight = 1.0;[/COLOR]
            LootType = LootType.Regular;

            i_KeyVal = KeyVal;
            i_Description = Desc;
            i_Max = MaxUsage;
            i_Delay = DelayTime;
        }
 

milva

Sorceror
Oh gesh, can't believe I missed that weight :rolleyes: Right- has to be 11 stones, so 11 for weight. This way if it is in a mobs pack, no one can steal it. Of course the mob will be tough, need more of group for it. But wanted to cover myself with it. Thanks!!
 

Kamron

Knight
milva;833965 said:
Oh gesh, can't believe I missed that weight :rolleyes: Right- has to be 11 stones, so 11 for weight. This way if it is in a mobs pack, no one can steal it. Of course the mob will be tough, need more of group for it. But wanted to cover myself with it. Thanks!!

The other option is to put the key when the mob dies. Interesting to see if there is a drag/drop method for this.
 
Top