sobb Posted January 12, 2024 Share Posted January 12, 2024 How do you edit existing animations without changing them for everyone? Say I have a character named "custom" and want to replace idle_loop, idle_inaction, etc. with custom_idle_loop, custom_idle_inaction, or chop_loop with custom_chop_loop. Any animation really. Link to comment https://forums.kleientertainment.com/forums/topic/153810-how-do-you-replace-existing-animations-with-custom-ones-for-one-character/ Share on other sites More sharing options...
_zwb Posted January 12, 2024 Share Posted January 12, 2024 Just replace the animations in the animation file? Link to comment https://forums.kleientertainment.com/forums/topic/153810-how-do-you-replace-existing-animations-with-custom-ones-for-one-character/#findComment-1693924 Share on other sites More sharing options...
sobb Posted January 13, 2024 Author Share Posted January 13, 2024 9 hours ago, _zwb said: Just replace the animations in the animation file? That replaces the animation for every character. I'd like to replace them for individual ones Link to comment https://forums.kleientertainment.com/forums/topic/153810-how-do-you-replace-existing-animations-with-custom-ones-for-one-character/#findComment-1693971 Share on other sites More sharing options...
Rickzzs Posted January 13, 2024 Share Posted January 13, 2024 (edited) local makewrap = function(self, k) local fn = self._AnimState[k] local function fn_wrap(_, ...) return fn(self._AnimState, ...) end self[k] = fn_wrap return fn_wrap end local function HookAnimState(inst) local as = inst.AnimState inst.AnimState = setmetatable({ _AnimState = as, PlayAnimation = function(self, anim, loop) anim = anim:gsub("monkey", "wokey") return self._AnimState.PlayAnimation(self._AnimState, anim, loop) end, PushAnimation = function(self, anim, loop) anim = anim:gsub("monkey", "wokey") return self._AnimState.PushAnimation(self._AnimState, anim, loop) end }, {__index = makewrap}) end Here is a simplified solution that only hooks PlayAnimation and PushAnimation. Full solution needs to hook more. Edited January 13, 2024 by Rickzzs 1 Link to comment https://forums.kleientertainment.com/forums/topic/153810-how-do-you-replace-existing-animations-with-custom-ones-for-one-character/#findComment-1693979 Share on other sites More sharing options...
sobb Posted January 13, 2024 Author Share Posted January 13, 2024 1 hour ago, Rickzzs said: local makewrap = function(self, k) local fn = self._AnimState[k] local function fn_wrap(_, ...) return fn(self._AnimState, ...) end self[k] = fn_wrap return fn_wrap end local function HookAnimState(inst) local as = inst.AnimState inst.AnimState = setmetatable({ _AnimState = as, PlayAnimation = function(self, anim, loop) anim = anim:gsub("monkey", "wokey") return self._AnimState.PlayAnimation(self._AnimState, anim, loop) end, PushAnimation = function(self, anim, loop) anim = anim:gsub("monkey", "wokey") return self._AnimState.PushAnimation(self._AnimState, anim, loop) end }, {__index = makewrap}) end Here is a simplified solution that only hooks PlayAnimation and PushAnimation. Full solution needs to hook more. I was looking at stategraphs and wasn't able to come up with a solution. I'll have a look at this, thank you! Link to comment https://forums.kleientertainment.com/forums/topic/153810-how-do-you-replace-existing-animations-with-custom-ones-for-one-character/#findComment-1693986 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