I edited amaurea's RNGscript a bit to add some littles functionalities:
1- It now prints the HP of both Unit and Enemy.
2- It now counts the ammount of RN burned.
3- You can reset the counter each time you want by pressing the key "Q".
Something you also have to notice is that the counter auto-resets each time a savestate is loaded or saved. There may be possible to not reset it when saving, but with my current knowledge, i can't. Something to be noticed is that it sometimes crash when you load a savestate at full speed, during frame advance it doesn't, so i recommend to pause the game before loading anything.
For FE6 TASers: You would have to replace 655.36 to 655 each time it appears. And also change the memory adresses for the correct ones.
For FE8 TASers: Just change the memory adresses for the correct ones.
And finally, the code:
Language: lua
function nextrng(r1, r2, r3)
return AND(XOR(SHIFT(r3, 5), SHIFT(r2, -11), SHIFT(r1, -1), SHIFT(r2, 15)),0xFFFF)
end
function rngsim(n,base)
local result = { memory.readword(base+4), memory.readword(base+2), memory.readword(base+0) }
for i = 4, n do
result[i] = nextrng(result[i-3],result[i-2],result[i-1])
end
return result
end
local rngbase=0x03000000
local RNG = rngsim(20, rngbase)
local key={}
local counter = 0
local php = 0x0203E064
local phit = 0x0203E0C6
local pdmg = 0x0203E0CA
local pcrt = 0x0203E0CE
local ehp= 0x0203E062
local ehit = 0x0203E0C4
local edmg = 0x0203E0C8
local ecrt = 0x0203E0CC
while true do
local nsim = 20
rngs = rngsim(nsim, rngbase)
for i = 1, nsim do
gui.text(228, 8*(i-1), string.format("%3d", rngs[i]/655.36))
end
key = input.get()
if key.Q or key.F1 or key.F2 or key.F3 or key.F4 or key.F5 or key.F6 or key.F7 or key.F8 or key.F9 or key.F10 then
counter = 0
RNG = rngsim(nsim, rngbase)
end
local j = 1
while (RNG[j]/655.36 ~= rngs[1]/655.36) do
counter = counter + 1
j=j+1
end
RNG = rngsim(nsim, rngbase)
gui.text(0,96,"Burned RNs: " .. counter)
gui.text(210,0,"RNG1:")
gui.text(210,8,"RNG2:")
gui.text(210,16,"RNG3:")
gui.text(194,24,"Next RNs:")
gui.text(0,0,"Player")
gui.text(0,8,"HP: " .. memory.readbyte(php))
gui.text(0,16,"Hit: " .. memory.readbyte(phit))
gui.text(0,24,"Damage: " .. memory.readbyte(pdmg))
gui.text(0,32,"Crit: " .. memory.readbyte(pcrt))
gui.text(0,48,"Enemy")
gui.text(0,56,"HP: " .. memory.readbyte(ehp))
gui.text(0,64,"Hit: " .. memory.readbyte(ehit))
gui.text(0,72,"Damage: " .. memory.readbyte(edmg))
gui.text(0,80,"Crit: " .. memory.readbyte(ecrt))
emu.frameadvance()
end