[Solved] NexgenPLus 2 annoucer voice Need Help can't play the 2nd sound)

Discussions about Coding and Scripting
Letylove49
Experienced
Posts: 133
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: <[MHA]> /UK Admin
Location: suisse

[Solved] NexgenPLus 2 annoucer voice Need Help can't play the 2nd sound)

Post by Letylove49 » Sun Sep 11, 2022 12:03 am

Ok i would like to set 2 sound with the count down with Nexgenplus
1 wiih Prepare
2 Goodluckwarrior ( like in MHA edtion)

I wish to let to the player to choose betwen the 2 sound.

this come from NXPClient

here the fonction for the count down

Code: Select all

/***************************************************************************************************
 *
 *  $DESCRIPTION  Timer tick function. Called when the game performs its next tick.
 *                The following actions are performed:
 *                 - Game start count down announcing.
 *  $PARAM        delta  Time elapsed (in seconds) since the last tick.
 *  $OVERRIDE     
 *
 **************************************************************************************************/
simulated function tick(float deltaTime) {
	super.tick(deltaTime);
	
	// Client side actions.
	if (role == ROLE_SimulatedProxy && client != none && !client.bNetWait) {
		
		// Game starting count down ticked?
		if (client.gInf.gameState == client.gInf.GS_Starting && lastCountDown != client.gInf.countDown) {
			lastCountDown = client.gInf.countDown;
			
			// Play count down announcer sound?
			if (bEnableStartAnnouncer) {
				if (1 <= lastCountDown && lastCountDown <= 10 &&
				    lastCountDown <= client.sConf.startTime - startCountDownWait) {
					client.player.receiveLocalizedMessage(class'Botpack.TimeMessage', 16 - lastCountDown);
				} else if (!bGameStartingAnnounced) {
					bGameStartingAnnounced = true;
                                        
                              if(!bEnablePrepareMessage)
					client.player.clientPlaySound(sound'Prepare', , true);
					else
					 if(!bEnableGoodLuckWariorMessage)
					client.player.clientPlaySound(sound'GoodLuckWarrior', , true);
				}
			}
		}
		
	}
	
	// Server side actions.
	if (role == ROLE_Authority) {
		// Disable UT antispam.
		if (NXPConfig(xControl.xConf).disableUTAntiSpam) {
			client.player.lastMessageWindow = 0;
		}
	}

}
 

Code: Select all

 // Dynamic control info.
var bool bEnableStartAnnouncer;                   // Enable game start count down voice announcer.
var bool bEnablePrepareMessage;                   // Enable Message Prepare for Battle.
var bool bEnableGoodLuckWariorMessage;            // Enable Message GoodLuckWarior.
var int lastCountDown;                            // Last known value of gInf.countDown.
var bool bGameStartingAnnounced;                  // Has the game starting state been announced yet?


// Client side settings.
const SSTR_EnableStartAnnouncer = "EnableStartCountDown";        // Enable game start countdown voice.
const SSTR_EnablePrepareMessage = "EnablePrepare";               // Enable game start with Prepare.
const SSTR_EnableGoodLuckWariorMessage = "EnableGoodLuckWarrior"; // Enable game start with GoodLuckWarrior.


// Client side settings default values.
const SSTRDV_EnableStartAnnouncer = "true";
const SSTRDV_EnablePrepareMessage = "true";
const SSTRDV_EnableGoodLuckWariorMessage = "false";

i don't understand what i have do wrong. someone can help me to fix this ???

thanks in advance
Last edited by Letylove49 on Thu Sep 22, 2022 5:53 pm, edited 1 time in total.
<[MHA]>Letylove49 aka Shado170

Letylove49
Experienced
Posts: 133
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: <[MHA]> /UK Admin
Location: suisse

Re: NexgenPLus 2 annoucer voice Need Help can't play the 2nd sound)

Post by Letylove49 » Mon Sep 12, 2022 6:22 pm

i have try to remove a bool fonction to have only the goodluck warior to enable or diseable horewer that don't work better

Code: Select all


***************************************************************************************************
 *
 *  $DESCRIPTION  Timer tick function. Called when the game performs its next tick.
 *                The following actions are performed:
 *                 - Game start count down announcing.
 *  $PARAM        delta  Time elapsed (in seconds) since the last tick.
 *  $OVERRIDE     
 *
 **************************************************************************************************/
simulated function tick(float deltaTime) {
	super.tick(deltaTime);
	
	// Client side actions.
	if (role == ROLE_SimulatedProxy && client != none && !client.bNetWait) {
		
		// Game starting count down ticked?
		if (client.gInf.gameState == client.gInf.GS_Starting && lastCountDown != client.gInf.countDown) {
			lastCountDown = client.gInf.countDown;
			
			// Play count down announcer sound?
			if (bEnableStartAnnouncer) {
				if (1 <= lastCountDown && lastCountDown <= 10 &&
				    lastCountDown <= client.sConf.startTime - startCountDownWait) {
					client.player.receiveLocalizedMessage(class'Botpack.TimeMessage', 16 - lastCountDown);
				} else if (!bGameStartingAnnounced) {
					bGameStartingAnnounced = true;
                                        

                              if(!bEnableGoodLuckWariorMessage)
                              client.player.clientPlaySound(sound'GoodLuckWarrior', , true);
                             else
			client.player.clientPlaySound(sound'Prepare', , true);
					
					 
					
				}
			}
		}
		
	}
	
	// Server side actions.
	if (role == ROLE_Authority) {
		// Disable UT antispam.
		if (NXPConfig(xControl.xConf).disableUTAntiSpam) {
			client.player.lastMessageWindow = 0;
		}
	}

}
 
 

Code: Select all

// Dynamic control info.
var bool bEnableStartAnnouncer;                   // Enable game start count down voice announcer..
var bool bEnableGoodLuckWariorMessage;            // Enable Message GoodLuckWarior.
var int lastCountDown;                            // Last known value of gInf.countDown.
var bool bGameStartingAnnounced;                  // Has the game starting state been announced yet?


// Client side settings.
const SSTR_EnableStartAnnouncer = "EnableStartCountDown";        // Enable game start countdown voice.
const SSTR_EnableGoodLuckWariorMessage = "EnableGoodLuckWarrior"; // Enable game start with GoodLuckWarrior.
<[MHA]>Letylove49 aka Shado170

Letylove49
Experienced
Posts: 133
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: <[MHA]> /UK Admin
Location: suisse

[Solved] NexgenPLus 2 annoucer voice Need Help can't play the 2nd sound)

Post by Letylove49 » Thu Sep 22, 2022 5:52 pm

i have fund the solution

Code: Select all

 #exec OBJ LOAD FILE=Announcer
#exec AUDIO IMPORT NAME="alertSound" FILE="Resources\alertSound.wav"
#exec AUDIO IMPORT NAME="Prepare" FILE="Resources\Prepare.wav"
#exec AUDIO IMPORT NAME="GoodLuckWarrior" FILE="Resources\GoodLuckWarrior.wav"

Code: Select all

// Client side settings.
const SSTR_EnableStartAnnouncer = "EnableStartCountDown";        // Enable game start countdown voice.
const SSTR_EnableGoodLuckWariorMessage = "EnableGoodLuckWarrior"; // Enable game start with GoodLuckWarrior.
const SSTR_ShowPingStatusBox = "ShowPingStatusBox";              // Show a ping status box in the HUD.
const SSTR_ShowTimeStatusBox = "ShowTimeStatusBox";              // Show a time status box in the HUD.
const SSTR_LastVersionNotify = "LastVersionNotify";            // Last Nexgen update the client was notified of. 

Code: Select all

// Client side settings default values.
const SSTRDV_EnableStartAnnouncer = "true";
const SSTRDV_EnableGoodLuckWariorMessage = "true";
const SSTRDV_ShowPingStatusBox = "false";
const SSTRDV_ShowTimeStatusBox = "false"; 

Code: Select all

 /***************************************************************************************************
 *
 *  $DESCRIPTION  Initializes the client controller.
 *  $OVERRIDE
 *
 **************************************************************************************************/
simulated event postNetBeginPlay() {
	if (bNetOwner) {
		super.postNetBeginPlay();
		
		// Load localization support.
		lng = spawn(class'NXPLang', self);
		
		// Check if start announcer should be enabled.
		bEnableStartAnnouncer = client.gc.get(SSTR_EnableStartAnnouncer, SSTRDV_EnableStartAnnouncer) ~= "true";

		// Check if GoodLuckWariorMessage  should be enabled.
		bEnableGoodLuckWariorMessage = client.gc.get(SSTR_EnableGoodLuckWariorMessage, SSTRDV_EnableGoodLuckWariorMessage) ~= "true";  ( i have added this )

		
		
		// Make sure the HUD won't show a muted icon just after we joined the game.
		lastSpamTimeStamp = -spamNotifyDuration;
	} else {
		destroy();
	}
}
here i have change if(!BenableGoodLuckWariorMessage )
by this if(bEnableGoodLuckWariorMessage ==True)

Code: Select all

// Play count down announcer sound?
			if (bEnableStartAnnouncer) {
				if (1 <= lastCountDown && lastCountDown <= 10 &&
				    lastCountDown <= client.sConf.startTime - startCountDownWait) {
					client.player.receiveLocalizedMessage(class'Botpack.TimeMessage', 16 - lastCountDown);
				} else if (!bGameStartingAnnounced) {
					bGameStartingAnnounced = true;
                                        
                             if(bEnableGoodLuckWariorMessage ==True)
					client.player.clientPlaySound(sound'GoodLuckWarrior', , true);
					else
					 client.player.clientPlaySound(sound'Prepare', , true);
					
										
				} 
now that work like i wanted.

i will put this function on Nexplus101 official relase.
<[MHA]>Letylove49 aka Shado170