Jump to content

Help with changing durability of Ice Staff


Recommended Posts

Hi, all!

I'm wondering how to increase the durability of the Ice Staff, remove the Sanity debuff, etc. I thought it would be fun to just run around freezing as much as I wanted to, but it seems that nobody has done a mod specifically for this (at least that I could find). I also thought this would be a sort of stepping stone into modding, because I'd really like to learn about it. Any help would be appreciated!

Edited by Luminum
Link to comment
Share on other sites

Here, should work in theory:

--- Mod Main

	AddPrefabPostInit("icestaff", function(inst)

		inst.components.finiteuses:SetMaxUses(X) -- you could also look into removing the component, though I haven't investigated that far.
		inst.components.weapon:SetOnAttack(nil) -- the function before basically handles sanity.

		inst.components.weapon:SetDamage(0) -- have some fun (default values set here)
   		inst.components.weapon:SetRange(8, 10)
	end)

Mod function as declared in "modutil.lua" from DST lua files; allows you to add additional conditions to existing prefabs post-initialisation.

Can potentially cause conflicts with mods that may edit prefabs(editing shared spaces etc), I'd assume that whichever post init runs last will have dominance or "lasting impact / final say".

----

Might also be of interest to you (from an implementation of new objects point of view):

 

Edited by MorickClive
Link to comment
Share on other sites

13 hours ago, MorickClive said:

Here, should work in theory:


--- Mod Main

	AddPrefabPostInit("icestaff", function(inst)

		inst.components.finiteuses:SetMaxUses(X) -- you could also look into removing the component, though I haven't investigated that far.
		inst.components.weapon:SetOnAttack(nil) -- the function before basically handles sanity.

		inst.components.weapon:SetDamage(0) -- have some fun (default values set here)
   		inst.components.weapon:SetRange(8, 10)
	end)

Mod function as declared in "modutil.lua" from DST lua files; allows you to add additional conditions to existing prefabs post-initialisation.

Can potentially cause conflicts with mods that may edit prefabs(editing shared spaces etc), I'd assume that whichever post init runs last will have dominance or "lasting impact / final say".

----

Might also be of interest to you (from an implementation of new objects point of view):

 

Thanks for the detail! I'm not entirely sure about how to implement this. I've heard that editing the base files is a VERY bad idea, so how would I actually add the changes I want into the game? 

Link to comment
Share on other sites

First you might want to start off with a staple build/mod an expand from there - keep at it and you should get some progress:

As for editing the base files, you never do it directly - that will cause issues, but this function slots in functionality directly to existing assets; you'd only have to worry about it should another mod overwrite the values you are setting.

Edited by MorickClive
Link to comment
Share on other sites

1 hour ago, Luminum said:
15 hours ago, MorickClive said:

 

Thanks for the detail! I'm not entirely sure about how to implement this. I've heard that editing the base files is a VERY bad idea, so how would I actually add the changes I want into the game? 

When you add something with "prefabpostinit" function or similar function, you don't edit the base file. So you keep the possibility of compatibility with others mods. Editing base file is something to avoid, but adding a prefabpostinit function is the way to do thing properly.

Link to comment
Share on other sites

35 minutes ago, Lumina said:

When you add something with "prefabpostinit" function or similar function, you don't edit the base file. So you keep the possibility of compatibility with others mods. Editing base file is something to avoid, but adding a prefabpostinit function is the way to do thing properly.

So then where exactly would I put the code for the mod? If you can't tell already, I basically have no idea what I'm doing.

Link to comment
Share on other sites

17 hours ago, Lumina said:

you create a modmain.lua and you put the code here. You'll also need a modinfo.lua

 

I've created both. The modmain.lua is the code you gave me, and under that is some code that I found about removing the finiteuses component. Keep/move/remove it?

modmain.PNG

The modinfo.lua is also something that I found and copied, then edited.

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