Jump to content

Recommended Posts

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.

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...