Having trouble with Active Item Usage

Discussion in 'RPG Maker MV' started by Jimminybob, Feb 1, 2018.

  1. Jimminybob

    Jimminybob Villager Member

    Messages:
    24
    Likes Received:
    7
    First Language:
    English
    Primarily Uses:
    RMMV
    Hi all,

    I recently saw a video by SumRndmDde on "Active Item Usage":



    This is where you can set up common events for items so you can effectively use them on the map. This is useful for me as I want to use this on puzzles in my game.

    However I'm adding the Conditional Branch to check the player's position to make sure they are using the item in the right place, but no matter what I try it is failing the check. The check I want to use is:

    $gamePlayer.scrolledX() == 3 && $gamePlayer.scrolledY() == 10 && $gamePlayer.direction() == 4 && $gameMap.mapId() == 17

    Where the player is in position (3, 10) on map 017 and facing left, but even reducing this down to checking the player's X coordinate isn't working so i'm not sure what I am doing wrong.

    Does anyone have experience on this and can point me in the right direction?

    Thanks
     
    #1
  2. Trihan

    Trihan Speedy Scripter Veteran

    Messages:
    1,483
    Likes Received:
    976
    Location:
    Buckie, Scotland
    First Language:
    English
    Could you not use the built-in item use event command for this if it needs to be used in a specific place?
     
    #2
  3. Jimminybob

    Jimminybob Villager Member

    Messages:
    24
    Likes Received:
    7
    First Language:
    English
    Primarily Uses:
    RMMV
    I can't see that command in the list, do you know which page it's on? Also does that come up with a prompt to select an item when you interact with an event? Because I want it to force the player to think about where to use them rather than being prompted for it
     
    #3
  4. Zemtax

    Zemtax Secret Open World Game Dev Veteran

    Messages:
    39
    Likes Received:
    21
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    I'm not entirely sure how you're trying to make it work, but whenever I have to check player position, map, direction etc. I'm using variables.
    In your case I'd make it like this:
    Create variables the variables needed (player X, Y, map ID, player direction)
    [​IMG]

    Make a common event using the variables and setting them to the player's data. You can find these variables under "Game Data" in the 'Control Variables' panel.

    [​IMG]
    That should do it in terms of setting the variables.
    Now you can just add whatever you want to the common event or make it so that a parallel process is running on the maps that you want to have these events happening. You could make it so that if all the variables (player X, Y, player direction) are correct for the map the player is on, that a switch is flipped to continue with whatever the event is supposed to do. And since the player coordinates would only update when you use the item, it wouldn't happen accidentally. Might not even use a 'map ID' variable.

    Just my two cents. Hope I could help!
     
    #4
  5. Jimminybob

    Jimminybob Villager Member

    Messages:
    24
    Likes Received:
    7
    First Language:
    English
    Primarily Uses:
    RMMV
    Using the variables has worked, so thank you very much for your help there.

    The method above is meant to avoid the nesting conditions required when checking all the variables, by instead using script to check the positions etc. Or at least that's what the video explains, but I couldn't get it working.
     
    #5

Share This Page