Jump to content

How to enable/disable "talker.mod_str_fn = Umlautify"?


Recommended Posts

Hello, If somebody can help me with this I would really appreciate it, since I dunno what to do :)..

So, basically is there a way I can enable & disable "inst.components.talker.mod_str_fn = Umlautify" on certain actions? From what I tried it only works when in the common_postinit & I don't know how to enable & disable it or if it's even possible :(.

So, if anyone knows how that would be great :D!!

Link to comment
Share on other sites

_G = GLOBAL
local ACTIONS = _G.ACTIONS
local ActionHandler = _G.ActionHandler

AddStategraphPostInit("wilson", function(sg)
	sg.actionhandlers[ACTIONS.PICKUP] = ActionHandler(ACTIONS.PICKUP, function(inst, action)					
		if inst.components.talker then inst.components.talker.mod_str_fn = "UmlautifyON" end
		return "doshortaction"
	end)
	sg.actionhandlers[ACTIONS.DROP] = ActionHandler(ACTIONS.DROP, function(inst, action)					
		if inst.components.talker then inst.components.talker.mod_str_fn = "UmlautifyOFF" end
		return "doshortaction"
	end)
end)

 

Link to comment
Share on other sites

23 hours ago, zUsername said:

_G = GLOBAL
local ACTIONS = _G.ACTIONS
local ActionHandler = _G.ActionHandler

AddStategraphPostInit("wilson", function(sg)
	sg.actionhandlers[ACTIONS.PICKUP] = ActionHandler(ACTIONS.PICKUP, function(inst, action)					
		if inst.components.talker then inst.components.talker.mod_str_fn = "UmlautifyON" end
		return "doshortaction"
	end)
	sg.actionhandlers[ACTIONS.DROP] = ActionHandler(ACTIONS.DROP, function(inst, action)					
		if inst.components.talker then inst.components.talker.mod_str_fn = "UmlautifyOFF" end
		return "doshortaction"
	end)
end)

 

I put it in my modmain.lua & it didn't seem to work, unfortunately.. I also tried putting "inst.components.talker.mod_str_fn = "UmlautifyON"" in common_postinit but it just crashed the game, but thanks very much for helping :D!!

Edited by SuperDavid
Link to comment
Share on other sites

2 minutes ago, zUsername said:

_G = GLOBAL
local ACTIONS = _G.ACTIONS
local ActionHandler = _G.ActionHandler
local IsServer = _G.TheNet:GetIsServer()

local state = "wilson_client"
if IsServer then
	state = "wilson"
end	

AddStategraphPostInit(state, function(sg)
	sg.actionhandlers[ACTIONS.PICKUP] = ActionHandler(ACTIONS.PICKUP, function(inst, action)					
		if inst.components.talker then inst.components.talker.mod_str_fn = "UmlautifyON" end
		return "doshortaction"
	end)
	sg.actionhandlers[ACTIONS.DROP] = ActionHandler(ACTIONS.DROP, function(inst, action)					
		if inst.components.talker then inst.components.talker.mod_str_fn = "UmlautifyOFF" end
		return "doshortaction"
	end)
end)

 

Is is supposed to become umlautified when picking up a item? If yes then it didn't work..but thanks so much for your help :)! I appreciate it :D!!

Link to comment
Share on other sites

Have you enabled the mods on both server and client? You must remove ON and OFF follow Umlautify.

_G = GLOBAL
local ACTIONS = _G.ACTIONS
local ActionHandler = _G.ActionHandler
local IsServer = _G.TheNet:GetIsServer()

local state = "wilson_client"
if IsServer then
	state = "wilson"
end	

AddStategraphPostInit(state, function(sg)
	sg.actionhandlers[ACTIONS.PICKUP] = ActionHandler(ACTIONS.PICKUP, function(inst, action)					
		if inst.components.talker then inst.components.talker.mod_str_fn = "Umlautify" end
		return "doshortaction"
	end)
	sg.actionhandlers[ACTIONS.DROP] = ActionHandler(ACTIONS.DROP, function(inst, action)					
		if inst.components.talker then inst.components.talker.mod_str_fn = nil end
		return "doshortaction"
	end)
end)

 

Edited by zUsername
Link to comment
Share on other sites

I put that code in modmain.lua & I picked up/dropped items but it seemed it never worked?

I also tried using it in my own function but it didn't work either?

Spoiler

local function activate_wathgrithr(act)
if act.target.lord_mode == true then return end

   if act.target.wathgrithr_mode == nil then
	  swap_mode(act)
      act.target.wathgrithr_mode = true
	  act.target.components.talker.mod_str_fn = "Umlautify"
      act.target.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODTYPE.MEAT, FOODTYPE.GOODIES })
   elseif act.target.wathgrithr_mode == true then
	  swap_mode(act)
	  act.target.battleborn = 0
	  act.target.wathgrithr_mode = nil
	  act.target.components.talker.mod_str_fn = nil
	  act.target.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODGROUP.OMNI })
   end
