-- name: Coin Requirement Modifier -- description: Change the requirement of the 100 coin and red coin stars with these 3 commands!\n\n/coin [number] to change 100 coin star requirement\n\n/redcoin [number] to change red coin star requirement\n\n/resetcoins to reset both coin star requirements\n\nOnly the host can run these commands\n\nMod created by Dragonary -- Create gGlobalSyncTable Fields gGlobalSyncTable.coinsRequiredForCoinStar = gLevelValues.coinsRequiredForCoinStar gGlobalSyncTable.redCoinsRequired = 8 -- 100 Coin Star function coin(n) local value = tonumber(n) if value == nil then djui_chat_message_create("Invalid number") return true end value = math.floor(value) if value < 1 then djui_chat_message_create("Value must be at least 1") return true end if value > 999 then value = 999 end if network_is_server() then gGlobalSyncTable.coinsRequiredForCoinStar = value djui_chat_message_create("Coin requirement set to " .. tostring(value)) return true else djui_chat_message_create("You cannot run this command") return true end end function on_coin_change(tag, oldVal, newVal) gLevelValues.coinsRequiredForCoinStar = newVal end hook_on_sync_table_change(gGlobalSyncTable, "coinsRequiredForCoinStar", "coins", on_coin_change) hook_chat_command("coin", "[number] - Change number of coins needed for 100 coin star", coin) -- Red Coin Star function redcoin(n) local value = tonumber(n) if value == nil then djui_chat_message_create("Invalid number") return true end value = math.floor(value) if value < 1 then djui_chat_message_create("Value must be at least 1") return true end if value > 99 then value = 99 end if network_is_server() then gGlobalSyncTable.redCoinsRequired = value djui_chat_message_create("Red coin requirement set to " .. tostring(value)) return true else djui_chat_message_create("You cannot run this command") return true end end hook_chat_command("redcoin", "[number] - Change number of red coins needed for the star", redcoin) ---@param obj Object function bhv_custom_red_coin_star_loop(obj) if obj.oHiddenStarTriggerCounter >= gGlobalSyncTable.redCoinsRequired then obj.oAction = 1 end end hook_behavior(id_bhvHiddenRedCoinStar, OBJ_LIST_LEVEL, false, nil, bhv_custom_red_coin_star_loop) hook_behavior(id_bhvBowserCourseRedCoinStar, OBJ_LIST_LEVEL, false, nil, bhv_custom_red_coin_star_loop) -- Reset Both Coin Star Requirements function resetcoins() if network_is_server() then gGlobalSyncTable.coinsRequiredForCoinStar = 100 gGlobalSyncTable.redCoinsRequired = 8 djui_chat_message_create("Coin requirements have been reset") return true else djui_chat_message_create("You cannot run this command") return false end end hook_chat_command("resetcoins", "Reset both coin star requirements", resetcoins)