Jump to content

Recommended Posts

I'm not into modding at all, but from what I've seen with online tutorials, etc, creating a custom Don't Starve character isn't all that hard. 

Thus, the battle between my creativity and procrastination hath begun!

But in the meantime, I've had ideas for the character in question, including an item. The idea is a magical nature staff, with very few uses, maybe five or six. With each use, it would spawn a custom set piece related to nature, eg; twigs/grass, berry bushes, and eventually a couple of farm plots. But as it gets increasingly special with what it spawns, (more "potent" of the nature magic) the effect on the area would be matched by an increased effect on sanity with each use. I'm thinking like 10 sanity for the first use, making it very negligible, but by the last use it'll basically drive you to the brink of insanity from full, while doing something cool, like spawning a large forest and three treeguards.

Now, my question, I was wondering if a steadily increasing effect, or even a different effect at all with each us of an item is even possible in Don't Starve. If it is, can I have it be randomized and eliminate any "used up" effects in the list?

Again, this is from a TOTAL modding noob's POV, and I'm really just asking if my concept is remotely possible to mod into the game.

Thanks for your time, have a wonderful day/night :3

I don't know if you can spawn a set piece like that. I haven't dealt with those yet so it is just outside what I know anything about. However, I know the programming can be done to go through a list of effects with each "casting" of your wand. 

You could program a table, and add indexed functions to the table. Then, as you use the wand you would have the program grab the first indexed function, or "spell", then increment the index counter. In this way the next use would start the function at the next index and increment again. This will all probably happen in the decision maker of your choosing and have the item "break" at the end of it's uses. 

I'll try to write up a sample code for what I have in my mind in a few and get back to you with more information. I know if you are starting that will over your head, but I hope you will come back to that idea when you learn enough to better understand it. For now I guess the important part is the coding is possible if a set piece can be spawned.

Edited by HatefulGravey
14 minutes ago, lilgizmo838 said:

http://steamcommunity.com/sharedfiles/filedetails/?id=635683295

I saw this today and it's what made me think of the idea. If it can be stapled to some console code, then an item can certainly do it, right?

Honestly, I wouldn't call that mod "set pieces". A traditional set piece only spawns during World Generation, not in a dynamic way which that mod allows. I'm not saying that you couldn't create code to allow the dynamic spawning of set pieces, but in reality a traditional "set piece" is a template layout inside a .lua file created in Tiled.

The mod in which you linked is just a template layout hard coded to spawn items in a specific manner, not in a dynamic manner and does not appear to be able to be used in a modular fashion like traditional set pieces were designed. If you're wanting the ability to dynamically spawn a set piece I am pretty sure there is a solution for that, but I'm not sure if it would be simple.

I think part of the issue here is just understanding of the term "set piece". If you want to spawn 25 pig men (or any other Prefab for that matter) you can do that in console so I don't see why you couldn't do it in the program for a wand. I'm not sure how you would control where they spawn in relation to one another but I'm sure that can be done with some measure of success. 

 

Oh, yes, I'm sorry. I didn't mean in-game set-pieces. I meant unique set pieces custom made for this specific item. Examples would be 4 bushes, a grove of trees, etc. Those "set pieces". 

And I was figuring that the "targeting" for the wand could be the actual player location, each piece surrounding them. Makes it extra interesting when it spawns a trio of treeguards >:D

We can use the a pre-existing example for this. 

    if food.components.edible and food.components.edible.foodtype == "VEGGIE" then
		local poo = SpawnPrefab("poop")
		poo.Transform:SetPosition(inst.Transform:GetWorldPosition())		
	end

The above code comes from the pigman.lua prefab. This is the code that lets him poop for you when you feed him a veggie. I'm sure it can be modified to spawn more than one prefab. If nothing else the "poo" variable could refer to a custom function that loops through calling the SpawnPrefab function over and over again. 

In this example inst.Trandform:GetWorldPosition() returns the position of the character in the game world. I would assume there is some way to apply more conditions to that though I don't know what they are. There has to be a way to set a position relative to that GetWorldPosition.

 

Hope that helps get you on the right track. 

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