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

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

Lucario
Blooper
Blooper
Posts: 172
Joined: Thu Dec 10, 2020 11:54 am
Flair: A beginner Mario-level modder that also uses SMBX.
Pronouns: He/him/

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

Postby Lucario » Sat Jan 08, 2022 12:33 pm

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.

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6422
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Contact:

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

Postby MECHDRAGON777 » Sat Jan 08, 2022 12:51 pm

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

deice
Rocky Wrench
Rocky Wrench
Posts: 638
Joined: Fri Jul 23, 2021 7:35 am

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

Postby deice » Sat Jan 08, 2022 12:52 pm

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

Lucario
Blooper
Blooper
Posts: 172
Joined: Thu Dec 10, 2020 11:54 am
Flair: A beginner Mario-level modder that also uses SMBX.
Pronouns: He/him/

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

Postby Lucario » Mon Jan 10, 2022 6:30 am

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!


Return to “LunaLua Help”

Who is online

Users browsing this forum: Semrush [Bot] and 5 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari