Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Version 0.19d
- -- OPTIONS -- OPTIONS -- OPTIONS -- Change to true or false
- Level_Blitz = true
- NoLeftMode = false
- DrunkMode = true
- HardMode = false
- ForceRetry = true
- DeathTimer = false --combine with Hard Mode for Insane Mode (1-hit death)
- AlwaysExtendedFlutter = false
- NoFlutter = true
- NoTongue = false
- Velcro = false
- AlwaysFilledMouth = false -- Enter 2 for bubbles and 3 for melons. Enter false to disable
- FullEggsStart = false
- NumberOfEggs = 6 -- For FullEggsStart, how many to start with - choose between 1-6
- EggType = 43 -- What eggs to start with (34 = flashing egg - 35 = red - 36 = yellow - 37 = green - 39 = key - 40 = flashing egg - 43 = big egg
- FastMode = false
- SpeedBoost = 5 -- For fast mode, enter 0-9 (higher is faster)
- -- Level Blitz Options -- Level Blitz Options --
- AutoScrollers = false
- ExtraStages = false
- ExcludeStages = {68, 72, 54, 61} -- seperate by a comma, write stages like 54 for 5-4
- NormalFortressOrder = true
- NormalCastleOrder = true
- RandomSeed = 666
- SameStage = false
- Fortresses = true
- Castles = true
- World1 = true
- World2 = true
- World3 = true
- World4 = true
- World5 = true
- World6 = true
- -- OPTIONS End -- OPTIONS End -- OPTIONS End --
- -- !Instructions! Instructions! Instructions! Instructions!
- -- 1. You must use a lua compatible Snes9x emulator. Recommended is -> http://code.google.com/p/snes9x-rr/downloads/detail?name=snes9x-1.51-rerecording-svn147.zip&can=2&q=
- -- 2. Recommended ROM is (U) (1.0) (!) but others should work but they are untested
- -- 3. Change options above and replace with true or false, RandomSeed is a number though, if it's a word, it's just random
- -- 4. In Snes9x, load ROM then go File -> Lua Scripting -> New Lua Script Window... -> Load file -> Press Run
- -- 5. You know you have loaded it right when the Lua Script window outputs what modes are on and what are false
- -- 6. If you have changed the options, you have to restart the script for it to take effect
- -- Newest version is always found at http://pastebin.com/qCGDbZZZ
- ------------------------------------------------
- ------------------------------------------------
- ------------------------------------------------
- ----------------Script starts here--------------
- ------------------------------------------------
- ------------------------------------------------
- ------------------------------------------------
- ------------------------------------------------
- ------------------------------------------------
- function table.contains(table, element)
- for i, value in pairs(table) do
- if value == element then
- valpos = i
- return true
- end
- end
- return false
- end
- function deepcopy(t)
- if type(t) ~= 'table' then return t end
- local mt = getmetatable(t)
- local res = {}
- for k,v in pairs(t) do
- if type(v) == 'table' then
- v = deepcopy(v)
- end
- res[k] = v
- end
- setmetatable(res,mt)
- return res
- end
- function removetable(tab,tab2)
- table.sort(tab)
- table.sort(tab2)
- rem = 0
- tabcopy = deepcopy(tab)
- for cy, value in ipairs(tab) do
- for cx, value2 in ipairs (tab2) do
- if value == value2 then
- table.remove(tabcopy,cy - rem)
- rem = rem + 1
- end
- end
- end
- return tabcopy
- end
- function convertstages(tablelist)
- for i, stg in pairs(tablelist) do
- worldnumber = math.floor(stg/10)
- levelnumber = stg - worldnumber*10
- realstagevalue = (worldnumber - 1)*12 + levelnumber - 1
- tablelist[i] = realstagevalue
- end
- end
- ------------------------------------------------
- ------------------------------------------------
- ------------------------------------------------
- print("Version 0.19")
- NumberOfEggs = NumberOfEggs*2
- eggcount = 0
- keycount = 0
- mouth_var = 0
- instage = 0
- enteredstage = 0
- laststage = 0
- lastworld = 0
- stage = 0
- levelsplayed = {}
- scrollerslist = {4, 53, 64} -- This can be changed to include or exclude other stages depending on how you define an autoscroller
- extralist = {8, 20, 32, 44, 56, 68}
- castlelist = {7, 19, 31, 43, 55}
- fortresslist = {3, 15, 27, 39, 51, 63}
- world1list = {0, 1, 2, 3, 4, 5, 6, 7, 8 }
- world2list = {12, 13, 14, 15, 16, 17, 18, 19, 20}
- world3list = {24, 25, 26, 27, 28 ,29, 30, 31, 32}
- world4list = {36, 37, 38, 39, 40, 41, 42, 43, 44}
- world5list = {48, 49, 50, 51, 52, 53, 54, 55, 56}
- world6list = {60, 61, 62, 63, 64, 65, 66, 68}
- stageslist = {0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 19, 20, 24, 25, 26, 27, 28 ,29, 30, 31, 32, 36, 37, 38, 39, 40, 41, 42, 43, 44, 48, 49, 50, 51, 52, 53, 54, 55, 56, 60, 61, 62, 63, 64, 65, 66, 68}
- -- Remove stages according to options
- if AutoScrollers == false then
- stageslist = removetable(stageslist, scrollerslist)
- end
- if ExtraStages == false then
- stageslist = removetable(stageslist, extralist)
- end
- if World1 == false then
- stageslist = removetable(stageslist, world1list)
- end
- if World2 == false then
- stageslist = removetable(stageslist, world2list)
- end
- if World3 == false then
- stageslist = removetable(stageslist, world3list)
- end
- if World4 == false then
- stageslist = removetable(stageslist, world4list)
- end
- if World5 == false then
- stageslist = removetable(stageslist, world5list)
- end
- if World6 == false then
- stageslist = removetable(stageslist, world6list)
- end
- if Fortresses == false or NormalFortressOrder == true then
- stageslist = removetable(stageslist, fortresslist)
- end
- if Castles == false or NormalCastleOrder == true then
- stageslist = removetable(stageslist, castlelist)
- end
- convertstages(ExcludeStages)
- stageslist = removetable(stageslist, ExcludeStages)
- castlelist = removetable(castlelist, ExcludeStages)
- fortresslist = removetable(fortresslist, ExcludeStages)
- --
- if RandomSeed ~= nil then
- math.randomseed(RandomSeed)
- end
- --
- ------------------------------------------------
- --------------------GAMEMODES-------------------
- ------------------------------------------------
- ------------------------------------------------
- if Level_Blitz == true then
- function LevelBlitz()
- levelamount = #stageslist
- stage = memory.readbyte(0x7E021A)
- stagenumber = memory.readbyte(0x7E1112) --//or memory.readbyte(0x7E112E)
- worldnumber= memory.readbyte(0x7E0218)
- overworld = memory.readbyte(0x7E0009)
- entering_stage = memory.readbyte(0x7E111D)
- titlescreen = memory.readbyte(0x7E011C)
- --
- if entering_stage == 1 and enteredstage == 0 and titlescreen == 12 then
- laststage = stagenumber
- lastworld = worldnumber
- if NormalFortressOrder == true and table.contains(fortresslist, laststage+lastworld*6) == true then
- randstage = fortresslist[math.random(1,#fortresslist)]
- elseif NormalCastleOrder == true and table.contains(castlelist, laststage+lastworld*6) == true then
- randstage = castlelist[math.random(1,#castlelist)]
- else
- randstage = stageslist[math.random(1,levelamount)]
- end
- memory.writebyte(0x7E021A,randstage )
- stagecompleted = stage + 1
- enteredstage = 1
- instage = 1
- print("Randomizes", randstage, " ", levelamount)
- elseif overworld == 126 then
- if SameStage == false and instage == 1 then
- table.insert(levelsplayed, stage)
- if NormalFortressOrder == true and table.contains(fortresslist, laststage+lastworld*6) == true then
- fortresslist = removetable(fortresslist, levelsplayed)
- elseif NormalCastleOrder == true and table.contains(castlelist, laststage+lastworld*6) == true then
- castlelist = removetable(castlelist, levelsplayed)
- else
- stageslist = removetable(stageslist, levelsplayed)
- end
- print(levelsplayed)
- print(stageslist)
- instage = 0
- levelsplayed = {}
- print("Removing Stage")
- end
- memory.writebyte(0x7E021A, laststage+lastworld*6)
- memory.writebyte(0x7E0218, lastworld) -- This is not needed? Kept just in case
- elseif overworld == 64 and entering_stage ~= 1 then
- enteredstage = 0
- end
- end
- print("Blitz Mode is ON")
- else
- function LevelBlitz()
- end
- print("Blitz Mode is OFF")
- end
- -----------------------------------------------
- ------------------------------------------------
- if NoLeftMode == true then
- function noleft()
- speed = memory.readwordsigned(0x7000B4)
- if speed < 0 and memory.readbyte(0x7000AC) == 0 then
- memory.writeword(0x7000B4,0)
- end
- end
- print("NoLeftMode is ON")
- else
- function noleft()
- end
- print("NoLeftMode is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- if DrunkMode == true then
- function drunk()
- if memory.readbyte(0x7E0118) == 16 or memory.readbyte(0x7E0118) == 57 then
- memory.writeword(0x701FE8, 0)
- else
- memory.writeword(0x701FE8, 10)
- end
- end
- print("Drunk Mode is ON")
- else
- function drunk()
- end
- print("Drunk Mode is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- if HardMode == true then
- timerreset = 1
- function hardmode()
- gamemode = memory.readbyte(0x7E0118)
- hit = memory.readbyte(0x701960)
- if hit == 85 and timerreset == 0 and gamemode == 15 then
- memory.writeword(0x7E03B6, 1)
- timerreset = 1
- elseif hit ~= 85 and timerreset == 1 then
- timerreset = 0
- memory.writeword(0x7E03B6, 100)
- end
- end
- print("Hard Mode is ON")
- else
- function hardmode()
- end
- print("Hard Mode is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- if ForceRetry == true then
- function forceretry()
- memory.writebyte(0x704094, 0)
- memory.writebyte(0x7E0379, 1)
- end
- print("Force Retry Mode is ON")
- else
- function forceretry()
- end
- print("Force Retry Mode is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- if DeathTimer == true then
- function deathtimer()
- startimer = memory.readword(0x7E03B6)
- gamemode = memory.readbyte(0x7E0118)
- if gamemode ~= 15 then
- die = 1
- end
- if startimer == 0 and die == 1 and gamemode == 15 then
- memory.writebyte(0x7000AC, 40)
- memory.writebyte(0x7001B0, 40)
- memory.writebyte(0x7001D2, 34)
- memory.writebyte(0x002140, 07)
- die = 0
- end
- end
- print("Death Timer Mode is ON")
- else
- function deathtimer()
- end
- print("Death Timer Mode is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- if AlwaysExtendedFlutter == true then
- function extendedflutter()
- mario = memory.readbyte(0x7E0205)
- if mario == 1 then
- memory.writebyte(0x7000D3, 128)
- end
- end
- print("Always Extended Flutter is ON")
- else
- function extendedflutter()
- end
- print("Always Extended Flutter is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- if NoTongue == true then
- function notongue()
- memory.writebyte(0x700162, 126)
- end
- print("No Tongue Mode is ON")
- else
- function notongue()
- end
- print("No Tongue Mode is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- if NoFlutter == true then
- function noflutter()
- memory.writebyte(0x7000D2, 0)
- end
- print("No Flutter Mode is ON")
- else
- function noflutter()
- end
- print("No Flutter Mode is OFF")
- end
- -------------------------------------------------
- ------------------------------------------------- -- Boss cutscenes are very slow, fix if people think it's a problem.
- if Velcro == true then
- function velcromode()
- if memory.readbyte(0x7000C0) == 0 and memory.readbyte(0x7E0118) == 15 and math.abs(memory.readwordsigned(0x7000B4)) > 20 then
- memory.writeword(0x7000B4,0)
- end
- end
- print("Velcro Mode is ON")
- else
- function velcromode()
- end
- print("Velcro Mode is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- if AlwaysFilledMouth == false then
- function mouthmode()
- end
- print("Always Filled Mouth is OFF")
- else
- if AlwaysFilledMouth == melon or AlwaysFilledMouth == melons or AlwaysFilledMouth == seeds or AlwaysFilledMouth == melonseeds or AlwaysFilledMouth == melonseed then
- mouth_var = 3
- end
- if AlwaysFilledMouth == bubble or AlwaysFilledMouth == bubbles then
- mouth_var = 2
- end
- function mouthmode()
- memory.writebyte(0x700162, 89)
- memory.writebyte(0x70016A, AlwaysFilledMouth)
- memory.writebyte(0x700170, 30)
- end
- print("Always Filled Mouth is ON")
- end
- -------------------------------------------------
- -------------------------------------------------
- if FullEggsStart == true then
- function eggstransitions()
- gamemode = memory.readbyte(0x7E0118)
- if gamemode == 12 then
- eggcount = memory.readbyte(0x7E5D98)
- for i = 0, eggcount, 2 do
- memory.writebyte(0x7E5D9A + i, memory.readbyte(0x7E5D9A + i))
- end
- for i = eggcount, NumberOfEggs, 2 do
- memory.writebyte(0x7E5D9A+i, EggType)
- end
- if eggcount > NumberOfEggs then
- memory.writebyte(0x7E5D98, eggcount)
- else
- memory.writebyte(0x7E5D98, NumberOfEggs)
- end
- end
- end
- print("Always Start With Full Eggs is ON -", NumberOfEggs/2, "eggs")
- else
- function eggstransitions()
- end
- print("Always Start With Full Eggs is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- if FastMode == true then
- speedmodifier = 1000 - SpeedBoost*100
- function fastmode()
- if memory.readbyte(0x7E0118) == 15 and memory.readbyte(0x7E0387) == 0 then
- speed = memory.readwordsigned(0x7000B4)
- xposition = memory.readwordsigned(0x70008c)
- memory.writeword(0x70008c, xposition + speed/speedmodifier)
- end
- end
- print("Fast Mode is ON - Speed:",SpeedBoost)
- else
- function fastmode()
- end
- print("Fast Mode is OFF")
- end
- -------------------------------------------------
- -------------------------------------------------
- ------------------MAIN---------------------------
- while true do
- --
- LevelBlitz()
- noleft()
- drunk()
- hardmode()
- deathtimer()
- forceretry()
- extendedflutter()
- notongue()
- noflutter()
- velcromode()
- mouthmode()
- eggstransitions()
- fastmode()
- --
- emu.frameadvance()
- end
- -- END MAIN --
- -- Yes I'm a bad programmer, I never really done anything before so I improvise and try to learn.
- -- Made by Arnethegreat - message me on #speedrunslive if you want anything
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement