Johnnyprofane Posted October 20, 2013 Share Posted October 20, 2013 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 Share on other sites More sharing options...
Heavenfall Posted October 20, 2013 Share Posted October 20, 2013 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. Link to comment Share on other sites More sharing options...
Johnnyprofane Posted October 24, 2013 Author Share Posted October 24, 2013 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? Link to comment Share on other sites More sharing options...
Johnnyprofane Posted October 24, 2013 Author Share Posted October 24, 2013 Actually I'm just reading through the API guide by ipsquiggle and it's helping a lot. Thanks again though! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.