Jump to content

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

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