Inside3D!
     

Killing Spree

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Tue Aug 28, 2007 1:05 am    Post subject: Killing Spree Reply with quote

How would I go about creating a killing spree message.
I tried this:

if (1 <= time <= 5 && self.frags >= 3)
sprint (self, PRINT_HIGH, "you are on a killing spree!\n");


Trying to get the message to print if you have 3 or more kills in a 5 second span.

It didn't quite work although it compiled Smile

Any words of wisdom?
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Orion



Joined: 12 Jan 2007
Posts: 413
Location: Brazil

PostPosted: Tue Aug 28, 2007 1:44 am    Post subject: Reply with quote

Well, you should remove the code you created.
Open client.qc and before ClientObituary() add:

Code:

.float kill_time, kill_amount;
void(entity dude, float howmany) killmsg =
{
   if (howmany == 11)
      centerprint(dude, "Humongous Hemorraghe!\n");
   else if (howmany == 10)
      centerprint(dude, "Ultra Violence!\n");
   else if (howmany == 9)
      centerprint(dude, "Serious Dismemberment!\n");
   else if (howmany == 8)
      centerprint(dude, "Massive Destruction!\n");
   else if (howmany == 7)
      centerprint(dude, "Major Demolish!\n");
   else if (howmany == 6)
      centerprint(dude, "Death wake!\n");
   else if (howmany == 5)
      centerprint(dude, "Monster kill!\n");
   else if (howmany == 4)
      centerprint(dude, "Riot kill!\n");
   else if (howmany == 3)
      centerprint(dude, "Multi kill!\n");
   else if (howmany == 2)
      centerprint(dude, "Double kill!\n");
   else
      return;
};


Notice the dot floats (.float) I created. kill_time will be the time between your kills, and kill_amount will be your individual kills, that aren't frags. And if you use time itself for those messages, it will only work at the first 5 seconds of game for example.
The time float will increase every frame, that's why it only works at the beginning of game, and that's why I've created a kill_time.

You can change the messages in the centerprints if you want.
Now at ClientObituary(), before (if (rnum == IT_AXE)) add:

Code:

if (attacker.kill_time >= time)
{
   attacker.kill_amount = attacker.kill_amount + 1;
   killmsg (attacker, attacker.kill_amount);
}
else
   attacker.kill_amount = 1;
if (targ.classname == "player")
   attacker.kill_time = time + 3;


The kill_time you can change to some other number of seconds too.
Now compile and it should work.
_________________
There's no signature here. Stop looking for one.
Back to top
View user's profile Send private message
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Tue Aug 28, 2007 2:52 am    Post subject: Reply with quote

Thanks Orion! It works great!
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming 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 © 2004 phpBB Group