Jump to content

Recommended Posts

How would I modify the set pieces to generate in survival? (hound mound field) I looked everywhere but I couldn't figure it out >.<

Override scripts\map\levels.luaThe "hound mound field" is a task called "HoundFields"You could either add that to tasks in one of the Levels in free_levels if you want to make it always generate, or optionaltasks if you want to to generate occasionally. You can also create your own level preset by adding another Level object into free_tasks, even just by copying and pasting and changing the ID, and then manipulating the fields how you want.I don't know if there's a way to change that without overriding the whole file, so it will not coexist with any mod that also tries to do the same thing.

Yeah, you can't just put GetWorldEntityUnderMouse into the prefab's initialization function. That only runs once when the prefab is created. It's crashing because most of the time you are getting nil, since nothing is under your mouse. Also, the keyword local in that example has no business being there. local defines a variable's scope, but you're not defining a variable, you're doing a comparison. Essentially that line is saying "local false" because TheInput:GetWorldEntityUnderMouse() is going to return an Entity, and FLOWER is probably undeclared. You'll probabaly get a crash saying that you're trying to operate on FLOWER which is undeclared

To stop it from crashing you could do something like:

entity = TheInput:GetWorldEntityUnderMouse()

if entity.name and entity.name == STRINGS.NAMES.FLOWER then

--do something

end

However, again, it will only do that check a single time, when the prefab is initialized.

What you want to look at, if you want the cane to do things when you click on them is to create a component that handles those actions and add that component to the prefab.

Look at how CollectUseActions, CollectEquippedActions, CollectInventoryActions, CollectSceneActions etc. get used by existing prefabs.

The way I would do it would be:

In the prefab, I'd add a component called "caner"

In the caner component I would test the target, depending on the target I would assign a different action.

Any action that's not defined I'd try to define in ACTIONS from modmain.lua

I haven't done this so I couldn't give you step by step instructions.

Thanks man, I appreciate you picking your brain on this. About the first thing I tried was entity = TheInput:GetWorldEntityUnderMouse(), but it still was a nil value and crashed.

I've learned to hate the way this game is programmed (quite well, but un-bending and seemingly very convoluted). In my first attempt at this (weeks ago, now) I went with 'target', thinking it made perfect sense, but guess what? You can't use 'target' with AddComponent("tool") (not a valid use!). I spent an afternoon digging into files to find that out and you have to use 'tool' go be able to chop/mine/dig.

Quite early in the process I was able to give the cane a chop/mine/dig use, but not at the same time and depending what your 'target' was. That's why I'm trying just to get a freakin' if statement in there.

Anyway, thanks, but I've wasted enough of yours and my time on this. Moving on for now.:black_eyed:

[MENTION=55]Ipsquiggle[/MENTION]The cave wall textures have bugged me a bit since they were released since the texture is stretched about 7 times higher than it is wide. I have created a new texture that I would otherwise like to release as a mod, but since it requires overriding files in data\levels\tiles I don't think I can do that. Will this be something that could be possible in the future?Also, is it against the rules to post files with instructions to replace things in the data folder?post-38597-13764594761539_thumb.png

Wow, big improvement!

[MENTION=55]Ipsquiggle[/MENTION]The cave wall textures have bugged me a bit since they were released since the texture is stretched about 7 times higher than it is wide. I have created a new texture that I would otherwise like to release as a mod, but since it requires overriding files in data\levels\tiles I don't think I can do that. Will this be something that could be possible in the future?Also, is it against the rules to post files with instructions to replace things in the data folder?[ATTACH=CONFIG]8342[/ATTACH]

  • Developer

Yeah, no worries creating your own data to override ours with. That's what modding is all about! :) We try to make it possible to do from the mods folder, but sometimes overwriting the game data is what it takes.One of the main focuses of this upcoming release is going to be to make overriding assets from the mods folder work better/easier, it should be as simple as just supplying the file in a mod folder in the same path and register the asset. :) Coming soon!

  • Developer

@Ipsquiggle

Is there a limit to the world size we can set in files?

I set the world to 1000x1000 it generates and works you can save game on that size of the world, but it will always crush on load time for some reason.

There's no hard limits that I know of, just computer memory and system stability. 1000x1000 is pretty honkin' huge, I'd estimate about a half a million entities get spawned in a world that size (depending on terrain). The game just isn't built to handle that kind of load. :)
  • Developer

So, @Ipsquiggle, is there something in the works so we don't have to load ModLib for the more complex mods that use custom animation files? It's quite a pain...

Gah. I didn't even know that ModLib existed! :(

I'll investigate and see what exactly it does for you and how I can work that into the standard game. Much of this, though, are the exact kinds of things I'm trying to make easier this release. Thanks for pointing this out! :) There will be a new build on the test server quite soon so you can start checking it out.

  • Developer

So, @Ipsquiggle, is there something in the works so we don't have to load ModLib for the more complex mods that use custom animation files? It's quite a pain...

Just realized I didn't answer your question.

Yes, even more of the functionality of ModLib has made its way into the game. The only thing left that I can see is the texture container backgrounds, and the various constants for tab and inventory bars. (Which are both on my todo list.)

The overall problem is just the iterative process of fixing hard-coded paths, extracting constants, etc. is kind of inherently a bit-by-bit process. I'm working through making more stuff accessible, but I suspect you folks will always stay a step ahead of me, and so ModLib will continue to be a thing for a while.

In general these kinds of changes are very easy, it's more just that I need to know to make them. I'll make a thread where everyone can point out these sorts of problems as they come across them.

Hello there ^_^I just wonder how to add some texture pack to Don't starve, I'm really suck at coding / programming, no way I can understand , It's like teaching grandma how to drift a car they way I use for now is directly replace the something.zip under the anim filescan I just drop the.zip files at mod files and it change the anim file

[MENTION=23254]Lexicroft[/MENTION]Right now, no. Later, maybe?In post 132 he's saying that it should be easier to do that sort of thing in the future, but whether it means just dropping it in the anim folder of a mod, or whether it means doing that and editing a prefabs.xml file, I'm not sure.

Sweet. Yeah, the Maxwell's Chest mod I just made took everything I had to pull off, from reworking the Chest ANIM file to editing the BIN file hex code to the new name and adding my own texture to the back of the new chest (that's where ModLib comes in). Not for the faint of heart...

Just realized I didn't answer your question.Yes, even more of the functionality of ModLib has made its way into the game. The only thing left that I can see is the texture container backgrounds, and the various constants for tab and inventory bars. (Which are both on my todo list.)The overall problem is just the iterative process of fixing hard-coded paths, extracting constants, etc. is kind of inherently a bit-by-bit process. I'm working through making more stuff accessible, but I suspect you folks will always stay a step ahead of me, and so ModLib will continue to be a thing for a while.In general these kinds of changes are very easy, it's more just that I need to know to make them. I'll make a thread where everyone can point out these sorts of problems as they come across them.

Could you maybe add more funtionality to fishable? So its similary to Lootdropper.So take for sample you want to make a beehive fishable and you want the "fish" to be random( you never know what you find down there :p)If it was loot dropper you would do fx. this:

inst.components.lootdropper:AddRandomLoot("bee", .8) inst.components.lootdropper:AddRandomLoot("killerbee", 1) inst.components.lootdropper:AddRandomLoot("honey", .1) inst.components.lootdropper.numrandomloot = 1

But in fishable you would have to make a varible. and the define it which is a mess.

inst.components.fishable:AddFish("FISHVARIBLE")

I would be easier if it was like this:

inst.components.fishable:AddRandomFish("bee", .8) inst.components.fishable:AddRandomFish("killerbee", 1) inst.components.fishable:AddRandomFish("honey", .1) inst.components.fishable.numrandomfish = 1

I hope you understood my suggestion, which is based on my limited knowledge :)
  • Developer

So [MENTION=23254]Lexicroft[/MENTION] and [MENTION=10028]tehMugwump[/MENTION], now that the public preview is out I'd love to have you try it out and see what works and what doesn't. I've still got a bunch of paths I need to fix, but in principle just dropping a file in a mod folder should cause it to be overwritten in the main game if it has the same path (i.e. mods/yourmod/anim/pig_build.zip should overwrite data/anim/pig_build.zip)

In addition it should be much more straight forward to actually add a new character, just copy the example character mod and replace all the "Wod" "WOD" and "wod" with a name for your character. :)

  • Developer

Could you maybe add more funtionality to fishable? So its similary to Lootdropper.So take for sample you want to make a beehive fishable and you want the "fish" to be random( you never know what you find down there :p)I hope you understood my suggestion, which is based on my limited knowledge :)

Right now you could do
	inst.components.fishable:AddFish("bee")	inst.components.fishable:AddFish("killerbee")	inst.components.fishable:AddFish("honey")
and it would randomly spawn one of those when you go fishing.If the weighting is important to you, you could grab LootDropper:AddRandomLoot and LootDropper:PickRandomLoot from lootdropper, and modify Fishable:HookFish so it gets the fish from there instead of its own list...

*big frown*. I'm seeing tons of mods that no longer work. Especially ones that call method "LoadPrefabDefs". Will we get some pointers on how to fix these?

Here's a rough list:

InfiniteTools: Crash on start

Test Tools: Crash on "LoadPrefabDefs"

RPG HUD: Crash on "LoadPrefabDefs"

ModLib loads, but doesn't do anything

MaxwellsChest: Crash on "LoadPrefabDefs"

Recipe Book: Crash on "LoadPrefabDefs"

Wall Gate: Crash on "LoadPrefabDefs"

A couple of things:

[*]Many file paths have been changed to resolve the file path, so try to remove any reference to /mods/modname in the prefabs stuff.

[*]I've noticed that all of Klei's prefabs have been edited to add an additional whitespace at the end of the prefab file. I don't know if it's important, but to be on the safe side I'd make sure that any of your prefabs end in whitespace.

I'm going over changes, and there's some neat stuff in there.

  • Developer

*big frown*. I'm seeing tons of mods that no longer work. Especially ones that call method "LoadPrefabDefs". Will we get some pointers on how to fix these?

That method isn't used at all anymore so I removed it. I'll stub it back in and have it print a warning so that mods with it aren't broken for no good reason. But it ought to be removed from mods that are using it. :)
  • Developer

A couple of things:

    [*]Many file paths have been changed to resolve the file path, so try to remove any reference to /mods/modname in the prefabs stuff.

    [*]I've noticed that all of Klei's prefabs have been edited to add an additional whitespace at the end of the prefab file. I don't know if it's important, but to be on the safe side I'd make sure that any of your prefabs end in whitespace.

I'm going over changes, and there's some neat stuff in there.

Similar to above with LoadFileDefs, I'll return support for asset paths which include the full mod path, to avoid breaking too many old mods.

I guess I got overzealous! ;)

The whitespace is just a quirk of the text editors that some of us use. Back in the day some software would fail/crash if the last character in a text file wasn't a newline, so oldschool text editors often ensure that files end with a blank line whenever you save.

Similar to above with LoadFileDefs, I'll return support for asset paths which include the full mod path, to avoid breaking too many old mods.

I guess I got overzealous! ;)

The whitespace is just a quirk of the text editors that some of us use. Back in the day some software would fail/crash if the last character in a text file wasn't a newline, so oldschool text editors often ensure that files end with a blank line whenever you save.

I just noticed that all of the prefabs had a space inserted at the end while none of the other scripts seemed to. I didn't know if it was significant but since it was so consistent I figured it was noteworthy. I don't remember if it was a newline that they even ended with, I thought it was just a space character. I wondered if it had something to do with how the files were parsed.

I was looking over the scripts diffs last night and I've seen some of the stuff for custom worldgen functions. Though I have to say I spend most of the evening playing the new darkness prefab.

I like the new lighting system.

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