Code: Select all
-- This initializes the SaveData.
SaveData.altJumpAvailable = SaveData.altJumpAvailable or false
SaveData.altRunAvailable = SaveData.altRunAvailable or false
SaveData.reserveAvailable = SaveData.reserveAvailable or false
-- This is recommended if you want to disable the reserve box, as it allows for hiding its graphics.
local hudoverride = require("hudoverride")
-- This allows the inputs if the corresponding SaveData is activated beforehand. If it's available, it'll make sure it's available. If not, it'll lock the input. onTick is NEEDED for locking inputs.
function onStart()
function onTick()
if SaveData.altJumpAvailable then
else
player.keys.altJump = nil
end
if SaveData.altRunAvailable then
else
player.keys.altRun = nil
end
if SaveData.reserveAvailable then
else
player.keys.dropItem = nil
player.reservePowerup = 0
hudoverride.visible.itembox = false
end
end
end
-- Change the names in quotation marks (such as "altJumpUnlocked") to whatever event you want to use to unlock each input.
function onEvent(eventName)
if eventName == "altJumpUnlocked" then
SaveData.altJumpAvailable = true
end
if eventName == "altRunUnlocked" then
SaveData.altRunAvailable = true
end
if eventName == "reserveUnlocked" then
SaveData.reserveAvailable = true
end
if eventName == "resetUnlocks" then
SaveData.altJumpAvailable = false
SaveData.altRunAvailable = false
SaveData.reserveAvailable = false
end
end
Added in 24 minutes 5 seconds:
Here's an example of how it works in action (with a controller overlay so you can see that yes, inputs are being enabled and disabled).
