PCS Game Hosting
 
  Forum Index    Search    Usergroups    Edit your profile    Members    Arcade    Ranks

 Reputation    Medals    Staff    Statistics    Board Rules    Forum FAQ    Private MessagesLogin, Check Messages    Log in 

Search for at
Soldier Of Fortune 2 Advanced Search



Post new topicReply to topicprinter-friendly viewThank Post
   Soldier Of Fortune 2 Forum Index » SOF2 Tutorials » how to add your own gameover song (code)
 View previous topic :: View next topic  
Author Message
kingsfloo
Moderator
Moderator


Gender: Gender:Female
Joined: Jan 15, 2014
Last Visit: Mar 25, 2019
Age: 26
Posts: 57
Location: Argentina
Argentina.png 
Reputation: 328.3
votes: 1
Medals: 2 (View more...)
Distinguished Uploader (Amount: 1)

Status: Offline
PostPosted: Wed Apr 08, 2015 6:09 pm
PostPost subject: No icon how to add your own gameover song (code)
Reply with quote

i´m bored then i decide to make this very little tutorial about how to add your own gameover song in your client mod ...its very very easy and i think everyone can do it whitout any problems....

first go to cg_local.h

// all of the model, shader, and sound references that are
// loaded at gamestate time are stored in cgMedia_t
// Other media that can be tied to clients, weapons, or items are
// stored in the clientInfo_t, itemInfo_t, weaponInfo_t

then put the new song i put this exactly here...under the fragselfsound

qhandle_t fragSelfSound;
qhandle_t       gameoverSound; //there is your song


now go to cg_main.c

/*
=================
CG_RegisterSounds

called during a precache command
=================
*/

then just put your song...i put my song here

cgs.media.gogglesOffSound = trap_S_RegisterSound ( "sound/weapons/goggles/turn_off.mp3" );
cgs.media.gameoverSound   = trap_S_RegisterSound ( "sound/mysong/gameover.mp3" );  //gameover song what u hear when the map end...u need just put the route where u are going to save your song...is important the cgs.media.gameoverSound this name (gameoverSound) need to be exactly like u write in local.h

finally go to cg_event.c and the part CG_GameOver need to look like this

/*
=============
CG_GameOver
=============
*/
static void CG_GameOver ( entityState_t *ent )
{
switch ( ent->eventParm )
{
case GAME_OVER_TIMELIMIT:
Com_sprintf ( cgs.gameover, MAX_QPATH, "Timelimit Hit" );
trap_S_StartLocalSound ( cgs.media.gameoverSound, CHAN_AUTO );  //Floo add gameover sound 2013
           break;

case GAME_OVER_SCORELIMIT:
if ( cgs.gametypeData->teams )
{
switch ( ent->otherEntityNum )
{
case TEAM_RED:
Com_sprintf ( cgs.gameover, MAX_QPATH, "%s%s^7 Team hit the score limit", cgs.teamData.teamcolor[1], cgs.teamData.redName );
trap_S_StartLocalSound ( cgs.media.gameoverSound, CHAN_AUTO );  //your gameoversong..again be carefull to write the cgs.media part, respect how u write this in local.h and main
break;

case TEAM_BLUE:
Com_sprintf ( cgs.gameover, MAX_QPATH, "%s%s^7 Team hit the score limit", cgs.teamData.teamcolor[2], cgs.teamData.blueName );
trap_S_StartLocalSound ( cgs.media.gameoverSound, CHAN_AUTO );  //your gameover song
break;
}
}
else
{
Com_sprintf ( cgs.gameover, MAX_QPATH, "%s" S_COLOR_WHITE " hit the score limit", cgs.clientinfo[ent->otherEntityNum].name );
trap_S_StartLocalSound ( cgs.media.gameoverSound, CHAN_AUTO );   //your gameover song
}
break;

default:
return;
}

CG_CenterPrint ( cgs.gameover, 0.43f );

Com_Printf ( "@%s
", cgs.gameover );
}

ok, thats all what u need to add in the source code...now u need to add the .mp3 song into your rocmod_2.1c.pk3:

1) remember what u add in main with this route? sound/mysong/gameover.mp3...thats what we need to do...create a folder called sound, inside this other called mysong, and inside this put the gameover.mp3 song (dont modificate the name)

2) open your rocmod.pk3 with winrar or paskape and put the folder inside the pk3

3) go to the game and when the timelimit hit or the map end u will hear your song!

note: the song need to be 44100 Hz and in Mono (no stereo or others things)

End...like i say its basic and easy to do...
Back to top
View user's profile Send private message
Sponsor
Punisher
Administrator
Administrator


In Game: The Punisher
Gender: Gender:Male
Joined: May 04, 2012
Last Visit: Jun 16, 2019
Age: 22
Posts: 740

Netherlands.png 
Reputation: 3594
votes: 3
Medals: 2 (View more...)
Dedication (Amount: 1)

Status: Offline
PostPosted: Wed Apr 08, 2015 7:27 pm
PostPost subject: No icon Re: how to add your own gameover song (code)
Reply with quote

Nice tutorial made,

Quote:

i´m bored


Play sof2 :d


Website: House of Pain Server - Website
Serverlist: House of Pain Server - Serverlist

<a><img></a>

<a><img></a>
Back to top
View user's profile Send private message
kingsfloo
Moderator
Moderator


Gender: Gender:Female
Joined: Jan 15, 2014
Last Visit: Mar 25, 2019
Age: 26
Posts: 57
Location: Argentina
Argentina.png 
Reputation: 328.3
votes: 1
Medals: 2 (View more...)
Modder (Amount: 1)

Status: Offline
PostPosted: Fri Apr 10, 2015 5:00 am
PostPost subject: No icon Re: how to add your own gameover song (code)
Reply with quote

lol ya i play sometimes Smile ...usually a bit in the night
Back to top
View user's profile Send private message
abdouraoui
Pro Poster
Pro Poster



Joined: Aug 23, 2013
Last Visit: Sep 05, 2018
Posts: 21


Reputation: 43.9
Medals: None

Status: Offline
PostPosted: Fri Apr 10, 2015 10:43 am
PostPost subject: No icon Re: how to add your own gameover song (code)
Reply with quote

Thanks Floo nice job i like it Smile
Back to top
View user's profile Send private message
Sponsor
Smiley face
Display posts from previous:
Post new topicReply to topic printer-friendly viewThank Post
Soldier Of Fortune 2 Forum Index »  SOF2 Tutorials
 
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts How to make you own mod? 6 Crankedup 4698 Tue Jun 19, 2018 11:00 pm
Punisher View latest post
No new posts SOF2MAPPING Tutorial.2 - Make a room 0 Punisher 2101 Tue Oct 06, 2015 3:16 pm
Punisher View latest post
No new posts To make it more clear to everyone READ PLZ 3 Teo 4162 Thu Nov 28, 2013 8:41 pm
Teo View latest post
No new posts want to make a post :) 6 conviction 4996 Thu Nov 15, 2012 10:08 pm
Lessoe View latest post
No new posts Teo which programs u use for make themes? 1 MacTavishXx 3944 Wed May 02, 2012 5:23 pm
Teo View latest post
 




Back to Top

SOF2.ORG Multiplayer Community © 2019 All times are UTC + 2 Hours [DST enabled]
 

Copyright ©