Advertisement
roninator2

Damage for more types of Floors v1.1a

Nov 21st, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.58 KB | None | 0 0
  1. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. #Damage for more types of Floors Script v 1.1
  3. #Author = Kio Kurashi
  4. #Credit = Kio Kurashi
  5. #Modded by Roninator2
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #Notes:
  8. #  Currently this script only works for three types of Floor damage. It doesn't
  9. #  nessesarly need to be Poison, Lava, and Shock, however. If more than the
  10. #  provided number of Floors are needed I can add more.
  11. #
  12. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  13. #Instructions:
  14. #  The editable section is directly bellow. For each you will have a Terrain tag,
  15. #  and a Damage ammount. The Terrain tag will be a number between 0 and 7.
  16. #  as the number on the tiles. Damage will be the Base damage that is
  17. #  applied for each number.
  18. #Important:
  19. #  The map tileset must be properly configured.
  20. #  The tile that will be a damage tile must be marked as a damage tile. go figure
  21. #  The tile must also have the terrain tag matching the settings below.
  22. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  23. #Update:
  24. #  The script will now apply a damage effect at the specified interval
  25. #  60 = 1 second
  26. #  Also available is a switch to turn the interval damage off.
  27. #  Turn switch on to stop interval damage.
  28. #~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  29. #~     BEGINING OF EDITABLE SECTION
  30. #~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  31.  
  32. module R2_Floor_Damage
  33.  
  34. NORMAL_TERRAIN_REGION = 0      #  This is rather useless since I doubt that
  35. NORMAL_TERRAIN_DAMAGE = 0        #  any normal Terrain would be checking for this.
  36.  
  37. POISON_TERRAIN_REGION = 1
  38. POISON_TERRAIN_DAMAGE = 10
  39.  
  40. LAVA_TERRAIN_REGION = 2
  41. LAVA_TERRAIN_DAMAGE = 20
  42.  
  43. SHOCK_TERRAIN_REGION = 3
  44. SHOCK_TERRAIN_DAMAGE = 30
  45.  
  46. FDR_DAMAGE_INT = 60         # interval at which the damage effect will apply again.
  47. FDR_DAMAGE_SWITCH = 1               # Turn switch on to turn off interval damage
  48.  
  49. end
  50. #~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  51. #~     END OF EDITABLE SECTION
  52. #~       Editing beyond this point without prior knowledge is dangerous!!
  53. #~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  54.  
  55. class Game_Actor
  56.   def basic_floor_damage
  57.     case $game_map.terrain_tag($game_player.x, $game_player.y)
  58.     when R2_Floor_Damage::NORMAL_TERRAIN_REGION
  59.       return R2_Floor_Damage::NORMAL_TERRAIN_DAMAGE
  60.     when R2_Floor_Damage::POISON_TERRAIN_REGION
  61.       return R2_Floor_Damage::POISON_TERRAIN_DAMAGE
  62.     when R2_Floor_Damage::LAVA_TERRAIN_REGION
  63.       return R2_Floor_Damage::LAVA_TERRAIN_DAMAGE
  64.     when R2_Floor_Damage::SHOCK_TERRAIN_REGION
  65.       return R2_Floor_Damage::SHOCK_TERRAIN_DAMAGE
  66.     when nil
  67.       return 10
  68.     end
  69.   end
  70. end
  71.  
  72. class Game_Player < Game_Character
  73.   alias r2_fdr_initialize initialize
  74.   def initialize
  75.     @standingtime = 0
  76.     r2_fdr_initialize
  77.   end
  78.   alias r2_input_move_fdr move_by_input
  79.   def move_by_input
  80.     @standingtime = 0 if $game_player.moving?
  81.     r2_input_move_fdr
  82.   end
  83.   alias r2_fdr_update_nonmoving update_nonmoving
  84.   def update_nonmoving(last_moving)
  85.     if !$game_switches[R2_Floor_Damage::FDR_DAMAGE_SWITCH]
  86.       @standingtime += 1 if !$game_map.interpreter.running?
  87.       actor.check_floor_effect if @standingtime > R2_Floor_Damage::FDR_DAMAGE_INT
  88.       @standingtime = 0 if @standingtime > R2_Floor_Damage::FDR_DAMAGE_INT
  89.     end
  90.     r2_fdr_update_nonmoving(last_moving)
  91.   end
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement