Not_Wilson Posted July 17, 2016 Share Posted July 17, 2016 I'm making a character and I need him to comment/announce when he prototypes one specific item. I don't know how to make him say it ONLY for one item. I assume you would use something similar to the Builder component. function Builder:UnlockRecipe(recname) local recipe = GetValidRecipe(recname) if recipe ~= nil and not recipe.nounlock then --print("Unlocking: ", recname) inst.components.talker:Say(GetString(inst, "ANNOUNCE_PROTOTYPE_HEALTH")) self:AddRecipe(recname) self.inst:PushEvent("unlockrecipe", { recipe = recname }) end end The specific item prefab I'll need him to prototype isn't made yet, so I guess a placeholder of "yourprefab" will do. Link to comment https://forums.kleientertainment.com/forums/topic/68916-player-announces-prototyping-of-an-item/ Share on other sites More sharing options...
DarkXero Posted July 17, 2016 Share Posted July 17, 2016 inst:ListenForEvent("unlockrecipe", function(inst, data) if data and data.recipe == "yourprefab" then inst.components.talker:Say(GetString(inst, "ANNOUNCE_PROTOTYPE_HEALTH")) end end) Link to comment https://forums.kleientertainment.com/forums/topic/68916-player-announces-prototyping-of-an-item/#findComment-794070 Share on other sites More sharing options...
Not_Wilson Posted July 17, 2016 Author Share Posted July 17, 2016 Goodness, thank you, DarkXero. Link to comment https://forums.kleientertainment.com/forums/topic/68916-player-announces-prototyping-of-an-item/#findComment-794071 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