Gekido2802 Posted December 6, 2015 Share Posted December 6, 2015 I've made a 2 handed attack animation. In SGwilson.lua that's where it trigger the state to use : EventHandler("doattack", function(inst) if not inst.components.health:IsDead() and not inst.sg:HasStateTag("attack") then local weapon = inst.components.combat and inst.components.combat:GetWeapon() if weapon and weapon:HasTag("blowdart") then inst.sg:GoToState("blowdart") elseif weapon and weapon:HasTag("thrown") then inst.sg:GoToState("throw") else inst.sg:GoToState("attack") end end end)So if I add :elseif weapon and weapon:HasTag("2h") then inst.sg:GoToState("two_handed_spear")it works perfectly but I don't want to modify the original files so my question is : How would I do it in the modmain.lua? Thanks Link to comment Share on other sites More sharing options...
ZupaleX Posted December 8, 2015 Share Posted December 8, 2015 (edited) Check out Archery Mod modmain.lua to have an example of how to do it without overriding the original file, neither making your mod incompatible with other mods doing similar stuffs. Edited December 8, 2015 by ZupaleX Link to comment Share on other sites More sharing options...
Gekido2802 Posted December 11, 2015 Author Share Posted December 11, 2015 Ìn your mod, at this line :AddStategraphActionHandler("wilson", ActionHandler(ACTIONS.BOWATTACK, function(inst, action)-- inst.sg.mem.localchainattack = not action.forced or nil if not inst.components.health:IsDead() and not inst.sg:HasStateTag("attack") then if inst.components.combat ~= nil and (GLOBAL.GetTime() - inst.components.combat.laststartattacktime) > 1.2 then local weapon = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) or nil return (weapon:HasTag("bow") and weapon:HasTag("zupalexsrangedweapons") and "bow") end end end ))When is this ActionHandler called? Link to comment Share on other sites More sharing options...
Gekido2802 Posted December 11, 2015 Author Share Posted December 11, 2015 Just figured that your action is being triggered by the CollectEquippedActions from your components zupalexsrangedweapons which is called GetEquippedItemActions from the playeractionpicker. Now things is, that my left and right mouse button actions are inverted. It wants to examine with left click and attack with right click. Link to comment Share on other sites More sharing options...
ZupaleX Posted December 11, 2015 Share Posted December 11, 2015 Wait, you want to make a mod for Don't Starve or Don't Starve Together? The CollectAction is specific to Don't Starve but doesn't exist for Together. You should be sure you're checking the proper version on my mod Link to comment Share on other sites More sharing options...
Gekido2802 Posted December 11, 2015 Author Share Posted December 11, 2015 Haha, well I started with don't starve to understand the basics and started with your DST mod and I was like : "wut? that doesn't exist in DS" then later I found that you made a DS version , so right now I'm looking at your DS version. ^^ Link to comment Share on other sites More sharing options...
ZupaleX Posted December 12, 2015 Share Posted December 12, 2015 Alright. The ds version is outdated though so the way it's done is a bit ugly. You do not really have to go modify the playeractionpicker or stuffs like that. I'll update the ds version to include the dst version improvements soon. Meanwhile I'll check your previous posts from a computer so i can try to help. Cheers 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