intercept prog health damage

For builders to discuss and ask building questions.
Post Reply
User avatar
Algon
Sword Grand Master
Sword Grand Master
Posts: 1070
Joined: Thu Aug 14, 2003 12:44 am
Location: Waterdeep

intercept prog health damage

Post by Algon » Mon Aug 19, 2013 12:37 am

Is there a way to make it so that when you do something specific it would take off a very small amount of health away.
Example:

Code: Select all

>intercept_prog touch~
  mpechoat $n As you touch the door, a trap triggers and explodes in your face! 
Now this is where I would like to have say 5% or even a specific number of hit points removed...say 10. I am sure this is somewhere in the lessons, but finding little things like this in there can be quite daunting.
Thanks in advance!
Counting bodies like sheep...to the rhythm of the war drums. ~~~ Maynard
User avatar
Casamir
Sword Grand Master
Sword Grand Master
Posts: 286
Joined: Tue Aug 04, 2009 2:27 am
Location: The Twilit Grottoes beneath Exham Priory
Contact:

Re: intercept prog health damage

Post by Casamir » Mon Aug 19, 2013 1:04 am

Code: Select all

>intercept_prog touch~
  mpechoat $n As you touch the door, a trap triggers and explodes in your face! 
  if hitprcnt($n) > 10
     mpmadd $n currhp -10
     mpmset $i percenthp -5
That is both the variants, percentage and hp. You can remove the hp check if you want this trap to actually be able kill instead of just injure. Maybe add an 'if rand' or 'if dex' to vary the damage done with regards to luck/reflexes.
"Get thee back into the tempest and the Night's Plutonian shore!" "'Tis as impossible that he's undrowned as he that sleeps here swims." "I'm begging you please wake me up, In all my dreams I...."
User avatar
Algon
Sword Grand Master
Sword Grand Master
Posts: 1070
Joined: Thu Aug 14, 2003 12:44 am
Location: Waterdeep

Re: intercept prog health damage

Post by Algon » Mon Aug 19, 2013 1:14 am

*sigh* Of course lol Now I feel dumb XD Thank you! That is exactly what I wanted.
Counting bodies like sheep...to the rhythm of the war drums. ~~~ Maynard
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: intercept prog health damage

Post by Harroghty » Mon Aug 19, 2013 6:43 pm

Casamir is all over this one, but I wanted to also add my two cents.

You can also use a trap setting and do this more directly. A trap reset will make the trap visible to those who can detect them and give them an opportunity to disarm it before it harms them. You set these in the resets and need not make an actual trap object.
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Post Reply