-- name: Global 100 Coin Star Script -- description: A script that allows the 100 coin star to spawn in non main levels like HUB Worlds, The Bowser Levels or Secret Levels.\n\nScript by B. Bones Johnson w/ the help of Dzeigh and xLuigiGamerx --Here is the script's code, I tried to document it the best I can -Bones --This is the level table, it contains a list of all of the non main course in which the 100 coin star can spawn in. --You can add or remove levels as you wish. local levelTable = { --Overworld/HUB levels [LEVEL_CASTLE_GROUNDS] = true, [LEVEL_CASTLE] = true, [LEVEL_CASTLE_COURTYARD] = true, --Secret Levels [LEVEL_PSS] = true, [LEVEL_WMOTR] = true, [LEVEL_SA] = true, [LEVEL_ENDING] = true, --For those unaware, the end cake screen CAN be replaced with a custom level if you wish! that's why this is here. --Cap Levels [LEVEL_TOTWC] = true, [LEVEL_VCUTM] = true, [LEVEL_COTMC] = true, --Bowser Levels [LEVEL_BITDW] = true, [LEVEL_BITFS] = true, [LEVEL_BITS] = true, --Bowser Fight Levels [LEVEL_BOWSER_1] = true, [LEVEL_BOWSER_2] = true, [LEVEL_BOWSER_3] = true, } --We store the previous number of coins after another is collected as a safety check local prev_numCoins = 0 hook_event(HOOK_ALLOW_INTERACT, function(m, obj, inter_type) if inter_type == INTERACT_COIN then prev_numCoins = m.numCoins end return true end) --The main function of the coin spawn script hook_event(HOOK_ON_INTERACT, function(m, obj, inter_type, value) for i = 0, MAX_PLAYERS - 1 do local np = gNetworkPlayers[i] --Run code for all connected players --[[Uncomment these attributes if you don't want the 100 coin star to respawn after it's been collected once, it's an optional feature -Bones local courseIndex = np.currCourseNum - COURSE_MIN local starFlags = save_file_get_star_flags(get_current_save_file_num() - 1, courseIndex) if (starFlags & (1 << 6)) ~= 0 then return end ]]-- if inter_type == INTERACT_COIN then local numcoins = m.numCoins --Current Number of coins local required = gLevelValues.coinsRequiredForCoinStar --Required amount of coins for star to spawn if levelTable[np.currLevelNum] then --Don't run script if the current level isn't on the table. --djui_chat_message_create("yes spawn") --Debug Message if numcoins >= required and prev_numCoins < required then --if m.controller.buttonDown & X_BUTTON ~= 0 then --Debug Test bhv_spawn_star_no_level_exit(m.marioObj, 6, 1) --Spawns 100 Coin Star end end end end end)