Jump to content

[SOLVED] Character speech and strings...


Recommended Posts

Wasted some time by myself, but didn't find the solution. I need your help.

Idea: Using player name in character speech.

This is what I got

local describe = "XXX"

AddPlayerPostInit(function(inst)
	if not GLOBAL.TheWorld.ismastersim then
		return
	end	
    inst:DoTaskInTime(0.1, function(inst)--no idea
		print(inst:GetDisplayName())
		describe = inst:GetDisplayName()
		print(describe)
--		inst.components.talker:Say("~~~")
    end)
end)

STRINGS.CHARACTERS.BILLY.DESCRIBE.MULTIPLAYER_PORTAL = "This is portal,  "..describe

Not really sure if its ok to get player's name this way. At least this part works fine. For some reason var describe doesn't set new value to speech string (but it surely gets it, I tested it with print).So instead "This is portal, playername", Im getting "This is portal, XXX"

Edited by TheZotikRus
Link to comment
Share on other sites

Yay! That is how it looks like if someone need it:

GLOBAL.MOD_BILLY = {}
GLOBAL.MOD_BILLY.PLAYERNAME = ""

AddPlayerPostInit(function(inst)
	if not GLOBAL.TheWorld.ismastersim then
		return
	end

    inst:DoTaskInTime(0.1, function(inst)
		GLOBAL.MOD_BILLY.PLAYERNAME = inst:GetDisplayName()
		STRINGS.CHARACTERS.BILLY.DESCRIBE.MULTIPLAYER_PORTAL = "This is portal, "..GLOBAL.MOD_BILLY.PLAYERNAME

    end)
end)

 

Link to comment
Share on other sites

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
 Share

×
  • Create New...