Jump to content

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.

Huh, okay so the bottom half isn't technically necessary after all. I figured it was going to insist there be a sound made, but I guess not lol

 

So I suppose you can say this was resolved by removing the ListenForEvent's

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