Jump to content

Recommended Posts

So basically, i've made an item, and when that item is used I'd like an animation to play. All I want for the animation for the moment is a simple Wilson moving his hands around thing like he does when he messes with stuff already. I just can't figure out how to add that in to the item. Is it just a component I add in, or something to do with stategraphs? Do I add it into the item at all? Because when you murder bees it plays the animation I want but there's nothing in the bee prefab (I think) that tells it to do that. I think it's in the SgWilson file that makes it play the animation, and it just plays it whenever Wilson murders anything. So do I have to add it into the stategraph for my character, under ActionHandler (ACTIONS.USE, "dolongaction")?

 

Any help would be appreciated.

Link to comment
https://forums.kleientertainment.com/forums/topic/28891-question-on-animation/
Share on other sites

There is an API call for this from modmain.lua

 

AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(MAGNIFYIDENTIFY, "dolongaction"))

 

where MAGNIFYIDENTIFY is the variable containing your new action.

local MAGNIFYIDENTIFY = GLOBAL.Action()MAGNIFYIDENTIFY.str = "Identify"MAGNIFYIDENTIFY.id = "MAGNIFYIDENTIFY"MAGNIFYIDENTIFY.fn = function(act)    if act.target and act.target.components.rpgweapon and act.target.components.rpgweapon.discovered == false and act.invobject and act.invobject.components.magnifyidentify then        return act.invobject.components.magnifyidentify:DoIdentify(act.target, act.doer)    end    if act.target and act.target.components.rpgarmor and act.target.components.rpgarmor.discovered == false and act.invobject and act.invobject.components.magnifyidentify then        return act.invobject.components.magnifyidentify:DoIdentify(act.target, act.doer)    endendAddAction(MAGNIFYIDENTIFY)AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(MAGNIFYIDENTIFY, "dolongaction"))

the above is an example of an action created from modmain in RPG Items mod.

Edited by Heavenfall

Thank you for the reply. I tried this, and don't know what I did wrong, but it crashed my computer and all my work was lost... I had to format my computer. If I try this method do I have to make a new component for it to call upon, similar to usable item?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...