Jump to content

Character Transformation from eating certain food


Recommended Posts

Hello! So I wanted to make my own character (his all done for now if it goes to working and naming and now I'm working on textures) So I wanted to make him change into a monster when he eats nightmare fuel, what can I do to achieve my goal? Thanks for any tips!

Link to comment
Share on other sites

Hi. Here's how to transform after eating.

(mod->scripts->prefabs->[your.character's.name].lua)
Paste this above master_postinit

local function pastalavista(inst, food)	
	if inst.components.eater and food.prefab == "dragonfruit" then
		if not inst.transformed then	
			inst.AnimState:SetBuild("merm_build")
			inst.AnimState:SetBank("pigman")			
		else
			inst.AnimState:SetBuild("[your.character's.name]")
			inst.AnimState:SetBank("wilson")
		end
	end	
	inst.transformed = not inst.transformed	
	return true
end

and of course change this:

Quote

inst.AnimState:SetBuild("[your.character's.name]")

into adequate name of your character without square brackets.


Inside master_postinit

	inst.components.eater:SetOnEatFn(pastalavista)


This perk will give you ability of transformation into merm after consuming dragonfruit. You can change it according to your preferences.

You need to know that most of in-game monsters will miss some animations, for example merm can attack but when you try to gather some grass your character will disappear for a moment and come back when action is completed.

I have used dragonfruit as a food because nightmare fuel is not a food. You can use this thread as a help with turning nightmare fuel into edible stuff. It might require some adjustments with the code I have sent.

I know my English is chaotic and overall bad, so if you need me to explain something again or deeper, just let me know in comment.
Have fun with modding!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...