findradius in CSQC?

Discuss programming in the QuakeC language.
Post Reply
Ghost_Fang
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

findradius in CSQC?

Post by Ghost_Fang »

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;
      }
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: findradius in CSQC?

Post by Cobalt »

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;
			}
		}
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: findradius in CSQC?

Post by Spike »

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.
Ghost_Fang
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: findradius in CSQC?

Post by Ghost_Fang »

So would I call that findradius function in ssqc then the found entities moved to csqc via addentity, then do my stuff from there?
Post Reply