Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Jragyn on April 09, 2010, 04:37:14 am

Title: [RESOLVED?] Poison/Regen Overtime & HoT.DoT
Post by: Jragyn on April 09, 2010, 04:37:14 am
As the topic suggests, I was looking for a merging of two scripts...that are both like, rather short.
I attempted to combine them myself, but in the end, it just results in failure v.v (failure being nothing happens)

The scripts in question are::
http://forum.chaos-project.com/index.php/topic,5963.0.html (http://forum.chaos-project.com/index.php/topic,5963.0.html) G_G's Over-time script.
Used for taking/healing damage over time on the map.
^
|
v
http://forum.chaos-project.com/index.php/topic,2482.0.html (http://forum.chaos-project.com/index.php/topic,2482.0.html) shdwlinks1993's ultimately useful and simple poison/regen script. (I approve)


Both of these scripts are really short, yet really powerful at the sametime, and if they could be merged, I think that the end result would be quite an impressive feat, for any of those who would wish to utilize an ABS.

Oh, btw, the end result must be in VX...RGSS2...
Though I'm certain making it compatible with both wouldn't be a huge task...

Of course, I will continue to drone away on this script as well, but if some elite script could come up and just kick this dilemma in the face, I'd be satisfied just the same.


--JeR



Title: [RESOLVED?] Poison/Regen Overtime & HoT.DoT
Post by: Jragyn on April 11, 2010, 01:08:52 am
Tadaa!
I am not certain if this is a 100% working thing, but it works for me.
For those of you desiring my results, here!
#==============================================================================
# [HoT DoT] by Shdwlink1993
# [Poison/Regen Overtime] by Game_Guy
#
# I only wrote a single 1 line definition at the end,
# Otherwise, it functions just as you might hope the two scripts would.
#
# It is capable of creating Poison and/or Regen effects.
# These poison/regen effects will expire after a certain amount of time
# has elapsed. The duration is defined by the "turns" in the STATES tab.
# Assuming your framerate holds steady, its roughly 1 turn per second.
#
# Combined somewhat by:: Jragyn
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

module SL93
 
  def self.hotdot(id)
    case id
    #------------------------------------------------------------------------
    # Poison Database Begins
    #------------------------------------------------------------------------
    #  when STATE_NUMBER then return [TYPE, DAMAGE, VARIANCE, LIMIT_DRAIN]
    #  * STATE_NUMBER is the state you want to be affected by this.
    #  * TYPE refers to the thing sustaining damage.
    #      1 = HP, 2 = MP. If the type is positive, the amount is a literal
    #      number (eg. You lose about 50 HP). If the type is negative, then
    #      the amount is a fraction of the maximum (eg. You lose about 50% of
    #      your HP).
    #  * DAMAGE refers to how much damage is healed/taken.
    #      A Positive amount hurts you and a negative amount heals you.
    #  * VARIANCE refers to how much the damage varies. Positive only.
    #      This depends in part on if the type was positive (~5 HP difference)
    #      or negative (~5% HP difference).
    #  * LIMIT_DRAIN refers to if the poison can leave you with 0 HP/SP.
    #      If true, then it is limited, and stops at 1. If false, then it
    #      isn't.
    #------------------------------------------------------------------------
   
  when 2 then return [-1, 50, 0, false]  # Poison
  when 5 then return [-2, 50, 0, false]  # Leak
  when 42 then return [-1, -100, 0, false]  # Regen
  when 43 then return [-2, -100, 0, false]  # Rejuv
    #------------------------------------------------------------------------
    # Poison Database Ends
    #------------------------------------------------------------------------
    end
    return false
  end
 
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Battler
 
  def slip_damage?
    return @states.any? {|i| SL93.hotdot(i) != false }
  end
 
  def slip_damage_effect
    ids = []
    for i in @states
      ids.push(i) if SL93.hotdot(i) != true
    end
    for i in ids
      damage = SL93.hotdot(i)[1] if SL93.hotdot(i)[0] > 0
      damage = self.maxhp / SL93.hotdot(i)[1] if SL93.hotdot(i)[0] == -1
      damage = self.maxmp / SL93.hotdot(i)[1] if SL93.hotdot(i)[0] == -2
     
      damage = damage * -1 if SL93.hotdot(i)[0] < 0
     
      if SL93.hotdot(i)[0] == 1 || SL93.hotdot(i)[0] == -1
        damage = self.hp - 1 if !SL93.hotdot(i)[3] && (0 > self.hp += damage)
        self.hp += damage
       
      elsif SL93.hotdot(i)[0] == 2 || SL93.hotdot(i)[0] == -2
        damage = self.mp - 1 if !SL93.hotdot(i)[3] && (0 > self.mp += damage)
        self.mp += damage
      end
     
    end
    return true
  end
 
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_System
  attr_accessor :time_wait
  alias initialize_more initialize
  def initialize
    @time_wait = 1  # PROver::TimeWait
    initialize_more
  end
end


class Game_Player
 
  attr_accessor :check_dmg
 
  alias initialize_more initialize
  def initialize
    @check_dmg = false
    @time = $game_system.time_wait * 60
    initialize_more
  end
 
  alias update_more update
  def update
    if @check_dmg
      $game_party.take_that_damage
      @check_dmg = false
    end
    if @time > 0
      @time -= 1
    elsif @time <= 0
      @time = $game_system.time_wait * 60
      @check_dmg = true
    end
    update_more
  end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Party

  def on_player_walk
    $game_party.increase_steps unless @move_route_forcing
#    for actor in members
#      if actor.slip_damage?
#        actor.slip_damage_effect
#        $game_temp.next_scene = "gameover" if $game_party.all_dead?
#      end
#    end
  end
 
  def take_that_damage
    for actor in members
      if actor.slip_damage?
        actor.slip_damage_effect
        $game_temp.next_scene = "gameover" if $game_party.all_dead?
      end
    end
  end
 
end