Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Telefrag gun help please :/

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
gnounc Joined: 06 Apr 2009 Posts: 120 |

Posted: Thu Aug 12, 2010 12:49 pm Post subject: Telefrag gun help please :/ |

I'm on my second attempt at making a telefrag gun. This time I figured I'd adapt the self teleporter tutorial. I got to the point where shooting the enemy twice would telefrag them, but I didnt want to have to be aiming at them the second time.
I just want to tag them, then be able to teleport to where they are at my leisure.

Code:
void() W_FireTp = { local vector dir,org; local entity t_ent; dir = aim (self, 100000);
traceline (self.origin, self.origin + dir*2048, FALSE, self);
if(!self.tele_dropped)
{
t_ent = trace_ent; //records entity
if (t_ent.takedamage)
{
self.teledrop_dest = spawn(); //create a temp entity for location of Teleporter
self.tele_dropped = 1;
}
}
else
{
if(self.health <= 0) {
return;
}
self.teledrop_dest.origin = t_ent.origin; //records the entity location
self.teledrop_dest.mangle = self.angles;
spawn_tfog (self.teledrop_dest.origin);
makevectors (self.teledrop_dest.mangle);
org = self.teledrop_dest.origin;
spawn_tfog (org);
spawn_tdeath (org,self);
setorigin (self,self.teledrop_dest.origin);
self.angles = self.teledrop_dest.mangle;
self.fixangle = 1;
self.velocity = v_forward * 100;
self.teleport_time = time + 0.5; // Shorter teleport recovery time
self.flags = self.flags - self.flags & FL_ONGROUND;
self.tele_dropped = 0;
}
};

Any help?
Right now it just teleports me to exactly where I'm at, I dont see anything wrong, except maybe the engine doesnt keep track of the entity position after the frame has already checked it?

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Thu Aug 12, 2010 4:07 pm Post subject: |

t_ent is not set (so world). Which means its teleporting you to '0 0 0', surely? If you get stuck, quake will move you back to the last location where you were not stuck, so basically back to where you were, so no difference in position overall.
_________________
What's a signature?

Back to top |

gnounc Joined: 06 Apr 2009 Posts: 120 |

Posted: Fri Aug 13, 2010 6:06 am Post subject: |

Thanks, but would you know why t_ent isnt set? Does trace_ent expire? And would you know how to fix it so t_ent is usable?

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Fri Aug 13, 2010 9:00 am Post subject: |

you could always try setting it in each pathway. Indentation is good. _________________ What's a signature?

Back to top |

gnounc Joined: 06 Apr 2009 Posts: 120 |

Posted: Sat Aug 14, 2010 5:36 pm Post subject: |

Rich pointed out t_ent should be global if its supposed to be persistant. Works just fine now : )

Back to top |

Display posts from previous:

| 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