Equipment that Inflicts a Stats at end of turn.

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
Hello! :kaohi:

I'm wondering if anyone could help me out with a script.

What I'm hoping to accomplish is having a notetag for weapons and armor (something like <Turnstate: 8> ), in which an actor equipped with that equipment would be inflicted with state 8 at the end of each turn in battle.

Hopefully I explained this in a way that makes sense. Let me know if you have any questions.

Thank you!
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Something, something like this
Code:
class Game_Actor
  def on_turn_end
    super
    weapons.each do |wp|
      if wp.note[/<turnstate\s*:\s*(\d+)>/i]
        add_state($1.to_i)
      end
    end
  end
end
Edit: All equips version
Code:
class Game_Actor
  def on_turn_end
    super
    equips.each do |eq|
      if eq.note[/<turnstate\s*:\s*(\d+)>/i]
        add_state($1.to_i)
      end
    end
  end
end
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
Hey, thank you for all your help! :) Although, currently getting the following crash at the end of a turn:

Code:
Equipment State End of Turn:5:in `block in on_turn_end': undefined method `note' for nil:NilClass, NoMethodError
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Try this one
Code:
class Game_Actor
  def on_turn_end
   super
   equips.compact.each do |eq|
     if eq.note[/<turnstate\s*:\s*(\d+)>/i]
       add_state($1.to_i)
     end
   end
  end
end
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
Yep, that fixed it! Thanks again!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,868
Messages
1,017,066
Members
137,576
Latest member
SadaSoda
Top