Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Skill Exhuastion

Code:
class Game_Battler
  One_turn = 17
  Two_turn = 18
  Three_turn = 19
  
  
  
  attr_accessor :exhaustion
  
  alias old_initialize initialize
  def initialize
    old_initialize
    @exhaustion = 0
  end
  
  def inputable?
    return ((not @hidden and restriction <= 1) and @exhaustion == 0)
  end
  
  def movable?
    return ((not @hidden and restriction < 4) and @exhaustion == 0)
  end
  
  alias old_skill_effect skill_effect
  def skill_effect(user, skill)
    effective = old_skill_effect(user, skill)
    
    if skill.element_set.include?(One_turn)
      user.exhaustion += 2
    end
    
    if skill.element_set.include?(Two_turn)
      user.exhaustion += 3
    end
    
    if skill.element_set.include?(Three_turn)
      user.exhaustion += 4
    end
    
    
    return effective
  end
  
end


class Scene_Battle
  
  alias old_start_phase2 start_phase2
  def start_phase2
    if @last_turn == nil
      @last_turn = 0
    end
    if @last_turn != $game_temp.battle_turn
      for battler in $game_party.actors + $game_troop.enemies
        if battler.exhaustion > 0
          battler.exhaustion -= 1
        end
      end
      @last_turn = $game_temp.battle_turn
    end
    old_start_phase2
  end
  
  alias old_start_phase5 start_phase5
  def start_phase5
    for i in 0...$game_party.actors.size
      $game_party.actors[i].exhaustion =0
    end
    old_start_phase5
  end
  
  
end

You just change the ids to refer to an element in the database and the character/enemy will have to wait that many turns before they can act again think Hyper Beam (Poke'mon)..

This will probably conflict with some of my scripts, I always alias methods by sticking old infront of the name, so try changing the alias if you have some problems and use other scripts by me.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top