Advertisement
Guest User

Untitled

a guest
Aug 28th, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.99 KB | None | 0 0
  1. -- Player
  2. local pbase = 0xFF1CD4
  3. local px = pbase + 0x19
  4. local py = pbase + 0x1D
  5.  
  6. local camx = 0xFF1BC5
  7. local camy = 0xFF1BC9
  8.  
  9. --Player projectiles
  10.  
  11. local projbase = 0xFF1D34
  12.  
  13. --Enemies
  14. local ebase = 0xFF21B4
  15.  
  16. --Bosses
  17. local bbase = 0xFF35F4
  18.  
  19.  
  20.  
  21.  
  22. local function endian(address)
  23.     local result = memory.readbyte(address) + (memory.readbyte(address-1) * 256)
  24.     return result
  25. end
  26.  
  27. local function Toki()
  28.     local cx = endian(camx)
  29.     local cy = endian(camy)
  30.     local x = endian(px) - cx
  31.     local y = endian(py) - cy
  32.     local xoff = memory.readbytesigned(pbase + 0x11)
  33.     local yoff = memory.readbytesigned(pbase + 0x15)
  34.     local xrad = memory.readbyte(pbase +0x13)
  35.     local yrad = memory.readbyte(pbase +0x17)
  36.     local flip = memory.readbyte(pbase +1)
  37.     if flip == 1 then
  38.         xoff = xoff * -1
  39.     end
  40.     gui.box(x+xoff-xrad,y+yoff-yrad,x+xoff+xrad,y+yoff+yrad,"#0000FF30","#0000FFFF")
  41. end
  42.  
  43. local function enemies()
  44.     local cx = endian(camx)
  45.     local cy = endian(camy)
  46.     local x
  47.     local y
  48.     local xoff
  49.     local xrad
  50.     local yoff
  51.     local yrad
  52.     local oend = 44
  53.     local base = ebase 
  54.     local flip
  55.     local hp
  56.     for i = 0,oend,1 do
  57.         if i > 0 then
  58.             base = ebase + (i * 0x60)
  59.         end
  60.         flip = memory.readbyte(base +1)
  61.         if memory.readbyte(base) > 0 then
  62.             hp = memory.readbyte(base + 0xD)
  63.             x = endian(base + 0x19) - cx
  64.             xrad = memory.readbyte(base + 0x13)
  65.             xoff = memory.readbytesigned(base + 0x11)
  66.             yrad = memory.readbyte(base + 0x17)
  67.             yoff = memory.readbytesigned(base + 0x15)
  68.            
  69.             if flip == 1 then
  70.                 xoff = xoff * -1
  71.             end
  72.             y = endian(base + 0x1D) - cy
  73.             if hp > 0 then
  74.                 gui.text(x,y-10, "HP: " .. hp)
  75.             end
  76.             gui.box(x+xoff-xrad,y+yoff-yrad,x+xoff+xrad,y+yoff+yrad,"#FF000035","#FF0000FF")
  77.         end
  78.     end
  79. end
  80.  
  81. local function boss()
  82.     local cx = endian(camx)
  83.     local cy = endian(camy)
  84.     local x = endian(bbase + 0x19) - cx
  85.     local y = endian(bbase + 0x1D) - cy
  86.     local xrad = memory.readbyte(bbase + 0x11)
  87.     local yrad = memory.readbyte(bbase + 0x15)
  88.     local hp = memory.readbyte(bbase+ 0x0D)
  89.    
  90.     if hp > 0 then
  91.         gui.text(x-10,y-10,"HP: " .. memory.readbyte(bbase + 0x0D))
  92.     end
  93.     gui.box(x-xrad,y-yrad,x+xrad,y+yrad,"#FF000035","#FF0000FF")
  94. end
  95.  
  96. local function projectiles()
  97.     local cx = endian(camx)
  98.     local cy = endian(camy)
  99.     local x
  100.     local y
  101.     local xoff
  102.     local xrad
  103.     local yoff
  104.     local yrad
  105.     local oend = 11
  106.     local base = projbase
  107.     local flip
  108.    
  109.     for i = 0,oend,1 do
  110.         if i > 0 then
  111.             base = projbase + (i * 0x60)
  112.         end
  113.         flip = memory.readbyte(base +1)
  114.        
  115.         if memory.readbyte(base) > 0 then
  116.             x = endian(base + 0x19) - cx
  117.             y = endian(base + 0x1D) - cy
  118.             xoff = memory.readbytesigned(base + 0x11)
  119.             yoff = memory.readbytesigned(base + 0x15)
  120.             xrad = memory.readbyte(base + 0x13)
  121.             yrad = memory.readbyte(base + 0x17)
  122.            
  123.             if flip == 1 then
  124.                 xoff = xoff * -1
  125.             end
  126.             gui.box(x+xoff-xrad,y+yoff-yrad,x+xoff+xrad,y+yoff+yrad,"#FFFFFF40","#FFFFFFFF")
  127.         end
  128.     end
  129.  
  130. end
  131.  
  132.  
  133.  
  134. while true do
  135.     Toki()
  136.     enemies()
  137.     projectiles()
  138.     boss()
  139.     emu.frameadvance()
  140. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement