Copy basegame npcs? [Solved]

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

Moderator: Userbase Moderators

Turtle Guy
Buster Beetle
Buster Beetle
Posts: 83
Joined: Tue Sep 10, 2024 3:50 am
Flair: Spinysaurus
Pronouns: he/him/hem
Contact:

Copy basegame npcs? [Solved]

Postby Turtle Guy » Mon Oct 07, 2024 12:42 pm

I want to make two copies of the basegame boo with difrent textures. How do i do that?
Last edited by Turtle Guy on Thu Oct 10, 2024 10:47 am, edited 1 time in total.

mariobrigade2018
Rocky Wrench
Rocky Wrench
Posts: 646
Joined: Wed May 24, 2023 7:00 pm
Flair: OK in coding who dreams of making a Mario game
Pronouns: he/him

Re: Copy basegame npcs?

Postby mariobrigade2018 » Mon Oct 07, 2024 1:05 pm

If the boo will act the same as normal, then you just need custom graphics.

Retro
2025 Egg Hunter
2025 Egg Hunter
Posts: 343
Joined: Thu Jul 25, 2024 5:34 am
Flair: fish
Pronouns: i identify as sand

Re: Copy basegame npcs?

Postby Retro » Mon Oct 07, 2024 1:23 pm

Turtle Guy wrote:
Mon Oct 07, 2024 12:42 pm
I want to make two copies of the basegame boo with difrent textures. How do i do that?
Unfortunatley, you can't copy nor make 2 boos in your desired episode/level. Afterall, there are some workarounds that might help you solve this problem (example: you could use SMB3 and SMW boos to change one of them and the other with the original sprite from the changed one. Not All of them is like this.)

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

Re: Copy basegame npcs?

Postby deice » Tue Oct 08, 2024 6:55 am

if you need to replicate basegame behavior within a custom range npc, your only real option is to go here, search for instances of

Code: Select all

.Type = <id>
(where <id> is the id you're trying to copy) and manually interpret and translate all the logic into lua code. not an easy undertaking for sure, so instead i'd recommend simply changing the graphics for the basegame npc as you need to.

even if you want the version with custom graphics to show up in the same level as the unchanged basegame npc, it still might be possible without a custom npc by manually drawing a custom sprite over specific instances of the normal npc, though this isn't super simple either, so it'd be good to know your exact use case.

Turtle Guy
Buster Beetle
Buster Beetle
Posts: 83
Joined: Tue Sep 10, 2024 3:50 am
Flair: Spinysaurus
Pronouns: he/him/hem
Contact:

Re: Copy basegame npcs?

Postby Turtle Guy » Tue Oct 08, 2024 9:25 am

mariobrigade2018 wrote:
Mon Oct 07, 2024 1:05 pm
If the boo will act the same as normal, then you just need custom graphics.
Well okay I can retexture the SMB3 boo, but I'm still 1 npc short

mariobrigade2018
Rocky Wrench
Rocky Wrench
Posts: 646
Joined: Wed May 24, 2023 7:00 pm
Flair: OK in coding who dreams of making a Mario game
Pronouns: he/him

Re: Copy basegame npcs?

Postby mariobrigade2018 » Tue Oct 08, 2024 9:35 am

Turtle Guy wrote:
Tue Oct 08, 2024 9:25 am
mariobrigade2018 wrote:
Mon Oct 07, 2024 1:05 pm
If the boo will act the same as normal, then you just need custom graphics.
Well okay I can retexture the SMB3 boo, but I'm still 1 npc short
1 npc short of what? Another boo NPC? There is also the SMW boo, if you want to retextue that.

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

Re: Copy basegame npcs?

Postby Emral » Tue Oct 08, 2024 10:22 am

for boo specifically you could use boo.lua in the scripts folder.
make a copy of the "reverse boo" npc (586) in the custom range (copy and rename the lua file).
Change the condition function:
Reverse boo:

Code: Select all

local function conditionFunction(v)
	local centerX = v.x + 0.5 * v.width
	for k,p in ipairs(Player.get()) do
		if math.sign(p.x + p.width * 0.5 - centerX) ~= p.direction and not p:mem(0x50,FIELD_BOOL) then
			return p
		end
	end
	return false
end
Regular boo:

Code: Select all

local function conditionFunction(v)
	local centerX = v.x + 0.5 * v.width
	for k,p in ipairs(Player.get()) do
		if math.sign(p.x + p.width * 0.5 - centerX) == p.direction and not p:mem(0x50,FIELD_BOOL) then
			return p
		end
	end
	return false
end


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari