Equipment that Inflicts a Stats at end of turn.

Hello! 👋

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!
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
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
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
Yep, that fixed it! Thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/equipment-that-inflicts-a-stats-at-end-of-turn.113330/