Jump to content

Custom item problems


Recommended Posts

Hey I made a character mod with a starting mod item it's working kind fine but if I equip the item it looks like my character is holding the air.

It doesn't appear on the hand neither the ground when I drop it but it doe's damage. I have checked the scripts but because I'm a noob at modding I can't figure out in which script is the problem. Any ideas?

P.S. Another question. Can I add sanity loss when the character sees/it's close to a specific thing?

Alice.rar

Edited by MarilouXD
Link to comment
Share on other sites

Attach a .zip of your mod, it will probably help. Also, explain how you created your item, because the problem could be very dependant of the method used.

 

About the sanity loss :

 


local function sanityfn(inst)
	local x, y, z = inst.Transform:GetWorldPosition()
	local ents = TheSim:FindEntities(x, y, z, TUNING.SANITY_EFFECT_RANGE, {"mole"})
	local delta = 0
	for k, v in pairs(ents) do
		local distsq = math.max(inst:GetDistanceSqToInst(v), 1)
		delta = delta - TUNING.SANITYAURA_SMALL / distsq
	end
	return delta
end

and

	inst.components.sanity.custom_rate_fn = sanityfn

This goes in your character.lua file. The first part as a function, the second part in the master_postinit.

 

Replace "mole" by whatever the prefab you want is.

Link to comment
Share on other sites

1 hour ago, Lumina said:

Attach a .zip of your mod, it will probably help. Also, explain how you created your item, because the problem could be very dependant of the method used.

 

About the sanity loss :

 



local function sanityfn(inst)
	local x, y, z = inst.Transform:GetWorldPosition()
	local ents = TheSim:FindEntities(x, y, z, TUNING.SANITY_EFFECT_RANGE, {"mole"})
	local delta = 0
	for k, v in pairs(ents) do
		local distsq = math.max(inst:GetDistanceSqToInst(v), 1)
		delta = delta - TUNING.SANITYAURA_SMALL / distsq
	end
	return delta
end

and


	inst.components.sanity.custom_rate_fn = sanityfn

This goes in your character.lua file. The first part as a function, the second part in the master_postinit.

 

Replace "mole" by whatever the prefab you want is.

I know it's ****ty but it's my first mode and I'm a little frustrated :p  I just found some scripts and mixed them up all together

 

Edited by MarilouXD
Link to comment
Share on other sites

Judging by what was inside the scml file it was a completely new file, which in turn wouldn't be accepted by the game (can't create stuff in thin air and expect the game make it, other wise there would be some interesting mods on the workshop). So after a few minutes I pretty much fixed it up to the wand format that's in the modding tools, tutorials and examples section of the downloads. I left the zip file for you and you tinker with the wand file.

Alice.zip

Link to comment
Share on other sites

11 hours ago, K1NGT1GER609 said:

Judging by what was inside the scml file it was a completely new file, which in turn wouldn't be accepted by the game (can't create stuff in thin air and expect the game make it, other wise there would be some interesting mods on the workshop). So after a few minutes I pretty much fixed it up to the wand format that's in the modding tools, tutorials and examples section of the downloads. I left the zip file for you and you tinker with the wand file.

Alice.zip

I believe you say about the knife scml file:p because the item i used to "paint" over it, it wasn't accepted (something was wrong with the names and the autocompiler wouldn't make the animation) Thank you anyway me and my new wand/knife are grateful :) 

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