Changing a sound

I saw this in Spells.txt:

±------±--------------
| Z,AA | ConjSoundMale, ConjSoundFemale
±------±--------------
Obsolete with NX1 spell chant system. These are the sound effects for the chanting that the caster does while invoking the spell. If the spell is disrupted, this sound plays anyway, and plays for the full duration dispite any changes to CastTime/ConjTime.

2 Likes

So it seems like the sound for bard-casting is hardcoded … to use a file with the label “gui_whistlesong*”

@andgalf
out of curiosity, how did you find out that the name of the songcast sound is gui_whistlesong ?

May be involving completely different sound file utilization, but may provide clues (or not):

https://neverwintervault.org/project/nwn2/audio/sound/nwn1-spell-chants-nwn2

I’m pretty far from my computer and unable to look at these files. There may be 2da files within

1 Like

It was by accident. Since it sounded like whistling when casting the spell, I searched for whistle I believe when on a node in the conversation editor. Listening to the sound I recognize that it was the one used for casting the spell. So, as I think I’ve already explained, I first downloaded a new female singing sound and called it gui_whistlesong01 and put it in my campaign folder. That made the sound appear ingame

But I need to override the whistling sound with two different sounds: one male singing and another with female singing. That’s what this is all about, and that’s why I would need a script doing that. A script that checks if the caster is male or female and choose the sound thereafter. Or, preferably, if there was a 2da row/column/whateverit’scalled where I could point the game to the correct sound if the caster is male or female.

1 Like

Sadly, those are just the different female and male chant sounds. They don’t contain any scripts or 2da files.

I guess all this must be hardcoded then since noone seems to know (or if it’s even possible) how to change the whistling sound if the caster is male or female within a 2da or a script.

Yes, that’s the only logic solution. And it seems the game switches from gui_whistlesong01 to gui_whistlesong02 to gui_whistlesong03 to gui_whistlesong04 at random, even if I’ve only heard proof of the game using gui_whistlesong01 and gui_whistlesong02 so far with the Fascinate spell. That’s my guess at least.

There’s no other 2da one could check that would prove useful for this? No other spell 2da or something like that?

those 2 statements conflict, just sayin’

bizarre …

aye, if one can get the ConjSound* fields to work that would be the ticket

(as long as any other places that use the whistle sound use a new file …)

2 Likes

That’s correct, and that’s because I initially had two Spells.2da in my override. I can confirm that ConjSoundMale and ConjSoundFemale indeed does work. However, those sounds are not the ones I want to change. Those are the conjuring sounds, the “talk chant” sounds, if you will. From what I can tell ConjSoundOverride doesn’t work though.

EDIT: Did some more testing:

  1. At the moment I have my own gui_whistlesong01, 02, 03, 04 in my campaign folder.
  2. I have Akhacha 's 2da in my override folder.
  3. In the 2da: The spell Fascinate uses gl_dove_0000 on ConjSoundMale, ConjSoundFemale and ConjSoundOverride (on all three of them).

We first hear Kaelyn’s line and shortly thereafter we hear one of my own samples. I also (and I’ve got proof now) noticed that the game is indeed switching between the four gui_whistlesong samples at random.

EDIT2: When using “1” on the ConjSoundOverride we still hear one of my own samples. I even tried putting vs_chant_evoc_lm there, and it doesn’t do anything.

EDIT3: So the question remains:

  1. Why doesn’t ConjSoundOverride do anything?
  2. Which code/script decides to switch between all the 4 gui_whistlesong samples? Is it indeed hardcoded or is there a script somewhere hidden deep within the toolset that handles this?
1 Like

@andgalf

You might be able to play your sound using spell pre cast hook.

Use empty sounds to prevent official ones. Then use GetGender function in spell pre cast script to determine which of yours to play.

Not at computer, so can’t test myself yet.

I don’t know how to do that. I think I’ve used a spellhook before, but I never understood how that worked fully. Aqvilinus helped me with that on one of my modules, I believe. So I would need further more in depth instructions to know what to do.

@andgalf

I’ll test the theory first and come back to you. :slight_smile:

I played around with it a bit more, and here’s what it looks like: the whistling (and presumably other instrument sounds) are tied to the ConjAnim column. Set it to **** and you won’t get those sounds anymore (and the animation won’t be the same, but well, decide for yourself if that’s an issue or not); you will get regular casting conjuration sounds, but you can override these with ConjSoundOverride.

