Duplicating an NPC's settings for a custom one

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
vee_Sleepy
Fighter Fly
Fighter Fly
Posts: 40
Joined: Tue Nov 29, 2022 7:15 pm
Flair: oh worm?
Pronouns: they/it

Duplicating an NPC's settings for a custom one

Postby vee_Sleepy » Tue May 23, 2023 3:43 pm

i was wondering if it's possible to create a custom NPC that's effectively the same as an existing one, in behavior and such, but that can be modified separately
to give an example relevant to a project of mine, and why i'm asking at all: i want to have a Pokey boss at the end of a castle level, but i want said level to also contain normal Pokeys as enemies, working as they usually do
Pokeys, as far as i've searched, don't have a base .lua file to look into, so i can't just copy their code to a new NPC with all the settings i want, at least not as easily as I could've if they did have a .lua
any ideas on what i can do?

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9720
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Duplicating an NPC's settings for a custom one

Postby Emral » Tue May 23, 2023 8:01 pm

When it comes to recreating redigit's npcs your best bet is to use references to that NPC's ID in the source code
movement logic (onTickNPC)
change the below segment's frame (NPC.getIntersecting)
special cliffturn logic (might not be necessary)
animation (onDrawNPC)

Transcribe the logic into an NPC in the custom range. This guide might help with that. Though since the variables in source code are differently named and the syntax is different too, it can be a bit of a headache.
A lot of redigit's npcs also heavily rely on NPC config. Pokey most importantly seems to use cliffturn, playerblocktop and grabtop.

vee_Sleepy
Fighter Fly
Fighter Fly
Posts: 40
Joined: Tue Nov 29, 2022 7:15 pm
Flair: oh worm?
Pronouns: they/it

Re: Duplicating an NPC's settings for a custom one

Postby vee_Sleepy » Tue May 23, 2023 8:19 pm

i had seen someone made a unique SMW Pokey, so i thought to use that for normal enemy Pokeys and redesign the default redigit Pokey as my boss
i'm really impatient for learning to code, and i'm alredy trying to do that for Godot's gdscript, so y'know "Work smarter, not harder"


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari