Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Metroids do not spawn until they are on screen. They do not directly use Samus's X or Y position.
- -- When a Metroid starts spawning, it is given a delay between 1 and 61 frames before it will finish spawning.
- -- The delay is calculated by: EnemyRN * 4 + 1
- -- When a Metroid is inactive, the script displays the next five times a Metroid will be given the minimum amount of delay (which is 1 frame).
- -- When a Metroid is active, the script displays the delay it was given when it started spawning, as well as the timer used for the delay. You can use the timer to verify that the calculated delay was correct.
- -- The timer is used for other things once the Metroid has finished spawning, so you can ignore its value.
- -- Note: the delay is not calculated correctly for Metroids that are already spawning when you enter the room. You'll have to use the timer value to find a favorable delay.
- 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 }
- wait = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
- while true do
- local counter1 = memory.readbyte(0x3000C77) + 1
- local counter2 = memory.readword(0x3000002) + 1
- local number = 0
- for i=0,23 do
- if memory.readbyte(0x30001C9 + i*56) == 0x64 then
- -- check if metroid is active
- local status = memory.readbyte(0x30001AC + i*56)
- local pose = memory.readbyte(0x30001D0 + i*56)
- if pose == 1 and AND(status, 2) == 0 then
- gui.text(3, 11 + number * 8, "Inactive", "red")
- -- calculate when metroid will spawn
- local timer1 = counter1
- local timer2 = counter2
- local enemyX, enemyY = memory.readword(0x30001B0 + i*56), memory.readword(0x30001AE + i*56)
- local addVal = i + enemyX + enemyY
- local enRN = rns[((timer1 + 1 + bit.rshift(timer2 + 1, 4) + addVal) % 32) + 1]
- wait[i] = enRN * 4 + 1
- -- find next 5 times metroid will spawn as fast as possible
- local delay = -1
- for j=0,4 do
- enRN = -1
- while enRN ~= 0 do
- enRN = rns[((timer1 + bit.rshift(timer2, 4) + addVal) % 32) + 1]
- timer1 = timer1 + 1
- timer2 = timer2 + 1
- delay = delay + 1
- end
- gui.text(39 + j*12, 11 + number*8, delay)
- timer1 = timer1 + 1
- timer2 = timer2 + 1
- delay = delay + 1
- end
- else
- gui.text(3, 11 + number * 8, "Active", "green")
- -- display how much the metroid's spawn was delayed
- gui.text(31, 11 + number * 8, wait[i])
- -- display timer for the delay
- gui.text(42, 11 + number * 8, memory.readword(0x30001D8 + i*56))
- end
- number = number + 1
- else
- wait[i] = 0
- end
- end
- vba.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement