Having trouble with Active Item Usage

Jimminybob

Villager
Member
Joined
Apr 17, 2017
Messages
24
Reaction score
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
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
Could you not use the built-in item use event command for this if it needs to be used in a specific place?
 

Jimminybob

Villager
Member
Joined
Apr 17, 2017
Messages
24
Reaction score
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
 

Zemtax

Secret Open World Game Dev
Veteran
Joined
Jul 17, 2014
Messages
42
Reaction score
22
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)


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.


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!
 

Jimminybob

Villager
Member
Joined
Apr 17, 2017
Messages
24
Reaction score
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top