Edit: Finally got the code working after hours of trial and error. Functional code below, for anyone interested.
(Note: Wing cap only gets added/removed when entering a loading zone.)
(Note: Wing cap only gets added/removed when entering a loading zone.)
LUA:
local wingCapBool = mod_storage_load_bool("wingCheckbox")
local function wingCapToggle(_, value)
wingCapBool = value
mod_storage_save_bool("wingCheckbox", value)
end
--checks whether or not Mario already spawns with any caps to prevent bugs in special stages
local function on_level_init()
if wingCapBool == true and (gMarioStates[0].flags & MARIO_WING_CAP) == 0 then
gMarioStates[0].flags = gMarioStates[0].flags + MARIO_WING_CAP
end
end
hook_event(HOOK_ON_LEVEL_INIT, on_level_init)
hook_mod_menu_checkbox("Wing Cap", wingCapBool, wingCapToggle)
YO! I'd like to make a mod menu for sm64coopdx which enables each of the cap power-ups, but I can't seem to get the checkboxes to actually do anything and desperately need assistance.
The code for the wing cap works perfectly fine, it's just that I have no idea how to tell the game to use the checkbox to evaluate whether or not they should appear.
Here's the cut-down version (without metal and vanish cap):
Any help at all would be very much appreciated :>
The code for the wing cap works perfectly fine, it's just that I have no idea how to tell the game to use the checkbox to evaluate whether or not they should appear.
Here's the cut-down version (without metal and vanish cap):
LUA:
local wingcapbool = false
local function wingcapToggle(index, value)
if index == 0 then
wingcapbool = value
end
end
if wingcapbool == true then
local function give_wingcap(m, flags)
if (m.flags & MARIO_WING_CAP) == 0 then
m.flags = m.flags + MARIO_WING_CAP
end
end
hook_event(HOOK_MARIO_UPDATE, give_wingcap)
end
hook_mod_menu_checkbox("Wing Cap", false, wingcapToggle)
Last edited: