Inside3D!
     

Death timer?

 
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: Mon Feb 18, 2008 5:40 am    Post subject: Death timer? Reply with quote

Guys once again I am in a bind.
I'm trying to get a timer started when the player dies and stops when the player respawns and grabs his first item.

In Clientobituary() I tried:

Code:
targ.deathtimer = time + 3;    //(I want my actions to take place 3 seconds after death)

if (targ.deathtimer == time)
if (targ.netname == "redrum")
   stuffcmd(targ, "say nice shot!\n");


Stopping the timer would be easy, so I don't need help with that part.
Any suggestions?
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Willem



Joined: 23 Jan 2008
Posts: 73

PostPosted: Mon Feb 18, 2008 10:17 am    Post subject: Reply with quote

I'm new to QuakeC but would:

Code:
if (targ.deathtimer >= time)


Be any more reliable? Checking for == with floats is often bad news in C based languages.
_________________
www.wantonhubris.com
Back to top
View user's profile Send private message Visit poster's website
Orion



Joined: 12 Jan 2007
Posts: 414
Location: Brazil

PostPosted: Mon Feb 18, 2008 1:09 pm    Post subject: Reply with quote

ClientObituary() is only called after a player is killed... if you check for that in there it won't work properly.

Remove the time check but keep this line and add another after it:

Code:

targ.deathtimer = time + 3;
targ.dontloop = 0;


and put this new one in PlayerPreThink():

Code:

if (self.deathtimer < time)
if (damage_attacker != self)
if (!self.dontloop)
{
         self.dontloop = 1;
         stuffcmd (self, "say nice shot!\n");
}


And at the very top of the file, add this line:

Code:
.float dontloop;


And it should work. Smile
_________________
There's no signature here. Stop looking for one.
Back to top
View user's profile Send private message
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