Jump to content

Making a character upgrade with gears


Recommended Posts

I need to make a mod character of mine upgrade when he eats gears like WX-78 does. I looked at WX-78's files but I don't know what exactly I should do to make my character upgrade like WX-78.

 

-What do I need to put in my modmain.lua, if anything,

 

-What do I need to put in my prefab script?

 

-Anything else that needs adding?

 

I want to let my character eat gears without letting all of the characters eat gears.

Link to comment
Share on other sites

In modmain.lua, nothing.

 

In your prefab:

local function oneat(inst, food)   -- apply upgrades to my characterendinst.components.eater:SetCanEatGears()inst.components.eater:SetOnEatFn(oneat)

is the basics.

 

Anything else? Well, something to store your character upgrades, like levels.

Link to comment
Share on other sites

You should aim for making your character without levels and upgrades, and then adding them.

Or your prefab without the wx78 stuff runs nicely?

 

I would suggest downloading any character mod and looking at it.

In your fn, you put things you didn't use, like OnLoad.

Also,

MakePlayerCharacter("wc81", prefabs, assets, fn)

fn would be common_postinit in the average character prefab, you will need a master_postinit.

 

Also, please post your log.txt in DoNotStarveTogether, I presume your error is an assert c++ error after you copy pasted wx78 build anim and renamed the zip into wc81. You need to edit the ID of the build or else the game will crash because you can't upload two builds with the same ID.

Edited by DarkXero
Link to comment
Share on other sites

I made a version of my character that didn't have levels or upgrades before this. It works just fine still. The build already has the proper ID, it did with the broken version too. I have attached the prefab file from the working version. I just need to know exactly what to add and where, so that my character can eat gears and upgrade from them, while being able to save the upgrades. This prefab is from a working version, without anything added for upgrading or saving the upgrades.

wc81.lua

Link to comment
Share on other sites

I noticed just now I am in the wrong forum. I feel like such a n00b.

 

I don't need DST compatibility just yet.

That might be why when I put your new file in place of the one I had,

Don't Starve freezes up at the title screen. Hm.

Also I don't need that little bit about the ghost asset yet.

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...