Common Equip Events

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

This script allows you to assign common events to weapons/armors that will be run when you equip or dequip (un-equip) them. The common events are assigned separately, so you might have one equip event, and another dequip event.

Download

Script: download here

If you would like the common event to run in the scene, you will need to use something like the Scene Interpreter

Installation

Place this below Materials and above Main.

Usage

Tag your equips with

<equip event: x>
<dequip event: x>

For some common event ID x.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

49 Responses

  1. Anonymous says:

    is any plugin like this for rpg maker mv

  2. blackmdawn says:

    This script might be just what I needed, but I can’t seem to get past one thing.

    From what I’ve read, it seems like I would need to create a different pair of common events for every equip in the game. If I have to do that, then so be it, but I would really like to be able to have one equip and one unequip common events, each with a series of conditionals to do something based on the particular equip.

    Every armor and weapon is going to have a weight, which I want to add or subtract from a total_weight variable upon equip/unequip.

    I guess the issue with that would be if I changed armor several times before exiting the menu, and it wouldn’t know what to do.

    I’d really appreciate it if you have any suggestions.

    Thank you for your time.

  3. shotokun says:

    hello! this script is absolutely perfect, but i was wondering if there was a way to get the event to play only once, such as having a conversation play only the first time you equip the weapon/armor? i apologize if this is a simple oversight on my part or just something that can’t be done, but thanks in advance anyway!

    • Hime says:

      You can use a switch to keep track of whether the event has been played or not, and wrap everything inside a conditional branch on that switch.

  4. Mireneye says:

    Using this together with Smithing by Richter_h and TheoAllen. I have this oddity where if I quit the game to meny and try to start a new game i get this error: “undefined method ‘equip_event_id=’ for#<RPG::UpgradeWeapon:0x8e3x3x8”

    I’m trying to draw some conclusion as to what is going on but so far I’m drawing blanks. It’s referencing line 254 of the Smithing script which is the last “end” within the quotation marks:

    cloned = RPG::UpgradedWeapon.new
    self.instance_variables.each do |varsym|
    ivar_name = varsym.to_s.gsub(/@/) {""}
    eval("
    if cloned.respond_to?(\"#{ivar_name}\")
    begin
    cloned.#{ivar_name} = original.#{ivar_name}.clone
    rescue
    cloned.#{ivar_name} = original.#{ivar_name}
    end
    end")

    Any ideas? Thanks in advance!

    • Hime says:

      equip_event_id is not publicly accessible. You can only read the value.

      Easiest way to get around this would be to add the following

      attr_accessor :equip_event_id

      Inside of class RPG::EquipItem

  5. Seth says:

    How would you go about requiring two of the same weapon needed to be equip for the event to run?

    • Hime says:

      This script does not support conditions. You can add the check to the common event with a conditional branch, but then this script doesn’t tell you which actor called the common event. For the most part there isn’t an obvious way that I can see how this would be done without modifying the script.

      • Seth says:

        Thanks for the fast response. In my game you get to choose between sword and sword or sword and shield (same set-up for war axes and other weapons) but i want them to be equipped before you can progress in the game. If you know of how i can do this or another script that does the same please let me know.

        • Hime says:

          If you just need to check a specific actor, you can call a common event and then inside the common event you would check whether the specific actor has two of the same equip.

          This can be done using a script call in your conditional branch

          w = $game_actors[2].weapons; w.length > 1 && w[0].id == w[1].id
          

          Which will be true only if actor 2 is holding two of the same weapon (based on ID)

  6. Flimbo says:

    Hi Tsukihime,

    Would it be possible to use the Scene Interpreter script together with this one, so a dequip common event is run right when I try to remove an equip, instead of when I press esc and leave the equip menu scene?

    Thanks!

    • Hime says:

      It should work the same as using items in the item menu.

      • Flimbo says:

        Regarding the example, right now if I use an item from the item menu (with effect manager + effect common event) it quickly goes to the map and then runs the common event. With the dequip event, it only runs after I exit the equip scene and the menu scene. It’s the expected behavior?

  7. Flimbo says:

    Hi Tsukihime,

    Would be possible to pass arguments to the common event, so it would know which equip called it, the actor, etc?

    Thanks!

  8. unfauglith says:

    Well, I'm not exactly good at scripting (if that's not evident already), but I did followed the instructions of both scripts.
    I tagged a equipment to asign it a common event, and in the common event I placed the comment that make the event run in the current scene. The event itself was the class change.
    So, what happened is that the actor changed it's class without having to exit to the map, but not before exiting the equipment window.
    What I would like is the change of class to occur when still in the equipment window.

    • Hime says:

      If the class change is supposed to change the equip slots, that won't occur until you refresh the window (which by default means you need to leave and re-enter).

  9. unfauglith says:

    Hello, Hime. Thanks for this excelent script. It works perfectly, although I'm having some sort of an issue (but I don't think it's because there's something wrong with the script, it's just that it doesn't do exactly what I want… which is to be expected).

    Anyway. Using your script, I made an armor that change the class of the actor when equipped. And it does change the class. The problem is that it doesn't do it 'immediately', as in that when the armor is equipped, nothing happens (the class remain the same) until you exit the equipment window. So, this is sort of an issue, because I would like that the class changed when still being in the equipment window, so the player could change the equipment of the actor now that it have a different class.

    ¿Something can be done about this? I hope so. Sorry for bad english and too much text. Thanks again for your awesome scripts.

    • unfauglith says:

      Also, I tried to use the Scene Interpreter script, but it didn't do much.

    • Hime says:

      The problem you're having is that common events only run on the map or during battle and nowhere else. This means that even if you reserve a common event in the equip scene, it won't be run until you go to the map.

      The scene interpreter allows you to run common events in every scene, but you need to tell the engine that you actually want the common event to run in the current scene.

  10. RaynorX says:

    The link is down 🙁

  11. Joey Desud says:

    Hi, I know this goes beyond the script of your scope. I was wondering what I could do to use this with Victor's Materia Equip. For example, I want to make a materia that enables you to Equip Guns. Once you take off the materia any gun that is equipped to the character should come off.

    The materias are set up as armor, so I thought that I could use this equip/deequip script with it, but nothing happens; If you could give me some guidance it would be great. thanks for the script 🙂

    • Hime says:

      You need to get someone to update victor's script to automatically remove equips that cannot be equipped. This script should detect un-equipping automatically if done correctly.

  12. Nathan says:

    Thanks for the Script! But I seem to have a problem when the actor changes equipment to equipment. For example if actor equips dragon armor (common event ID: 001) then while wearing the dragon armor, changes to Leather armor (common event ID: 001 – I use conditional branch to keep the common event list clean) it goes to dequip sprite instead of the leather armor sprite, but if the actor removes ANY armor in general and re-equip whatever armor It chooses it works just fine. Am I doing something wrong in the common event?

    • Hime says:

      When you change armors, you would first un-equip your dragon armor and then equip the leather armor. You would expect the dequip event to run first, followed by the equip event. It is possible that the order is wrong.

      I looked at the script and found that the equip event is queued up before the dequip event, so that may be why.
      I’ve re-ordered them based on the logic above since order of execution actually matters.

      Update the script and see if that solves the problem.

  13. NitewolfDa says:

    Sry to bother you, but is this how i do it?: I create a common event that is named “song” and it will play a song when i put on armor. Then i go to my armor and write “song” in the notes box. Is that how you do it?

  14. NitewolfDa says:

    How do i “tag equips” I don’t really understand the explanation on how to use… Please tell! (I’m not too familiar with scripts…)

  15. Nick says:

    What are the usage conditions on this script?

  16. A Post says:

    For some reason, this script seems to be incompatible with the Scene Interpreter script.

    This error comes up on a clean project with only the “Scene Interpreter” script above the “Common Equip Events” script whenever I utilize a usable item with a common event attached:

    http://d.pictureupload.us/152536972251b253b00d22c.png

    Without this script, it runs as it should:

    http://d.pictureupload.us/187816143951b25490cadf6.png

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax