Creating an item that can only be used on a certain map

Discussion in 'Javascript/Plugin Support' started by Johnboy, Jul 19, 2016.

  1. Johnboy

    Johnboy Veteran Veteran

    Messages:
    317
    Likes Received:
    104
    Location:
    Canadia
    First Language:
    English
    Got another question for the gurus out there.


    I want to create an item that only functions on my overworld map and not any others. I'm not sure how to go about this. The majority of my plugins are Yanfly's, but if I need another plugin to do this, that's ok too. Any help or insight ( or pointing out my stupidity, :p) would be greatly appreciated.
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,586
    Likes Received:
    11,302
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You don't need a plugin for this.


    You can do one of two things ...


    Attach the item to a common event.  In the common event, check the map id.  If it's the overworld map, apply the item effects (you would need to set the item to not actually do anything, and in your common event issue the commands to apply the effects that WOULD have been listed on the item - change HP, whatever).  If it's not the overworld map, show a message and give the item back to the player (only if it's set to be consumable).


    OR


    Create two items that are identical, but set one to be used from the menu and the other not to be used at all.  When you give the item to the player, if you're on the overworld map, give them the one that can be used; if you're on a different map, give the one that can't be used.  Now go to the overworld map and create a parallel process event that does this:

    Code:
    Conditional Branch: Item [X] in Inventory
      Change Items: [X] - 1
      Change Items: [Y] + 1
    End
    Erase Event
    where X is the "can't use" item, and Y is the "can use" item.


    Then reverse that process when you leave the overworld map.  If you have a number of events that will take you to other maps (likely), create a common event, and just have all of your exit events do a Call Common Event.  Make your common event look like this:

    Code:
    Conditional Branch: Item [Y] in Inventory
      Change Items: [Y] - 1
      Change Items: [X] + 1
    End
    
    So what you're doing is giving the player a dud item that looks useful, but can't be used.  When you go to the overworld map, it swaps the dud item for the real one.  And when you leave the overworld map it swaps the real item for the dud one.


    I'd probably prefer the second method, as it means you don't have to mess around with commands to apply the item effect.  It depends though on what the item is actually meant to do.  


    Of course your list of Yanfly's plugins might already have something that will do this anyway.  I'm just not familiar with them.
     
    Last edited by a moderator: Jul 19, 2016
    #2
    Skunk likes this.
  3. Johnboy

    Johnboy Veteran Veteran

    Messages:
    317
    Likes Received:
    104
    Location:
    Canadia
    First Language:
    English
    The item I want to make is a recover all item similar to the tents in Final Fantasy games. I'm going to go with your second method I think. Thanks.
     
    #3

Share This Page