SEARCH UNDERFOOT IN RM2K/3
A basic tutorial for searching underfoot
kentona- 03/29/2010 04:32 PM
- 2822 views
Someone recently asked me to do a tutorial for searching underfoot like in my games, so here it is. Try not to start a RMVX vs. RM2k3 flamewar this time guys.
Searching Underfoot in RM2k3
The gist of it is the player will press SHIFT to initiate a search, a common event will trap that keypress, and a map event will distribute any found loot.
In a common event
Name: Searching
Trigger: Parallel Process
Trigger Switch: (optional) SEARCHING_ENABLED
*I usually have a switch that I can turn ON or OFF to control whether or not the player can search underfoot. I set it to ON at the start of the game and turn it OFF for things like cutscenes or menus.
In a map event
*When the user steps on this tile, the event will flag that there is an item underfoot. If the player then presses SHIFT while on this tile, the common event will catch it and trigger the auto-start event to distribute the loot.
Page 1
Name: ItemUnderfoot
Trigger: On Hero Touch
Layer: Below Hero
Page 2
Name: ItemUnderfoot
Trigger: Auto-Start
Precond: {0002:SearchedUNDERFOOT} is ON
Precond: {00XX:HiddenItem_X} is ON
Page 3
Name: ItemUnderfoot
Trigger: Action Key
Precond: {00YY:search-ubersword} is ON
In map events surrounding the hidden item event
*This is used to turn off the trigger that the player has stepped on a tile with a hidden item under it. Place copies of this event on the passable tiles around the hidden item event, to turn off the flag that indicates an item is underfoot.
Name: ResetUnderfoot
Trigger: On Hero Touch
Layer: Below Hero
...and that's how I make searching underfoot code in my RM2k3 games.
Searching Underfoot in RM2k3
The gist of it is the player will press SHIFT to initiate a search, a common event will trap that keypress, and a map event will distribute any found loot.
In a common event
Name: Searching
Trigger: Parallel Process
Trigger Switch: (optional) SEARCHING_ENABLED
*I usually have a switch that I can turn ON or OFF to control whether or not the player can search underfoot. I set it to ON at the start of the game and turn it OFF for things like cutscenes or menus.
<> Variable Oper: [0001:Keypress], Set 0
<> Key Input Proc: [0001:Keypress], Do NOT Wait until pressed, checked Shift Key (7)
<> Branch if Var [0001:Keypress] is 7
<> Branch if Switch [0001:ItemUNDERFOOT] is ON
<> Message: "\N[0] searched underfoot..."
<> Switch Oper: [0002:SearchedUNDERFOOT] ON
<> Else
<> Message: "\N[0] searched underfoot..."
<> Message: "But there was nothing."
<> Switch Oper: [0001:ItemUNDERFOOT] OFF
<> Switch Oper: [0002:SearchedUNDERFOOT] OFF
<> End if
<> End if
In a map event
*When the user steps on this tile, the event will flag that there is an item underfoot. If the player then presses SHIFT while on this tile, the common event will catch it and trigger the auto-start event to distribute the loot.
Page 1
Name: ItemUnderfoot
Trigger: On Hero Touch
Layer: Below Hero
<> Switch Oper: [0001:ItemUNDERFOOT] ON
<> Switch Oper: [00XX:HiddenItem_X] ON
Page 2
Name: ItemUnderfoot
Trigger: Auto-Start
Precond: {0002:SearchedUNDERFOOT} is ON
Precond: {00XX:HiddenItem_X} is ON
<> Play Sound Effect: Success2
<> Change Items: Uber Sword of Godliness 1 Add
<> Message: "Found an Uber Sword of Godliness!"
<> Switch Oper: [0001:ItemUNDERFOOT] OFF
<> Switch Oper: [0002:SearchedUNDERFOOT] OFF
<> Switch Oper: [00XX:HiddenItem_X] OFF
<> Switch Oper: [00YY:search-ubersword] ON
Page 3
Name: ItemUnderfoot
Trigger: Action Key
Precond: {00YY:search-ubersword} is ON
<> no code...
In map events surrounding the hidden item event
*This is used to turn off the trigger that the player has stepped on a tile with a hidden item under it. Place copies of this event on the passable tiles around the hidden item event, to turn off the flag that indicates an item is underfoot.
Name: ResetUnderfoot
Trigger: On Hero Touch
Layer: Below Hero
<> Switch Oper: [0001:ItemUNDERFOOT] OFF
<> Switch Oper: [0002:SearchedUNDERFOOT] OFF
<> Switch Oper: [00XX:HiddenItem_X] OFF
...and that's how I make searching underfoot code in my RM2k3 games.
Posts 

Pages:
1
a different way, although a bit more involved would be to make the common event memorize the hero's location and then compare it to a list of exact coordinates for hidden treasure. Doing it this way would allow you to place hidden items closer to teleports or other events that would normally prevent you from turning off the 'flag' switch after stepping off the main square.
Although, there would be a lot more variable use in that method, so yours is definitely much better for a newer user to do.
Very informative tutorial, however.
Although, there would be a lot more variable use in that method, so yours is definitely much better for a newer user to do.
Very informative tutorial, however.
Pages:
1















