SecretlyAPotato Posted August 29, 2021 Share Posted August 29, 2021 I'd like to override the staff spellcasting animation with the horn animation Link to comment Share on other sites More sharing options...
Monti18 Posted August 30, 2021 Share Posted August 30, 2021 Depends on which spellcasting animation you want to override. ActionHandler(ACTIONS.CASTSPELL, function(inst, action) return action.invobject ~= nil and ((action.invobject:HasTag("gnarwail_horn") and "play_gnarwail_horn") or (action.invobject:HasTag("guitar") and "play_strum") or (action.invobject:HasTag("cointosscast") and "cointosscastspell") or (action.invobject:HasTag("quickcast") and "quickcastspell") or (action.invobject:HasTag("veryquickcast") and "veryquickcastspell") ) or "castspell" end), This is the actionhandler that gives back which animation should be played. local function ChangeSpellAnim(self) local old_actionhandler_spell = self.actionhandlers[GLOBAL.ACTIONS.CASTSPELL].deststate self.actionhandlers[GLOBAL.ACTIONS.CASTSPELL].deststate = function(inst,action,...) if action.invobject then return "play_gnarwail_horn" end end end AddStategraphPostInit("wilson", ChangeSpellAnim) AddStategraphPostInit("wilson_client", ChangeSpellAnim) This will replace all castspell animations with the gnarwail horn animation. Change it to your liking 2 Link to comment Share on other sites More sharing options...
SecretlyAPotato Posted August 31, 2021 Author Share Posted August 31, 2021 (edited) 19 hours ago, Monti18 said: Depends on which spellcasting animation you want to override. ActionHandler(ACTIONS.CASTSPELL, function(inst, action) return action.invobject ~= nil and ((action.invobject:HasTag("gnarwail_horn") and "play_gnarwail_horn") or (action.invobject:HasTag("guitar") and "play_strum") or (action.invobject:HasTag("cointosscast") and "cointosscastspell") or (action.invobject:HasTag("quickcast") and "quickcastspell") or (action.invobject:HasTag("veryquickcast") and "veryquickcastspell") ) or "castspell" end), This is the actionhandler that gives back which animation should be played. local function ChangeSpellAnim(self) local old_actionhandler_spell = self.actionhandlers[GLOBAL.ACTIONS.CASTSPELL].deststate self.actionhandlers[GLOBAL.ACTIONS.CASTSPELL].deststate = function(inst,action,...) if action.invobject then return "play_gnarwail_horn" end end end AddStategraphPostInit("wilson", ChangeSpellAnim) AddStategraphPostInit("wilson_client", ChangeSpellAnim) This will replace all castspell animations with the gnarwail horn animation. Change it to your liking Why thank you good sir! Now, I'm still very new to modding, so quick question. Do I put this in the modmain or my item prefab? edit: On second thought let me just experiment first and I'll ask for help if I need it Edited August 31, 2021 by SecretlyAPotato Link to comment Share on other sites More sharing options...
Monti18 Posted August 31, 2021 Share Posted August 31, 2021 It's always better to test it out first, that's the way you get better Sure, just ask away if you need help 1 Link to comment Share on other sites More sharing options...
SecretlyAPotato Posted August 31, 2021 Author Share Posted August 31, 2021 14 hours ago, Monti18 said: It's always better to test it out first, that's the way you get better Sure, just ask away if you need help I appreciate the help, I really do. Anyway, because I assume it completely replaces the anim for all items that use it, I put the code in my modmain, and... [string "../mods/DeadCells_Mod/modmain.lua"]:173: attempt to call global 'ActionHandler' (a nil value) Also, sorry for the late responses I've got a bit going on. And also I forget to do things. Link to comment Share on other sites More sharing options...
Monti18 Posted September 1, 2021 Share Posted September 1, 2021 Don't worry about late responses, happens to me too Did you copy the first paragraph in your modmain? This was just copy and pasted from the Wilson stategraph file to show you how the actionhandler decides which animation it will play. You don't need to copy this into the modmain, you just need the second parapgraph, this one, in the modmain: local function ChangeSpellAnim(self) local old_actionhandler_spell = self.actionhandlers[GLOBAL.ACTIONS.CASTSPELL].deststate self.actionhandlers[GLOBAL.ACTIONS.CASTSPELL].deststate = function(inst,action,...) if action.invobject then return "play_gnarwail_horn" end end end AddStategraphPostInit("wilson", ChangeSpellAnim) AddStategraphPostInit("wilson_client", ChangeSpellAnim) 1 Link to comment Share on other sites More sharing options...
SecretlyAPotato Posted September 2, 2021 Author Share Posted September 2, 2021 Oh hey yeah, that did it haha. My bad. Thanks for all the help! 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