by PepsiRanger

Well... this script is so well-commented that I have nothing to say to you no more. (Parappa reference, sorry.)

#The purpose of this script is to suck the magic or life out of a hero no matter where he or she
#walks, thus eliminating the need to fill an area with harm tiles (which affects HP only).

#The script below as used in Tightfloss Maiden simulates eminent dehydration in a desert valley.
#It begins by draining the hero's energy (EP--formerly MP), and slowly sucks away her health when
#her energy is sapped.


#please note that this script must be ran as an Each-Step script.  If you have another script
#that utilizes the Each-Step slot on a given map, you can insert this script into the other.

define script (1,Dehydration,none)


variable (t) #the hero's current MP (or EP as used in this script)
variable (e) #the hero's new MP stat
variable (m) #the hero's current HP
variable (h) #the hero's new HP stat

#the first section of the script slowly eats away at the hero's energy (or magic)

set variable (t,get hero stat (0,stat:EP,current stat)) #sets the variable to the hero's current
                                                        #MP (EP) stat.
if (t>>0) #if the hero still has some MP...
then,begin( #then she must lose a little with each step she takes.
reset palette   #this sets the viewing screen to normal.  This is important if the screen takes
                #on a different shade for when her health is affected.  It's important to add it
                #here just in case she regains some of her energy back.
fade screen in   #this implements the palette change.
set variable (e,t--4) #this subtracts 4 MP from the current stat.
set hero stat (0,stat:EP,e,current stat) #this activates the change in MP.
show value (e) #this shows the hero's current MP on the lower left hand of the screen.

#the second section slowly decreases her physical health.

if (t<=0) #if the hero doesn't have anymore MP...
then,begin( #then it's time for her to lose some health.
set hero stat (0,stat:EP,0,current stat) #this makes sure that the number in the MP slot reads
                                         #zero.  I found that leaving this out can potentially
                                         #leave a dying hero to walk with 3 MPs or so.  It's
                                         #essentially there to be picky.
tweak palette (56,0,0) #if the hero starts losing her health, the screen changes to a different
                       #color (in this case red) to signify that the decreasing value in the
                       #corner of the screen is in fact killing her, and not just making her
fade screen in  #implements the change in palette.
set variable (m,get hero stat (0,stat:HP,current stat)) #sets the variable to the hero's current
set variable (h,m--4) #this subtracts 4 HP from the current stat.
set hero stat (0,stat:HP,h,current stat) #this implements the change in HP.
show value (h) #this shows the new HP stat.

if (h<=0) #and if her health reaches zero...
then,begin( #it's "Game over, man!  Game over!"
game over

#please note that the "game over" command MUST be implemented if you want your hero to die from
#zero health.  I found that leaving this out means the script starts adding 4 HP back to her
#health once it figures out that she can't have negative energy.


#And that's that.  Feel free to simulate something similar in your game, but please be creative.
#I don't want to see a bunch of Tightfloss Maiden clones springing up in the next few months. 

Site layout (c)2000 Jennifer Raby. Used by permission.