1

Topic: Get the real-time position of a projectile?

If the player shoots a gun, how would I get the real time position of the bullet and do something with it? Is there a variable for that?

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);

2

Re: Get the real-time position of a projectile?

WTH...?
The "real time position"?
explain, what do you mean?^^

ima charhgin ma lazerz!!1
SHOOP DA WHOOOOP!!!!!!11

3

Re: Get the real-time position of a projectile?

Like, the player fires a projectile, and I set a var ("shot_time") to when the projectile is fired. Then, if a certain amount of time (one second) passes after shot_time I perform an action, but I need to do it where the projectile is after one second.

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);

4

Re: Get the real-time position of a projectile?

you can find it in function tick of class projectile in file src/game/server/gs_server.cpp. you don't need this shot_time. it's saved in objects of projectile in var start_tick. then you can use server_tick() to get the current tick and so on.

5

Re: Get the real-time position of a projectile?

Ok, so projectile::tick will yield the real time pos? Thanks. Shot_time is actually modified after the projectile fires, so I will use it.

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);

6

Re: Get the real-time position of a projectile?

No, that doesn't work because tick() returns nothing. <.<

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);

7

Re: Get the real-time position of a projectile?

Do you want to get position in server or client?

Sorry for my english sad

8

Re: Get the real-time position of a projectile?

What do you mean by that? What's the difference?

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);

9

Re: Get the real-time position of a projectile?

look at the code of this function. It is self-explanatory. You only have to modify projectile::tick():

float pt = (server_tick()-start_tick-1)/(float)server_tickspeed();
float ct = (server_tick()-start_tick)/(float)server_tickspeed();
vec2 prevpos = get_pos(pt);
vec2 curpos = get_pos(ct);

10 (edited by shmafoozius 2008-06-17 07:16:37)

Re: Get the real-time position of a projectile?

Roanoke wrote:

No, that doesn't work because tick() returns nothing. <.<

Uh.. what are you trying to do? You should put your code into this method, not somewhere else.

/edit: ok, scous answered while I was reading some other posts... X-P

bam: WARNING:'src/game/server/gamemodes/mod.cpp' comes from the future

11

Re: Get the real-time position of a projectile?

Thanks, scousu. I'll check it out later.

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);