while this might work, i have to recommend against as it would mandate putting each star coin in its own section due to the way vanilla smbx keeps track of collected stars.
instead, you'd be better off creating an individual layer for each distinct star coin requirement and putting each corresponding warp into it (for example, every warp that leads to a level that needs 30 star coins would be in the layer "starCoin30"), having each layer be hidden by default
then, putting something like this in your hub's luna.lua file should do the trick (assuming no star coins can be collected inside the hub itself):
Code: Select all
local layerPrefix = "starCoin" -- change this according to the common prefix of your layer names
function onStart()
for _, v in ipairs(Layer.find(layerPrefix)) do
local reqCoins = tonumber(string.sub(v.name, string.len(layerPrefix) + 1))
if(SaveData._basegame.starcoinCounter and SaveData._basegame.starcoinCounter >= reqCoins) then
v:show(true)
end
end
end