How do you make a custom npc die after a certain amount of frames?

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

Moderator: Userbase Moderators

AlanLive2020
Buster Beetle
Buster Beetle
Posts: 98
Joined: Fri Nov 27, 2020 8:15 am
Flair: The guy with no social skills or self-esteem :')

How do you make a custom npc die after a certain amount of frames?

Postby AlanLive2020 » Tue Dec 28, 2021 7:14 pm

When i do it, all of the npcs with the same id die at the same time. Can anyone help?

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

Re: How do you make a custom npc die after a certain amount of frames?

Postby deice » Wed Dec 29, 2021 6:12 am

if i'm understanding you correctly, you're trying to only make a specific instance of said npc die after a certain amount of frames elapse.
if you're not well-acquainted with custom npcs, i recommend looking at "npc-n.lua" in "data/_templates".

to accomplish what you've described, simply declare a local timer variable equal to the amount of frames, decrement it in onTickNPC() and call kill() when it reaches 0.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 5 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari