RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
% equipment script

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 69
RMRK Junior
So... I am looking for a 'unique' script that makes it so that weapons, instead of hard adding attack, would add a percentage to your attack power based on your attack power. (or spirit based on your spirit if you're using a magic staff) or have armor that does the same thing with defense.. and agility would also be an option for either armor or weapons... Would this script be hard to code?

(edit: And when I look to equip the weapon, it will still show in the equip menu how much attack it gains by equipping the weapon - Same with armor)

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
It would be pretty simple to do with note tags. Is that how you want it done, specified by the notebox, or do you want the upgrade determined automatically?
it's like a metaphor or something i don't know

**
Rep: +0/-0Level 69
RMRK Junior
Note tags if you could. Thanks for the help Pac!

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
I'll do it tomorrow once I finish the SP stat.
it's like a metaphor or something i don't know

**
Rep: +0/-0Level 69
RMRK Junior
Any update on this script by chance?

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Yeah, it really won't take that long at all. Should be done by the end of the day.
I've pretty much already written the script anyway.
« Last Edit: July 14, 2011, 08:52:45 AM by Pacman »
it's like a metaphor or something i don't know

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Sooner than I expected.
Code: [Select]
#==============================================================================
# RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # * Passive Traits
  #--------------------------------------------------------------------------
  def passive_traits
    return if self.is_a?(RPG::Skill) or self.is_a?(RPG::Item)
    return @passive_traits if @passive_traits != nil
    @passive_traits = { :maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
      :spi => 0, :agi => 0, :dex => 0, :res => 0, :hit => 0, :eva => 0,
      :cri => 0, :odds => 0, :maxhpp => 100, :maxmpp => 100, :atkp => 100,
      :defp => 100, :spip => 100, :agip => 100, :dexp => 100, :resp => 100,
      :hitp => 100, :evap => 100, :crip => 100, :oddsp => 100, :states => []}
    self.note.split(/[\r\n]+/).each { |line|
      case line
        when /<(?:PASSIVE|pas)[ ](.*):[ ]([\+\-]\d+)>/i
          case $1.upcase
            when "MAXHP", "HP"; @passive_traits[:maxhp] = $2.to_i
            when "MAXMP", "MP"; @passive_traits[:maxmp] = $2.to_i
            when "ATK"        ; @passive_traits[:atk] = $2.to_i
            when "DEF"        ; @passive_traits[:def] = $2.to_i
            when "SPI"        ; @passive_traits[:spi] = $2.to_i
            when "AGI"        ; @passive_traits[:agi] = $2.to_i
            when "DEX"        ; @passive_traits[:dex] = $2.to_i
            when "RES"        ; @passive_traits[:res] = $2.to_i
            when "HIT"        ; @passive_traits[:hit] = $2.to_i
            when "EVA"        ; @passive_traits[:eva] = $2.to_i
            when "CRI"        ; @passive_traits[:cri] = $2.to_i
            when "ODDS"       ; @passive_traits[:odds] = $2.to_i
          end
        when /<(?:PASSIVE|pas)[ ](.*):[ ](\d+)([%?])>/i
          case $1.upcase
            when "MAXHP", "HP"; @passive_traits[:maxhpp] = $2.to_i
            when "MAXMP", "MP"; @passive_traits[:maxmpp] = $2.to_i
            when "ATK"        ; @passive_traits[:atkp] = $2.to_i
            when "DEF"        ; @passive_traits[:defp] = $2.to_i
            when "SPI"        ; @passive_traits[:spip] = $2.to_i
            when "AGI"        ; @passive_traits[:agip] = $2.to_i
            when "HIT"        ; @passive_traits[:hitp] = $2.to_i
            when "EVA"        ; @passive_traits[:evap] = $2.to_i
            when "CRI"        ; @passive_traits[:crip] = $2.to_i
            when "ODDS"       ; @passive_traits[:oddsp] = $2.to_i
          end
        when /<(?:PASSIVE_STATE|passive state):[ ](\d+(?:\s*,\s*\d+)*)>/i
          $1.scan(/\d+/).each { |num|
          @passive_traits[:states].push($data_states[num.to_i]) if num.to_i > 0}
        end
      }
    return @passive_traits
  end
 
end
 
#==============================================================================
# ** Game_Battler
#==============================================================================
 
class Game_Battler
  #--------------------------------------------------------------------------
  # * Get Current States as an Object Array
  #--------------------------------------------------------------------------
  alias passive_equips_states states unless $@
  def states
    array = passive_equips_states
    if actor?
      for skill in skills do array |= skill.passive_traits[:states] end
    end
    return array.compact
  end
end

#==============================================================================
# Game Actor
#==============================================================================
 
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Get Basic Maximum HP
  #--------------------------------------------------------------------------
  alias passive_equips_base_maxhp base_maxhp unless $@
  def base_maxhp
    n = passive_equips_base_maxhp
    for skill in skills do n = n * skill.passive_traits[:maxhpp] / 100.0 end
    for skill in skills do n += skill.passive_traits[:maxhp] end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum MP
  #--------------------------------------------------------------------------
  alias passive_equips_base_maxmp base_maxmp unless $@
  def base_maxmp
    n = passive_equips_base_maxmp
    for skill in skills do n = n * skill.passive_traits[:maxmpp] / 100.0 end
    for skill in skills do n += skill.passive_traits[:maxmp] end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Basic Attack
  #--------------------------------------------------------------------------
  alias passive_equips_base_atk base_atk unless $@
  def base_atk
    n = passive_equips_base_atk
    for skill in skills do n = n * skill.passive_traits[:atkp] / 100.0 end
    for skill in skills do n += skill.passive_traits[:atk] end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Basic Defense
  #--------------------------------------------------------------------------
  alias passive_equips_base_def base_def unless $@
  def base_def
    n = passive_equips_base_def
    for skill in skills do n = n * skill.passive_traits[:defp] / 100.0 end
    for skill in skills do n += skill.passive_traits[:def] end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Basic Spirit
  #--------------------------------------------------------------------------
  alias passive_equips_base_spi base_spi unless $@
  def base_spi
    n = passive_equips_base_spi
    for skill in skills do n = n * skill.passive_traits[:spip] / 100.0 end
    for skill in skills do n += skill.passive_traits[:spi] end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Basic Agility
  #--------------------------------------------------------------------------
  alias passive_equips_base_agi base_agi unless $@
  def base_agi
    n = passive_equips_base_agi
    for skill in skills do n = n * skill.passive_traits[:agip] / 100.0 end
    for skill in skills do n += skill.passive_traits[:agi] end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Hit Rate
  #--------------------------------------------------------------------------
  alias passive_equips_hit hit unless $@
  def hit
    n = passive_equips_hit
    for skill in skills do n = n * skill.passive_traits[:hitp] / 100.0 end
    for skill in skills do n += skill.passive_traits[:hit] end
    return [Integer(n), 0].max
  end
  #--------------------------------------------------------------------------
  # * Get Evasion Rate
  #--------------------------------------------------------------------------
  alias passive_equips_eva eva unless $@
  def eva
    n = passive_equips_eva
    for skill in skills do n = n * skill.passive_traits[:evap] / 100.0 end
    for skill in skills do n += skill.passive_traits[:eva] end
    return [Integer(n), 0].max
  end
  #--------------------------------------------------------------------------
  # * Get Critical Rate
  #--------------------------------------------------------------------------
  alias passive_equips_cri cri unless $@
  def cri
    n = passive_equips_cri
    for skill in skills do n = n * skill.passive_traits[:crip] / 100.0 end
    for skill in skills do n += skill.passive_traits[:cri] end
    return [Integer(n), 0].max
  end
  #--------------------------------------------------------------------------
  # * Get Ease of Hitting
  #--------------------------------------------------------------------------
  alias passive_equips_odds odds unless $@
  def odds
    n = passive_equips_odds
    for skill in skills do n = n * skill.passive_traits[:oddsp] / 100.0 end
    for skill in skills do n += skill.passive_traits[:odds] end
    return [Integer(n), 1].max
  end
end
Place this anywhere in the script editor as long as none of the methods are overwritten. If there are incompatibility errors with anything else you're using, just tell me.
To make the dang thing raise a stat, use a tag in a weapon or armor notebox:
<passive stat: +x> To raise a stat by a certain constant.
<passive stat: -x> To lower a stat by a certain constant.
<passive stat: %x> To raise a stat by a certain percentage.
Place stat as hp, mp, atk, def, agi, spi, hit, eva or odds. An example tag:
<passive atk: %40>
Placed in a weapon's notebox will have it so that when the weapon is equipped the attack of the equip-pee will have their attack raised by 40 percent.
Good?
it's like a metaphor or something i don't know

**
Rep: +0/-0Level 69
RMRK Junior
No method error on this line     for skill in skills do n = n * skill.passive_traits[:maxhpp] / 100.0 end

Undefined method for nilClass. It's on line 91.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Line 91 is a comment?
it's like a metaphor or something i don't know

**
Rep: +0/-0Level 69
RMRK Junior
Woops 86. I added a few comments at the beginning with instructions. Srry bout that.

I'm using some passive skill scripts so not sure if they are creating incompatibility issues.

**
Rep: +0/-0Level 69
RMRK Junior

**
Rep: +0/-0Level 75
Je voudrais pouvoir parler français.
Yeah, I tried it out too, and there's definitely an error at 86. :-\
Anatidaephobia- The fear that somewhere, somehow, a duck is watching you.

**
Rep: +0/-0Level 69
RMRK Junior

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
It looks like it is just a typo with an extra p in :maxmp. Change:

Code: [Select]
    for skill in skills do n = n * skill.passive_traits[:maxmpp] / 100.0 end

to:

Code: [Select]
    for skill in skills do n = n * skill.passive_traits[:maxmp] / 100.0 end

**
Rep: +0/-0Level 69
RMRK Junior
Still having the same error take place.

****
Rep:
Level 69
in other parts of the script it mentions the hpp's and mpp's again so it might be part of the script

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Ok, yeah, you're right; I got confused. Reverse whatever I told you to do before. Instead, go to line 9:

Code: [Select]
    return if self.is_a?(RPG::Skill) or self.is_a?(RPG::Item)

Delete it. Then, at line 5 you should see:

Code: [Select]
class RPG::BaseItem

replace it with:

Code: [Select]
class RPG::UsableItem

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
That's weird; why didn't I see that before?
Clumsy me.
it's like a metaphor or something i don't know

**
Rep: +0/-0Level 69
RMRK Junior
I just tried it and it's not raising the attack any with this <passive atk: %40>..

****
Rep:
Level 69
have you tried <passive atk: 40%> or <passive atk: 40>  ?

**
Rep: +0/-0Level 69
RMRK Junior
Yes. They don't work. =(