Main
Projects
Art
Music
Scripting
LiveJournal
Forum
Links
Footsteps
by Pepsi Ranger

Does your hero leave a slimy trail? Or perhaps he's just trudging through some snow. Either way, you're gonna love Pepsi Ranger's Footsteps script.


#this script as used in Tightfloss Maiden is designed to give your hero some footprints when he
#or she walks.


define script (1,Footprints,none)

global variable (1,stepx) #variable used for all x-axis coordinate positions.
global variable (2,stepy) #variable used for all y-axis coordinate positions.

#Special Note--this script accounts for all directions a hero can walk.  Draw your footprints
#accordingly.

#------------------------------------------------------------------------------


script,Footprints,begin

variable (a) #checks which direction the hero is facing.
variable (b) #checks which X coordinate the hero is standing.
variable (c) #checks which Y coordinate the hero is standing.
variable (d) #defines which maptile(s) footprints can be made.

variable (b1) #if the hero faces west
variable (b2) #if the hero faces east
variable (c1) #if the hero faces north
variable (c2) #if the hero faces south


#please note that the b1-b2 variables account for horizontal (x-axis) movement while the C1-C2
#account for vertical (y-axis) movement.


set variable (a,hero direction (0)) #sets the variable to the hero's current direction.
set variable (b,hero x (0)) #sets the variable to the hero's current horizontal position.
set variable (c,hero y (0)) #sets the variable to the hero's current vertical position.
set variable (d,read map block (b,c)) #sets the variable to the type of maptile the hero is
                                      #standing on.


#please note that in this example, the manipulative tile (sand tile) serves as the default tile
#for the entire map, therefore its tile number is 0.


if (d==0) #checks to see if the hero is standing on the sand tile (tile 0).
then,begin(  #if he or she is, then the script checks which direction she's facing.

if (a==north)  #if she's facing north...
then,begin( #then a northbound footprint tile will be placed.
set variable (c1,c) #this sets the northbound variable (c1) to the current vertical coordinate.
set variable (stepx,hero x) #this sets the hero's horizontal position to itself.
set variable (stepy,c1) #this sets the hero's vertical position to the northbound variable.
write map block (stepx,stepy,2) #this writes the northbound footprint to wherever the hero is
                                #standing.
)
end

else,begin(  #if she's not facing north...
if (a==east)  #then maybe she's facing east.  If that's the case...
then,begin(  #then an eastbound footprint tile will be placed.
set variable (b2,b) 
set variable (stepx,b2)
set variable (stepy,hero y)
write map block (stepx,stepy,3)
)
end
)

else,begin(   #if not north or east...
if (a==south)   #you get the idea.
then,begin(
set variable (c2,c)
set variable (stepx,hero x)
set variable (stepy,c2)
write map block (stepx,stepy,4)
)
end
)

else,begin(
if (a==west)
then,begin(
set variable (b1,b)
set variable (stepx,b1)
set variable (stepy,hero y)
write map block (stepx,stepy,5)
)
end
))
end
end
end
end
end


#Special Note 2--this script was originally written to draw footprints BEHIND the hero and not
#underneath her.  Therefore the b1-c2 variables were used to add or subtract one tile from the
#hero's current coordinate.  The script as presented here draws the tile underneath the hero,
#and probably doesn't need to make use of these variables.  Using variables b and c should be
#enough as far as I can tell.  If however you want to draw a fart trail or something, the b1-c2
#variables should come in quite nicely.

#-------------------------------------------------------------------------------

#Also be aware that this script must be used as an Each-Step script, or else the hero will only
#leave one footprint behind.

#Hope you enjoy.

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