Inside3D!
     

Telefrag gun help please :/

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
gnounc



Joined: 06 Apr 2009
Posts: 120

PostPosted: Thu Aug 12, 2010 12:49 pm    Post subject: Telefrag gun help please :/ Reply with quote

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
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Thu Aug 12, 2010 4:07 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
gnounc



Joined: 06 Apr 2009
Posts: 120

PostPosted: Fri Aug 13, 2010 6:06 am    Post subject: Reply with quote

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
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Fri Aug 13, 2010 9:00 am    Post subject: Reply with quote

you could always try setting it in each pathway.
Indentation is good.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
gnounc



Joined: 06 Apr 2009
Posts: 120

PostPosted: Sat Aug 14, 2010 5:36 pm    Post subject: Reply with quote

Rich pointed out t_ent should be global if its supposed to be persistant.

Works just fine now : )
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