Jump to content

Recommended Posts

I'm working on a character mod, and I'm trying to make her able to use a specific item in a way that none of the other characters can. I have all the code written out and right there, but I need to find the boolean value to go into the if statement I'm going to surround it with. This is my first mod, and I'm not very familiar with the way Don't Starve's code is laid out, so I don't know how to actually check it.

 

Usually, something like this would be named GetWorld().Player.identy() == myCharacter.identity(), or maybe Player.isInstanceOf(myCharacter). I just don't know what it would be in Don't Starve and I've been looking all afternoon and can't figure it out. Any help?

GetPlayer().prefab

I should probably elaborate a tiny bit:

if GetPlayer().prefab == <myprefabname> then

...

end

If you need to do this check a lot, near the top of your modmain add local is_<myprefabname> and use that in your checks.

Edited by Corrosive

--snip--

Thanks. This fixed it, and now it works! On the to the feature.

 

There's also a component called "playerspecific", it removes the item if the player isn't the one specified.

I'm aware of playerspecific, and it's not what I was looking for. The item I want to add the functionality to needs to be available to everyone. The item is an important component of many crafting recipes and naturally appears throughout the world, so it would be very bad to make it playerspecific.

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
×
  • Create New...