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.

HBGames

I did this as a request a while ago.

No one replied with any errors so I assume it's ok.

It mimics the blink skill from FF where you have won't be hit by attacks or magic if you have clones/copies.

Code:
# Script By Fomar0153
class Game_Battler
  
  Hit_by_attacks_removes_blink = false
  Hit_by_skill_removes_blink = true
  Blink_guards_attacks = true
  Blink_guards_skills = false
  Skill_blinks = [
  {'id'=>1, 'blinks'=>1},
  {'id'=>2, 'blinks'=>2},
  {'id'=>3, 'blinks'=>3}
  ]
  
  attr_accessor :blinks
  
  alias before_blink_initialize initialize
  def initialize
    before_blink_initialize
    @blinks = 0
  end
  
  alias before_blink_skill_effect skill_effect
  def skill_effect(user, skill)
    if Hit_by_skill_removes_blink == true
      @blinks = 0
    end
    
    if @blinks == 0 or Blink_guards_skills == false
      
      for blink_skill in Skill_blinks
        if blink_skill['id'] == skill.id
          @blinks += blink_skill['blinks']
        end
      end
      
      return before_blink_skill_effect(user, skill)
    else
      @blinks -= 1
      self.critical = false
      self.damage = 'Miss'
      return false
    end
    
  end
  
  alias before_blink_attack_effect attack_effect
  def attack_effect(attacker)
    if Hit_by_attacks_removes_blink == true
      @blinks = 0
    end
    
    if @blinks == 0 or Blink_guards_attacks == false
      return before_blink_attack_effect(attacker)
    else
      @blinks -= 1
      self.critical = false
      self.damage = 'Miss'
      return false
    end
  end
  
end

To use just mess with:
Hit_by_attacks_removes_blink = false
Hit_by_skill_removes_blink = true
Blink_guards_attacks = true
Blink_guards_skills = false
Skill_blinks = [
{'id'=>1, 'blinks'=>1},
{'id'=>2, 'blinks'=>2},
{'id'=>3, 'blinks'=>3}
]
The first two remove all blinks when you are attacked with that method if set to true, ie a skill will ignore and reset the number of blinks to 0 and an attack will miss if blinks > 0 and lower it by one as it is configured now.
Then you set up what blink guards attacks and/or skills.
Then skill blinks add a hash for every skills that adds a blink/s and then id is the skill's id and blinks is the amount of blinks.

Note: there is no visual indication.

To make all blinks end after battle use this:
Code:
class Scene_Battle
  
  alias before_blink_start_phase5 start_phase5
  def start_phase5
    for actor in $game_party.actors
      actor.blinks = 0
    end
    before_blink_start_phase5
  end
  
end

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