Page 1 of 1

Is there a way to make Koopa Shells interact with Star Coins?

Posted: Sat Jan 08, 2022 12:33 pm
by Lucario
yay I'm back I guess

I have fond memories of NSMBWII 2-1, where to get the Third Star Coin, you needed to jump on a Parakoopa, pick up its shell and shoot it to the Star Coin. I'm making a desert themed level and I thought it'd be a good idea to make a Star Coin like that, as a nod to NSMBWII, to fuel nostalgia, to make the level interesting!

However, the shell doesn't interact with the Star Coin...

Sadly, this fun interaction doesn't exit in SMBX. So, I wanted to ask if there was a way to make a moving Koopa Shell and/or Buzzy Shell collect Star Coins? Thanks for reading, please answer and I rest my case here.

Re: Is there a way to make Koopa Shells interact with Star Coins?

Posted: Sat Jan 08, 2022 12:51 pm
by MECHDRAGON777
While this gif uses another NPC, I am sure I can cook something up that works with Shells. It is also a good excuse for me to reimplement that back into my episode.
Image

Re: Is there a way to make Koopa Shells interact with Star Coins?

Posted: Sat Jan 08, 2022 12:52 pm
by deice
give this code a try:

Code: Select all

local colliders = require("colliders")
local scai = require("npcs/ai/starcoin")

local valid_npc = { 5, 7, 24, 73, 113, 114, 115, 116, 172, 174 } -- add/remove npcs that you wish to be able to collect star coins with here

function onTick()
	for _, cc in ipairs(NPC.get(valid_npc)) do
		for _, coin in ipairs(NPC.get(310)) do
			if(cc ~= nil and coin ~= nil and colliders.collide(coin, cc)) then
				scai.collect(coin)
				coin:kill(HARM_TYPE_VANISH)
			end
		end
	end
end

Re: Is there a way to make Koopa Shells interact with Star Coins?

Posted: Mon Jan 10, 2022 6:30 am
by Lucario
Thanks a lot! I'll try it to see if it works! Again, thanks for helping me! :mrgreen:

Edit: It worked! Thanks again! I'm so happy!