Equipment that Inflicts a Stats at end of turn.

Discussion in 'RGSS3 Script Requests' started by Vis_Mage, Sep 16, 2019.

  1. Vis_Mage

    Vis_Mage Novice Magician Veteran

    Messages:
    388
    Likes Received:
    141
    Location:
    Ridge Island
    First Language:
    English
    Primarily Uses:
    RMVXA
    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!
     
    #1
  2. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,441
    Likes Received:
    5,029
    Location:
    Riftverse
    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
    
     
    #2
    Vis_Mage likes this.
  3. Vis_Mage

    Vis_Mage Novice Magician Veteran

    Messages:
    388
    Likes Received:
    141
    Location:
    Ridge Island
    First Language:
    English
    Primarily Uses:
    RMVXA
    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
     
    #3
  4. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,441
    Likes Received:
    5,029
    Location:
    Riftverse
    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
    
     
    #4
    Vis_Mage likes this.
  5. Vis_Mage

    Vis_Mage Novice Magician Veteran

    Messages:
    388
    Likes Received:
    141
    Location:
    Ridge Island
    First Language:
    English
    Primarily Uses:
    RMVXA
    Yep, that fixed it! Thanks again!
     
    #5

Share This Page