Advertisement
Robert_Ordis

Castlevania Aria of Sorrow Luascript By Robert Ordis

Nov 4th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.51 KB | None | 0 0
  1. --[[
  2. キャッスルヴァニア 暁月の円舞曲 米版
  3. 当たり判定表示luaスクリプト。
  4.  
  5. Visual Boy Advance re-recording 23.5にて動きます。
  6.  
  7. カメラ座標を元にしたグリッド、
  8. 自機のHPとMP、
  9. 自機のスピード、
  10. 敵機の残りHP、
  11. 自機及び敵機の当たり判定、
  12. 敵機のマップ上の絶対座標
  13.  
  14. を表示するスクリプトです。
  15.  
  16. ・現行の問題点
  17. 死神の鎌の柄の部分が触れても問題ないのに攻撃判定が表示されている問題。
  18. 自機ユリウスの判定表示には対応していない。
  19.  
  20. --------
  21. Castlevania Aria of Sorrow (U)
  22. Lua script for showing hitbox.
  23.  
  24. This script is tested on Visual Boy Advance re-recording v23.5
  25.  
  26. This script shows
  27.  
  28. Grid from Camera's position,
  29. HP and MP of Player,
  30. Speed of Player,
  31. HP of enemies,
  32. Hitbox for attacking and taking damage of Player and enemies,
  33. and absolute position of enemies on map.
  34.  
  35. Now problems are these.
  36. -For grip of Death's sickle, it doesn't any hitbox for attacking,
  37. but this script shows it.
  38. -This script is not compatible with Julius Belmont as Player character.
  39.  
  40. ]]--
  41.  
  42.  
  43. while (true) do
  44.     --if(movie.active()==true) then
  45.         currentHP=memory.readword(0x0201327A)
  46.         MaxHP=memory.readword(0x0201327E)
  47.         currentMP=memory.readword(0x0201327C)
  48.         MaxMP=memory.readword(0x02013280)
  49.         -- --0x40以上がLeft
  50.  
  51.         myspeedx=(memory.readdwordsigned(0x0200052C))/65536
  52.         myspeedy=(memory.readdwordsigned(0x02000530))/65536
  53.        
  54.         gridcolor="#FF00FF88"
  55.         gridsubcolor="#FF00FF33"
  56.         camerax=memory.readwordsigned(0x0200A09A)  
  57.         cameray=memory.readwordsigned(0x0200A09E)
  58.         gridx=camerax%16
  59.         gridy=cameray%16
  60.         for line=0,255,16 do
  61.             gui.line(0,line-gridy,255,line-gridy,gridcolor)
  62.             gui.line(line-gridx,0,line-gridx,255,gridcolor)
  63.             gui.line(0,line-gridy+8,255,line-gridy+8,gridsubcolor)
  64.             gui.line(line-gridx+8,0,line-gridx+8,255,gridsubcolor)
  65.             gui.text(line-gridx,153,string.format("%d",camerax-gridx+line),"#00000044","#ffffff44")
  66.             gui.text(0,line-gridy-3,string.format("%d",cameray-gridy+line),"#00000044","#ffffff44")
  67.            
  68.         end
  69.  
  70.         j=0
  71.         k=0
  72.         for i=1,200,1 do
  73.  
  74.             eneheader=0x020004E4+(i*0x00000084)
  75.             Hitboxheader=0x03001A58+(i*0x00000008)
  76.             ObjectStatus=eneheader+0x72
  77.             isJulius1=memory.readdword(eneheader)
  78.             isJulius2=memory.readdword(eneheader+0x04)
  79.             enedispx=memory.readwordsigned(0x02000526+(i*0x00000084))
  80.             enedispy=memory.readwordsigned(0x0200052A+(i*0x00000084))
  81.  
  82.             RightLeft=memory.readbyte(eneheader+0x58)
  83.    
  84.             if(RightLeft<40) then
  85.                 TouchingHitboxXOnset=enedispx+memory.readbytesigned(Hitboxheader+0x00)+1
  86.                 TouchingHitboxYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x01)
  87.                 TouchingHitboxXOffset=TouchingHitboxXOnset+memory.readbyte(Hitboxheader+0x02)-3
  88.                 TouchingHitboxYOffset=TouchingHitboxYOnset+memory.readbyte(Hitboxheader+0x03)
  89.    
  90.                 TouchedHitboxXOnset=enedispx+memory.readbytesigned(Hitboxheader+0x04)-1
  91.                 TouchedHitboxYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x05)
  92.                 TouchedHitboxXOffset=TouchedHitboxXOnset+memory.readbyte(Hitboxheader+0x06)+1
  93.                 TouchedHitboxYOffset=TouchedHitboxYOnset+memory.readbyte(Hitboxheader+0x07)
  94.  
  95.                 BodyAttackXOnset=enedispx+memory.readbytesigned(Hitboxheader+0x04)+1
  96.                 BodyAttackYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x05)
  97.                 BodyAttackXOffset=BodyAttackXOnset+memory.readbyte(Hitboxheader+0x06)-3
  98.                 BodyAttackYOffset=BodyAttackYOnset+memory.readbyte(Hitboxheader+0x07)
  99.  
  100.             else
  101.                 TouchingHitboxXOnset=enedispx-memory.readbytesigned(Hitboxheader+0x00)-1
  102.                 TouchingHitboxYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x01)
  103.                 TouchingHitboxXOffset=TouchingHitboxXOnset-memory.readbyte(Hitboxheader+0x02)+3
  104.                 TouchingHitboxYOffset=TouchingHitboxYOnset+memory.readbyte(Hitboxheader+0x03)
  105.    
  106.                 TouchedHitboxXOnset=enedispx-memory.readbytesigned(Hitboxheader+0x04)+1
  107.                 TouchedHitboxYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x05)
  108.                 TouchedHitboxXOffset=TouchedHitboxXOnset-memory.readbyte(Hitboxheader+0x06)-1
  109.                 TouchedHitboxYOffset=TouchedHitboxYOnset+memory.readbyte(Hitboxheader+0x07)
  110.  
  111.                 BodyAttackXOnset=enedispx-memory.readbytesigned(Hitboxheader+0x04)-1
  112.                 BodyAttackYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x05)
  113.                 BodyAttackXOffset=BodyAttackXOnset-memory.readbyte(Hitboxheader+0x06)+3
  114.                 BodyAttackYOffset=BodyAttackYOnset+memory.readbyte(Hitboxheader+0x07)
  115.  
  116.             end
  117.  
  118.             gui.line(enedispx-8,enedispy,enedispx+7,enedispy,"#00000088")
  119.             gui.line(enedispx,enedispy-8,enedispx,enedispy+7,"#00000088")
  120.             if(bit.band(memory.readbyte(ObjectStatus),0x00000001)==1) then
  121.                 if(bit.band(memory.readbyte(ObjectStatus),0x00000002)==0) then
  122.                     gui.box(TouchingHitboxXOnset,TouchingHitboxYOnset+1,TouchingHitboxXOffset,TouchingHitboxYOffset-1,"#00FF0033","#00ff00ff")
  123.                 end
  124.                 if(bit.band(memory.readbyte(ObjectStatus),0x00000004)==0) then
  125.                     gui.box(TouchedHitboxXOnset,TouchedHitboxYOnset,TouchedHitboxXOffset,TouchedHitboxYOffset,"#ff000033","#ff0000ff")
  126.                 end
  127.                 if(bit.band(memory.readbyte(ObjectStatus),0x00000006)==0) then
  128.                     if(memory.readbyte(eneheader+0x20)==0x01) then
  129.                     else
  130.                         gui.box(BodyAttackXOnset,BodyAttackYOnset+1,BodyAttackXOffset,BodyAttackYOffset-1,"#00ff0033","#00ff00ff")
  131.                     end
  132.                 end
  133.             end
  134.             --gui.text(enedispx,enedispy,RightLeft)
  135.  
  136.             enehp=memory.readwordsigned(0x02000518+(i*0x00000084))
  137.             --eneinvc=memory.readbyte(0x02000024+(i*0x00000084)
  138.            
  139.             Status=memory.readbyte(ObjectStatus)
  140.             --gui.box(enedispx-8,enedispy-8,enedispx+7,enedispy+7,0xffff0088)
  141.             if(bit.band(Status,0x00000003)~=0x00000003 and Status ~= 0) then
  142.                 --gui.text(enedispx,enedispy,string.format("0x%02x,%02d\n0x%08x,0x%08x",i,Status,0x020004E4+(i*0x00000084),Hitboxheader))
  143.             end
  144.             if( enehp>0 ) then
  145.                 if( j>16 ) then
  146.                     k=k+1
  147.                 end
  148.                 camerax=memory.readwordsigned(0x0200A09A)
  149.                 cameray=memory.readwordsigned(0x0200A09E)
  150.                 gui.text(16+k*48,16+j*8,string.format("No.%02x,%4d,(%3d,%3d),0x%08x",i,enehp,camerax+enedispx,cameray+enedispy,eneheader),"#ffffff80","#00000080")
  151.                 gui.text(enedispx-8,enedispy,string.format("No,%02x",i),"#ffffff88","#00000088")
  152.                 --gui.text(enedispx,enedispy,string.format("%4d,0x%08x",enehp,eneheader),0x00ffffff))
  153.                 j=j+1
  154.             end
  155.        
  156.            
  157.         end
  158.    
  159.         i=0
  160.             eneheader=0x020004E4+(i*0x00000084)
  161.             Hitboxheader=0x03001A58+(i*0x00000008)
  162.             ObjectStatus=eneheader+0x00000072
  163.             enedispx=memory.readwordsigned(0x02000526+(i*0x00000084))
  164.             enedispy=memory.readwordsigned(0x0200052A+(i*0x00000084))
  165.  
  166.             Mydispx=enedispx
  167.             Mydispy=enedispy
  168.  
  169.             RightLeft=memory.readbyte(eneheader+0x58)
  170.    
  171.             if(RightLeft<40) then
  172.                 TouchingHitboxXOnset=enedispx+memory.readbytesigned(Hitboxheader+0x00)+1
  173.                 TouchingHitboxYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x01)
  174.                 TouchingHitboxXOffset=TouchingHitboxXOnset+memory.readbyte(Hitboxheader+0x02)-2
  175.                 TouchingHitboxYOffset=TouchingHitboxYOnset+memory.readbyte(Hitboxheader+0x03)
  176.    
  177.                 TouchedHitboxXOnset=enedispx+memory.readbytesigned(Hitboxheader+0x04)-1
  178.                 TouchedHitboxYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x05)
  179.                 TouchedHitboxXOffset=TouchedHitboxXOnset+memory.readbyte(Hitboxheader+0x06)+1
  180.                 TouchedHitboxYOffset=TouchedHitboxYOnset+memory.readbyte(Hitboxheader+0x07)
  181.             else
  182.                 TouchingHitboxXOnset=enedispx-memory.readbytesigned(Hitboxheader+0x00)-1
  183.                 TouchingHitboxYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x01)
  184.                 TouchingHitboxXOffset=TouchingHitboxXOnset-memory.readbyte(Hitboxheader+0x02)+2
  185.                 TouchingHitboxYOffset=TouchingHitboxYOnset+memory.readbyte(Hitboxheader+0x03)  
  186.    
  187.                 TouchedHitboxXOnset=enedispx-memory.readbytesigned(Hitboxheader+0x04)+1
  188.                 TouchedHitboxYOnset=enedispy+memory.readbytesigned(Hitboxheader+0x05)
  189.                 TouchedHitboxXOffset=TouchedHitboxXOnset-memory.readbyte(Hitboxheader+0x06)-1
  190.                 TouchedHitboxYOffset=TouchedHitboxYOnset+memory.readbyte(Hitboxheader+0x07)
  191.             end
  192.             if(bit.band(memory.readbyte(ObjectStatus),0x00000002)==0) then
  193.                 gui.box(TouchingHitboxXOnset,TouchingHitboxYOnset+1,TouchingHitboxXOffset,TouchingHitboxYOffset-1,"#00ff0044","#00ff00ff")
  194.             end
  195.  
  196.  
  197.         Myright=Mydispx+8
  198.         Myleft=Mydispx-7
  199.         Mydown=Mydispy
  200.         --Myup=memory.readwordsigned(0x03001A52)
  201.         Myup=Mydispy-32
  202.  
  203.         gui.line(Mydispx-8,Mydispy,Mydispx+7,Mydispy,"#00000088")
  204.         gui.line(Mydispx,Mydispy-8,Mydispx,Mydispy+7,"#00000088")
  205.  
  206.         MydispX1=memory.readwordsigned(0x03001A50)
  207.         MydispX2=memory.readwordsigned(0x03001A54)
  208.         MydispY1=memory.readwordsigned(0x03001A52)
  209.         MydispY2=memory.readwordsigned(0x03001A56)
  210.         if(bit.band(memory.readbyte(ObjectStatus),0x00000001)==1) then
  211.             if(bit.band(memory.readbyte(ObjectStatus),0x00000002)==0) then
  212.                 gui.box(TouchingHitboxXOnset,TouchingHitboxYOnset+1,TouchingHitboxXOffset,TouchingHitboxYOffset-1,"#00ff0044","#00ff00ff")
  213.             end
  214.             if(bit.band(memory.readbyte(ObjectStatus),0x00000004)==0) then
  215.                 gui.box(MydispX1-1,MydispY1,MydispX2+1,MydispY2+1,"#ff000044","#ff0000ff")
  216.  
  217.             end
  218.         end
  219.  
  220.  
  221.         gui.box(Myright,Myup+1,Myleft,Mydown,"#00000000","#ffff00f88")
  222.  
  223.         gui.text(8,0,"X Speed:" .. myspeedx)
  224.         gui.text(8,8,"Y Speed:" .. myspeedy)
  225.    
  226.         gui.text(110,0,"HP : " .. currentHP .. "/" .. MaxHP)
  227.         gui.text(110,8,"MP : " .. currentMP .. "/" .. MaxMP)
  228.  
  229.  
  230.    
  231.        
  232.    
  233.         if (vba.lagged()==true) then
  234.             gui.text(5,125,"Frames:" .. vba.framecount() .. ":*" .. vba.lagcount(),0xff0000ff)
  235.         else
  236.             gui.text(5,125,"Frames:" .. vba.framecount() .. ":" .. vba.lagcount())
  237.         end
  238.     --else
  239.         --gui.fillbox(0,0,500,500,0x00000088)
  240.         --gui.text(50,50,"Movie is NOT ACTIVE!!")
  241.     --end
  242.     vba.frameadvance()
  243. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement