Goomba Killing Achievement (SOLVED!)

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
KurttheKing
Bit
Bit
Posts: 78
Joined: Tue Mar 15, 2022 4:55 pm
Flair: Certified Nerd
Pronouns: He/Him
Contact:

Goomba Killing Achievement (SOLVED!)

Postby KurttheKing » Wed Feb 22, 2023 7:07 pm

How can I make an achievement that activates when I've killed a grand total of 100 Goombas?
Last edited by KurttheKing on Thu Feb 23, 2023 12:07 pm, edited 1 time in total.

KurttheKing
Bit
Bit
Posts: 78
Joined: Tue Mar 15, 2022 4:55 pm
Flair: Certified Nerd
Pronouns: He/Him
Contact:

Re: Goomba Killing Achievement (SOLVED!)

Postby KurttheKing » Thu Feb 23, 2023 12:07 pm

Nevermind. I figured it out!

Torterra18
Koopa
Koopa
Posts: 19
Joined: Fri Feb 03, 2023 9:43 am
Pronouns: he/him

Re: Goomba Killing Achievement (SOLVED!)

Postby Torterra18 » Fri Feb 24, 2023 8:48 am

KurttheKing98YT wrote:
Thu Feb 23, 2023 12:07 pm
Nevermind. I figured it out!
Tell me how you did it in excruciating detail

KurttheKing
Bit
Bit
Posts: 78
Joined: Tue Mar 15, 2022 4:55 pm
Flair: Certified Nerd
Pronouns: He/Him
Contact:

Re: Goomba Killing Achievement (SOLVED!)

Postby KurttheKing » Fri Feb 24, 2023 4:18 pm

Torterra18 wrote:
Fri Feb 24, 2023 8:48 am
Tell me how you did it in EXCRUCIATING detail

With pleasure! First, write the Achievement's info in ach-1.ini, located in the achievements file of your episode:

Code: Select all

name = "Goomba Destroyer"
desc = "Destroy 100 Goombas!"
condition-1 = 100
condition-1-desc = "Goombas Defeated:"
and then go to the Global Lunalua File and write the following:

Code: Select all

local ach1 = Achievements(1)

function onNPCKill(eventObj, killedNPC, killReason)
	if killedNPC.id == 1 then
		if killReason ~= HARM_TYPE_OFFSCREEN then
			ach1:progressCondition(1)
		end
	end
end
If I understand correctly, the way it all works is like this. First, we create a Variable to take the place of Achievement 1 (ach1), then we make an onNPCKill Function to check when a Goomba is killed using the code, "if killedNPC.id == 1 then" Afterwards, we check if the Goomba didn't die to Harm Type Off-Screen. This is so that the Goomba isn't considered to be dead when he falls down a hole or walks off-screen and despawns. Then we just need to advance the Achievement. To do this, we write ach1:progressCondition(1). What this does is first checks for what Achievement we are referring to (in this case Achievement 1 because ach1 takes it's place) and then progresses the condition in parentheses (1), which adds 1 to the amount of Goombas you killed. So everytime a Goomba is killed it adds on 1 until you kill 100 Goombas and will be given the Achievement.

I hope this helped and was filled with enough excruciating detail! :D

Torterra18
Koopa
Koopa
Posts: 19
Joined: Fri Feb 03, 2023 9:43 am
Pronouns: he/him

Re: Goomba Killing Achievement (SOLVED!)

Postby Torterra18 » Fri Feb 24, 2023 6:57 pm

KurttheKing wrote:
Fri Feb 24, 2023 4:18 pm
Torterra18 wrote:
Fri Feb 24, 2023 8:48 am
Tell me how you did it in EXCRUCIATING detail

With pleasure! First, write the Achievement's info in ach-1.ini, located in the achievements file of your episode:

Code: Select all

name = "Goomba Destroyer"
desc = "Destroy 100 Goombas!"
condition-1 = 100
condition-1-desc = "Goombas Defeated:"
and then go to the Global Lunalua File and write the following:

Code: Select all

local ach1 = Achievements(1)

function onNPCKill(eventObj, killedNPC, killReason)
	if killedNPC.id == 1 then
		if killReason ~= HARM_TYPE_OFFSCREEN then
			ach1:progressCondition(1)
		end
	end
end
If I understand correctly, the way it all works is like this. First, we create a Variable to take the place of Achievement 1 (ach1), then we make an onNPCKill Function to check when a Goomba is killed using the code, "if killedNPC.id == 1 then" Afterwards, we check if the Goomba didn't die to Harm Type Off-Screen. This is so that the Goomba isn't considered to be dead when he falls down a hole or walks off-screen and despawns. Then we just need to advance the Achievement. To do this, we write ach1:progressCondition(1). What this does is first checks for what Achievement we are referring to (in this case Achievement 1 because ach1 takes it's place) and then progresses the condition in parentheses (1), which adds 1 to the amount of Goombas you killed. So everytime a Goomba is killed it adds on 1 until you kill 100 Goombas and will be given the Achievement.

I hope this helped and was filled with enough excruciating detail! :D
OMG thx so much for the info!

KurttheKing
Bit
Bit
Posts: 78
Joined: Tue Mar 15, 2022 4:55 pm
Flair: Certified Nerd
Pronouns: He/Him
Contact:

Re: Goomba Killing Achievement (SOLVED!)

Postby KurttheKing » Fri Feb 24, 2023 10:25 pm

Torterra18 wrote:
Fri Feb 24, 2023 8:48 am
OMG thx so much for the info!

You're welcome! Glad I could help! :)


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari