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!
