Sir_Kasalott Posted October 10, 2017 Share Posted October 10, 2017 Hey, I need help finding out what the component would be for when an axe is used to chop a tree. For example: This is for when a player uses a weapon to attack something, inst.components.weapon.onattack And think it would look something like this: inst.components.tool.onchop Thank You Link to comment Share on other sites More sharing options...
ptr Posted October 10, 2017 Share Posted October 10, 2017 It is done by action instead of component function. You can listen to performaction event instead. local function onchop(inst, data) if data then data = data.action end if data and data.action==GLOBAL.ACTIONS.CHOP then --do something here print("Doer is a", data.doer.prefab) print("Target is a", data.target.prefab) end end inst:ListenForEvent("performaction", onchop) Link to comment Share on other sites More sharing options...
Sir_Kasalott Posted October 10, 2017 Author Share Posted October 10, 2017 Thank you @ptr I had to change some of my code to get this to work for what I need, but it works fine now. Thank you 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