Jump to content

[HELP] Lucy the Axe like custom item speech


Recommended Posts

I made a crown to go along with my custom character in DT and I want to make it sentient like Lucy the Axe. I managed to make a separate component for the talker and associate it with the crown so it "talks" like Lucy. Now, what I want to do next is make a custom speech for the crown as it still uses the ones for Lucy from the core Strings.lua. I tried copying the core Strings.lua to my mod's script folder thinking that any changes I make to that file would override the core lua but it didn't work. I tried different ideas but none of them worked.
 
Here is the custom component. 
 
 

local SentientCrown = Class(function(self, inst)    self.inst = inst    self.time_to_convo = 10    self.inst:ListenForEvent("ondropped", function() self:OnDropped() end)    self.inst:ListenForEvent("equipped", function(_, data) self:OnEquipped(data.owner) end)    local dt = 5    self.inst:DoPeriodicTask(dt, function() self:OnUpdate(dt) end)    self.warnlevel = 0end)function SentientCrown:OnDropped()    self:Say(STRINGS.LUCY.on_dropped)    endfunction SentientCrown:OnEquipped(picked_up_by)    if picked_up_by == GetPlayer() then        self:Say(STRINGS.LUCY.on_pickedup)     endendfunction SentientCrown:OnUpdate(dt)    self.time_to_convo = self.time_to_convo - dt    if self.time_to_convo <= 0 then        self:MakeConversation()    endendfunction SentientCrown:Say(list, sound_override)    self.sound_override = sound_override    self.inst.components.talker:Say(list[math.random(#list)])    self.time_to_convo = math.random(60, 120)endfunction SentientCrown:MakeConversation()        local grand_owner = self.inst.components.inventoryitem:GetGrandOwner()    local owner = self.inst.components.inventoryitem.owner    local quiplist = nil    if owner == GetPlayer() then        if self.inst.components.equippable:IsEquipped() then            --currently equipped            quiplist = STRINGS.LUCY.equipped        else            --in player inventory        end    elseif owner == nil then        --on the ground        quiplist = STRINGS.LUCY.on_ground    elseif grand_owner ~= owner and grand_owner == GetPlayer() then        --in a backpack        quiplist = STRINGS.LUCY.in_container    elseif owner and owner.components.container then        --in a container        quiplist = STRINGS.LUCY.in_container    else        --owned by someone else        quiplist = STRINGS.LUCY.other_owner    end    if quiplist then        self:Say(quiplist)    endendreturn SentientCrown

 
Any help is greatly appreciated! 
 
Also, here is a link to the mod.
https://steamcommunity.com/sharedfiles/filedetails/?id=508351274

Link to comment
Share on other sites

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.

×
  • Create New...