end

 

Maybe it's impossible to toggle it off or on :(...but I really appreciate all the effort you put into helping me, really thank you very much :D!!!!

Link to comment
Share on other sites

12 hours ago, zUsername said:

Wait you want everytime you picked up something, wathgrith will say "Wigfrid's umlauts..." right? Because I'm don't know "Umlautify" mean.

No, what I want is on the function I show above I want to be able to turn " inst.components.talker.mod_str_fn = Umlautify " on & off, what " inst.components.talker.mod_str_fn = Umlautify " does is it makes the character say "ö" instead of "o" :)!

Edited by SuperDavid
Link to comment
Share on other sites

Does anyone know how to do this :)? Because I really don't want to have to make a double of my 5 speech files with  "ö" instead of "o" :(..but if nobody knows then I guess that's the only choice...

Edited by SuperDavid
Link to comment
Share on other sites

@SuperDavid 

local function activate_wathgrithr(act)

	f act.target.lord_mode == true then return end

   if act.target.wathgrithr_mode == nil then -- Add Valkyrie.
	  swap_mode(act)
      act.target.wathgrithr_mode = true
	  
	  GLOBAL.Profile:SetWathgrithrFontEnabled(true)
	  act.target.components.talker.mod_str_fn = GLOBAL.Umlautify
	  
      act.target.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODTYPE.MEAT, FOODTYPE.GOODIES })
   elseif act.target.wathgrithr_mode == true then -- Remove Valkyrie.
	  swap_mode(act)
	  act.target.battleborn = 0
	  act.target.wathgrithr_mode = nil
	  
	  GLOBAL.Profile:SetWathgrithrFontEnabled(false)
	  act.target.components.talker.mod_str_fn = nil

	  act.target.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODGROUP.OMNI })
   end
end

Tested works. Make sure you save Wathgrithr Font on save and load Wathgrithr Font on load.

Edited by zUsername
Link to comment
Share on other sites

@zUsername I used the "activate_wathgrithr" you made like this in my modmain

Spoiler

local function activate_wathgrithr(act)
if act.target.lord_mode == true then return end

   if act.target.wathgrithr_mode == nil then -- Add Valkyrie.
	  swap_mode(act)
      act.target.wathgrithr_mode = true
	  
	  GLOBAL.Profile:SetWathgrithrFontEnabled(true)
	  act.target.components.talker.mod_str_fn = GLOBAL.Umlautify
	  
      act.target.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODTYPE.MEAT, FOODTYPE.GOODIES })
   elseif act.target.wathgrithr_mode == true then -- Remove Valkyrie.
	  swap_mode(act)
	  act.target.battleborn = 0
	  act.target.wathgrithr_mode = nil
	  
	  GLOBAL.Profile:SetWathgrithrFontEnabled(false)
	  act.target.components.talker.mod_str_fn = nil
	  
	  act.target.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODGROUP.OMNI })
   end
end

 

and my character when activating this code in a world with caves still does not talk like Wigfrid (I haven't tested on world with no caves)? ...Am I doing something wrong cause you said it worked, right :shock:?

20 hours ago, zUsername said:

Make sure you save Wathgrithr Font on save and load Wathgrithr Font on load.

Maybe this is what I did wrong? How do I do this, sorry i'm dumb :(...and thanks very much for your help man :D!!!

Link to comment
Share on other sites

15 hours ago, zUsername said:

Sorry. My old laptop can't creating world with caves server. But it's works on world with no caves.

Oh, okay! Thanks a lot for your help :D!!! Shame that it doesn't work on world with caves but whatevs :D!!

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