Welcome to the Builder Academy

Question Looking for ideas on how to make a keyring

More
Yesterday 19:58 #10895 by Salty
Greetings,

I'm looking for ideas on how to make a keyring for players.  The thought is players can clean up inventory by placing keys on their keyring, thus extracting the keys, and making the keyring act as a key for the door/obj the key would normally open.

The keyring would need to reset on copyover / rent / quit, just as keys do.  

Unlocking doors is managed in act.movement.c within the do_gen_door() function using the has_key() function.

If we use these functions, we need a way to add the "obj_vnum key" to the keyring object.  I'd like to add more keys than the 4 that using GET_OBJ_VAL would allow.

How would you implement this idea?  

Thanks,

Salty

Please Log in or Create an account to join the conversation.

More
Today 20:19 #10896 by thomas
I think this is a good case for adding a new type of container flag. I'd add a CONT_KEYRING and check that only keys can be put in. It's a small change in the examine output to list is as a "keyring with these keys", and much of the other container code would just work. Then, in the unlock code, just check if the player is trying to unlock with a container with that bit set, and if so, check if it contains the needed key.
The quit/rent code will "just work" and purge any keys when leaving.

Please Log in or Create an account to join the conversation.

Time to create page: 0.179 seconds