Re: Special Key

From: Christian Ejlertsen (
Date: 01/11/03

>I would like to know if there is any way to make a key dissaper after
>it's used.
>Is there some code on de ftp site? I want to do it to many diferent

Yes of course there is a way :)
You could make key's that can be used for X number of times and then

Basicly make a copy of int has_key in act.movement.c and call it
something like crumble_key.
Add some lines that are send to the character that tells them something
in the line of, the key crumbles to dust. This function can be a void
type since it doesn't need to return anything. In the function you could
if you use a variable on the item and simply step it down and when it
hits 0 send the messages and extract the object.

Add a new if check to the last else if statement in ACMD(do_gen_door),
also located in act.movement.c, looking something like this.

if (has_key(ch, keynum) &&
   ((subcmd == SCMD_LOCK) || (subcmd == SCMD_UNLOCK))) {
        crumble_key(ch, keynum);

Now if a door is locked and you got the key and either lock or unlock
the door, it will call curmble_key.

I don't know if you want to add a flag ONE_USE or add a variable to
items flagged ITEM_KEY. I would prefer the last and none of the 4
standard variables are used on ITEM_KEY flagged items.

If you got questions just mail me.


PS: This could be done by dg_scripts triggers to.

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/26/03 PDT