Forum

targ, and attacker?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

targ, and attacker?

Postby redrum » Wed Feb 27, 2008 11:29 pm

Is there a way that I can use targ, and attacker in PlayerPostThink?
I put them in defs.qc, it compiled albeit with a bunch of warnings.
But didn't work. Any ideas would be appreciated. Thanks!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Wed Feb 27, 2008 11:45 pm

I think that's the only way:

declare in defs qc something like this:

Code: Select all
entity targ, inflictor, attacker;
float damage;


And then, remove the parameters between the parenthesis (dunno how it's written) from T_Damage() and T_RadiusDamage() declared in combat.qc, remove from other declarations and calls.

And a damaging function should be like this:

Projectile weapons:
Code: Select all
attacker = self.owner;
inflictor = self;
targ = other;
damage = X; // any number here
T_Damage ();


Instant weapons:
Code: Select all
attacker = inflictor = self;
targ = trace_ent;
damage = X; // any number here
T_Damage ();


Use T_RadiusDamage() if you want an area damage.

If you receive errors or warning try playing around with declarations with the same name, but if you're about to break your keyboard or you don't know what you're doing just ask.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Thu Feb 28, 2008 3:05 am

Nothing is ever easy in .qc :cry:
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Preach » Thu Feb 28, 2008 8:44 am

Charles Babbage was famously asked if you gave a computer the wrong input, would it still give the correct answer? He replied "I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."The same kind of confusion is probably why you haven't received much help on this question today.

The problem is that the idea of a targ and attacker don't make sense outside of a bit of code dealing with an attack from a missile or weapon. By the time you get to PlayerPreThink all attacks from the last frame have already been evaluated. So it's not clear what values you'd expect targ and attacker to take. If you just wanted them to be the last people to attack/be attacked in the last frame, what about the case where two people got damaged by the same rocket explosion. How would your code cope with that case? It would really help if we knew what kind of thing you were trying to do with targ and attacker, as then we could point you more on the right lines.
Preach
 
Posts: 122
Joined: Thu Nov 25, 2004 7:20 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest