24 Nov, 2009, jurdendurden wrote in the 1st comment:
Votes: 0
Ok, I have implemented a full system for traps in my QuickMUD project, and one of the additions included a passive skill for Thieves call find trap. Basically everytime format_obj_to_char is called, it checks to see if they have this skill, makes sure it fires, then if it does, shows the character a (Trapped) flag in front of the object. This works perfectly, except I have a check_improve line in there, right after it adds the flag, which fires immediately thereafter, meaning you will see the improvement in the middle of checking your equipment :P Below is the portion of code to give you an idea of what I mean.

if (get_skill(ch, gsn_find_trap) > 0  && !is_affected(ch, gsn_detect_traps))
{
if (number_percent() < get_skill(ch, gsn_find_trap))
{
if (is_trapped(obj))
strcat (buf, "({CTrapped{x) ");
check_improve (ch, gsn_find_trap, TRUE, 4);
}
}


Any ideas where ELSE I could put this check_improve line so it doesn't give results like this?:

You are using:
<used as light> (3365) [near] (Glowing) a war banner
<worn on finger> (3364) [worn] a city guard signet ring
<worn on finger> (3364) [brkn] a city guard signet ring
<worn around neck> nothing.
<worn around neck> nothing.
<worn on torso> (3353) [brkn] a standard issue vest
<worn on head> nothing.
<worn on legs> nothing.
<worn on feet> nothing.
<worn on hands> nothing.
<worn on arms> You have become better at find trap!
(3360) [brkn] (Glowing) a pair of standard issue sleeves
<worn about body> nothing.
<worn about waist> (3362) [good] a standard issue belt
<worn around wrist> nothing.
<worn around wrist> nothing.
<wielded> nothing.
<worn as shield> (3354) [brkn] (Glowing) a standard issue shield
<offhand> nothing.
<held> (3379) [worn] a set of thieves' tools
<floating nearby> nothing.
24 Nov, 2009, David Haley wrote in the 2nd comment:
Votes: 0
You need to call check_improve at the end of the loop that displays each object to the character. The two ways I see of doing this with minimal repercussions on your overall design are:

- before each call to format_obj_to_char, check if the skill succeeds. If it does, pass in a boolean saying that traps should be indicated; otherwise pass in false. Keep a count of how many times the skill succeeded, and at the end of the loop, call improve_skill the appropriate number of times.
- Have format_obj_to_char return true if a hidden object was detected.

I prefer the first option, personally, for a few reasons. There are other options too, but they would require somewhat more intrusive changes. For example, I think that the skill should be improved as soon as it succeeds, but the message should only be displayed later; this requires keeping track of the messages after the improvement has occurred, until you can print out the messages reasonably.
24 Nov, 2009, Mudder wrote in the 3rd comment:
Votes: 0
jurdendurden said:
if (is_trapped(obj))
{ // <– Added brackets
strcat (buf, "({CTrapped{x) ");
check_improve (ch, gsn_find_trap, TRUE, 4);
} // <– Added brackets
}
}


Why not only let them improve if there actually is a trap? This way it won't be mastered incredibly fast or incredibly easy. You could just spam master it within 30 minutes. For an RP reason, how do you know you're actually checking something properly unless it has a trap?

This should fix the issues of displaying you've become better since you shouldn't be wearing trapped eq in the first place.
24 Nov, 2009, jurdendurden wrote in the 4th comment:
Votes: 0
Ahh that did it. I didn't even realize it was checking non-trapped eq. Thanks for pointing that out lol. Thanks to you too
David, also helpful. By the way.. we have the same last name David :P
24 Nov, 2009, jurdendurden wrote in the 5th comment:
Votes: 0
Took it one step further and made the trap spring if you tried to wear a piece of eq that was trapped, to completely remove any chance of wearing trapped eq.
0.0/5