Give Item to Event (Gift Giving System!)

Discussion in 'RPG Maker MV Tutorials' started by Rhino, May 14, 2017.

  1. Rhino

    Rhino ~Inactive~ Veteran

    Messages:
    482
    Likes Received:
    783
    First Language:
    English
    Primarily Uses:
    RMMV
    “Select Item” is a new feature that was introduced to RPG Maker MV. This tutorial aims to explain and give some examples on how to use it.

    Covering the following:

    • (For beginners) What the select item does and how to use it
    • Eventing a gift giving system
    • How to gift weapons and armors
    • Bonus: Explanation of Hidden item A & B

    Although the tutorial is focused on a giving presents, it’s basically a ‘give item to event’ tutorial, meaning it can be used on doors/chests or any other kind of puzzle. You can also play through this tutorial by checking out my Select Item lesson for the MV School!

    Recommended (but entirely option plugins):

    Yanfly’s Message Core – So the event can react and say the name of the item that has been selected

    Mjshi ‘s Conditional Branch+ – Makes eventing the conditional branches a lot simpler

    Yanfly’s Map Select Equip – Lets you select weapons and armors.

    Yanfly's Map Select Skill- Lets you select skills.

    Ossra's Show Description- Displays the item's description to aid the player in making their decision.

    I hope you enjoy this tutorial! So, without any further ado, let’s begin!

    Note: If some of the pictures aren't loading, try refreshing your page. If they're still not working, please send me a message.

    The select item command can be found on page one under “message” 1.png

    Press it, and you’ll see this pop up asking for you to choose a variable, and the item type. 2.png

    You can choose any variable you like, just be sure to remember which you’ve picked. The best way to do this is by naming the variable.
    3.png

    Item type refers to the items tab in the database. When making an item, you can set the type.
    4.png

    As you can see, the types you can chose are the same are the ones in the select item pop up. This lets you easily group the items, so the player doesn’t have to look through their entire inventory.

    ‘Regular Item’ is used to make items that show up under the players ‘item’ tab in their menu, and can also be used in battle (if you’ve set the occasion to always/battle menu.) They’re normally used to make items such as potions, food, books etc, anything that will affect characters/enemies.

    Key Items however, are items that are connected to the story. It might be the metal that you owe a blacksmith, the toy you’ve found for a child, or well.. the key you need to open a dungeon door. These items can’t be used/consumed by the player, they are plot-related only.

    With that covered, let’s try selecting an item! Using the ‘select item command’ a box will appear at the top of the screen allowing the player to choose their item.
    5.png
    It will also show the how much of that item the player possesses. Remember: the select item let’s the player select from their inventory, not from all the items you’ve defined in the database. Make sure your player has actually received the item you want them to choose before using this command.

    Now that we’ve seen how the select item command works, let’s try using it in an event!

    Here’s Harold, going about his regular hero business, on a dungeon crawl.
    6.png

    Oh dear, he can’t get through without using a key. Now that’s a conundrum... Luckily for Harold, we can create a key item!
    7.png

    Create the key, and set it up so that the price is 0 (so the player can’t accidentally sell it in a shop), it’s none consumable and can never be used (so the player can’t use the item on themselves.)

    Take a note of the item ID (the number next to the item name.) For me, the key is number 5. Add the item to a chest/loot in a forced battle (not a random encounter/battle you can escape from) or however else you’d like as long as you can be sure the player will be able to find it.

    Let’s make our door event...
    [​IMG]

    When the player interacts with the door, it will show select item from a choice of all the key items in the players inventory. I’ve set the variable to be 1.

    Using a conditional branch, I’m checking whether variable 1 = 5. Remember that my key item has an ID of 5. If the player has chosen the key, the door will unlock, however, using an ‘else’ branch, if the player has chosen anything other than the key, or pressed ESC to get out of the menu, it’s not going to open.

    The select item command won't automatically add or remove any items, so you'll have to do that manually using the "Change Items" command. Alternatively, you can leave it in for use in another puzzle.

    You could also add in several red herrings to make it harder for the player to guess which item is correct, but try not to go overboard. No one wants to be scrolling through tons of items.

    door.gif

    Success!

    Note: this step assumes you already know the basics of how to use a select item event, if you don’t, make sure to check out the Basic Select Item Event step.
    11.png

    Ahh, it’s Christmas Day. After a whole year of going around and being a hero, Harold is certain he got into Santa’s ‘nice list’. He’s anxiously waiting to open his presents.

    Let’s take a look in Santa’s Sack..
    12.png

    Item 1+2 are gifts that Harold would love to receive, whereas 3 is a little disappointing, and 4+5 are just plain awful.

    We want Harold to be able to react to all of these items, but writing out a conditional branch for each one is going to be a nightmare, so let’s try using mjshi’s conditional branch +

    With this plugin installed, we can check if variable 1= items 1 or 2 in one single branch!

    Use the conditional script: Check.is_any(variable, *values)

    To check for item one or two, we’re going to use the script;
    Code:
    Check.is_any(1, 1, 2)
    Now that we're checking for multiple item ids in one branch, it makes things a bit trickier if we'd like to gain or remove that item after it's been selected. (As mentioned earlier, the select item command doesn't automatically change items, it has to be done manually.) Last time, we used the "change item" command- but we no longer know the exact item ID! Instead, we need another script.
    Code:
    $gameParty.gainItem($dataItems[$gameVariables.value(x)], n);
    This script is to gain items. You could also use "$gameParty.loseItem" to remove them, but simply adding a negative number works as a negative gain to remove items!

    So x in "$gameVariables.value(x)" needs to the number of the variable you've used to store the item IDs in the 'select item' command. In our case- that's variable 1.

    And N will usually always be either 1 or -1.

    Finally, we also want there to be a response if the player cancels their choice, so we add a conditional branch checking if the variable = 0. Poor Harold!

    Let’s try making this event.

    [​IMG]

    Now Harold is going to react to the gift you give him, but hm.. It’s not very dynamic. Let’s have Harold say the name of the item you just gave him. For this, you’re going to need Yanfly’s Message Core. Use the text code \ni[\v[x]] Where x= the variable you’re checking.

    14.png
    Much more interesting!
    15.gif
    That’s all for this basic system, it’s up to you to decide how you’ll use it. Will Harold and Santa’s friendship meter increase/decrease? Will Harold be offended and challenge Santa to a fight? Are you going to unlock some super secret side story about Harold’s Grandma’s cookies? Anything is possible!

    The select item command lets you choose regular, key, or hidden items, but what if you want an equipable item to be chosen? That’s where Yanfly’s Map Select Equip comes in!

    When you install the plugin, I recommend changing the default Y position to be ‘top’ so that the select equip window looks the same as an ordinary select item window.
    16.png

    To open the window, instead of using the event command ‘select item’, you should use a plugin command “MapSelectEquip var type” where var is the variable you want to store the item ID to, and type is either 'weapon', 'armor', or 'both'.

    Now Santa can give Harold an awesome new weapon instead!

    17.jpg

    When you’re using a weapon/armor, make sure to change \ni[\v[x]] to be \nw[\v[x]] or \na[\v[x]] respectively, or Harold won’t say the correct name!

    So, we know what Regular Items and Key Items are, but what about Hidden Items A & B? Simply put- these are items that won’t show in the inventory.

    You can use them as a hidden mechanic during eventing, so, instead of having an event check for a switch, you can have it look for the item being in the players inventory instead.

    Their true purpose is of course, for the Select Item command! You can use hidden items to have minigame parts that you don’t want showing up in the players inventory, as a replacement for the ‘show choice text’ or to make a ‘skill/action’ with a limited number of uses (as the item will run out when it’s been selected.)

    For some ideas on how to use the select event and hidden items, check out this youtube video:

    Note: this video wasn't made by me and I'm not affiliated with CrackedRabbitGaming, I just thought it was helpful hence why I'm sharing it here.

    Hope you've enjoyed this tutorial! Let me know if you come up with any other cool ideas/systems that use the select item event :D
     
    Last edited: Jan 23, 2018
    #1
  2. SatansAngel

    SatansAngel THE RPG Maker 2003 World Champion (retired) Veteran

    Messages:
    32
    Likes Received:
    17
    Location:
    Georgia, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    You have got to be kidding me...

    I invented a script like this for RPG Maker 2003 about 10+ years ago and I just got MV a month or two ago. I'm sitting here already re-making the old scripts and I COMPLETELY... COMPLETELY overlooked this command in the menu. LOL!!!!!!!! OH GOODNESS.

    Be back in a few days ;)

    and kudos on the little javascript script commands here, that saves me a lot of time.
     
    #2
  3. Rhino

    Rhino ~Inactive~ Veteran

    Messages:
    482
    Likes Received:
    783
    First Language:
    English
    Primarily Uses:
    RMMV
    Aw, what a shame! I spent a while looking for a plugin before I randomly happened to find a video talking about the select item command, so I understand :guffaw:

    If you're still thinking of making a plugin like this, I have a few suggestions (ignore if not)..
    There's no way to change the default select item window. Yanfly's plugin lets you change the position, rows/columns, hide the item quantity and other cool features. It'd be nice if there was a way to jazz up the select item window like this, otherwise you if you're going to be using both select items and equips, you can't really use any of these features, it's too noticeable.

    The only thing I don't like about Yanfly's Equips, is that it closes the message window. (I guess since it's defaulted to appear over it.) But again, it looks weird if you're using the select item as well. (You can see in my screenshot where Santa is giving Harold a sword- the message window is closed.. I really like having it open, just so the player can remember what they're selecting the item for.)

    Alternatively, if you're just going to make a different 'item to event' I think it would be nice to be able to open the whole inventory (-minus key item/option for key item alone.) It makes the gift giving part smoother, since you don't have to show a choice "Do you want to give an item, weapon, or armour?" and can just jump straight in "give anything from your inventory!"

    Though, I have no idea how you'd get that to work with all the different item IDs and get the \ni,\nw,\na to work. Maybe store each in a different variable? That's going to need a whole lot of conditional branches though :guffaw:

    And the other thing I think would be really neat is a way for the event to refuse/return the gift. You can do that by making a conditional branch for each id and having it change items back to +1, but that's really messy and doesn't work for the way I'm doing it with mjshis conditional branch +;_;
     
    #3
    SatansAngel likes this.
  4. SatansAngel

    SatansAngel THE RPG Maker 2003 World Champion (retired) Veteran

    Messages:
    32
    Likes Received:
    17
    Location:
    Georgia, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Well, since I just found this in the menu and it's 5am now - I'll start looking at it another day and re-read what you posted once I'm more familiar with it on MV.
     
    #4
    Rhino likes this.
  5. Rhino

    Rhino ~Inactive~ Veteran

    Messages:
    482
    Likes Received:
    783
    First Language:
    English
    Primarily Uses:
    RMMV
    I think you should definitely get to bed. Sleep is important :guffaw:

    Of course there's no rush for this to be done by, I'm happy you're even considering it! :kaoluv:
     
    #5
  6. kaiijuu

    kaiijuu Veteran Veteran

    Messages:
    106
    Likes Received:
    88
    First Language:
    English
    Primarily Uses:
    RMMV
    Ah! I love this! I really wanted to create a gift giving system in my game. Would this be doable the other way around? Like the actor giving another actor a present from the party?
     
    #6
  7. Rhino

    Rhino ~Inactive~ Veteran

    Messages:
    482
    Likes Received:
    783
    First Language:
    English
    Primarily Uses:
    RMMV
    @kaiijuu By default the party shares an inventory so mechanically that'd be a bit pointless, but of course where there's an event you can use the "select item" command! (Mentioned by default as there are plugins to create multiple inventories, but I'm not sure whether they'll be compatible with this method.)

    So the simplest way would be to go about making something like 'tent cutscenes', or any general places where your party splits up so they're no longer just followers, and you can give each actor an event. Then you can set up the system as you like! If you want it to look like the event is giving the player an item- I'd recommend taking advantage of the hidden items type. That way the player can choose some unique items they don't already have 'in their inventory' and make it feel more like they're actually getting a gift! Just remember that you'll have to make a duplicate of these item- one that's a hidden item already in the player's inventory so they can pick it from the list, and one that's either a regular or key item which they gain after selection!

    A point I seemed to have missed in this tutorial is that selecting an item doesn't automatically cause that item to be increased or decreased, you have to add that part in manually. (You would also want to create a conditional branch for ItemSelect=0 in case the player backs out of the choice.) I wrote this tutorial as I was actually figuring the system out myself, so it's a bit outdated :kaoswt2: You can check out a newer version here, though I've also gone back and updated the thread now!

    If you want the player to be able to give or get gifts from other party members whilst they're followers, you'll have to set it up in a common event and use this system.
     
    Last edited: Jan 23, 2018
    #7
    kaiijuu likes this.
  8. about7

    about7 Veteran Veteran

    Messages:
    31
    Likes Received:
    9
    First Language:
    English
    Primarily Uses:
    RMMV
    Hey great tips. Thanks for everything!
     
    #8
  9. CrypticSpoon

    CrypticSpoon Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    english
    Primarily Uses:
    Other
    *deleted*
     
    Last edited: Dec 28, 2018
    #9
  10. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,771
    Likes Received:
    10,580
    First Language:
    English
    Primarily Uses:
    RMVXA
    @CrypticSpoon Your image is not showing up. Could you edit your post and try again. It might be easier to use the 'Upload a file' button (you'll have to chose the 'More options' button in the edit window) and upload it straight from your HD.
     
    #10
  11. Demonbane

    Demonbane a very cool bear Member

    Messages:
    24
    Likes Received:
    11
    Location:
    Philippines
    First Language:
    Filipino
    Primarily Uses:
    RMMV
    I learned a lot about item eventing, thank you.
     
    #11

Share This Page