Advertisement
Guest User

Untitled

a guest
May 6th, 2012
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.01 KB | None | 0 0
  1. ----------------------------------------------------
  2. --Super Ghouls n' Ghosts Hitbox Display Lua Script--
  3. ----------------------------------------------------
  4.  
  5.  
  6. ---Blue = Arthur's Hitbox
  7. ---Red = Touch damage, if red touches arthur's blue hitbox he is damaged.
  8. ---Green = Projectile vulnerability for enemies
  9. ---White = Arthurs magic and weapons
  10.  
  11. local left_edge = 0x7e15DD
  12. local top_edge = 0x7E15E1
  13.  
  14. function findbit(p)
  15.     return 2 ^ (p - 1)
  16. end
  17.  
  18. function hasbit(x, p)
  19.     return x % (p + p) >= p
  20. end
  21.  
  22. local function draw_axis(x,y)
  23.     gui.line(x,y-2,x,y+2,0xFFFFFF80)
  24.     gui.line(x-2,y,x+2,y,0xFFFFFF80)
  25. end
  26.  
  27. local function draw_arthur()
  28.     local arthur = 0x043C
  29.     local pointoff = bit.lshift(bit.lshift(bit.band(memory.readbyte(arthur + 0x09),0x01),1),1)
  30.     local yrad = memory.readbyte(0xB963 + pointoff)
  31.     local xrad = memory.readbyte(0xB963 + pointoff + 1)
  32.     local yoff = memory.readbytesigned(0xB965 + pointoff)
  33.     local xoff = memory.readbytesigned(0xB965 + pointoff + 1)
  34.     local x = memory.readword(arthur + 0x1F)
  35.     local y = memory.readword(arthur + 0x22)
  36.    
  37.     x = x - memory.readword(left_edge)
  38.     y = y - memory.readword(top_edge)
  39.     gui.box((x+xoff) - (xrad), (y+yoff) - (yrad), (x+xoff) + (xrad), (y+yoff) + (yrad),0x0000FF30,0x0000FFF0)
  40.     --Comment out next line to hide arthur's hitbox center axis
  41.     draw_axis(x,y)
  42. end
  43.  
  44. local function draw_projvuln(x,y,xrad,yrad,base)
  45.         gui.box(x - (xrad), y - (yrad), x + (xrad), y + (yrad),0x2AFF0040,0x2AFF00F0)
  46. end
  47.  
  48.  
  49.  
  50. local function draw_enemies()
  51.  
  52.     local ostart = 0x090F
  53.     local oend = 30
  54.     local base = 0
  55.     local pointoff = 0
  56.     local xrad = 0
  57.     local yrad = 0
  58.     local x = 0
  59.     local y = 0
  60.        
  61.     for i = 0,oend,1 do
  62.    
  63.         if i ~= 0 then
  64.             base = ostart + (0x41 * i)
  65.         else
  66.             base = ostart
  67.         end
  68.        
  69.        
  70.         if hasbit(memory.readbyte(base + 0x09),findbit(7)) == true then
  71.            
  72.             if memory.readbyte(base+1) ~= 0 and memory.readbyte(base) ~= 0 then
  73.            
  74.                 pointoff = bit.lshift(bit.band(memory.readbyte(base + 0x06),0x00FF),1)
  75.                 xrad = memory.readbyte(0xD6E1 + pointoff)
  76.                 yrad = memory.readbyte(0xD6E2 + pointoff)
  77.                 x = memory.readword(base + 0x1F)
  78.                 y = memory.readword(base + 0x22)
  79.                
  80.                 life = memory.readbyte(base + 0x0E)
  81.                
  82.                 x = x - memory.readword(left_edge)
  83.                 y = y - memory.readword(top_edge)
  84.                
  85.                 --Red boxes
  86.                 gui.box(x - (xrad), y - (yrad), x + (xrad), y + (yrad),0xFF000070,0xFF0000FF)
  87.                 xrad = memory.readbyte(0xD85D + pointoff)
  88.                 yrad = memory.readbyte(0xD85E + pointoff)
  89.                
  90.                 --Comment/Uncomment out next line to hide/show drawing the projectile vulnerability boxes
  91.                
  92.                 draw_projvuln(x,y,xrad,yrad,base)
  93.                
  94.                 if life > 0 then
  95.                 --Comment out next line to hide HP display over objects
  96.                   gui.text(x, y-10, life)
  97.                 end
  98.                
  99.                 --Comment out next line to hide box center axis
  100.                 draw_axis(x,y)
  101.                
  102.             end
  103.         end
  104.        
  105.     end
  106. end
  107.  
  108. local function draw_weapons()
  109.  
  110.     local ostart = 0x047D
  111.     local oend = 9
  112.     local base = 0
  113.     local weapon = 0x14D3
  114.     local dmg = 0
  115.     local pointoff = 0
  116.     local wep_xrad = 0
  117.     local wep_yrad = 0
  118.     local mag_xrad = 0
  119.     local mag_yrad = 0
  120.     local x = 0
  121.     local y = 0
  122.    
  123.     pointoff = bit.lshift(memory.readbyte(weapon),1)
  124.     wep_xrad = memory.readbyte(0xb98b + pointoff)
  125.     wep_yrad = memory.readbyte(0xb98c + pointoff)
  126.     mag_xrad = memory.readbyte(0xb9ab + pointoff)
  127.     mag_yrad = memory.readbyte(0xb9ac + pointoff)
  128.        
  129.     for i = 0,oend,1 do
  130.    
  131.    
  132.         if i ~= 0 then
  133.             base = ostart + (0x41 * i)
  134.         else
  135.             base = ostart
  136.         end
  137.        
  138.         if memory.readbyte(base+1) ~= 0 and memory.readbyte(base) ~= 0 then
  139.             x = memory.readword(base + 0x1F)
  140.             y = memory.readword(base + 0x22)
  141.        
  142.             dmg = memory.readbyte(base + 0x0E)
  143.            
  144.             x = x - memory.readword(left_edge)
  145.             y = y - memory.readword(top_edge)
  146.             gui.box(x - (wep_xrad), y - (wep_yrad), x + (wep_xrad), y + (wep_yrad),0xFFFFFF40,0xFFFFFFFF)
  147.            
  148.             if dmg > 0 then
  149.             --Comment out next line to hide weapon DMG display over objects
  150.                 gui.text(x, y-10, dmg)
  151.             end
  152.             --Comment out next line to hide box center axis
  153.             --draw_axis(x,y)
  154.  
  155.         end
  156.     end
  157.    
  158.     -- If we have the gold armor and not the magic bracelet, check for magic hitboxes
  159.     if memory.readbyte(0x7E14BA) == 0x04 and memory.readbyte(weapon) ~= 0x0E then
  160.        
  161.         ostart = 0x0707
  162.        
  163.         for i = 0,oend-2,1 do
  164.        
  165.             if i ~= 0 then
  166.                 base = ostart + (0x41 * i)
  167.             else
  168.                 base = ostart
  169.             end
  170.            
  171.             if memory.readbyte(base+1) ~= 0 and memory.readbyte(base) ~= 0 then
  172.                 x = memory.readword(base + 0x1F)
  173.                 y = memory.readword(base + 0x22)
  174.        
  175.                 dmg = memory.readbyte(base + 0x0E)
  176.            
  177.                 x = x - memory.readword(left_edge)
  178.                 y = y - memory.readword(top_edge)
  179.                 gui.box(x - (mag_xrad), y - (mag_yrad), x + (mag_xrad), y + (mag_yrad),0xFFFFFF40,0xFFFFFFFF)
  180.  
  181.                 if dmg > 0 then
  182.                 --Comment out next line to hide magic DMG display over objects
  183.                     gui.text(x, y-10, dmg)
  184.                 end
  185.                 --Comment out next line to hide box center axis
  186.                 --draw_axis(x,y)
  187.             end
  188.  
  189.         end
  190.     end
  191.  
  192. end
  193.  
  194. gui.register(function()
  195.     draw_arthur()
  196.     draw_enemies()
  197.     draw_weapons()
  198. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement