[MV] Item increases a variable by amount

Discussion in 'RPG Maker MV' started by recklessjive, Jul 14, 2017.

    Tags:
  1. recklessjive

    recklessjive Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    Heya!

    I want to set a variable to 10 every time I receive a specific item. And when the variable reaches 0, I want to remove -1 of that item in the inventory and reset the variable to 10 if there is still 1 or more of that item in inventory.

    Example:
    - Player receives 1 [Bucket of water] item.
    - Adds +10 to [Litres of water in party] variable.
    - Player performs events that reduce the above variable by 1.
    - When the variable reaches 0, remove 1 Bucket of water.
    - If the player still has 1 or more [Buckets of water] in inventory, reset variable to 10.

    I'm not sure how to set up the events and conditions to do this. I have a common event set up so the max amount of [Litres of water in party] is 10, which co relates with a little on screen HUD gauge.

    I'm fairly new to RPG Maker MV but am interested to develop some skills.

    Thanks :)
     
    #1
  2. Naveed

    Naveed Veteran Veteran

    Messages:
    314
    Likes Received:
    142
    First Language:
    English
    Primarily Uses:
    RMMV
    Well, based on your description, I'm going to assume the player only receives a [Bucket of water] in events (ie not randomly such as enemy drops) and that they are used only during events and not by the player in the menu.

    In that case, in the event where the player receives a [Bucket of water], just use control variables to set the [Litres of water in party] variable to 10.
    Whenever the player performs an event that reduces this variable by 1, immediately after reducing the variable, check to see if the variable is 0. If it is, remove 1 [Bucket of water] and immediately check if the party has any [Bucket of water] left. If they do, set [Litres of water in party] to 10.

    It'll look like this:

    [​IMG]
    [​IMG]
     
    #2
    recklessjive likes this.
  3. recklessjive

    recklessjive Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    That is correct. Thank you so much Naveed, this is working perfectly! :) I really appreciate the effort you went into explaining this.

    I've made a common event to check the variable whenever there is an even in which the variable is reduced by 1.
     
    #3

Share This Page