Forum

findradius in CSQC?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

findradius in CSQC?

Postby Ghost_Fang » Thu Feb 16, 2012 8:08 am

I'm not sure what I'm doing wrong here, the code works just fine in SVQC, but it doesn't work at all in CSQC. Did I do something wrong?

Code: Select all
local entity blip;
  blip = findradius(self.origin, 300);
  while(blip)
   {
      if(blip != self)
         {
         if(blip.classname == "player")
            {
            centerprint(blip.netname);   //Yes, thats all I'm doing, just to see if the dang code works!
            }
         }
   blip = blip.chain;
      }
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: findradius in CSQC?

Postby Cobalt » Thu Feb 16, 2012 3:30 pm

hhmm, Im not sure it detects the entity at the self.origin , all the code I have studied so far will check for world or other things , but nothing about self.


Code: Select all
e = findradius (self.origin, 75);
      while ((e != world))
      {
         if ((e.classname == "trigger_teleport"))
         {
            ObserverTeleporter (self, e);
            e = world;
         }
         e = e.chain;
         if (!e)
         {
            e = world;
         }
      }
User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: findradius in CSQC?

Postby Spike » Thu Feb 16, 2012 8:36 pm

csqc is not ssqc. that is the entities in ssqc only exist in csqc if you create them, either through the SendEntity stuff or from spawn() in the csqc. Either way you need to explicitly set the classname within csqc or it'll be blank.

findradius works purely on origin (and usually solidity), it doesn't care about self (and will thus return it as it would any other entity), but will ignore world.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: findradius in CSQC?

Postby Ghost_Fang » Thu Feb 16, 2012 10:14 pm

So would I call that findradius function in ssqc then the found entities moved to csqc via addentity, then do my stuff from there?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest