ebmar

[TSL] PlaySound Utility Script

Recommended Posts

This is not in any way your go-to modding tools, though perhaps closer to *amazing new discoveries*, lol - so I dropped it here. 🍻

So, this list of texts and numbers below --

//:://////////////////////////////////////////////////////////////
//:: [TSL] PlaySound Utility Script
//:://////////////////////////////////////////////////////////////
//:: File Name     : eb_playsound_wav
//:://////////////////////////////////////////////////////////////
/*
   Param1/P1         -  Delay that will be applied before playing
                        the sound
   string sSoundName -  sTemplate of the Sound in the game files
                        to play
   
   Created By      : ebmar [based on OEI's implementation]
   Created On      : May 05, 2020
   Modified On     : June 11, 2020 -- v1.0.0
   Credits         : JCarter426    -- Odyssey++
                   : Fred Tetra    -- KotOR Tool
                   : tk102         -- DLGEditor
                   : Don Ho        -- Notepad++
*/
//:://////////////////////////////////////////////////////////////

void main()
{
	int nDelay          = GetScriptParameter(1);
	string sSoundName   = GetScriptStringParameter();

	DelayCommand(IntToFloat(nDelay), PlaySound(sSoundName));
}

- is an equivalent to a_playsndobj, a TSL's utility script that plays the sound objects indicated by tag passed in. On the other hand, instead of using the oTag of sound objects/UTS in the game-world like its older-brother, this will use the sString that it gets from the String Param of the DLG.

To use it is fairly simple:

  1. Drop the compiled script/NCS to the Override folder
  2. Insert the script name [default eb_playsound_wav] to either Script #1/#2 field in the relevant node of the DLG
  3. Use P1 to determine the delay applied before playing the sound
  4. Use String Param to determine which sound to play, based on their template/file name

Notes:

  1. In my experience using this script -which is in TSL, and not K1-  PlaySound action can only play custom files that placed in the Override. I have tried with customs placed in StreamSounds but I can't seem get it to work. You might though, perhaps I was missing something
  2. You can't input decimals. I don't know what the legit term is but you can only insert integers/INT; something like 0, 1, or 2, and not FLOAT, like 0.2, 1.25, or 4.20. You can though - but not with this script and using the DLG as the medium

Anyway, here's the compiled script if you don't feel like compiling yourself -- eb_playsound_wav.ncs

Hope that helps anything of your projects, and may the Force be with you! :cheers:

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.