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.
Auto-states while armor is equipped

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 71
RMRK Junior
I would like to get a script made that allows, through the use of note tags to equipment (weapons and armor) to automatically inflict a state when equipped, and remove the state when the item is unequipped. Example:

an Accessory that allows auto-health regeneration:

<auto-state X>    (X being the state ID) (state X being the regeneration state)

I did actually find a script that allowed for this, but it was inside of one of the yanfly scripts and it was added into another huge script that modified a ton of stuff that I didn't want. So I'm requesting a script that JUST does this (even if someone can simply pull it from the existing yanfly script)

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
This should do it.
Code: [Select]
# Put <autostate: x> where x is the ID of a state in the notebox of an eqiup to
# make the state

class RPG::BaseItem
  def auto_state
    return if self.is_a?(RPG::Skill) || self.is_a?(RPG::Item)
    return @auto_state if !@auto_state.nil?
    @auto_state = []
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /<(?:AUTOSTATE|auto state|AUTO_STATE):[ ](\d+(?:\s*,\s*\d+)*)>/i
        $1.scan(/\d+/).each { |num|
          @auto_state << $data_states[num.to_i] if num.to_i > 0
        }
      end
    }
    return @auto_state
  end
end

class Game_Battler
  alias pac_as_ga_states states
  def states
    list = pac_as_ga_states
    if actor?
      for equip in equips.compact do list |= equip.auto_state end
    end
    return list.uniq
  end
end
« Last Edit: October 28, 2011, 10:59:23 PM by Dr. Evil »
it's like a metaphor or something i don't know

***
Rep:
Level 71
RMRK Junior
# Put <autostate: x> where x is the ID of a state in the notebox of an eqiup to
# make the state

class RPG::BaseItem
  def auto_state
    return if self.is_a?(RPG::Skill) || self.is_a?(RPG::Item)
    return @auto_state if !@auto_state.nil?
    @auto_state = []
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /<(?:AUTOSTATE|auto state|AUTO_STATE):[ ](\d+(?:\s*,\s*\d+)*)>/i
        $1.scan(/\d+/).each { |num|
          @auto_state << $data_states[num.to_i] if num.to_i > 0
        }
      end
    }
    return @auto_state
  end
end

class Game_Battler
  alias pac_as_ga_states states
  def states
    list = pac_as_ga_states
    if actor?
      for equip in equips.combat do list |= equip.auto_state end
    end
    return list.uniq
  end
end


"Line 26: NoMethodError occured.
undefined method 'combat' for #<Array:0x2c9bb49>
« Last Edit: October 27, 2011, 05:36:43 PM by zerothedarklord »

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Change combat in line 26 to compact.
*facepalms self*
it's like a metaphor or something i don't know

***
Rep:
Level 71
RMRK Junior
lol, it's fine man, I looked close and you misspelled like half of line 26 so I had to change it. I'd imagine you were probably in a hurry when you wrote it.

But yeah, thanks for checking back, that did it. Thanks again.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
What else was wrong with that line? Everything else looks fine to me.
it's like a metaphor or something i don't know

*
Rep:
Level 82
Code: [Select]
for eqiup in equips.compat do list |= equip.auto_state end

'equip' is spelled wrong - you put 'eqiup'

It also now says 'compat' instead of 'compact', but at least it's a little more closer than 'combat'.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Oh yeah. Them.

*learns English*
*fixes line*
it's like a metaphor or something i don't know

***
Rep:
Level 71
RMRK Junior
now if I could just get my other requests fulfilled.....