Jump to content

How to understand API on my own?


palpita

Recommended Posts

TL;DR what's the best resource for learning virtually ANYTHING I'd want to do without just asking "how to do X"? In terms of Don't Starve modding of course.

First of all, I should probably tell that I know quite a few programming languages and I love programming, so that part is done, at least for this case. I never used lua before, although I've read some samples already, and as I understand most of the code, since it's syntax is really simple, and code in general is self explanatory, I couldn't really do anything else than what wasn't provided in examples though...

My issue here is, where do I pull out other examples from? I know that DS engine is written in C++, and that most things that are ingame are actually scripted using lua, so, you could say that most of the game is written in the "modding api"? If so, how can I look at the code of don't starve? I'd prefer if there was documentation of most common things, but oh well, code will do too.

I don't know if it matters, but I want to learn how to write a mod that is compatible in any version, other than DST, basically base game and two expansions, RoG and Shipwrecked.

So now I want to add these things:

Base game modification:

  • Mining a common plain boulder, on every hit, will give player one sanity (affecting stats during interaction);
  • On last hit, when boulder is destroyed, by player, player loses 5hp (affecting stats during destroy event, I guess);
  • There's a chance that rock drops any gem, but gem replaces one of flint or rock piece, also there's a chance for additional gem to drop that doesn't do that (typical dropping from destroyed structure or well resource);

RoG modification:

  • Same things as base, just applied to glacier, doesn't really matter, just to confirm that it works in RoG;

Shipwrecked modification:

  • Limpet rocks have a chance to give Fish Morsel instead of limpets, just cause. (Overriding how existing thing works entirely)


That's just for learning, by the way, how do I know if it would even work? Especially the part where player mines boulder and their stats are changed, maybe there's a thing that is triggered on action (since magma piles in shipwrecked drop items even before being fully mined) in the object itself? Or would I have to make the tool affect the player only if it interacts with x thing?

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...