Jump to content

Omit hunger announcement?


Recommended Posts

I'd like my character to not announce when she's hungry as part of her downsides, but not be entirely mute like Wes.

I've tried searching for ANNOUNCE_HUNGRY to try and locate the call to it, but from what I can tell it's tied to some generic character class.

Commenting out the ANNOUNCE_HUNGRY line in her speech file or replacing it with nil just calls Wilson's instead, and leaving the line as "" still causes her to make a sound and flap her lips.

It's very probable that I just don't know what I'm looking for in order to get this functionality I'm after, so any help would be appreciated.

Link to comment
Share on other sites

the announcement for being hungry I believe is in the wisecracker component

I think what you should do is copypaste the wisecracker component and rename it to your own thing like "wisecracker_mychar" then in the component just get rid of the listenforevent/code which makes the player announce they are hungry then in yourchar.lua remove the old wisecracker component and add the new one you made

Link to comment
Share on other sites

Well, it seems that didn't work.
For clarity; I did as you suggested and added in a copy of wisecracker into my mod's scripts/components folder, renamed it (and the self references inside to match), commented out the hungry listener.

Then, within my character.lua's master_postinit I did:

inst:RemoveComponent("wisecracker")

inst:AddComponent("wisecracker_mychar")

 

It seemed not to work immediately (character still announces she's hungry) so I did a quick test, and within my version of wisecracker I changed ANNOUNCE_HUNGRY to ANNOUNCE_BEES. This did indeed make her scream about bees when she's hungry, so I know she's looking at the right version of wisecracker. However if I remove the hungry listener it just reverts to the default announcement rather than removing it all together.

Link to comment
Share on other sites

I see. So there isn't a way to override it?

EDIT:

So I figured out a solution, I'll post it here for the sake of anyone else who may search for this topic;

I removed my custom wisecracker_mychar and replaced it with just a plain old copy of wisecracker (still not really used to the idea of being able to include official files and have the game take them over the basegame)

and I just wrapped the hunger listener in an additional if statement that checks to see if the instance doesn't have my character tag on it first.

    inst:ListenForEvent("hungerdelta",
        function(inst, data)
            if not inst:HasTag("mycharactertag") then
                if data.newpercent <= TUNING.HUNGRY_THRESH and data.oldpercent > TUNING.HUNGRY_THRESH then
                inst.components.talker:Say(GetString(inst, "ANNOUNCE_HUNGRY"))
                end
            end
        end)

Edited by RevelHalcyon
Link to comment
Share on other sites

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
 Share

×
  • Create New...