Jump to content
gsuk

Continuous floor damage when standing still

Recommended Posts

I have areas of my game inside a volcano and, currently, floor damage is only dealt when my character steps on a lava tile once per tile. Is it possible (I'm sure it is) to have floor damage be dealt over and over if the character does not move off the tile? It doesn't make much sense to stand on hot lava and it not continue to damage you :). I suppose this would involve setting up something that deals damage every, say, half a second or something, but I don't know if that would involve scripting, or if there's a nice Common Event workaround.

Thanks in advance for any help you can give!

Share this post


Link to post
Share on other sites

Found this. It's not fully what you want but maybe someone can add to it.

Spoiler

=begin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Damage for more types of Floors Script v 1.0
Author = Kio Kurashi
Credit = Kio Kurashi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Notes:
  Currently this script only works for two types of Floor damage. It doesn't
  nessesarly need to be Poison, Lava, and Shock, however. If more than the
  provided number of Floors are needed I can add more. I am best contacted
  through steam on the RPG Maker VX Ace forums there.
 
Disclaimer:
  This is my first offical script and that is why it is rather lacking.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Instructions:
   The editable section is directly bellow. For each you will have a Region ID,
   and a Damage ammount. The Region ID will be whatever number you choose to set
   as the Region number on the tiles.(Yes every Tile must have a region on it if
   it is to be checked for damage.) Damage will be the Base damage that is
   applied for each number.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=end
 
 
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~     BEGINING OF EDITABLE SECTION
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
NORMAL_TERRAIN_REGION = 0      #  This is rather useless since I doubt that
NORMAL_TERRAIN_DAMAGE = 0   #  any normal Terrain would be checking for this.
 
POISON_TERRAIN_REGION = 1
POISON_TERRAIN_DAMAGE = 10
 
LAVA_TERRAIN_REGION = 2
LAVA_TERRAIN_DAMAGE = 50
 
SHOCK_TERRAIN_REGION = 3
SHOCK_TERRAIN_DAMAGE = 80
 
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~     END OF EDITABLE SECTION
#~       Editing beyond this point without prior knowledge is dangerous!!
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
class Game_Actor
 
  def basic_floor_damage
    case $game_player.region_id
    when NORMAL_TERRAIN_REGION
      return NORMAL_TERRAIN_DAMAGE
    when POISON_TERRAIN_REGION
      return POISON_TERRAIN_DAMAGE
    when LAVA_TERRAIN_REGION
      return LAVA_TERRAIN_DAMAGE
    when SHOCK_TERRAIN_REGION
      return SHOCK_TERRAIN_DAMAGE
    when nil
      return 10
    end
  end
 
end

 

 

Edited by roninator2
added spoiler

Share this post


Link to post
Share on other sites
7 hours ago, PhoenixSoul said:

Set up a parallel process common event

Actually I got it working

21 hours ago, gsuk said:

Thanks

Here is the new script.

Spoiler

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Damage for more types of Floors Script v 1.1
#Author = Kio Kurashi
#Credit = Kio Kurashi
#Modded by Roninator2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Notes:
#  Currently this script only works for three types of Floor damage. It doesn't
#  nessesarly need to be Poison, Lava, and Shock, however. If more than the
#  provided number of Floors are needed I can add more. 
# 
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Instructions:
#  The editable section is directly bellow. For each you will have a Terrain tag,
#  and a Damage ammount. The Terrain tag will be a number between 0 and 7.
#  as the number on the tiles. Damage will be the Base damage that is
#  applied for each number.
#Important:
#  The map tileset must be properly configured.
#  The tile that will be a damage tile must be marked as a damage tile. go figure
#  The tile must also have the terrain tag matching the settings below.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Update: 
#  The script will now apply a damage effect at the specified interval
#  60 = 1 second
#  Also available is a switch to turn the interval damage off.
#  Turn switch on to stop interval damage.
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~     BEGINING OF EDITABLE SECTION
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

module R2_Floor_Damage
  
NORMAL_TERRAIN_REGION = 0      #  This is rather useless since I doubt that
NORMAL_TERRAIN_DAMAGE = 0   	 #  any normal Terrain would be checking for this.
 
POISON_TERRAIN_REGION = 1
POISON_TERRAIN_DAMAGE = 10
 
LAVA_TERRAIN_REGION = 2
LAVA_TERRAIN_DAMAGE = 20
 
SHOCK_TERRAIN_REGION = 3
SHOCK_TERRAIN_DAMAGE = 30

FDR_DAMAGE_INT = 60         # interval at which the damage effect will apply again.
FDR_DAMAGE_SWITCH = 1				# Turn switch on to turn off interval damage

end
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~     END OF EDITABLE SECTION
#~       Editing beyond this point without prior knowledge is dangerous!!
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
class Game_Actor
  def basic_floor_damage
    case $game_map.terrain_tag($game_player.x, $game_player.y)
    when R2_Floor_Damage::NORMAL_TERRAIN_REGION
      return R2_Floor_Damage::NORMAL_TERRAIN_DAMAGE
    when R2_Floor_Damage::POISON_TERRAIN_REGION
      return R2_Floor_Damage::POISON_TERRAIN_DAMAGE
    when R2_Floor_Damage::LAVA_TERRAIN_REGION
      return R2_Floor_Damage::LAVA_TERRAIN_DAMAGE
    when R2_Floor_Damage::SHOCK_TERRAIN_REGION
      return R2_Floor_Damage::SHOCK_TERRAIN_DAMAGE
    when nil
      return 10
    end
  end
end

class Game_Player < Game_Character
  alias r2_fdr_initialize initialize
  def initialize
    @standingtime = 0
    r2_fdr_initialize
  end
  alias r2_input_move_fdr move_by_input
  def move_by_input
    @standingtime = 0 if $game_player.moving?
    r2_input_move_fdr
  end
  alias r2_fdr_update_nonmoving update_nonmoving
  def update_nonmoving(last_moving)
    if !$game_switches[R2_Floor_Damage::DAMAGE_SWITCH]
      @standingtime += 1 if !$game_map.interpreter.running?
      actor.check_floor_effect if @standingtime > R2_Floor_Damage::DAMAGE_INT 
      @standingtime = 0 if @standingtime > R2_Floor_Damage::DAMAGE_INT
    end
    r2_fdr_update_nonmoving(last_moving)
  end
end

 

Cleaned up the code

Edited by roninator2

Share this post


Link to post
Share on other sites

I had a derp moment and forgot what I was going to say.

Anyway, the method I mentioned would of involved a Wait command and then a script command that would deplete the party's HP by whatever.

Share this post


Link to post
Share on other sites

Change :DAMAGE_SWITCH in that line to :FDR_DAMAGE_SWITCH. See if that works.

Addendum:
:DAMAGE_INT should also be changed to :FDR_DAMAGE_INT because that left as is will also likely throw an error.

Edited by PhoenixSoul

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×