Having trouble with Active Item Usage

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
Could you not use the built-in item use event command for this if it needs to be used in a specific place?
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
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)
jS8koKy.png


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.

fNU6sQ5.png

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!
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.

Original thread: https://forums.rpgmakerweb.com/threads/having-trouble-with-active-item-usage.90739/