Augustusc Posted January 2, 2017 Share Posted January 2, 2017 Hello! I am creating a character who does something quite useless but amusing. Hopefully this is simple and not a headache for anyone. All I want is for whatever is being hit to say a word. That's it! Thanks in advance Link to comment https://forums.kleientertainment.com/forums/topic/73039-make-things-say-something-on-hit/ Share on other sites More sharing options...
Aquaterion Posted January 2, 2017 Share Posted January 2, 2017 --character.lua --anywhere above masterpostinit local function OnAttackOther(inst, data) if data.target and not data.target.components.health:IsDead() and data.target.components.talker then data.target.components.talker:Say("Hey") end end --masterpostinit inst:ListenForEvent("onattackother", OnAttackOther) However, prefabs without the talker component wouldn't be able to talk Link to comment https://forums.kleientertainment.com/forums/topic/73039-make-things-say-something-on-hit/#findComment-854845 Share on other sites More sharing options...
Augustusc Posted January 3, 2017 Author Share Posted January 3, 2017 Perfect! Thank you so much! Link to comment https://forums.kleientertainment.com/forums/topic/73039-make-things-say-something-on-hit/#findComment-855047 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