Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rns = { 13, 2, 6, 8, 7, 9, 14, 10, 2, 4, 14, 4, 12, 15, 13, 12, 11, 1, 3, 15, 0, 6, 7, 8, 11, 5, 0, 3, 5, 1, 9, 10 }
- timers = { }
- function Calculate(num, counter, index, enemyX, enemyY)
- local frame
- local enRN
- -- determine when it will open
- if num == 0 then
- timers[0] = memory.readbyte(0x300016E + index*56)
- else
- frame = counter + timers[num-1]
- enRN = rns[((frame + bit.rshift(frame, 4) + index + enemyX + enemyY) % 32) + 1]
- timers[num] = timers[num-1] + 61 + enRN * 4
- end
- -- determine if it will shoot
- frame = counter + timers[num] + 7
- enRN = rns[((frame + bit.rshift(frame, 4) + index + enemyX + enemyY) % 32) + 1]
- -- display
- gui.text(3, 19 + num*8, timers[num])
- if enRN <= 6 then
- gui.text(20, 19 + num*8, "O", "green")
- else
- gui.text(20, 19 + num*8, "X", "red")
- end
- end
- while true do
- local index = -1
- local pose
- for i=0,23 do
- local id = memory.readbyte(0x300015D + i*56)
- if id >= 0x8F and id <= 0x9E then
- index = i
- pose = memory.readbyte(0x3000164 + index*56)
- break
- end
- end
- if index ~= -1 and pose < 0x58 then
- -- display eyedoor activation region
- local cameraX, cameraY = memory.readword(0x3001228), memory.readword(0x300122A)
- local enemyX, enemyY = memory.readword(0x3000144 + index*56), memory.readword(0x3000142 + index*56)
- local xStart = bit.arshift(enemyX - 0x1C0 - cameraX, 2)
- local yStart = bit.arshift(enemyY - 0x80 - cameraY, 2)
- local xEnd = bit.arshift(enemyX + 0x1C0 - cameraX, 2)
- local yEnd = bit.arshift(enemyY + 0x80 - cameraY, 2)
- gui.box(xStart, yStart, xEnd, yEnd, "#00F00020", "#20C020")
- -- check if in range
- local samusX, samusY = memory.readword(0x300125A), memory.readword(0x300125C)
- if math.abs(samusX - enemyX) < 0x1C0 and math.abs(samusY - enemyY) < 0x80 then
- gui.text(3, 11, "In", "green")
- else
- gui.text(3, 11, "Out", "red")
- end
- if pose >= 0x18 and pose <= 0x20 then
- -- eyedoor is open
- local timer = memory.readbyte(0x300016E + index*56)
- gui.text(3, 19, timer)
- else
- -- calculate when eyedoor will open
- local counter = memory.readword(0x3000002)
- for n=0,3 do
- Calculate(n, counter, index, enemyX, enemyY)
- end
- end
- end
- vba.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement