Inside3D!
     

targ, and attacker?

 
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: Wed Feb 27, 2008 11:29 pm    Post subject: targ, and attacker? Reply with quote

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 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Orion



Joined: 12 Jan 2007
Posts: 414
Location: Brazil

PostPosted: Wed Feb 27, 2008 11:45 pm    Post subject: Reply with quote

I think that's the only way:

declare in defs qc something like this:

Code:

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:

attacker = self.owner;
inflictor = self;
targ = other;
damage = X; // any number here
T_Damage ();


Instant weapons:
Code:

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.
_________________
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: Thu Feb 28, 2008 3:05 am    Post subject: Reply with quote

Nothing is ever easy in .qc Crying or Very sad
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Preach



Joined: 25 Nov 2004
Posts: 122

PostPosted: Thu Feb 28, 2008 8:44 am    Post subject: Reply with quote

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.
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