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

Jump to navigation Jump to 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.

if (key is pressed (key:some key))  #change this, check scancode.hsi for available codes
 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

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]