Impulse commands

Discuss programming in the QuakeC language.
redrum
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Post by redrum »

Guys, I tried some of the tutorials. I got to the footsteps to work, and the proportional fall damage to work as well. (Didn't teach me much though, more of a walk-thru).
I can't get the healing backpack to work. Is the tutorial correct?

Where can I find the "Coffee" Tutorials?

Thanks for putting up with a noob!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
Orion
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Post by Orion »

There's a mistake in the healing backpack tutorial.
To fix that, find BackpackTouch() in items.qc, and after this line: (other.ammo_cells = other.ammo_cells + self.ammo_cells)

Add this:

Code: Select all

other.health = other.health + self.health;
	if (other.health > other.max_health)
		other.health = other.max_health;
Now the player will receive health. :wink:


Here you can find the Coffee's tutorials.
redrum
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Post by redrum »

Thanks man! I'll try it out later.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
redrum
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Post by redrum »

Man am I getting frustrated! :x

It didn't work. Still won't compile.

Anyway, I was thinking and tinkering. I thought it would be better if you lost health for picking up a backpack. A penalty for all the goodies. So I tried some coding on my own:


PLAYER BACKPACKS

===============================================================================
*/

void() BackpackTouch =
{
local string s;
local float best, old, new;
local entity stemp;
local float acount;
local float b_switch;

self.touch=health_touch;
self.healamount = -25;
if (self.health <= 0)
return;


if (deathmatch == 4)
if (other.invincible_time > 0)
return;

I added the code in bold.

The good news is it worked. When I grab the backpack I lost 25 health. :o
Bad news is if I died I wouldn't respawn. I'd just lie there on the ground dead. :x

How do I get to respawn?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
scar3crow
InsideQC Staff
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Post by scar3crow »

I'm not a coder, but in my dabbling, I have found that if your health goes below 1, and it isn't dealt by T_damage or some sort (anyone can correct me on this I know), it doesn't perform a proper death.

Instead of just doing a negative heal amount, you need to put in the backpack's touch function a damage call to whoever is picking it up. Take a look at the code for weapons and see how they damage things, find the specific line, and try applying similar to the backpack touch.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

What scar3crow said. Also what the iD source code says. T_Damage and T_RadiusDamage should be the only functions used to do damage to the player.
redrum
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Post by redrum »

Ok, got it.
All I needed to do was add:

T_Damage (other, self, self, 5);

In (void() BackpackTouch =) to do 5 damage. :)

I have another question.
You know how you lose a frag when you fall to your death?
How can that be removed?
I looked for a (self.frags = self.frags - 1; ) in (void() PlayerPostThink =) in client.qc where the code is for the falling damage, but I didn't see it. :?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Post by Sajt »

I think that happened in the ClientObituary function (bottom of client.qc)
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
redrum
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Post by redrum »

OK, found it. Thanks.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
Post Reply