Sound in override folder [SOLVED]

I use Nalencer’s Companion Influence System in my modules: https://neverwintervault.org/project/nwn2/script/nalencers-companion-influence-system

Edit: I corrected the link.

I’ve never liked the sound that plays when you gain influence though. So I found another sound used in the game for other things, copied that sound to the override folder and renamed it to “gui_infuencegain01” (In the include script ginc_influence it says that it uses this sound). However, now when testing this ingame, the game still plays the old sound. How come? Shouldn’t this new sound override the old one?

A few things to consider … (I know some are obvious) … (Not at my main PC at the moment, so cannot check the files.)

  1. Did you restart the game after moving to override folder.?
  2. Do you have any other stuff in override or hak that uses same file?
  3. Check name: Eg: Is it gui_influencegain_01? (With underscore?)

I don’t recall testing from an override, but changing within a campaign folder does work, so I would have guessed this should too.

Try writing your own test script to play your new sound and see what it plays … maybe it’s something in the way it is scripted? (Just a guess.)

Let me know,
Thanks, Lance.

I found what was wrong. There’s an error in the ginc_influence code:

	if (StringToInt(sChange) < 0) // influence loss
	{
   		SendMessageToPC(oPC, "Lost influence with " + sName + ": " + sChange + " (Total: " + IntToString(nInfluence) + ")");
   		SetNoticeText(oPC, "Lost influence with " + sName + ": " + sChange + " (Total: " + IntToString(nInfluence) + ")");
		PlaySound(SOUND_INFLUENCE_LOSS);
	}	
	else // influence gain
	{
		SendMessageToPC(oPC, "Gained influence with " + sName + ": +" + sChange + " (Total: " + IntToString(nInfluence) + ")");
   		SetNoticeText(oPC, "Gained influence with " + sName + ": +" + sChange + " (Total: " + IntToString(nInfluence) + ")");
		PlaySound(SOUND_INFLUENCE_GAIN);
	}

Nalencer had mixed up what sound that should be played, that’s why I there was no difference with my new sound in the override.

Hi andgalf,

Sorry, I don’t see the problem here … :roll_eyes:

I mean if you identified the sound correctly (which I assume you did), then changing the sound file (for that name) would make a difference no matter the scripting (as you said).

I mean SOUND_INFLUENCE_GAIN will have been defined somewhere, and that would have been the sound file you mentioned … and that is the bit you were changing, yes?

Can you explain this some more please? Or was there anything else you did that may have helped?

Thanks, Lance.

Ok. Somehow I showed you the wrong code. This is what it looked like before:

if (StringToInt(sChange) < 0) // influence loss
	{
   		SendMessageToPC(oPC, "Lost influence with " + sName + ": " + sChange + " (Total: " + IntToString(nInfluence) + ")");
   		SetNoticeText(oPC, "Lost influence with " + sName + ": " + sChange + " (Total: " + IntToString(nInfluence) + ")");
		PlaySound(SOUND_INFLUENCE_GAIN);
	}	
	else // influence gain
	{
		SendMessageToPC(oPC, "Gained influence with " + sName + ": +" + sChange + " (Total: " + IntToString(nInfluence) + ")");
   		SetNoticeText(oPC, "Gained influence with " + sName + ": +" + sChange + " (Total: " + IntToString(nInfluence) + ")");
		PlaySound(SOUND_INFLUENCE_LOSS);
	}

Hi andgalf,

The problem is that no matter how the script is written, if you replace the “sound file” that you do not like, then it will (read should) change.

From what you write, it implies you had not identified the correct sound file (that you did not like) then?

i.e. The influence gain file (which even if it was being incorrectly passed via SOUND_INFLUENCE_LOSS), could not have been “gui_infuencegain01”, as if it was, your changing it would have sufficed (as you rightly point out).

Maybe I am not understanding what you are saying … But the key point here is if you had definitely identified the “gain” sound file you did not like. If it was NOT “gui_infuencegain01”, then changing the script WILL change the sound, but not in the way you think.

I may try downloading that link and checking closer, to try to understand more.

EDIT: Do a search to see what SOUND_INFLUENCE_LOSS and SOUND_INFLUENCE_GAIN actually refer to as sound files to play. That will help. :slight_smile:

Thanks, Lance.

Exactly.

I’m actually not sure what you are on about here. It’s a really simple thing. It seems like you make it to be something bigger than it is. I changed the influence gain sound. Tried it ingame and didn’t hear any difference because the code didn’t play my sound, it played the influence loss sound. When changing the code I heard my sound in game and therefore that was the only thing that was anything to talk about. I thought that placing a new sound in one of my hak files or in the override folder didn’t do anything but of course it did, it was the code that was referencing the wrong sound.

