Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Werecrowe

Help with removing announce_eat speech lines

Recommended Posts

Werecrowe    132

Hello!

I'm trying to edit the files of a mod I downloaded (this one: https://steamcommunity.com/sharedfiles/filedetails/?id=1823073244&searchtext=portable+cookpots), which makes portable crockpots/blenders/grinding stations & Warly's recipes available to everyone. I wanted to edit it (for personal use ONLY) to have it exclude the speech lines that display when a character eats food.

With this mod running, things like seeds, berries, or meatballs will make each character give their "generic" line in their announce_eat speech file ("yum!" for Wilson, "mmm! soul free!" for Wortox, etc.) and this can get annoying when eating stacks of food. I decided to use Wortox as a test subject in my attempts to resolve this.

First, I went into Wortox's character speech file (the one the mod provided for me, not the actual speech file in the basegame scripts folder) to delete the "generic" line below announce_eat:

Spoiler


    ANNOUNCE_EAT =
    {
        GENERIC = "Mmm! Soul free!",     [ <-- deleted this one]
        PAINFUL = "Ouch! Hyuyu!",
        SPOILED = "Blech! At least souls never spoil.",
        STALE = "How unpleasant!",
        INVALID = "Not even I could eat that.",
        YUCKY = "I'd rather eat my own tail!",
    }


Removing this yielded no results, but didn't break anything.

Next, I went to try and find the source of the problem: my arch-nemesis, the masterchef" tag. After poking around, I found that the tags "masterchef", "professionalchef" and "expertchef" were added to Wortox's modded char file, to allow him to use Warly's portable items and cook his recipes. Makes sense. Then I realized that this tag must have something to do with how he reacts to food. 

Searching up "masterchef" in a copy of the basegame scripts folder, I found something that piqued my interest, a file named "wisecracker.lua". I opened it and found something I thought might have had to do with the issue:
 

Spoiler

                elseif data.food.components.perishable ~= nil then
                    if data.food.components.perishable:IsFresh() then
                        local ismasterchef = inst:HasTag("masterchef")
                        if ismasterchef and data.food.prefab == "wetgoop" then
                            inst.components.talker:Say(GetString(inst, "ANNOUNCE_EAT", "PAINFUL"))
                        else 
                            local count = inst.components.foodmemory ~= nil and inst.components.foodmemory:GetMemoryCount(data.food.prefab) or 0
                            if count > 0 then
                                inst.components.talker:Say(GetString(inst, "ANNOUNCE_EAT", "SAME_OLD_"..tostring(math.min(5, count))))
                            elseif ismasterchef then
                                inst.components.talker:Say(GetString(inst, "ANNOUNCE_EAT",
                                    (data.food:HasTag("masterfood") and "TASTY") or
                                    (data.food:HasTag("preparedfood") and "PREPARED") or
                                    (data.food.components.cookable ~= nil and "RAW") or
                                    (data.food.components.perishable.perishtime == TUNING.PERISH_PRESERVED and "DRIED") or
                                    "COOKED"
                                ))

                            end
                        end



I made a copy of wisecracker.lua, put it in a components folder inside the mod's script folder, and tried deleting some of this code (all the lines I've put in bold font in the spoiler text). I loaded up the game to try it out, and it crashed when I ate raw berries. I have a screenshot of this crash!

 

Spoiler

5d4865f6068a0_ScreenShot2019-08-05at12_31_50PM.thumb.png.93995d45293675d9d3ba67048da5057e.png

Well...that certainly attacked the issue, but I'm stumped on how to actually resolve it. I'm wondering if it has anything to do with these lines in player_common.lua:
 

Spoiler

local function OnWontEatFood(inst, data)
    if inst.components.talker ~= nil then
        inst.components.talker:Say(GetString(inst, "ANNOUNCE_EAT", "YUCKY"))
    end
end


I should add that the modmain.lua file only contained information about the global recipes for the portable crockpot, blender and grinding station-- it didn't seem to affect the characters in any way, and thus probably doesn't pertain to this issue. 


I should also add that I'm a total doof at code and I haven't even dabbled in mods before, but I'm curious to learn more if anyone has any suggestions! I know how dumb I probably sound, and I'll be looking into this on my own time as soon as I have the chance to read all the modding guides, but I was just wondering if anyone had any passing advice to offer me on how I can fix this!

Thanks, and sorry for any trouble! 

Share this post


Link to post
Share on other sites
Ultroman    537

Try putting this at the bottom of the modmain.lua

AddPlayerPostInit(function(inst)
	GLOBAL.STRINGS.CHARACTERS.GENERIC.ANNOUNCE_EAT = {}
	local name = string.upper(inst.prefab)
	if GLOBAL.STRINGS.CHARACTERS[name] then
		GLOBAL.STRINGS.CHARACTERS[name].ANNOUNCE_EAT = {}
	end
end)

This is REALLY forceful, and not very clever, but I think it'll work :) I leaned heavily on the fact that it is only for personal use ;)

If that crashes when you eat something, try this instead:

local mystrings =
    {
        GENERIC = "",
        PAINFUL = "",
        SPOILED = "",
        STALE = "",
        INVALID = "",
        YUCKY = "",
    }

AddPlayerPostInit(function(inst)
	GLOBAL.STRINGS.CHARACTERS.GENERIC.ANNOUNCE_EAT = mystrings
	local name = string.upper(inst.prefab)
	if GLOBAL.STRINGS.CHARACTERS[name] then
		GLOBAL.STRINGS.CHARACTERS[name].ANNOUNCE_EAT = mystrings
	end
end)

 

Share this post


Link to post
Share on other sites
Werecrowe    132
36 minutes ago, Ultroman said:

Try putting this at the bottom of the modmain.lua

Spoiler

 

This is REALLY forceful, and not very clever, but I think it'll work :) I leaned heavily on the fact that it is only for personal use ;)

If that crashes when you eat something, try this instead:

Spoiler

 

 

Thank you for the advice!! Unfortunately, neither of these seemed to work-- they actually crashed DST before I even loaded into the world; I've got a screencap of what it told me:
 

Spoiler

5d48975989ef6_ScreenShot2019-08-05at4_46_06PM.thumb.png.2e90d2b47fd795cd9af4cd9d5c9f2b06.png

and, just to make sure I plugged the code in right, here's a screenshot of the entire modmain.lua file:

 

Spoiler

5d48978aaf85f_ScreenShot2019-08-05at4_53_23PM.thumb.png.e4c13d33c1372cebfca149baffa0d037.png

I am...not very handy with code, but I'll get there eventually! thank you so much!

Share this post


Link to post
Share on other sites
Ultroman    537

I fixed the code in the previous post. I tested both, and they both work. At least with fishsticks. I don't know about other foods, like spiced things.

Share this post


Link to post
Share on other sites
Werecrowe    132
3 hours ago, Ultroman said:

I fixed the code in the previous post. I tested both, and they both work. At least with fishsticks. I don't know about other foods, like spiced things.

Thank you!! It works perfectly! I need to do more peeking into the code of DST...it's really fascinating stuff! 

Share this post


Link to post
Share on other sites