Jump to content

making a item that when worn changes the speech file to another one (vocal translator mod)


Siletrea

Recommended Posts

hello people of the internet that reside on this forum!

I'm currently working on a Chocobo mod for ODS ROG SW and once it comes out HAMLET!

I've decided that the Chocobo will speak a legit Chocobo language!...but then I realized that may be a smidge boring to some people and even frustrating to thoes who like being informed of what they're looking at...so I came up with the idea of having a necklace item that could be crafted! (or found) that when worn would translate the Chocobo's speech into something that can actually be read and understood! by essentially switching the speech files around!

now comes the kicker! I have absolutely NO idea how to do this! my entire modding process has been Frankenstein-ing code from other mods and getting it to work via trial and error!

the attempt to have an item trigger a speech swap? Ive never seen it done in any other mod!

if someone knows how to do this file swapping or even knows of a mod that succesfully pulled it off PLEASE comment below or message me to show me!

Link to comment
Share on other sites

This is actually pretty simple thing to do. 
(I am guessing that you already have a basic prefab file done for your necklace that you mentioned)
You just need to head to your prefab file of the necklace and add 1 simple line to the "onequip" and "onunequip" functions, and obviously you nee 2 different speech files for your character to switch between.
 The line you want to work with is:
    STRINGS.CHARACTERS.YOUCHARACTERHERE = require "speech_YourCharacterHere1"

Simply replace the "YOURCHARACTERHERE" With your character's prefab name, and then make it to require "speech_YourCharacterHere2" in the "onequip" function (So upon equipping the necklace the game will switch your character's speech files), and Do the same exact thing in the "onunequip" function but this time tell it to require the original speech file of your character. (So it will return to "normal" upon taking it off)

So your code sould look something like this:

local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
    STRINGS.CHARACTERS.YOUCHARACTERHERE = require "speech_YourCharacterHere1"
end

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "YourNecklaceHere", "swap_body")
    STRINGS.CHARACTERS.YOURCHARACTERHERE = require "speech_YourCharacterHere2"
end

I hope this helps. ^-^
And good luck! 

Link to comment
Share on other sites

15 hours ago, Siletrea said:

actually @BraveChicken I dont have the necklace made yet...I dont know how to make it... any advice?

To make the necklace you will need to create custom textures for it (if you want. You can also simply copy already existing textures and simply recolor them.)  So basically you'll need an anim file for your necklace. A Build renamer to be able to name the build of your necklace. ( Here is a link in case you don't have them ) And a simple prefab file.
Now I made you a base prefab file since I already had in my own mod an item which didn't had too many complicated things on it, and I marked you all of the things that you would need to know. (Remember just to replace the "red_scarf" which was my custom item, to the name of your custom item XD and everything should hopefully work well.)

base_prefab.lua

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