AkaiNight Posted June 29, 2021 Share Posted June 29, 2021 (edited) hi, my character is unable to use any weapon(except my custom weapon) and it still can use tools but pitchfork does not have tool tag in its lua. It only has weapon and sharp tags. Is there anyway to add pitchfork, pitchfork tag or use it without pitchfork tag. here is my code for weapons and tools if equippedweb ~= nil and not equippedweb:HasTag("kitsuraitem") then if equippedweb ~= nil and not equippedweb:HasTag("tool") or equippedweb:HasTag("pitchfork") or equippedweb:HasTag("farm_hoe") or equippedweb:HasTag("golden_farm_hoe") then inst.components.inventory:DropItem(equippedweb) end end neither farm_hoe or pitchfork is able to use for my character. (also i couldn't find farm hoe's lua idk how they named it) Edited June 30, 2021 by AkaiNight Link to comment Share on other sites More sharing options...
Monti18 Posted June 29, 2021 Share Posted June 29, 2021 You could either add a PrefabPostInit to the pitchfork and give it the tag you want or you use inherentactions. I used this in my mod to detect if a handheld item is a tool, change it what you need: local function inherentaction(inst) if inst.inherentactions ~= nil then if inst.inherentactions[ACTIONS.TILL] ~= nil or inst.inherentactions[ACTIONS.TERRAFORM] ~= nil or inst.inherentactions[ACTIONS.DIG] ~= nil then return true end end return false end 1 1 Link to comment Share on other sites More sharing options...
AkaiNight Posted June 30, 2021 Author Share Posted June 30, 2021 (edited) @monti18 thanks im leaving the code if anyone else needs it AddPrefabPostInit('pitchfork', function(inst) if inst.components and inst.components.weapon then inst:AddTag("tool") end end) in modmain.lua quick question: If i change something with "AddPrefabPostInit" is it changes just for the character or everyone? Edited June 30, 2021 by AkaiNight Link to comment Share on other sites More sharing options...
Monti18 Posted June 30, 2021 Share Posted June 30, 2021 It changes for everyone, so pay attention if you want to change something for only your character. 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now