ConjSoundOverride assumes a prefix, denoting gender and whether the caster is friendly or hostile, so for a bard song you’ll want the female one to be labled “FF_namehere”, and the male one “MF_namehere”.

Try this for inspire courage for example, replacing FILENAME with the name of your file without prefix:

905	Song_Inspire_Courage	112394	ife_BR_inspcourage	V	P	v	0x00	0x01	nw_s2_SngInCour	****	****	****	****	****	****	****	1	2000	****	****	****	****	****	****	****	****	FILENAME	bardsong	500	fx_bard_ins_song_cast.sef	fx_bard_ins_song_cast.sef	****	****	****	0	****	****	****	****	****	****	****	****	****	****	****	****	****	****	****	****	8	****	3	112394	0	0	0	53224	0	1466	****	****	0	****	0	0	0

1 Like

If the animation isn’t the same anymore, then I don’t know…feels like I would be changing too much.

I’ll wait and see what @Lance_Botelle comes up with first.

The difference in animation is very minor, try it out and see for yourself. Use inspire courage with the above line, and then try out another inspiration. There’s just a slight difference in pose.

@andgalf

Unfortunately, the timing is not the same (which I thought may be the case)… While the test sound plays at the start of the spell script, it does not start at the beginning of casting. :thinking:

So, there would be silence right up until the spell script itself cast - and from a coding perspective would amount to just adding sounds to the beginning of each bard “spell” … although using the spellhook means you only have to write it once and it works for all bard spells.

So, I don’t think that is what you wanted as I imagine you want the singing to be heard prior the actual casting? That’s the usual thing anyway.

I’ve never looked into replacing the bard sounds before, and so may take a quick look over these posts to see what else was discussed. :thinking:

Well, the way it works now in the vanilla version it seems (maybe I would need to check again since now I don’t quite remember how the vanilla thing appears with all this testing) that first there is a chant and then there is the whistling. So it’s not that greatly timed. I think I’ll actually go test the vanilla thing right now to check how it is…

@andgalf

If you want to test the timing yourself, there is a quick and easy test you can use before doing anything with spell hooking or gender checking …

Just add a PlaySound (anything you want) in a Bard “spell” script and test that script. Make sure it is the first thing the script does before the rest of the script fires the actual spell. This is effectively what the spellhook does, but spellhooking (if used) will do it for all spells you select it for. (i.e. All bard spells.)

Edit: If you want to prevent the oc whistle during the test, add a blank version of the file to the campaign folder.

1 Like

Alright, so I tested it with the vanilla thing. In the vanilla game the chant and the whistling appears roughly at the same time, which is actually a bit weird. It’s like the character both says the spell and then whistles it at the same time, which is impossible if you don’t have two mouths. So there is that.

@andgalf

See my last post about testing the script timing way. :+1:

You have to wait, I was to test @Akhacha 's suggestion first. I can’t keep up with all suggestions right now.

And I don’t know quite how you mean here. I have never (or maybe I have but now I feel stressed out) done a script when one casts a spell. I might have something from kevL_s where that is done, but having to go through and search for something like that takes too much time and effort at the moment, so this is just not something I can easily do. If it’s easy for you, please provide an example script for me to test instead. That would save me sooo much time and effort.

I have to go into the city to eat lunch now anyway. Be back in two hours or so. Then I will test @Akhacha 's thing. Too bad he wanted me to test another spell than the Fascinate spell, getting this to be way more complicated than it should have been, sigh.

@andgalf

No problem … it was only for you to see/hear the timing for yourself. :slight_smile:

The spell to edit would be the official nw_s2_sngfascin, which you are mentioning… and you would just be adding something like this … at the start of the script.

PlaySound(“gui_critical1”); // JUST AN EXAMPLE SOUND

You can ignore blanking the original bard sounds for now if you wanted to just hear when the scripted sound played in relation to anything else.

As in edited nw_s2_sngfascin … (Code shortened just to show the edited portion.)

#include "x0_i0_spells"
#include "nwn2_inc_spells"

void main()
{
	PlaySound("gui_critical1"); 

       if ( GetCanBardSing( OBJECT_SELF ) == FALSE )
	{
		return; // Awww :(	
	}
1 Like