Advertisement
Kirkq

7th Saga Encounter Script

Feb 2nd, 2017
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. --Nitrodon's 7th Saga encounters script.
  2.  
  3. local xcoord
  4. local ycoord
  5. local region
  6. local encmap
  7. local encgroups
  8.  
  9. while true do
  10.     if memory.readbyte(0x7e0722) ~= 2 then
  11.         xcoord = math.floor((memory.readword(0x7e07a8) + memory.readword(0x7e0a91)+16)/32)
  12.         ycoord = math.floor((memory.readword(0x7e07b0) + memory.readword(0x7e0a94)+16)/32)
  13.         region = math.floor(xcoord/8) - 64*math.floor(xcoord/512) + 64*math.floor(ycoord/8) - 4096*math.floor(ycoord/512)
  14.         encmap = memory.readword(0x7e07a3) + 0x10000*memory.readbyte(0x7e07a5)
  15.         if memory.readbyte(0x7e0723) == 0 and AND(memory.readbyte(0x7e4e03), 0x04) ~= 0 then
  16.             encgroups=0xc05f6f
  17.         else
  18.             encgroups=0xc058df
  19.         end
  20.         gui.text(0,210,"Current location: (" .. xcoord .. ", " .. ycoord .. ")")
  21.         if memory.readbyte(0x7e0723) ~= 2 then
  22.             gui.text(0,200,"Encounter region: " .. memory.readbyte(encmap+region))
  23.         end
  24.     else
  25.         gui.text(0,190,"Enemy HP:")
  26.         if AND(memory.readword(0x7e1e9e),0xa000) == 0 then
  27.             gui.text(96,190,memory.readword(0x7e1e84))
  28.         end
  29.         if AND(memory.readword(0x7e1f1e),0xa000) == 0 then
  30.             gui.text(160,190,memory.readword(0x7e1f04))
  31.         end
  32.         if AND(memory.readword(0x7e1f9e),0xa000) == 0 then
  33.             gui.text(224,190,memory.readword(0x7e1f84))
  34.         end
  35.     end
  36.     snes9x.frameadvance();
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement