Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Devil Island level 16 exp grind bot v0.0 by ThunderAxe31
- --This is an alpha version, so there is a lot of unfinished stuff scattered around, but it's already usable.
- local cycle = 0
- local cycle_sub = 0
- local addr_objects = 0xC200
- local level_x = memory.read_u16_le(0xC122)
- local experience = memory.read_u16_be(0xCFF8)
- local player_hp = 0
- local experience_old = -1
- local player_hp_old = -1
- local timing_whip_1 = -1
- local timing_whip_2 = -1
- local timing_stop = -1
- local timing_resume = -1
- local timing_jump = -1
- local timing_hurt_1 = -1
- local timing_hurt_2 = -1
- local timing_hurt_3 = -1
- local timing_hurt_4 = -1
- local whip_wait_start = 21 --constant confirmed
- local exp_wait = 15
- local move_wait_start = 40 --constant TO CONFIRM
- local wait_hurt = 20 --constant
- local function wait_disappear()
- savestate.save(".\\Devil Island level 16 exp grind bot\\" .. cycle .. "subtest.state")
- while true do
- for y = 0, 3 do --yes, there are just 4 object slots
- local addr = addr_objects+y*0x20 --data chunks for objects are 32 bytes long
- if memory.read_u8(addr)==0 or memory.read_u8(addr+0x4)==1 or memory.read_u8(addr+0x4)==2 then --check if any disappeared
- console.log("cycle_sub " .. cycle_sub .. " at frame " .. emu.framecount())
- savestate.load(".\\Devil Island level 16 exp grind bot\\" .. cycle .. "subtest.state")
- savestate.save(".\\Devil Island level 16 exp grind bot\\" .. cycle .. "_" .. cycle_sub .. ".state")
- return
- end
- end
- emu.frameadvance()
- end
- end
- local function check_hurt_1()
- while true do
- joypad.set({["Right"]=true})
- player_hp = memory.read_u8(0xCFF5)
- if player_hp_old > player_hp then
- timing_hurt_1 = emu.framecount()
- return
- end
- player_hp_old = player_hp
- emu.frameadvance()
- end
- end
- local function do_whipping()
- cycle_sub = 0
- experience = memory.read_u16_be(0xCFF8)
- experience_old = experience
- for i = 0 , whip_wait_start do
- for j = 0 , whip_wait_start do
- savestate.load(".\\Devil Island level 16 exp grind bot\\" .. cycle .. ".state")
- player_hp_old = player_hp
- while player_hp_old <= player_hp do
- player_hp_old = player_hp
- local framecount = emu.framecount()
- if framecount == (timing_hurt_1 - whip_wait_start + i) or
- framecount == (timing_hurt_1 - whip_wait_start + i + 1) or
- framecount == (timing_hurt_1 + i + j) or
- framecount == (timing_hurt_1 + i + j + 1) then
- joypad.set({["B"]=true})
- end
- joypad.set({["Right"]=true})
- emu.frameadvance()
- player_hp = memory.read_u8(0xCFF5)
- if framecount > timing_hurt_1 + exp_wait then
- experience = memory.read_u16_be(0xCFF8)
- if (experience_old + 24) <= experience then--if all enemies have been killed
- wait_disappear()
- cycle_sub = cycle_sub + 1
- break
- end
- end
- end
- if emu.framecount() <= (timing_hurt_1 + i + j) then break end --if we get hit before being able to hit 2, increase hit 1 delay
- end
- end
- console.log("the end")
- end
- savestate.save(".\\Devil Island level 16 exp grind bot\\" .. cycle .. ".state")
- --while true do
- check_hurt_1() --check for timing_hurt_1
- do_whipping()
- -- cycle = cycle + 1
- -- emu.frameadvance()
- --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement