MudBytes
Pages: << prev 1 next >>
master key
Igabod
Wizard






Group: Members
Posts: 1,080
Joined: Jul 23, 2008

Go to the bottom of the page Go to the top of the page
#1 id:43214 Posted Mar 10, 2010, 7:37 am

I'm just curious, is there a simple way to make a key that will unlock all doors in the mud world? This would come in handy for my cityguard type mobs so they can walk around the town and do their patrols via spec_funs and not have to load up keys for every door. I'm pretty sure this is possible with some minor coding tweaks but I'm not even sure which function to do this in or even exactly what I need to do. I'd be sure to make the key purge upon the cityguards death and take all the precautions so that mortals don't get their hands on the key. Just stating that so I don't get a bunch of people telling me what a stupid idea it is.
.........................
Every man has his follies, and often they are the most interesting thing he has got - Josh Billings
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. - Albert Einstein
I have a love interest in every one of my films... a gun. - Arnold Schwarzenegger
Recession is when a neighbor loses his job. Depression is when you lose yours. - Ronald Reagan
I like long walks, especially when they are taken by people who annoy me. - Fred Allen

KaVir
Wizard






Group: Members
Posts: 1,625
Joined: Jun 19, 2006

Go to the bottom of the page Go to the top of the page
#2 id:43216 Posted Mar 10, 2010, 8:13 am

The easy way would be to just change the has_key() function to check for a "master key" flag.  I'd suggest placing the flag on the mob rather than the key itself, though, if you don't want players getting hold of it.  Then you just need to worry about people charming the guard.

The problem is it does actually make sense to be able to take the keys from the guard.  So if you just dislike having lots of key objects, my suggestion would be to modify keys so that they can unlock a range of vnums rather than just a single vnum, then give the guards a "bunch of keys" that can unlock all doors in their area.  If you don't want the keys unlocking everything (eg perhaps the mayor has a safe in his house) you could also add a 'security' value to both locks and keys.  If you want the mayor to be able to change his locks every so often, you could add a timestamp as well.
.........................
KaVir at God Wars II: godwars2.org 3000  Roomless world.  Manual combat.  Endless possibilities.

Scandum
Wizard






Group: Members
Posts: 1,400
Joined: Aug 8, 2006

Go to the bottom of the page Go to the top of the page
#3 id:43224 Posted Mar 10, 2010, 10:07 am

In Emud a builder would have a mob execute: doorset <dir> flag EX_ISDOOR to open it, and doorset <dir> flag EX_ISDOOR|EX_CLOSED|EX_LOCKED to close and lock it.

The command would have to be able to find a door, manipulate it, and call a function that translates names to numbers.
.........................
TinTin++ Mud Client - I can't believe it's not butter!

Koron
Sorcerer




Group: Members
Posts: 382
Joined: Jun 7, 2008

Go to the bottom of the page Go to the top of the page
#4 id:43227 Posted Mar 10, 2010, 10:26 am

Assuming you've got some kind of vnum system, you could allow a key item to open doors in rooms in a vnum range of key->vX to key->vY.  Then your master key could just be vX->0, vY->over nine thousand!.

Igabod
Wizard






Group: Members
Posts: 1,080
Joined: Jul 23, 2008

Go to the bottom of the page Go to the top of the page
#5 id:43307 Posted Mar 11, 2010, 1:12 am

Thanks for all the great responses, I think I like KaVir's suggestion of having the has_key function check for the master_key flag or maybe for the spec_cityguard flag. I never thought of doing it that way.
.........................
Every man has his follies, and often they are the most interesting thing he has got - Josh Billings
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. - Albert Einstein
I have a love interest in every one of my films... a gun. - Arnold Schwarzenegger
Recession is when a neighbor loses his job. Depression is when you lose yours. - Ronald Reagan
I like long walks, especially when they are taken by people who annoy me. - Fred Allen

Pages:<< prev 1 next >>
Tags
[+]

Valid XHTML 1.1! Valid CSS!