How do I make an event happen when the player presses a key at a certain X and Y on a map?

From OHRRPGCE-Wiki
Jump to: navigation, search

It's actually pretty simple. Just set a script like this to the on-keypress script on the map on which you want this behaviour. Remember to number your script (don't use autonumber) so that it shows up in custom.

script,keypressfun,begin
if (key is pressed (key:some key))  #change this, check scancode.hsi for available codes
then(
 if (hero X (me)==12) #Put whatever the X position is where 12 is.
  then (
  if (hero y (me)==40) #Put the Y position where 40 is.
   then (
   #Put here what you want it to do
   )
  )
 )
end

So during the game, the keypress script activates every time you press a key. So if you press the key you want, it i'll check your position on the map, and if all is gewd, your stuff happens. You can include multiple keypresses in the keypress script.

See Also[edit]