Page 1 of 1

How to check if a player has collected enough star coins when entering a warp

Posted: Tue Dec 24, 2024 10:06 pm
by zekene20
I am wondering if there's a way to check if I can block a player from entering a warp if he does not have the required star coins. I know you can do it with Power Stars, but I wanted to use star coins instead.

Re: How to check if a player has collected enough star coins when entering a warp

Posted: Sun Mar 16, 2025 2:05 pm
by proCoder
I suppose you could do this:

Code: Select all

local starCoinsTotal = 3 -- Replace with how many star coins you placed in the editor
local starCoinsCollected = starCoinsTotal - #NPC.get(310)
But I don't actually know how to block the player from using a warp.
You could spawn some blocks to block the warp and then remove them when the player
gets enough, But if you want to do it without that I've got nothing.

Re: How to check if a player has collected enough star coins when entering a warp

Posted: Fri Aug 08, 2025 6:14 am
by Gaming-Dojo
Generally, there should be 3 ways to block warps for the player:

1. set entranceHeight and entranceWidth to 0
2. set locked property of warp to yes
3. set starsRequired to a very high number

I think the first option is best spontaneously as I think there are downsides to the other two options which doesn't apply to the first method, you just might want to draw an indicator next to the warp entrance so the player knows how much star coins are needed. However, I will do some tests when I'm at home and reply again when I have new results.

Re: How to check if a player has collected enough star coins when entering a warp

Posted: Fri Aug 08, 2025 8:05 am
by deice
Gaming-Dojo wrote:
Fri Aug 08, 2025 6:14 am
1. set entranceHeight and entranceWidth to 0
2. set locked property of warp to yes
3. set starsRequired to a very high number
besides this being a massive necrobump for a problem that the op is not that likely to still be interested in, none of these are good ways to disable warps. the cleanest method is to put the warp in its own layer and then hide/show that layer as necessary.
1. setting a warp's entrance size to 0 has the potential to cause certain bugs and is generally not elegant
2. a locked warp signals to the player that they need a key, rather than a different collectible (in this case star coins), not to mention it doesn't work for areas where the player might have access to a key
3. a warp blocked behind a star requirement also signals to the player that they need something completely different, making 2 and 3 both unnecessarily confusing

Re: How to check if a player has collected enough star coins when entering a warp

Posted: Fri Aug 08, 2025 8:32 am
by Gaming-Dojo
Thanks for the insights and the idea with layers. I didn't know that setting width and height of warp entrance is buggy. I thought about method 2 messing with keys but didn't think it were that severe, esp if keys aren't used otherwise in the episode. I also thought 3 to be confusing but thought there might be a way to disable the star message and sign. However I added them anyways for completions sake.