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.

Changing Attack Attribute

rexkim

Member

With the default set up, attack is only dependant on the weapon. How would you change it so that it'd be something like:

Attack of Weapon + (Strength of Actor/5) = Attack attribute.

Thanks.
 

poccil

Sponsor

Here.  Put the following code in a new script section (before the last one).
Code:
class Game_Actor
  def base_atk
    weapon = $data_weapons[@weapon_id]
    atk=(weapon != nil) ? weapon.atk : 0
    atk+=(self.str/5)
    return atk
  end
end

Alternatively, if the ATK should apply to both actors and enemies, use this instead:

Code:
class Game_Battler
  def atk
    n = base_atk
    n+=self.str/5
    for i in @states
      n *= $data_states[i].atk_rate / 100.0
    end
    return Integer(n)
  end
end
 

rexkim

Member

Ahhh thank you! ^.^

Oh but could you do something extra like that for me? >.>

Same formula but dex into physical def and int into magical def. Thanks and sorry. ^.^ -_|||

EDIT: Nevermind. I got it. Thanks. ^.^
 

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