It was just a simple error in the ginc_influence code. When changing that everything behaved as it should.

I guess I could/should just delete this whole topic since it’s unnecessary, but sure, if someone else uses Nalencer’s scripts it’s good that they know they need to edit it.

Hi andgalf,

Right I understand where you are coming from now … It is because you said this …

"I’ve never liked the sound that plays when you gain influence though. So I found another sound used in the game for other things, copied that sound to the override folder and renamed it to “gui_infuencegain01” (In the include script ginc_influence it says that it uses this sound). "

You mean that the sound allocated for the loss and gain were not the way around that you liked it, and that the coder had “put them the wrong way around” by the looks of it.

You had (fairly) assumed that the one used for “gain” had been the file “gui_infuencegain01", but it was not … but that’s my point. :slight_smile:

i.e. The script is not necessarily incorrect (although it certainly may well be from your post), but replacing the sound file (which was your original question) does work if you are replacing the correct file that the code is referring to. :slight_smile: The point is, you had not identified the correct sound file being played that you had not liked (if you see what I mean). < Not your fault at this point by the way, if the coder said that’s what it was.

I am not trying to complicate things, only make the logic clearer … if you see what I mean … After all, replacing a sound file in an override does work as long as you identify the sound file correctly in the first place … :slight_smile: That’s all I am trying to clarify.

EDIT: I just tried to download that file to check it out for any other errors, but cannot find it! It does some training dummy thing. :roll_eyes: Any other link perhaps?

Thanks, Lance.

I don’t agree. It is incorrect. It plays the sound for influence loss when influenced is gained and vice versa. That’s why it is indeed wrong. That’s why my initial statement was correct: “Nalencer had mixed up what sound that should be played, that’s why I there was no difference with my new sound in the override (when I did a scene ingame where you gained influence with a character).”

Yes, of course. But since there was an error in the coding, it led me to believe otherwise.

If I had read the code very thoroughly before adding my new sound everything would have been ok, but my guess was that since it was put here on the vault, and I have had no problem with this system (these scripts) before, I had no reason to believe it was anything wrong in the code, therefore I didn’t read through the ginc_influence script. I thought instead that I had done something wrong with putting my new sound in the override folder, but that was never the case.

The link does not work? How come? I click on it and it shows up.

Here is the link again:
https://neverwintervault.org/project/nwn2/script/nalencers-companion-influence-system

Hi andgalf,

I know … and that’s why I was trying to reassure you that you had NOT done anything wrong by trying to replace the sound file in your override - that should have worked … :slight_smile:

The error in the script (which I can well believe) and agree with you, however, was not the angle I was coming from. (i.e. It is “incorrect” from what it was aiming to do, but it was not broken in the fact that it still produced something. That is what I meant by what I said.) I focussed on the fact that I (wrongly) assumed you had checked the name of the file that needed changing … re my first post … and simply replaced that. That procedure would work … but, we now both know that trusting what someone says they have done and what is actually done is one of the first things to check … and I include myself in that. :wink:

i.e. I may say one thing, but double-check the code if something does not work as expected. Hey, I’m the king of updates and fixes for my own mod!, So, I should know. :wink:

I have never yet downloaded anything that I have not found errors in that have needed recoding. The bottom line being, it would have been prudent to double check the sound file you were trying to change … if (like you discovered) … expected results did not work.

I still only get Training Dummy links in that link you supply … i.e. I reckon the original poster may have abandoned that code you speak of … I’ll post an image to show what I mean …

Thanks, Lance.

Sorry for the small image, but I wanted to capture the whole page for you to be able to see …

1 Like

Ok, now I feel we are on the same page and understand each other. I guess because I’ve never been good at scripting, I’ve always trusted others here on the vault to always do things correctly (especially if it is something that’s been uploaded with files and all), and that the fault always lies with me. And again, since these scripts have worked flawelessly for me before I didn’t think to check it. But I’ll try to remember that from now on.

Huh? :astonished: I downloaded it and it is as you say…weird. There are no ga_influnece scripts there. That was really odd. Will check and see if I can find it elsewhere.

Ok, here is the correct one, I think (why is the other one there I wonder):
https://neverwintervault.org/project/nwn2/script/nalencers-companion-influence-system

Hey! We are two of a kind! Just be patient with each other and we’ll get there. :+1: After all, we all beginners to others … you are not alone. :wink:

Apart from that sound I assume … :wink:

Got It … I’ll take a quick look at it…

EDIT: Yup! The sounds play in “reverse” to that expected, and here is the bit I was also looking for … just to make sure the const string was referring to the correct sound file.

const string SOUND_INFLUENCE_GAIN = “gui_infuencegain01”;
const string SOUND_INFLUENCE_LOSS = “gui_infuenceloss01”;

Thanks, Lance.