. . . Posted August 20, 2016 Share Posted August 20, 2016 (edited) Hello, I have a question ... So, I was wondering is it possible to allow a character to be able to dig things up without the need of a shovel? Like when my character goes insane they can dig places up & instead of playing the shovel anim he plays the harvest resource anim, would that be possible or can only tools use dig, mine, chop & hammer actions? If I remember the Werebeaver can dig up places without the need of a tool, my character even gains the beaver tag when she goes insane but can't do those actions. I tried adding "inst:AddInherentAction(ACTIONS.DIG)" from the shovel.lua to my character but nothing happened! Can someone smart tell me if this would be possible, sorry for being such a noob .......... Thank you for reading, have a wonderful day/night !!!!!! PS. I added all the code below & still didn't give him the ability to dig, it didn't crash the game either ... I'll wait for someone smart to answer me ... inst:AddComponent("worker") inst.components.worker:SetAction(ACTIONS.CHOP, 4) inst.components.worker:SetAction(ACTIONS.MINE, .334) inst.components.worker:SetAction(ACTIONS.DIG, .334) inst.components.worker:SetAction(ACTIONS.HAMMER, .25) inst:AddComponent("tool") -- made my character to a tool inst.components.tool:SetAction(ACTIONS.DIG) Edited August 20, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/69670-solved-how-to-make-character-be-able-to-dig-without-need-of-tool/ Share on other sites More sharing options...
Soto8969 Posted August 20, 2016 Share Posted August 20, 2016 I know nothing about mods, but why you have a Lenny on the tags? Link to comment https://forums.kleientertainment.com/forums/topic/69670-solved-how-to-make-character-be-able-to-dig-without-need-of-tool/#findComment-805198 Share on other sites More sharing options...
. . . Posted August 20, 2016 Author Share Posted August 20, 2016 (edited) 1 hour ago, Soto8969 said: I know nothing about mods, but why you have a Lenny on the tags? I felt since many of my questions (that get answered) might be useful for beginner modders that are making their own mod characters so I put lenny on the tag if they want to find any of my questions they can easily find it because there's lots of useful code in my questions( of course all the code is credit is to the genius that made it not me xD )if they want they can copy paste it xD because I know when I was beginning on my mod I would've really loved if all the code I need for my character was already existed xD! If it's not okay please tell me then I remove it right away !!!! PS. I'm going to change it to something that makes more sense than ( ͡° ͜ʖ ͡°)... lol xD Edited August 20, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/69670-solved-how-to-make-character-be-able-to-dig-without-need-of-tool/#findComment-805199 Share on other sites More sharing options...
DarkXero Posted August 20, 2016 Share Posted August 20, 2016 local ActionHandler = GLOBAL.ActionHandler local ACTIONS = GLOBAL.ACTIONS local MYDIGACTION = AddAction("HARVESTDIG", "Dig", ACTIONS.DIG.fn) local harvestdighandler = ActionHandler(MYDIGACTION, "dolongaction") AddStategraphActionHandler("wilson", harvestdighandler) AddStategraphActionHandler("wilson_client", harvestdighandler) AddComponentPostInit("playeractionpicker", function(self) if self.inst:HasTag("mosslingwhisperer") then local LEAPACTION = ACTIONS.LEAP local DIGID = ACTIONS.DIG.id local _GetRightClickActions = self.GetRightClickActions self.GetRightClickActions = function(self, position, target) local actions = _GetRightClickActions(self, position, target) local iscrazyandalive = not self.inst.replica.sanity:IsSane() and not self.inst:HasTag("playerghost") if iscrazyandalive then if #actions == 0 and position then local ishungry = self.inst.replica.hunger:GetCurrent() < 10 local ispassable = self.map:IsPassableAtPoint(position:Get()) if ispassable and not ishungry then actions = self:SortActionList({LEAPACTION}, position) end elseif target and target:HasTag(DIGID.."_workable") then actions = self:SortActionList({MYDIGACTION}, target) end end return actions end end end) I combined it with the leap action code. You can use inst:AddComponent("worker") inst.components.worker:SetAction(ACTIONS.DIG, 0.334) in your character to adjust the effectiveness of a single dig action. By default, the effectiveness is 1. Link to comment https://forums.kleientertainment.com/forums/topic/69670-solved-how-to-make-character-be-able-to-dig-without-need-of-tool/#findComment-805374 Share on other sites More sharing options...
. . . Posted August 20, 2016 Author Share Posted August 20, 2016 @DarkXero You're literally so awesome, so awesome, so awesome, so awesome, SO AWESOME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Link to comment https://forums.kleientertainment.com/forums/topic/69670-solved-how-to-make-character-be-able-to-dig-without-need-of-tool/#findComment-805378 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