Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Golden Sun 2: The Lost Age utility script v1.0 for speedrunning. Would not be possible without the help of Fox aka teawater from the gs hacking community
- local AD3 = (0x0200049A) -- Next Encounter
- local AD4 = (0x020054C8) -- Battle RN
- local AD5 = (0x030011BC) -- General RN
- local gcount = 0
- local brncount = 0
- local store = memory.readdword(0x030011BC)
- local bstore = memory.readdword(0x020054C8)
- local fleestore = 0
- local fleepercent = 0
- local mem = 0x2010000
- local memcount = 0
- --eel = memory.readbyte(0x0203089E) -- venus res
- --eme = memory.readbyte(0x020308A2)
- --ema = memory.readbyte(0x020308A6)
- --eju = memory.readbyte(0x020308A8)
- -- Vulnerability Key
- --12 = Drop Def 25%
- --13 = Drop def 12%
- --16 = res drop 40
- --17 = res drop 20
- --20 = delusion
- --23 = stun
- --24 = sleep
- --27 = death
- --31 = HP steal
- --32 = PP steal
- --60 = 50% dmg to health
- --69 = 10% dmg to PP
- while true do
- gui.text(160,00,"BRN: ".. (memory.readdword(AD4)))
- gui.text(160,10,"GRN: ".. (memory.readdword(AD5)))
- if memory.readword(0x02000420) == 0x8D then
- gui.text(160,20,"Item: ".. memory.readword(0x020004FC))
- gui.text(160,30,"409 = ring")
- end
- if mem <= 0x2008000 then
- mem = 0x2010000
- memcount=0
- end
- if memory.readdword(mem) ~= 0 then
- if memory.readdword(mem+0x4) ~=0 or memory.readdword(mem+0x8)~=0 or memory.readdword(mem+0xB)~=0 or memory.readdword(mem+0xF)~=0 or memory.readdword(mem+0x10)~=0 then
- mem = 0x2010000
- memcount=0
- end
- end
- while memcount <= 20000 and memory.readdword(mem) == 0 or mem==0x02010000 do
- mem = mem-0x4
- memcount = memcount+1
- end
- gui.text(0,30,"Nonzero Tile: " .. memcount)
- --gui.text(140,20,"X: " .. (memory.readdword(0x02030ec4))/1000000)
- --gui.text(140,30,"Y: " .. (memory.readdword(0x02030ecc))/1000000)
- --g = memory.readdword(AD5)
- --print(bit.tohex(g))
- -- RNG Functions
- function RNA (R) -- RN Advance Function
- g = R
- m1 = 0x4e6d
- m2 = 0x41c6
- g1 = g*m1
- g2 = g*m2
- g2 = bit.band(g2,0xFFFF)
- g = g1 + g2*0x10000
- g = bit.band(g,0xFFFFFFFF)
- c=0x3039
- g = g+c
- g = bit.band(g,0xFFFFFFFF)
- return g
- end
- function RNB (R) -- RN Advance and reduce for use in RNG calculations
- g = R
- m1 = 0x4e6d
- m2 = 0x41c6
- g1 = g*m1
- g2 = g*m2
- g2 = bit.band(g2,0xFFFF)
- g = g1 + g2*0x10000
- c=0x3039
- g = g+c
- g = bit.band(g,0xFFFFFFFF)
- g = bit.lshift(g,8)
- g = bit.rshift(g,16)
- return g
- end
- -- begin enemy HP/encounter loops
- -- Encounter / Level up Stats
- if memory.readword(0x02000420) ~= 0x1FE then
- gui.text(0,20,"Encounter: ".. (memory.readword(AD3)))
- gui.text(0,40,"PP Regen: ".. (math.floor((memory.readword(0x020301A0))/0xFFF)))
- fagi=memory.readbyte(0x02000520+0x1C+0x14C*4)
- flv=memory.readbyte(0x02000520+0x14C*4+0xF)
- fagilv=-fagi+(flv-5)*4+0x1B -- imperfect levels ups discounting randomly rolled stats on new file
- jagi=memory.readbyte(0x02000520+0x1C+0x14C*5)
- jlv=memory.readbyte(0x02000520+0x14C*5+0xF)
- jagilv=-jagi+(jlv-5)*4+0x1B -- imperfect levels ups discounting randomly rolled stats on new file
- sagi=memory.readbyte(0x02000520+0x1C+0x14C*6)
- slv=memory.readbyte(0x02000520+0x14C*6+0xF)
- sagilv=-sagi+(slv-5)*4+0x1E -- imperfect levels ups discounting randomly rolled stats on new file
- pagi=memory.readbyte(0x02000520+0x1C+0x14C*7)
- plv=memory.readbyte(0x02000520+0x14C*7+0xF)
- pagilv=-pagi+(plv-18)*4+0x45 -- imperfect levels ups discounting randomly rolled stats on new file
- gui.text(0,140,"Missing Agi F:" .. fagilv .. " J:" .. jagilv .. " S:" .. sagilv .. " P:" .. pagilv) -- -ve numbers indicate gained agility through mint
- if memory.readbyte(0x02000040)==0xFF then -- only display this after the reunion
- iagi=memory.readbyte(0x02000520+0x1C+0x14C*0)
- ilv=memory.readbyte(0x02000520+0x14C*0+0xF)
- iagilv=-iagi+(ilv-28)*4+0x75 --
- gagi=memory.readbyte(0x02000520+0x1C+0x14C*1)
- glv=memory.readbyte(0x02000520+0x14C*1+0xF)
- gagilv=-gagi+(glv-28)*4+0x68 --
- vagi=memory.readbyte(0x02000520+0x1C+0x14C*2)
- vlv=memory.readbyte(0x02000520+0x14C*2+0xF)
- vagilv=-vagi+(vlv-28)*4+0x7B --
- magi=memory.readbyte(0x02000520+0x1C+0x14C*3)
- milv=memory.readbyte(0x02000520+0x14C*3+0xF)
- magilv=-magi+(milv-28)*4+0x6F
- gui.text(48,150,"I:" .. iagilv .. " G:" .. gagilv .. " V:" .. vagilv .. " M:" .. magilv)
- end
- end
- -- begin RNG counters
- GRN = memory.readdword(AD5)
- BRN = memory.readdword(AD4)
- if GRN == 1710661176 then
- store = 1710661176
- gcount=0
- end
- gcountbase = 0
- while store ~= GRN and gcountbase <= 750 do
- --print(store)
- store = RNA(store)
- if store <= 0 then
- store = 0xFFFFFFFF+store+1
- gcount = gcount +1
- gcountbase = gcountbase +1
- else
- gcount = gcount +1
- gcountbase = gcountbase +1
- end
- end
- if store == GRN then
- gcountbase = 0
- else
- store = GRN
- gcountbase = 0
- gcount = 0
- end
- bcountbase = 0
- while bstore ~= BRN and bcountbase <= 100 do
- bstore = RNA(bstore)
- if bstore <= 0 then
- bstore = 0xFFFFFFFF+bstore+1
- brncount = brncount+1
- bcountbase = bcountbase+1
- else
- brncount = brncount+1
- bcountbase = bcountbase+1
- end
- end
- if bstore == BRN then
- bcountbase = 0
- else
- bstore = BRN
- bcountbase = 0
- brncount = 0
- end
- if BRN == 0 then -- reset BRN counter on loadstate
- bstore = BRN
- bcount = 0
- end
- -- RNG Gui display
- gui.text(0,10,"GRN count: " .. gcount)
- gui.text(0,00,"BRN count: " .. brncount)
- Roll = memory.readdword(AD4)
- Roll = bit.lshift(Roll,8)
- Roll = bit.rshift(Roll,16)
- Roll = Roll*100
- Roll = bit.rshift(Roll,16)
- gui.text(120,00,"Roll: ".. Roll)
- -- Begin Flee/Assassinate Scripts
- -- Level Calculations
- local el1 = memory.readbyte(0x020308D7) -- Enemy 1 Level
- local el2 = memory.readbyte(0x020308D7+0x14C) -- etc
- local el3 = memory.readbyte(0x020308D7+2*0x14C)
- local el4 = memory.readbyte(0x020308D7+3*0x14C)
- local party = memory.readbyte(0x02000040) -- Party member number
- local isl= memory.readbyte(0x0200052F) -- Isaac level, +14C *user ID to get rest.
- -- local gal= memory.readbyte(0x0200067b) -- etc
- -- local ivl= memory.readbyte(0x020007c7)
- -- local mil= memory.readbyte(0x02000913)
- -- local mil= memory.readbyte(0x020008F3)
- -- local mil= memory.readbyte(0x020008F3)
- -- local mil= memory.readbyte(0x020008F3)
- -- local mil= memory.readbyte(0x020008F3)
- if memory.readword(0x02000420) == 0x1FE then
- if el4 ~= 0 then
- ela = (el1+el2+el3+el4)/4
- elseif el3 ~=0 then
- ela = (el1+el2+el3)/3
- elseif el2 ~=0 then
- ela = (el1+el2)/2
- else
- ela = el1
- end
- pc1 = memory.readbyte(0x02000458)
- pc2 = memory.readbyte(0x02000459)
- pc3 = memory.readbyte(0x0200045A)
- pc4 = memory.readbyte(0x0200045B)
- if party == 0x70 then
- ml = (memory.readbyte(0x02000520+0x14C*pc1+0xF)+memory.readbyte(0x02000520+0x14C*pc2+0xF)+memory.readbyte(0x02000520+0x14C*pc3+0xF))/3
- else
- ml = (memory.readbyte(0x02000520+0x14C*pc1+0xF)+memory.readbyte(0x02000520+0x14C*pc2+0xF)+memory.readbyte(0x02000520+0x14C*pc3+0xF)+memory.readbyte(0x02000520+0x14C*pc4+0xF))/4
- end
- LevelAve = ml-ela
- --Agility/HP Battle Scripts
- local pcag1=memory.readword(0x02030338+0x04)
- local pcag2=memory.readword(0x02030338+0x04+0x10)
- local pcag3=memory.readword(0x02030338+0x04+0x20)
- local pcag4=memory.readword(0x02030338+0x04+0x30)
- if memory.readbyte(0x02030368)==0xFF then -- Hacky way of checking if we are in fight menu or battle
- if pcag1 >= 1000 then
- pcag1 = 0
- end
- if pcag2 >= 1000 then
- pcag2 = 0
- end
- if pcag3 >= 1000 then
- pcag3 = 0
- end
- if pcag4 >= 1000 then
- pcag4 = 0
- end
- gui.text(0,40,"PC" .. pc1 .. " Agi: " .. pcag1) -- Displays agility of party member pc1
- gui.text(0,50,"PC" .. pc2 .. " Agi: " .. pcag2)
- gui.text(0,60,"PC" .. pc3 .. " Agi: " .. pcag3)
- gui.text(0,70,"PC" .. pc4 .. " Agi: " .. pcag4)
- if memory.readbyte(0x02030900)>0 then
- gui.text(60,40, "E1 Agi: " .. memory.readbyte(0x020308E4)) -- If Enemy 1 has nonzero HP display E1 agility
- gui.text(110,40, "HP: " .. memory.readword(0x02030900))
- else
- end
- if memory.readbyte(0x02030900+0x14C)>0 then
- gui.text(60,50, "E2 Agi: " .. memory.readbyte(0x020308E4+0x14C))
- gui.text(110,50, "HP: " .. memory.readword(0x02030900+0x14C))
- else
- end
- if memory.readbyte(0x02030900+0x14C*2)>0 then
- gui.text(60,60, "E3 Agi: " .. memory.readbyte(0x020308E4+0x14C*2))
- gui.text(110,60, "HP: " .. memory.readword(0x02030900+0x14C*2))
- else
- end
- if memory.readbyte(0x02030900+0x14C*3)>0 then
- gui.text(60,70, "E4 Agi: " .. memory.readbyte(0x020308E4+0x14C*3))
- gui.text(110,70, "HP: " .. memory.readword(0x02030900+0x14C*3))
- else
- end
- if memory.readbyte(0x02030900+0x14C*4)>0 then
- gui.text(60,80, "E5 Agi: " .. memory.readbyte(0x020308E4+0x14C*4))
- gui.text(110,80, "HP: " .. memory.readword(0x02030900+0x14C*4))
- else
- end
- elseif memory.readbyte(0x02030368)==0xFF and memory.readbyte(0x02030358)==0xFF then -- Hacky way of accounting for three person party
- gui.text(0,40,"PC" .. pc1 .. " Agi: " .. pcag1)
- gui.text(0,50,"PC" .. pc2 .. " Agi: " .. pcag2)
- gui.text(0,60,"PC" .. pc3 .. " Agi: " .. pcag3)
- if memory.readbyte(0x02030900)>0 then
- gui.text(60,40, "E1 Agi: " .. memory.readbyte(0x020308E4)) -- If Enemy 1 has nonzero HP display E1 agility
- gui.text(110,40, "HP: " .. memory.readword(0x02030900+0x14C*0))
- else
- end
- if memory.readbyte(0x02030900+0x14C)>0 then
- gui.text(60,50, "E2 Agi: " .. memory.readbyte(0x020308E4+0x14C))
- gui.text(110,50, "HP: " .. memory.readbyte(0x02030900+0x14C*1))
- else
- end
- if memory.readbyte(0x02030900+0x14C*2)>0 then
- gui.text(60,60, "E3 Agi: " .. memory.readbyte(0x020308E4+0x14C*2))
- gui.text(110,60, "HP: " .. memory.readbyte(0x02030900+0x14C*2))
- else
- end
- if memory.readbyte(0x02030900+0x14C*3)>0 then
- gui.text(60,70, "E4 Agi: " .. memory.readbyte(0x020308E4+0x14C*3))
- gui.text(110,70, "HP: " .. memory.readbyte(0x02030900+0x14C*3))
- else
- end
- if memory.readbyte(0x02030900+0x14C*4)>0 then
- gui.text(60,80, "E5 Agi: " .. memory.readbyte(0x020308E4+0x14C*4))
- gui.text(110,80, "HP: " .. memory.readbyte(0x02030900+0x14C*4))
- else
- end
- else -- otherwise, we are in a battle and do the following
- local j=1
- local k=1
- local trn={}
- while memory.readbyte(0x0203033C+0x10*(j-1)) ~= 0 do --while loop which checks nonzero agilities and therefore count number of actors in the battle
- trn[j]= memory.readbyte(0x02030338+0x10*(j-1)) -- add the character index to the trn array in order
- if trn[j]==0xFF then -- if user has already acted then do nothing
- j=j+1
- else
- gui.text(30+15*k,40,trn[j]) -- if user hasn't acted then display user in the turn order queue
- j=j+1
- k=k+1
- end
- end
- gui.text(0,40, "Turn Order: ")
- if memory.readbyte(0x02030900)>0 then
- gui.text(70,50, "E1 HP: " .. memory.readword(0x02030900))
- end
- end
- -- Agility Bonus Calculator
- if memory.readbyte(0x0203033C)>0 then
- local l=1
- while memory.readbyte(0x02030328+0x10*l) ~= pc1 and l<15 do
- l=l+1
- end
- if l~=15 then
- pcntag1=(memory.readbyte(0x02030328+0x10*l+0x04)-memory.readbyte(0x02000BDC+0x14C*(pc1-5)))/memory.readbyte(0x02000BDC+0x14C*(pc1-5))*10000
- pcntag1= math.floor(pcntag1)/100
- gui.text(0,90,"PC" .. pc1 .. " Bonus: " .. pcntag1 .. "%")
- end
- local l=1
- while memory.readbyte(0x02030328+0x10*l) ~= pc2 and l<15 do
- l=l+1
- end
- if l~=15 then
- pcntag2=(memory.readbyte(0x02030328+0x10*l+0x04)-memory.readbyte(0x02000BDC+0x14C*(pc2-5)))/memory.readbyte(0x02000BDC+0x14C*(pc2-5))*10000
- pcntag2= math.floor(pcntag2)/100
- gui.text(0,100,"PC" .. pc2 .. " Bonus: " .. pcntag2 .. "%")
- end
- local l=1
- while memory.readbyte(0x02030328+0x10*l) ~= pc3 and l<15 do
- l=l+1
- end
- if l~=15 then
- pcntag3=(memory.readbyte(0x02030328+0x10*l+0x04)-memory.readbyte(0x02000BDC+0x14C*(pc3-5)))/memory.readbyte(0x02000BDC+0x14C*(pc3-5))*10000
- pcntag3= math.floor(pcntag3)/100
- gui.text(0,110,"PC" .. pc3 .. " Bonus: " .. pcntag3 .. "%")
- end
- if memory.readbyte(0x0200045B)==0 and memory.readbyte(0x0200045C)==0 then
- else
- local l=1
- while memory.readbyte(0x02030328+0x10*l) ~= pc4 and l<15 do
- l=l+1
- end
- if l~=15 then
- pcntag4=(memory.readbyte(0x02030328+0x10*l+0x04)-memory.readbyte(0x02000BDC+0x14C*(pc4-5)))/memory.readbyte(0x02000BDC+0x14C*(pc4-5))*10000
- pcntag4= math.floor(pcntag4)/100
- gui.text(0,120,"PC" .. pc4 .. " Bonus: " .. pcntag4 .. "% Roll " .. memory.readbyte(0x02030328+0x10*l+0x04))
- end
- end
- end
- fleeFail = memory.readbyte(0x02030092)
- function flee(S) -- Flee Success Calculation
- g = S
- g = RNB(g)*10000
- fl = 5000 + (2000*fleeFail) + (LevelAve * 500)
- g = bit.rshift(g, 16)
- if fl >= g then
- return true
- else
- return false
- end
- end
- RN= memory.readdword(0x030011BC)
- count = 0
- while flee(RN) == false do -- Attack Cancel to Flee Calculation
- count = count + 1
- if count == 100 then break end
- RN= RNA(RN)
- end
- gui.text(160,30,"ACs to Run: " .. count)
- -- % Chance to Run
- fleecount = 0
- if fleestore ~= memory.readdword(AD5) then
- fleeRN = memory.readdword(AD5)
- for i=1,1000 do
- if flee(fleeRN) == true then
- fleecount= fleecount +1
- end
- fleeRN=RNA(fleeRN)
- end
- fleepercent = fleecount/10
- fleestore = memory.readdword(AD5)
- fev = fleepercent/100
- EV = (fev*1+ math.floor(fev+.20,1)*(1-fev)*2+ math.floor(fev+.40,1)*(1-math.floor(fev+.20,1))*(1-fev)*3+ math.floor(fev+.60,1)*(1-math.floor(fev+.40,1))*(1-math.floor(fev+.20,1))*(1-fev)*4+ math.floor(fev+.80,1)*(1-math.floor(fev+.60,1))*(1-math.floor(fev+.40,1))*(1-math.floor(fev+.20,1))*(1-fev)*5+ (1-math.floor(fev+.80,1))*(1-math.floor(fev+.60,1))*(1-math.floor(fev+.40,1))*(1-math.floor(fev+.20,1))*(1-fev)*6)
- gui.text(100,20,"Run EV: ".. EV)
- gui.text(160,20,"Run%: " .. fleepercent)
- else
- gui.text(100,20,"Run EV: ".. EV )
- gui.text(160,20,"Run%: " .. fleepercent)
- end
- evcount = 0
- function vuln (S)
- e1Ind = S
- vuln1 = memory.readbyte(0x080B9E7C + ((e1Ind - 8) * 0x4C) + 0x3E)
- vuln2 = memory.readbyte(0x080B9E7C + ((e1Ind - 8) * 0x4C) + 0x3F)
- vuln3 = memory.readbyte(0x080B9E7C + ((e1Ind - 8) * 0x4C) + 0x40)
- return vuln1, vuln2, vuln3
- end
- function enemy (S,Elm) -- Enemy Elemental Data Table
- elemInd = memory.readbyte(0x080B9E7C + ((S - 8) * 0x4C) + 0x2A)
- enemyelmlevel = memory.readbyte(0x080C6684 + (elemInd * 0x18) + 4+Elm)
- return enemyelmlevel
- end
- function bchance (E) -- base chance for status
- if E == 16 or E == 17 then
- c = 75
- elseif E == 23 then
- c = 40
- elseif E == 24 then
- c = 35
- elseif E == 27 then
- c = 20
- end
- return c
- end
- function effectproc (S,E,Elm,U) -- Random number, What effect is this, Elmemental Affinity 0 = Venus, 1 = Mercury, 2= Mars, 3 = Jupiter, Who is using this 0 = Isaac, 1 = Garet, 2 = Ivan, 3 = Mia
- uelm = memory.readbyte(0x0200061C+0x20+U*0x14C+Elm) -- Elemental Power of User
- eluc = memory.readbyte(0x020308E6) -- Enemy Luck
- eind = memory.readword(0x02030A12) -- Enemy Index
- eelm = enemy(eind,Elm) -- Enemy Elemental Levels
- vul1, vul2, vul3 = vuln(eind) -- Enemy Vulnerability
- if vul1 == E or vul2 == E or vul3 == E then -- Vulnerability key at top
- v=25
- else
- v=00
- end
- if memory.readbyte(0x080C0F4C + (U * 0xB4) + 0x92 + Elm) == 54 then
- elmaff = 5
- else
- elmaff = 0
- end
- proc = (((uelm + elmaff - eelm)-(math.floor(eluc/2)))*3+bchance(E)+v)
- g = RNB(S)*100
- g = bit.rshift(g,16)
- if proc >= g then
- return true
- else
- return false
- end
- end
- function unleash (S)
- g = S
- g = RNB(g)*100
- g = bit.rshift(g,16)
- if 35 >= g then
- return true
- else
- return false
- end
- end
- -- to add; themis axe, thanatos mace?, sleep bomb, stun, pirate sword
- psword=0
- for i=0,29 do
- --print(memory.readbyte(0x02000C74+i*0x2))
- if memory.readbyte(0x02000C74+i*0x2)==0x1F then -- Jenna inventory check for psword
- if memory.readbyte(0x02000C75+i*0x2)==0x3 then -- Equip check
- psword=1
- end
- elseif memory.readbyte(0x02000C74+i*0x2-0x14C)==0x1F then
- if memory.readbyte(0x02000C75+i*0x2-0x14C)==0x3 then -- Equip check
- psword=2
- end
- end
- end
- if psword==1 then -- Psword Proc Calc
- BRN = memory.readdword(0x020054C8)
- bcount=0
- while effectproc(RNA(BRN),24,1,5) == false or unleash(BRN) == false do
- bcount = bcount+1
- if bcount == 100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,40,"Psword Sleep: " .. bcount)
- end
- if psword==2 then -- Psword Proc Calc
- BRN = memory.readdword(0x020054C8)
- bcount=0
- while effectproc(RNA(BRN),24,1,4) == false or unleash(BRN) == false do
- bcount = bcount+1
- if bcount == 100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,40,"Psword Sleep: " .. bcount)
- end
- eindex=memory.readword(0x02030A12)
- sleepb=0
- sleepuser=0
- for i=0,29 do
- --print(memory.readbyte(0x02000C74+i*0x2))
- if memory.readbyte(0x02000C74+i*0x2)==0xE3 then
- sleepb=1
- sleepuser=5
- elseif memory.readbyte(0x02000C74+0x14C+i*0x2)==0xE3 then
- sleepb=1
- sleepuser=6
- elseif memory.readbyte(0x02000C74-0x14C+i*0x2)==0xE3 then
- sleepb=1
- sleepuser=4
- elseif memory.readbyte(0x02000C74+i*0x2+0x14C*2)==0xE3 then -- Inventory check for sleepbomb
- sleepb=1
- sleepuser=7
- end
- end
- if sleepb == 1 and eindex ~= 0x5B then
- bcount=0
- while effectproc(BRN,24,3,sleepuser) == false do
- bcount=bcount+1
- if bcount==100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,50,"Sleep bomb: " .. bcount)
- end
- if memory.readbyte(0x02000520+5*0x14C+0x129) >= 0x46 and memory.readbyte(0x02000520+5*0x14C+0x129) <= 0x54 then -- Jenna Class Check
- BRN = memory.readdword(0x020054C8)
- bcount=0
- while effectproc(BRN,16,3,5) == false do -- Weaken calculation
- bcount = bcount+1
- if bcount == 100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,50,"Jenna Weaken: " .. bcount)
- end
- if memory.readbyte(0x02000520+4*0x14C+0x129) >= 0x46 and memory.readbyte(0x02000520+4*0x14C+0x129) <= 0x54 then -- Felix Class Check
- BRN = memory.readdword(0x020054C8)
- bcount=0
- while effectproc(BRN,16,3,4) == false do -- Weaken calculation
- bcount = bcount+1
- if bcount == 100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,60,"Felix Weaken: " .. bcount)
- if eindex == 0x5B then
- Sour = memory.readdword(0x020054C8)
- Sour = RNA(Sour)
- bcount=0
- while effectproc(Sour,16,3,7) == false do
- bcount = bcount + 1
- if bcount == 100 then break end
- Sour = RNA(Sour)
- end
- gui.text(160,70, "Sour " .. bcount)
- end
- end
- -- Drop Stuff
- function drop(S)
- return memory.readbyte(0x080B9E7C+((S-8)*0x4C+0x44)), memory.readbyte(0x080B9E7C+((S-8)*0x4C+0x46))
- end
- function itemdrop(S,C)
- g = S
- g = RNB(g)*100
- g = bit.rshift(g,16)
- if C >= g then
- return true
- else
- return false
- end
- end
- function droprate(S,ch) -- enemy index, chance of drop
- BRN = memory.readdword(0x020054C8)
- bcount=0
- bcount2=0
- rate=bit.rshift(0x64,ch-1)
- rate2=bit.rshift(0x64,ch-3)
- while itemdrop(BRN,rate) == false do
- bcount=bcount+1
- if itemdrop(BRN,rate2) == true then
- bcount2=bcount
- end
- if bcount == 100 then break end
- BRN=(RNA(BRN))
- end
- return bcount, bcount2
- end
- if memory.readbyte(0x02030900)>0 then
- eindex=memory.readword(0x02030A12)
- dr,ch = drop(eindex)
- if dr == 0xE3 or dr == 0x44 then -- dropped item is something I care about, 0xE3 is sleep bomb, 0x44 is staff of anubis
- A,B= droprate(eindex,ch)
- gui.text(140,80, "E1 Item: " .. dr .. " Turns " .. A .. "|" .. B) -- A=turns without djinn, B=turns with djinn
- end
- end
- if memory.readbyte(0x02030900+0x14C)>0 then
- eindex2=memory.readword(0x02030A12+0x14C)
- dr,ch=drop(eindex2)
- if dr == 0xE3 or dr==0x44 then -- dropped item is something I care about, 0xE3 is sleep bomb
- A,B= droprate(eindex,ch)
- gui.text(140,100, "E2 Item: " .. dr .. " Turns " .. A .. "|" .. B)
- end
- end
- if memory.readbyte(0x02030900+0x14C*2)>0 then
- eindex3=memory.readword(0x02030A12+0x14C*2)
- dr,ch=drop(eindex3)
- if dr == 0xE3 or dr==0x44 then -- dropped item is something I care about, 0xE3 is sleep bomb
- A,B= droprate(eindex,ch)
- gui.text(140,120, "E3 Item: " .. dr .. " Turns " .. A .. "|" .. B)
- end
- end
- --end
- -- if memory.readbyte(0x02000048)>=0x70 and memory.readbyte(0x02000155) < 0x14 then -- If you have mist, return mist information
- -- BRN = memory.readdword(0x020023A8)
- -- bcount=0
- -- while effectproc(RNA(BRN),24,1,3) == false or unleash(BRN) == false do -- mist calculation
- -- bcount = bcount+1
- -- if bcount == 100 then break end
- -- BRN=RNA(BRN)
- -- end
- -- gui.text(160,50,"Mist: " .. bcount)
- -- end
- --end
- end
- --eindex=memory.readword(0x02030A12)
- vba.frameadvance();
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement