Wolf Planet Forum Index Wolf Planet
We want you here!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Tutorial] Random Death Messages

 
Post new topic   Reply to topic    Wolf Planet Forum Index -> Coding Alliance
View previous topic :: View next topic  
Author Message
Deathshead
Corporal


Joined: 18 Feb 2005
Posts: 87

PostPosted: Mon Apr 11, 2005 3:33 am    Post subject: [Tutorial] Random Death Messages Reply with quote

Hi all. I have once again developed a tutorial to show everyone. When you die, it gives a random number, then shows the corresponding message. There are also messages specific to certain enemies.

Let's begin. This code requires the ingame messages variation tutorial.

Open WL_GAME.C . Add the following two lines in the Global Variables section:

Code:

objtype      *LastAttacker;
void DeathMessages (void);


LastAttacker checks what enemy killed you, and DeathMessages is the routine that gives the random message. Now scroll down, and add this routine above the Died Function:

Code:

/*==
==== DeathMessages ();
==== By Deathshead
====
==== Checks for the
==== LastAttacker, then
==== display a random
==== random message
==*/

void DeathMessages (void)
{
   switch (rand()%7)
   {
      case 0:
      if (LastAttacker->obclass==guardobj)
               Msg_Printf ("Player gunned down by Guard");
           else if (LastAttacker->obclass==dogobj)
               Msg_Printf ("Player bit off more than he could chew");
           else if (LastAttacker->obclass==ssobj)
               Msg_Printf ("Player pumped full of lead");
           else if (LastAttacker->obclass==officerobj)
               Msg_Printf ("Player met an untimely end");
           else if (LastAttacker->obclass==mutantobj)
          Msg_Printf ("Player couldn't take the pressure");
           else
               Msg_Printf ("Player resigns from life");
           break;
      case 1:
           Msg_Printf ("Player became bored with life"); break;
      case 2:
           Msg_Printf ("Player bit the dust"); break;
      case 3:
           Msg_Printf ("Player likes the taste of blood"); break;
      case 4:
           Msg_Printf ("Player gave up"); break;
      case 5:
           Msg_Printf ("Player forgot to dodge"); break;
      case 6:
           Msg_Printf ("Player forgot not to die"); break;
   }
   IN_ClearKeysDown();
}


Then inside the died function, look for:

Code:

   gamestate.weapon = -1;         // take away weapon
   SD_PlaySound (PLAYERDEATHSND);


And add:

Code:

   DeathMessages ();


Directly underneath. Save and compile.

There you go
-Deathshead
_________________
Myspace
VampireFreaks
Music4Life
Wolfing Time
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Flamer46
Newbie


Joined: 16 Feb 2005
Posts: 25
Location: Italy

PostPosted: Mon Apr 11, 2005 4:15 pm    Post subject: Reply with quote

Hey very cool deathshead.
_________________
Join my forum at
[url]wolfingdays.exoboards.com[/url]
and visit my site at
www.wolfer.co.nr
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Wolf Planet Forum Index -> Coding Alliance All times are GMT
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


Powered by phpBB © 2001 phpBB Group

Chronicles phpBB2 theme by Jakob Persson (http://www.eddingschronicles.com). Stone textures by Patty Herford.