Advertisement
Kirkq

DQ3 Script 2

Feb 29th, 2016
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.79 KB | None | 0 0
  1. local HackEncountersAway = false
  2.  
  3. LandArray = {[0]=0x1F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
  4. 0x1F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x2C, 0x2C, 0x2C, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
  5. 0x1F, 0x1F, 0x09, 0x09, 0x09, 0x0A, 0x2E, 0x2D, 0x2C, 0x2C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
  6. 0x1F, 0x09, 0x09, 0x08, 0x09, 0x2E, 0x2E, 0x2C, 0x2C, 0x2C, 0x23, 0x24, 0x23, 0x23, 0x23, 0x23,
  7. 0x1F, 0x09, 0x08, 0x08, 0x08, 0x0C, 0x2D, 0x2C, 0x2C, 0x18, 0x24, 0x24, 0x24, 0x21, 0x20, 0x20,
  8. 0x0F, 0x0F, 0x0F, 0x08, 0x0C, 0x0C, 0x10, 0x2D, 0x2D, 0x18, 0x18, 0x24, 0x24, 0x21, 0x21, 0x20,
  9. 0x0F, 0x0F, 0x0E, 0x0F, 0x0C, 0x0C, 0x10, 0x15, 0x16, 0x17, 0x18, 0x18, 0x24, 0x21, 0x21, 0x20,
  10. 0x1A, 0x0E, 0x0D, 0x0D, 0x0C, 0x0C, 0x11, 0x15, 0x16, 0x17, 0x17, 0x20, 0x20, 0x20, 0x20, 0x20,
  11. 0x1A, 0x0E, 0x0E, 0x0D, 0x0D, 0x11, 0x11, 0x14, 0x14, 0x16, 0x17, 0x27, 0x27, 0x27, 0x2A, 0x2A,
  12. 0x1A, 0x1A, 0x1A, 0x0D, 0x30, 0x12, 0x12, 0x13, 0x13, 0x1C, 0x1C, 0x1C, 0x29, 0x2B, 0x2A, 0x27,
  13. 0x1A, 0x1A, 0x1A, 0x31, 0x30, 0x12, 0x13, 0x13, 0x13, 0x13, 0x27, 0x27, 0x27, 0x2B, 0x27, 0x27,
  14. 0x1B, 0x1B, 0x1B, 0x30, 0x30, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x29, 0x27, 0x27,
  15. 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1D, 0x1D, 0x1D, 0x05, 0x05, 0x06, 0x07, 0x07, 0x27, 0x27, 0x27,
  16. 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x2F, 0x1D, 0x05, 0x05, 0x04, 0x07, 0x05, 0x29, 0x27, 0x27,
  17. 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1D, 0x1D, 0x1D, 0x05, 0x05, 0x04, 0x05, 0x29, 0x29, 0x29, 0x29,
  18. 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x29, 0x29, 0x29, 0x29}
  19.  
  20. WaterArray = {[0]=0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  21. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  22. 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  23. 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x00, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
  24. 0x00, 0x00, 0x01, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x03, 0x03, 0x00, 0x01, 0x01, 0x00, 0x00,
  25. 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00,
  26. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
  27. 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  28. 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  29. 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  30. 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  31. 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  32. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
  33. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  34. 0x00, 0x03, 0x03, 0x03, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,
  35. 0x00, 0x03, 0x03, 0x03, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00}
  36.  
  37. local ThisEncounterCounter = 0
  38. local LastEncounterCounter = 0
  39. local EncounterDepletion = 0
  40. local X
  41. local Y
  42. local XMod
  43. local YMod
  44. local Zone
  45. local TravelMethod
  46.  
  47. if (HackEncountersAway) then
  48. memory.write_u16_le(0xF796, 64000)
  49. end
  50.  
  51. while true do
  52.  
  53. ThisEncounterCounter = memory.read_u16_le(0xF796)
  54.  
  55. if (HackEncountersAway) then
  56. if(ThisEncounterCounter < 2000) then
  57. memory.write_u16_le(0xF796, 64000)
  58. end
  59. end
  60.  
  61. if(LastEncounterCounter ~= ThisEncounterCounter) then
  62. EncounterDepletion = LastEncounterCounter - ThisEncounterCounter
  63. end
  64.  
  65. gui.text(0,0,"Encounter Counter: " .. memory.read_u16_le(0xF796))
  66. if(EncounterDepletion > 0) then
  67. gui.text(0,45,"Depletion: " .. EncounterDepletion)
  68. end
  69.  
  70. gui.text(0,75,"RNGA: " .. memory.read_u16_le(0x7F7A))
  71. gui.text(0,90,"RNGB: " .. memory.read_u16_le(0x7F7C))
  72.  
  73. gui.text(0,75,"RNGA: " .. memory.read_u16_le(0x7F7A))
  74. gui.text(0,90,"RNGB: " .. memory.read_u16_le(0x7F7C))
  75.  
  76. X = memory.read_u16_le(0x01E36C)
  77. Y = memory.read_u16_le(0x01E376)
  78. -- Also 01E36C
  79. -- Also 01E36E
  80. -- Also 01E370
  81. -- Also 01E374
  82. -- Also 01E376
  83. -- Also 01E378
  84. -- Also 01E37A
  85. -- Also 01E37E
  86.  
  87. TravelMethod = memory.read_u16_le(0xDB04) --Also 0xDB02
  88.  
  89. --Fair Warning this is kind of hackish
  90. XMod = math.floor((X - 2048 + 128) / 256)
  91. YMod = math.floor((Y - 2048 + 128 - 16) / 256)
  92. if(X > 6032) then
  93. XMod = 0
  94. end
  95. if(Y > 6032) then
  96. YMod = 0
  97. end
  98. if(XMod > 15) then
  99. XMod = 15
  100. end
  101. if(YMod > 15) then
  102. YMod = 15
  103. end
  104.  
  105. Zone = XMod + (YMod * 16)
  106. LandZoneValue = LandArray[Zone]
  107. WaterZoneValue = WaterArray[Zone]
  108.  
  109. gui.text(0,150,"XTile: " .. math.floor(X/16))
  110. gui.text(0,165,"YTile: " .. math.floor(Y/16))
  111. gui.text(0,180,"XZone: " .. XMod)
  112. gui.text(0,195,"YZone: " .. YMod)
  113. gui.text(0,210,"LandZone: " .. string.upper(string.format("%2x", LandZoneValue)))
  114. gui.text(0,225,"WaterZone: " .. string.upper(string.format("%2x", WaterZoneValue)))
  115.  
  116. if(LandZoneValue == 0x1B or LandZoneValue == 0x1C) then
  117. gui.text(0,240,"Land Encounters Doubled")
  118. end
  119. if(LandZoneValue == 0x2C or LandZoneValue == 0x2E) then
  120. gui.text(0,240,"Land Encounters Halved")
  121. end
  122. if(LandZoneValue == 0x29) then
  123. gui.text(0,240,"Land Encounters Zero")
  124. end
  125. if(WaterZoneValue == 0x02 or WaterZoneValue == 0x03) then
  126. gui.text(0,255,"Water Encounters Doubled")
  127. end
  128. if(TravelMethod == 512) then
  129. gui.text(0,270,"In Water")
  130. elseif(TravelMethod == 2048) then
  131. gui.text(0,270,"Lamia")
  132. else
  133. gui.text(0,270,"On Land")
  134. end
  135.  
  136. LastEncounterCounter = ThisEncounterCounter
  137.  
  138. emu.frameadvance()
  139. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement