Welcome to the Builder Academy

Question Looking for ideas on how to make a keyring

More
14 Sep 2025 20: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
15 Sep 2025 21: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.
The following user(s) said Thank You: Salty

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

More
18 Sep 2025 14:47 #10898 by Salty
Thomas,

Thank you for the suggestion.  I got the keyring container working from inventory and as a worn item in a new item slot.

Regards,

Salty

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

More
28 Sep 2025 15:33 #10911 by wlessard1
Hmmm, I have been making questmasters for most zones, locking them into having an obj to be able to get the quests after the first.

A "token" bag similar to the "key ring" seems like the best idea.

Now here is a different question, I have been wondering about.

What is the relationship between weight and containers?

Just a guy coding a mud at home for no reason but the challenge.

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

More
29 Sep 2025 23:00 #10912 by thomas
A container has its own weight, and the weight of everything you put in is added. Generally how bags work everywhere.

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

Time to create page: 0.203 seconds