Jump to content

Custom Crafting/Building Speed? (Like Winona)


Recommended Posts

i want the character im making to be slower at crafting

i thought i could easily find out the code for this by looking in winona's lua, but the code that makes her craft/build faster is a tag

i dont know where the tags for dst are located, so i have no idea where to find the code i want for my character

if someone could please help, it'd be greatly appreciated

Link to comment
Share on other sites

The tags are used in both files "SGwilson.lua" and "SGwilson_client.lua", but you would have to create a new state for a longer craft than normal, since the normal one uses the "dolongaction" string that is the max "wait".
But it shouldn't be hard to create.

Link to comment
Share on other sites

the dolongaction state has 'timeout' argument for how long the animation should play (in seconds) before the buffered action is performed

winona works by using the domediumaction state instead of the dolongaction state when crafting items

the domediumaction state is actually just the dolongaction state but halved in duration:

State
	{
		name = "domediumaction",

		onenter = function(inst)
			inst.sg:GoToState("dolongaction", .5)
		end,
	},

like caioketo said, you'd need to make your own state like so:

AddStategraphState("wilson",GLOBAL.State{
	name = "dolongeraction",
	onenter = function(inst)
		inst.sg:GoToState("dolongaction", 2) --'2 seconds, but you can change this into whatever you want'
	end,
})

now that you now have your own custom state called 'dolongeraction', you then need to add an action handler for the BUILD action which decides what state the player should use:

AddStategraphActionHandler("wilson",GLOBAL.ActionHandler(GLOBAL.ACTIONS.BUILD,function(inst)
	return (inst:HasTag("fastbuilder") and "domediumaction") --'check for the fastbuilder tag (for winona)'
	or (inst:HasTag("slowbuilder") and "dolongeraction") --'check for the slowbuilder tag (for your custom character)'
	or "dolongaction" --'use dolongaction for the rest of the characters'
end))

then now all you need to do is add the 'slowbuilder' tag to your custom character using inst:AddTag("slowbuilder") in your character's prefab file

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