Advertisement
Kirkq

Quest GBC Mapper

Aug 23rd, 2019
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.31 KB | None | 0 0
  1. --TO DO
  2. --Experience point values.
  3.  
  4. local MaxMPAd = 0xC101
  5. local CurrMPAd = 0xC103
  6. local MaxHPAd = 0xC105
  7. local CurrHPAd = 0xC107 --not actual battle HP, that is CurrHP2Ad
  8. local AgilityAd = 0xC109 -- need to match highest enemy agility to go first
  9. -- 0-23 AG = 3 steps wide.
  10. -- 24-35 = 5 steps wide. (+11)
  11. --36-47 = 7 steps wide. (+11)
  12. --48-59 = 9 steps wide. (+11)
  13. --60-?? = 11 steps wide.
  14. local DefenseAd = 0xC10B
  15. local FireLevel = 0xC10E
  16. local WindLevel = 0xC10F
  17. local WaterLevel = 0xC110
  18. local EarthLevel = 0xC111
  19. --
  20. local NumberItems = 0xC112 --Game checks this when you pick up an item I think
  21. local FirstItemSlot = 0xC113
  22. local LastItemSlot = 0xC126 -- This may or may not be only indicative?
  23. local ItemArray = {"Spirit Light","Fresh Bread", "Honey Bread","Healing Potion", "Dragon's Potion","Dew Drop","Mint Leaves","Heroes Drink","Secret Potion","Silent Flute","Celine's Bell","Replica","Giant's Shoes","Silver Amulet","Golden Amulet"} --From ID 1 to 15
  24. --
  25. local MelrodeWings = 0xC127 -- 1 if have, 0 if do not have
  26. local DondoranWings = 0xC128
  27. local LarapoolWings = 0xC129
  28. local NormoonWings = 0xC12A
  29. local LimelinWings = 0xC12B
  30. local BrannochWings = 0xC12C
  31. --
  32. local HaveEarthOrb = 0xC12D -- 0 = do not have, 1 = have
  33. local HaveWindJade = 0xC12E
  34. local HaveWaterJewel = 0xC12F
  35. local HaveFireRuby= 0xC130
  36. local HaveEletaleBook = 0xC131
  37. local HaveDarkGaolKey = 0xC132
  38. local HaveWarriorBadge = 0xC133
  39. local HaveWarriorStaff = 0xC134
  40. local HaveWarriorCape = 0xC135
  41. local HaveOrchestra = 0xC136
  42. --
  43. local LotteryInProgress = 0xC137 --0 if no, 1 if waiting for pidgeon, 3 if something in mailbox.
  44. local SpiritGemstones = 0xC138
  45. local LotteryStepCounter = 0xC139 --255 steps on overworld until pidgeon comes. If the number is even upon entering the overworld, it will decrease by one
  46. --
  47. local HPPercentAd = 0xC13A --Increments on physical attacks and either staff swings or hits.
  48. local MPPercentAd = 0xC13B -- Increments per spell that connects per enemy
  49. local AgilityPercentAd = 0xC13C
  50. --Moving in battle increments this when not running away.
  51. --It goes up by 10 per step initially, then later 2 per step.
  52. --Moving diagonally = 20 per step initially
  53. --Will stop you at 0 on rollover with no carryover.
  54. local DefensePercentAd = 0xC13D --Increments 3% at a time, rolls over after 102 damage.
  55. local ElementPercentAd = 0xC13E --Enemies seem to have an experience point value.
  56. local ExperienceHigh = 0xC13F
  57. local ExperienceLow = 0xC140
  58. local BrianLevel = 0xC141
  59. local XPosHigh = 0xC144
  60. local XPosLow = 0xC145
  61. local YPosHigh = 0xC146
  62. local YPosLow = 0xC147
  63. --1 step = 8 frames, 1 grid square = 2 steps
  64. local LotteryItemGoingFor = 0xC455 --You cannot win an item type you already have.
  65. local LotteryArray = {"Mint Leaves","Healing Potion","Heroes Drink","Spirit Light","Dragon's Potion","Secret Potion","Warrior's Cape","Warrior's Staff","Warrior's Badge","Orchestra"} --starts at index 1
  66. local BrianInTransit = 0xC45B -- 0 to 7 in movement
  67. local BrianBattleY = 0xC45C
  68. local BrianBattleX = 0xC45D
  69. local InBattle = 0xC464 -- 4 in town/overworld/dungeon, 2 in random battle
  70.  
  71. local NumEnemies1 = 0xC588
  72. local NumEnemies2 = 0xC589
  73. local NumEnemies3 = 0xCB28 --Objects on screen in battle?
  74.  
  75. local BrianAttackEligible = 0xC59B
  76. local CurrHP2Ad = 0xC5F1 -- BattleHP
  77.  
  78. local EnemyState = {}
  79. local EnemyY = {}
  80. local EnemyX = {}
  81. local EnemyType = {}
  82. local EnemyMaxHPHigh = {}
  83. local EnemyMaxHPLow = {}
  84. local EnemyCurrHPHigh = {}
  85. local EnemyCurrHPLow = {}
  86. local EnemyAgility = {}
  87. local EnemyDefense = {}
  88. local EnemyAtk = {}
  89. local EnemyElement = {}
  90. local EnemyItemDrop = {}
  91. local EnemyExp = {}
  92. local EnemyExperienceValue = {}
  93.  
  94. EnemyState[1] = 0xC615 -- 0 = dead, 1 = alive sometimes, 2 = its turn
  95. EnemyY[1] = 0xC618
  96. EnemyX[1] = 0xC619
  97. EnemyType[1] = 0xC626 --Indicative but not modifiable?
  98. EnemyMaxHPHigh[1] = 0xC62C
  99. EnemyMaxHPLow[1] = 0xC62D
  100. EnemyCurrHPHigh[1] = 0xC62E
  101. EnemyCurrHPLow[1] = 0xC62F
  102. EnemyAgility[1] = 0xC631
  103. EnemyDefense[1] = 0xC633
  104. EnemyAtk[1] = 0xC635
  105. EnemyElement[1] = 0xC636 --I think this is right? 3 earth 2 water, 1 = wind, 0 = fire
  106. EnemyExp[1] = 0xC638
  107. EnemyItemDrop[1] = 0xC639
  108. --EnemyExperienceValue
  109.  
  110. EnemyState[2] = 0xC653 -- 0 = dead, 1 = alive, 2 = its turn
  111. EnemyY[2] = 0xC656 --top of sprite, mirrored in 0xCF67
  112. EnemyX[2] = 0xC657 --left of sprite
  113. EnemyType[2] = 0xC664
  114. EnemyMaxHPHigh[2] = 0xC66A
  115. EnemyMaxHPLow[2] = 0xC66B
  116. EnemyCurrHPHigh[2] = 0xC66C
  117. EnemyCurrHPLow[2] = 0xC66D
  118. EnemyAgility[2] = 0xC66F
  119. EnemyDefense[2] = 0xC671
  120. EnemyAtk[2] = 0xC673
  121. EnemyElement[2] = 0xC674
  122. EnemyExp[2] = 0xC676
  123. EnemyItemDrop[2] = 0xC677
  124.  
  125. EnemyState[3] = 0xC691
  126. EnemyY[3] = 0xC694
  127. EnemyX[3] = 0xC695
  128. EnemyType[3] = 0xC6A2
  129. EnemyMaxHPHigh[3] = 0xC6A8
  130. EnemyMaxHPLow[3] = 0xC6A9
  131. EnemyCurrHPHigh[3] = 0xC6AA
  132. EnemyCurrHPLow[3] = 0xC6AB
  133. EnemyAgility[3] = 0xC6AD
  134. EnemyDefense[3] = 0xC6AF
  135. EnemyAtk[3] = 0xC6B1
  136. EnemyElement[3] = 0xC6B2
  137. EnemyExp[3] = 0xC6B4
  138. EnemyItemDrop[3] = 0xC6B5
  139.  
  140.  
  141.  
  142.  
  143. local LotteryRNG = 0xD522 --You win the lottery on multiples of 8, not including 0.
  144. local DefCounterSubAd = 0xD56D --0 to 2, maybe more later?
  145. local ToNextLevelHigh = 0xD5E8
  146. local ToNextLevelLow = 0xD5E9
  147. local BrianInTransit2 = 0xD837
  148. local StepCounter = 0xD82F --refreshes to 28-43 upon entering a battle.
  149. --56-86
  150.  
  151.  
  152. local RNG1Ad = 0xD82C --This does battle type and attack damages seemingly. It is part of the time based step counter determination. Changes based on Y position
  153. local RNG2Ad = 0xD5CD --This represents the amount to be subtracted every 8th frame on the overworld
  154.  
  155. --ON THE OVERWORLD OUTSIDE OF BATTLE
  156. -- 7 out of 8 frames, the RNG1 will decrease by a constant amount from 1 to 255 determined by Y CAMERA position and whether or not you last moved up or down. Up is 19 more than down.
  157. --On the 8th frame as determined by RNG2, the RNG1 will decrease by the exact value referred to by the value of RNG2 --the emulator can override lua byte setting when this 8th frame occurs.
  158. --The 8th frame values subtracted are: An example is: Starting with rollover from 0 to 1: 225, 126, 173, 92, 69, 122, 1, 160, (THESE CHANGE BETWEEN AREAS)
  159. --Moving the camera in the y direction will add 30 if it does not occur on the 8th frame. Up = 30 at start of step, Down = 30 at end of step.
  160.  
  161. --INSIDE A DUNGEON OUTSIDE OF BATTLE
  162. --the RNG1 will decrease by a constant amount from 1 to 255 determined by Y CAMERA POSITION and whether or not you last moved up or down. Up is 19 more than down.
  163. --Moving the camera in the y direction will add 200 if it does not occur on the 8th frame. Up = 200 at start of step, Down = 200 at end of step.
  164.  
  165. --INSIDE A BATTLE:
  166. --Standing still, the decrement per frame is approximately 212 to 214 depending on the amount of enemies in the battle.
  167. --If you stand in the escape zone this decrement will go between another exact value dependent on position and exactly 212-214 as the ESC text flashes.
  168. --Moving around the arena produces specific increments.
  169. --When enemies move and attack, the RNG behavior is a bit unpredictable.
  170.  
  171. local TestByte1 = 0xC126 --198->218
  172. local TestByte2 = 0xCF8C -- 210-230
  173.  
  174. --Healing = 4 water, 3 earth
  175. --Magic Barrier = 12 earth, 12 fire, 12 wind
  176.  
  177. ThisFrameRNG1 = 0
  178. LastFrameRNG1 = 0
  179.  
  180. StepCountTemp = 0
  181. PrevX = 256*memory.readbyte(XPosHigh) + memory.readbyte(XPosLow)
  182. PrevY = 256*memory.readbyte(YPosHigh) + memory.readbyte(YPosLow)
  183. ThisX = 256*memory.readbyte(XPosHigh) + memory.readbyte(XPosLow)
  184. ThisY = 256*memory.readbyte(YPosHigh) + memory.readbyte(YPosLow)
  185. BattleX = memory.readbyte(BrianBattleX)
  186. BattleY = memory.readbyte(BrianBattleY)
  187.  
  188. ScreenshotCounter = 0
  189.  
  190. --------------------------------------------------------
  191.  
  192. require "gd"
  193.  
  194.  
  195. snes9xImage = nil;
  196. hugeImage = gd.create((1200), (1200));
  197.  
  198. snes9xImage = gd.createFromGdStr(gui.gdscreenshot());
  199. gd.copy(hugeImage, snes9xImage, 8 + ThisX - BattleX, 8 + ThisY - BattleY, 0, 0, snes9xImage:sizeX(), snes9xImage:sizeY());
  200. --gd.copy(hugeImage, snes9xImage, X, Y, 0, 0, snes9xImage:sizeX(), snes9xImage:sizeY());
  201. hugeImage:png("map.png");
  202.  
  203.  
  204. --------------------------------------------------------
  205.  
  206.  
  207.  
  208. while true do
  209.  
  210. if ScreenshotCounter == 100 then
  211. snes9xImage = gd.createFromGdStr(gui.gdscreenshot());
  212. gd.copy(hugeImage, snes9xImage, 8 + ThisX - BattleX, 16 + ThisY - BattleY, 0, 0, snes9xImage:sizeX(), snes9xImage:sizeY());
  213. --gd.copy(hugeImage, snes9xImage, X, Y, 0, 0, snes9xImage:sizeX(), snes9xImage:sizeY());
  214. hugeImage:png("map.png");
  215. ScreenshotCounter = 0
  216. end
  217.  
  218. ScreenshotCounter = ScreenshotCounter + 1
  219.  
  220. if true then
  221. ThisX = 256*memory.readbyte(XPosHigh) + memory.readbyte(XPosLow)
  222. ThisY = 256*memory.readbyte(YPosHigh) + memory.readbyte(YPosLow)
  223. if PrevX~=ThisX then
  224. StepCountTemp = StepCountTemp+1
  225. PrevX = ThisX
  226. end
  227. if PrevY~=ThisY then
  228. StepCountTemp = StepCountTemp+1
  229. PrevY = ThisY
  230. end
  231.  
  232. if false then
  233. gui.text(1,80, StepCountTemp/8)
  234. end
  235.  
  236. end
  237.  
  238.  
  239.  
  240. if false then
  241. for i = 1,3 do
  242. -- if the enemy is not dead, if you are in battle, and there are at least that many enemies
  243. if ((memory.readbyte(EnemyState[i]) ~= 0) and (memory.readbyte(InBattle) == 2) and (memory.readbyte(NumEnemies1) + 1) > i) then --This still may be bugged.
  244. --gui.text(memory.readbyte(EnemyX[i]) - 5, memory.readbyte(EnemyY[i]) - 19, "#" .. memory.readbyte(EnemyType[i]))
  245. gui.text(memory.readbyte(EnemyX[i]) - 5, memory.readbyte(EnemyY[i]) - 19, i)
  246. gui.text(memory.readbyte(EnemyX[i]) - 5, memory.readbyte(EnemyY[i]) - 10, memory.readbyte(EnemyCurrHPHigh[i])*256 + memory.readbyte(EnemyCurrHPLow[i]))
  247. gui.text(memory.readbyte(EnemyX[i]) - 5, memory.readbyte(EnemyY[i]) - 1, "A" .. memory.readbyte(EnemyAgility[i]))
  248. --gui.text(memory.readbyte(EnemyX[i]) - 5, memory.readbyte(EnemyY[i]) + 8, "D" .. memory.readbyte(EnemyDefense[i]))
  249. gui.text(memory.readbyte(EnemyX[i]) - 5, memory.readbyte(EnemyY[i]) + 8, "E" .. memory.readbyte(EnemyExp[i]))
  250. if (memory.readbyte(EnemyItemDrop[i]) ~=0) then
  251. gui.text(memory.readbyte(EnemyX[i]) - 5, memory.readbyte(EnemyY[i]) + 17, "I" .. memory.readbyte(EnemyItemDrop[i]))
  252. end
  253. end
  254. end
  255. end
  256.  
  257. --memory.writebyte(HaveEarthOrb,1)
  258. --memory.writebyte(SpiritGemstones, 10)
  259. --memory.writebyte(DefenseAd, 54)
  260. memory.writebyte(CurrHPAd,50)
  261. memory.writebyte(CurrHP2Ad,50)
  262. memory.writebyte(CurrMPAd,15)
  263. --memory.writebyte(MaxHPAd,50)
  264.  
  265. memory.writebyte(StepCounter,3)
  266. --memory.writebyte(RNG1Ad,240)
  267. memory.writebyte(AgilityAd,17)
  268. --memory.writebyte(RNG2Ad,0)
  269. --memory.writebyte(RNG2Ad,0)
  270.  
  271. LastFrameRNG1 = ThisFrameRNG1
  272. ThisFrameRNG1 = memory.readbyte(RNG1Ad)
  273. RNG1Diff = LastFrameRNG1 - ThisFrameRNG1
  274. if (RNG1Diff < 0) then
  275. RNG1Diff = 256 + LastFrameRNG1 - ThisFrameRNG1
  276. end
  277.  
  278.  
  279.  
  280. if true then
  281. memory.writebyte(EarthLevel,1)
  282. memory.writebyte(WaterLevel,1)
  283. memory.writebyte(FireLevel,1)
  284. memory.writebyte(WindLevel,50)
  285. end
  286.  
  287. Fire = memory.readbyte(FireLevel)
  288. Water = memory.readbyte(WaterLevel)
  289. Earth = memory.readbyte(EarthLevel)
  290. Wind = memory.readbyte(WindLevel)
  291. Step = memory.readbyte(StepCounter)
  292. MaxMP = memory.readbyte(MaxMPAd)
  293. CurrMP = memory.readbyte(CurrMPAd)
  294. MaxHP = memory.readbyte(MaxHPAd)
  295. CurrHP = memory.readbyte(CurrHPAd)
  296. Agility = memory.readbyte(AgilityAd)
  297. Defense = memory.readbyte(DefenseAd)
  298. LotteryStep = memory.readbyte(LotteryStepCounter)
  299. LotteryProgress = memory.readbyte(LotteryInProgress)
  300. HPPercent = memory.readbyte(HPPercentAd)
  301. MPPercent = memory.readbyte(MPPercentAd)
  302. AgilityPercent = memory.readbyte(AgilityPercentAd)
  303. DefensePercent = memory.readbyte(DefensePercentAd)
  304. ElementPercent = memory.readbyte(ElementPercentAd)
  305. LotteryItemGoing = memory.readbyte(LotteryItemGoingFor)
  306. DefCounterSub = memory.readbyte(DefCounterSubAd)
  307. RNG1 = memory.readbyte(RNG1Ad)
  308. RNG2 = memory.readbyte(RNG2Ad)
  309. BattleX = memory.readbyte(BrianBattleX)
  310. BattleY = memory.readbyte(BrianBattleY)
  311.  
  312. if false then
  313. gui.text(1,50, RNG1)
  314. gui.text(20,50,"D: " .. RNG1Diff)
  315. gui.text(1,60, RNG2)
  316. end
  317.  
  318. if false then
  319. XPos = 256*memory.readbyte(XPosHigh) + memory.readbyte(XPosLow)
  320. YPos = 256*memory.readbyte(YPosHigh) + memory.readbyte(YPosLow)
  321. gui.text(1,0,"X " .. (XPos))
  322. gui.text(1,10,"Y " .. (YPos))
  323. gui.text(1,20,"Step " .. Step)
  324.  
  325. gui.text(28, 0, "X " .. (BattleX))
  326. gui.text(28, 10, "Y " .. (BattleY))
  327. end
  328.  
  329. if (LotteryProgress ~= 0) then
  330. if (LotteryProgress == 1) then
  331. gui.text(1,30, "Lottery: " .. LotteryStep)
  332. end
  333. if (LotteryProgress == 3) then
  334. gui.text(1,30, "Item in Box")
  335. end
  336. gui.text(1,40, LotteryArray[LotteryItemGoing+1])
  337. end
  338.  
  339. if false then
  340. ElementXBase = 1--top left corner
  341. ElementYBase = 114
  342. gui.text(ElementXBase + 7, ElementYBase, Fire)
  343. gui.text(ElementXBase + 14, ElementYBase + 7, Wind)
  344. gui.text(ElementXBase, ElementYBase + 7, Earth)
  345. gui.text(ElementXBase + 7, ElementYBase + 14, Water)
  346. end
  347.  
  348. if false then
  349. StatXBase = 111
  350. StatYBase = 88
  351. gui.text(StatXBase + 33, StatYBase - 10, memory.readbyte(BrianLevel))
  352. gui.text(StatXBase,StatYBase, memory.readbyte(ExperienceHigh)*256 + memory.readbyte(ExperienceLow) .. "/" .. memory.readbyte(ToNextLevelHigh)*256 + memory.readbyte(ToNextLevelLow))
  353. gui.text(StatXBase + 33, StatYBase, ElementPercent .. "%")
  354. gui.text(StatXBase,StatYBase + 10, CurrHP .. "/" .. MaxHP)
  355. gui.text(StatXBase + 33,StatYBase + 10, HPPercent .. "%")
  356. gui.text(StatXBase,StatYBase + 20, CurrMP .. "/" .. MaxMP)
  357. gui.text(StatXBase + 33,StatYBase + 20, MPPercent .. "%")
  358. gui.text(StatXBase,StatYBase + 30, Agility)
  359. gui.text(StatXBase + 33,StatYBase + 30, AgilityPercent .. "%")
  360. gui.text(StatXBase,StatYBase + 40, Defense)
  361. gui.text(StatXBase + 33,StatYBase + 40, DefensePercent + DefCounterSub .. "%") --This is out of 102%.
  362. end
  363.  
  364. vba.frameadvance();
  365. end
  366.  
  367. --Experience Levels
  368. --1 20 exp (3 ME)
  369. --2 25 exp (4 ME)
  370. --3 30 (+5) (4 ME)
  371. --4 35 (+10) (5 ME)
  372. --5 45 exp
  373. --6 55 exp
  374. --7 65 exp
  375. --8 75 (+10)
  376. --9 85 (+15)
  377. --10 100 exp
  378. --11 115 exp
  379. --12 130 exp
  380. --13 145 exp
  381. --14 150 exp
  382. --15 165 exp
  383. --16 180 exp
  384. --17 195 exp
  385. --18 210 exp
  386. --19 225 exp
  387. --20 240 exp
  388. --21 255 exp
  389. --22 270 exp
  390. --23 285 (+15)
  391. --24 300 (+20)
  392. --25 320 exp
  393. --26 340 exp
  394. --27 360 exp
  395. --28 380 exp
  396. --29 400 exp
  397. --30 420 exp
  398. --31 440 exp
  399. --32 460 exp
  400. --33 480 (+20)
  401. --34 500 (+25)
  402. --35 525
  403. --36 550
  404. --37 575
  405. --38 600
  406. --39 625
  407. --40 650
  408. --41 675 (+25)
  409. --42 700 (+30)
  410. --43 730
  411. --44 760
  412. --45 790
  413. --46 820
  414. --47 850
  415. --48 880
  416. --49 910
  417. --50 940
  418. --51 970 (+30)
  419. --52 1000 (+50)
  420. --55 1150 (+50)
  421. --60 1400 (+50)
  422. --61 1450 (+50)
  423. --62 1500 (+50)
  424. --63 1600 (+100)
  425. --64 1700 (+100)
  426. --65 1800 (+100)
  427. --70 2300 (+100)
  428. --75 2800 (+100)
  429. --80 3300 (+100)
  430. --85 3800 (+100)
  431. --86 3900 (+100)
  432. --87 4000 (+100)
  433. --88 4200 (+200)
  434. --89 4400 (+200)
  435. --90 4600 (+200)
  436. --95 5600 (+200)
  437. --100 6600 (+200)
  438.  
  439.  
  440. --Big Mouth = 2
  441. --Were Hare = 2
  442. --Parassault = 3
  443. --Bumbershoot = 3
  444. --Hell Hound = 3
  445. --Man Eater = 4
  446.  
  447. --200 frames to get an overworld spirit almost exactly.
  448.  
  449. --Tim, 3 turns with 2 earth, 4 turns with 2 water.
  450.  
  451. --Ideally level 1x off random battles before going to dondoran otherwise a level is wasted.
  452.  
  453. -- 5-6 wind for Solvaring
  454. --~12 wind or less for kiliac
  455. --~15 wind for dragon, more will cut down turns substantially.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement