Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Krash on September 16, 2012, 08:16:53 pm

Title: Change Skill Formula
Post by: Krash on September 16, 2012, 08:16:53 pm
Hello every body, i search a script.

(i use Blizz ABS on XP)

It depends on the skill you use the formula calculates will be different.

example:

If you use a lot of physical type there will be a calculated expected

ex: strenght - defense = damage

If you use a spell like magic there will be a calculated expected

ex: intelligence - magic defense = damage

The script i imagine look like it:

If skill {1,2,3,4,5,6,7,8,9} = physical then
Formula = (strenght - defense = damage)
else
Skill {10,11,12,13,14,15,16} = magical then
Formula = (inteligence - magic defense = damage)
End if

I don't know if you understand my idea...

I would like to remove the (normal attack for exemple when you use "S" keyboard)

thanks you for the people who will help me. if someone can do the script





Title: Re: Change Skill Formula
Post by: KK20 on September 16, 2012, 08:30:29 pm
This is how skill damage is calculated within RMXP:
Spoiler: ShowHide
class Game_Battler
  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #     user  : the one using skills (battler)
  #     skill : skill
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    # Clear critical flag
    self.critical = false
    # If skill scope is for ally with 1 or more HP, and your own HP = 0,
    # or skill scope is for ally with 0, and your own HP = 1 or more
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      # End Method
      return false
    end
    # Clear effective flag
    effective = false
    # Set effective flag if common ID is effective
    effective |= skill.common_event_id > 0
    # First hit detection
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    # Set effective flag if skill is uncertain
    effective |= hit < 100
    # If hit occurs
    if hit_result == true
      # Calculate power
      power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      # Calculate rate
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      # Calculate basic damage
      self.damage = power * rate / 20
      # Element correction
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      # If damage value is strictly positive
      if self.damage > 0
        # Guard correction
        if self.guarding?
          self.damage /= 2
        end
      end
      # Dispersion
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # Second hit detection
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      # Set effective flag if skill is uncertain
      effective |= hit < 100
    end
    # If hit occurs
    if hit_result == true
      # If physical attack has power other than 0
      if skill.power != 0 and skill.atk_f > 0
        # State Removed by Shock
        remove_states_shock
        # Set to effective flag
        effective = true
      end
      # Substract damage from HP
      last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp
      # State change
      @state_changed = false
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      # If power is 0
      if skill.power == 0
        # Set damage to an empty string
        self.damage = ""
        # If state is unchanged
        unless @state_changed
          # Set damage to "Miss"
          self.damage = "Miss"
        end
      end
    # If miss occurs
    else
      # Set damage to "Miss"
      self.damage = "Miss"
    end
    # If not in battle
    unless $game_temp.in_battle
      # Set damage to nil
      self.damage = nil
    end
    # End Method
    return effective
  end
end
If you want physical skills to do physical damage, then set the skill's MDEF-F to 0 and PDEF-F to 100. Unless you want certain skills to follow a unique formula, we can teach you how to do it, but you must come up with the formulas yourself. I assume English isn't your native language so I apologize if I'm not even touching the subject.
Title: Re: Change Skill Formula
Post by: Krash on September 18, 2012, 03:09:31 am
Thx for your help my problem is fixed

a orther question how can i remove the attack on blizz abs?
Title: Re: Change Skill Formula
Post by: Memor-X on September 18, 2012, 06:18:31 pm
Quote from: Krash on September 18, 2012, 03:09:31 am
Thx for your help my problem is fixed

a orther question how can i remove the attack on blizz abs?


simply do not assign a key to Attack in the config, you can see this done for other actions in the Blizz-ABS example game in tyhe config script
Title: Re: Change Skill Formula
Post by: KK20 on September 19, 2012, 02:12:45 pm
You forgot to take allies into consideration. Never messed with such a thing, so I'm not sure myself yet.