Page 1 of 1

Killevent for Koopa Troopas (id4)?

Posted: Mon Jan 01, 2018 3:32 pm
by seiteom
Hi!

I am using LunaLua to make a few changes to NPC id=4, the koopa troopas. Succeeded overall, but not figured out how to deal with the onNPCKill () event for these creatures. Seems that if you jump on them, they actually have no kill event. Are they turned into shells instead (id 5)? If so, are there any offset values that indicate this shift? Put simply, I want to be able to cancel any kill event and allow the koopa troopas better health. I've tried to turn any new shells into koopa troopas (NPC.id=4), but am not entirely happy with the results.

Hope someone knows a resolution.

Best /A

Re: Killevent for Koopa Troopas (id4)?

Posted: Mon Jan 01, 2018 3:35 pm
by Emral
I suggest using a non-koopa npc that dies when jumped on as your koopa replacement and then turning it into a shell manually once the excess HP has been depleted. You could use the SMB1 goombas, for example. It requires a bit of manipulating NPC txt files, but there's currently no way to easily find that ID change. There are solutions, but they're much more complex and prone to error than using a different ID for the walking koopa.

Re: Killevent for Koopa Troopas (id4)?

Posted: Mon Jan 01, 2018 5:11 pm
by seiteom
Thank you for your reply, Enji! Yes, I think you are right - better to fall back on an easier solution than to overwork a more complicated one.

Out of curiosity, and if you have time, could you please hint at the complicated way to - I assume - identify the koopa to shell shift? Always eager to learn new things about Lua.

Re: Killevent for Koopa Troopas (id4)?

Posted: Mon Jan 01, 2018 7:14 pm
by Emral
seiteom wrote:Thank you for your reply, Enji! Yes, I think you are right - better to fall back on an easier solution than to overwork a more complicated one.

Out of curiosity, and if you have time, could you please hint at the complicated way to - I assume - identify the koopa to shell shift? Always eager to learn new things about Lua.
You can check the HP variable of the koopa after it transformed by constantly being on the lookout for that variable when looping over all shells (and then immediately transforming them back as you catch one). It's incredibly wasteful performance-wise and seems like the kind of solution that has a dozen warnings attached to it beyond that.