Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
Leon

Damaging and Healing Floors

Recommended Posts

Ok, so this script basically makes it so some floors can heal or damage the player's actors as you please. This actually makes use of Terrain Tags, too. Anyway, the instructions are in the script:

 

#===================================
#  Damaging and Healing Floors
#----------------------------------------------------------------------
#
#  Features:
#  -Heals/Damages the actors if they step on certain tiles.
#  -Customizable amount of heal/damage.
#  -Can be based on either percentage or a fixed rate.
#
#  Instructions:
#  -Place this script above Main, but below all other default scripts.
#  -Change the damage and heal tags to different numbers. By default
#	 the are 1 for damage, 2 for heal.
#  -On your tilesets, go into the 'terrain' tag, and set all damage floor's
#	 terrain number equal to the one set in the script for damage, and
#	 do the same for any healing floors.
#
#===================================

#===================================
#  Module
#===================================
module Terrain_Tag_Setup
 #--------------------------------------------------------------------
 #  Percentage = 
 #  When true, takes away a percentage rather than a fixed amount.
 #--------------------------------------------------------------------
 Percentage = true
 #--------------------------------------------------------------------
 #  Damage_Amount = 
 #  How much is taken away from each step.  If Percentange = true
 #  It will remove that percent.
 #--------------------------------------------------------------------
 Damage_Amount = 10
 #--------------------------------------------------------------------
 #  Heal_Amount = 
 #  How much is taken away from each step.  If Percentange = true
 #  It will remove that percent.
 #--------------------------------------------------------------------
 Heal_Amount = 10
 #--------------------------------------------------------------------
 #  Kill = 
 #  if true, damage floors can kill players.
 #--------------------------------------------------------------------
 Kill = false
 #--------------------------------------------------------------------
 #  Damage_Tag = 
 #  The tag number that damages the player.
 #--------------------------------------------------------------------
 Damage_Tag = 1
 #--------------------------------------------------------------------
 #  Heal_Tag = 
 #  The tag number that heals the player.
 #--------------------------------------------------------------------
 Heal_Tag = 2
end

#===================================
#  * Scene_Map
#===================================
class Scene_Map

 alias leon_gamecharacter_moving_tt update

 def update
leon_gamecharacter_moving_tt
tts = Terrain_Tag_Setup
if $game_map.terrain_tag($game_player.x, $game_player.y) == tts::Damage_Tag
  if $moved == true
	@counter = 0
	$game_screen.start_flash(Color.new(200, 0, 0, 190), 15)
	Audio.se_play("Audio/SE/117-Fire01", 80, 130)
	for actor in $game_party.actors
	  if (actor.hp - tts::Damage_Amount) < 1
		actor.hp = 1
		$moved = false
	  else
		amt = tts::Damage_Amount
		if tts::Percentage == true
		  amt = amt * 0.01 * actor.maxhp
		  amt = amt.round
		end
		actor.hp -= amt
		if tts::Kill == false and actor.hp == 0
		  actor.hp = 1
		else
		  if actor.hp == 0
			@counter += 1
		  end
		end
		if @counter == $game_party.actors.size
		  $scene = Scene_Gameover.new
		end
	  end
	end
	$moved = false
  end
end
if $game_map.terrain_tag($game_player.x, $game_player.y) == tts::Heal_Tag
  if $moved == true
	$game_screen.start_flash(Color.new(0, 200, 200, 190), 15)
	Audio.se_play("Audio/SE/105-Heal01", 80, 130)
	for actor in $game_party.actors
	  amt = tts::Heal_Amount
	  if tts::Percentage == true
		amt = amt * 0.01 * actor.maxhp
		amt = amt.round
	  end
	  actor.hp += amt
	end
	$moved = false
  end
end
 end
end

#===================================
#  * Game_Player
#===================================
class Game_Player < Game_Character

 alias leon_gameactor_update_tt update

 def update
unless moving? or $game_system.map_interpreter.running? or
	   @move_route_forcing or $game_temp.message_window_showing
   case Input.dir4
  when 2
	$moved = true
  when 4
	$moved = true
  when 6
	$moved = true
  when 8
	$moved = true
  end
end
leon_gameactor_update_tt
 end
end

Share this post


Link to post
Share on other sites

The contest made me realize there is more to mapping than just graphics. When you go outside, there is more than just sight. There is sounds, things moving, noises, and even things that hurt when touched. :D

Share this post


Link to post
Share on other sites

Very nice script, Leon. I'll be sure to add all three of your new additions to the list when I update next.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...