Jump to content

Help with "Talker" and a non-player prefab? (like Lucy)


Recommended Posts

Basically I have a prefab, a regular item that can be placed in the inventory or dropped, that I want to speak.

 

The following code is what I used but it keeps breaking and I'm curious as to why. 

Additionally, I'm curious as to where the code for Lucy's speech is, and what events it uses to speak, but now I just used: inst.components.talker:Say()

    inst:AddComponent("talker")--Okay adding talker    inst.entity:AddSoundEmitter()--it speaks so it makes sound    inst:AddComponent("sentientaxe")--it asked for this, so I figured I'd add it    --[[however, adding the previous line crashed the game as it lacked "equipable" as    my item isn't equipable ]]    --[[ from here down all ripped from Lucy, and I played with the vectors but that's just color]]    inst.components.talker.fontsize = 28     inst.components.talker.font = TALKINGFONT    inst.components.talker.colour = Vector3(.2, .9, .2, 1)    inst.components.talker.offset = Vector3(0,0,0)    inst.components.talker.symbol = "swap_object"		inst:ListenForEvent("donetalking", function() inst.SoundEmitter:KillSound("talk") end)    inst:ListenForEvent("ontalk", function() 		if inst.components.sentientaxe.sound_override then			inst.SoundEmitter:KillSound("talk")			inst.SoundEmitter:PlaySound(inst.components.sentientaxe.sound_override, "special")		else			if not inst.SoundEmitter:PlayingSound("special") then				inst.SoundEmitter:PlaySound("dontstarve/characters/woodie/lucytalk_LP", "talk") 			end		end	end)

I annotated it in hopes of explaining it better, thank you for any advice in advance.

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