1) When hammer adds properties to an entity the property name is always
forced lowercase, so you will never metach the property "m_iPowerzone".
2) Depending on the version of the compile tools you're using they may be
deleting non-dynamic & unanamed the light entities out of your BSP after
RAD, many recent version  do this to reduce the number of entities.

-----Original Message-----
Date: Tue, 3 May 2005 10:44:38 +1000
From: Josh Matthews <[EMAIL PROTECTED]>
To: hlcoders@list.valvesoftware.com
Subject: [hlcoders] UTIL_FindEntityBy problems
Reply-To: hlcoders@list.valvesoftware.com

Rightm the UTIL_FindEntityBy* functions have been giving me some
problems with the work I'm doing for HL1.  I'm trying to find all
light entities with a certain property that I've added to group
certain lights together, there's a new variable in the fgd base light
class, and it's in the corresponding CLight class too, I've done the
keyvalues etc.  Anyways, I first tried using UTIL_FindEntityByString,
using the normal loop method:

CBaseEntity *pEnt = NULL;
for(;pEnt = UTIL_FindEntityByString(pEnt,"m_iPowerzone",m_iPowerzone;)
{
  if(!pEnt) break;
  //...
}

This came up with no entities.  I have checked the fgd, the light
class has a member called m_iPowerzone which is a string, it's
recorded in the KeyValues() function for CLight.  I'm stumped.  I
decide to try using the Classname function, like so:

for(;;)
{
  switch(light_type)
  {
    case 0:
      pTarget = UTIL_FindEntityByClassname(pTarget,"light");
      if(!pTarget) { ALERT(at_console,"no more lights\n");
light_type++; continue; }
      else break;
    case 1:
      pTarget = UTIL_FindEntityByClassname(pTarget,"light_spot");
      if(!pTarget) { ALERT(at_console,"no more light_spots\n");
light_type++; continue; }
      else break;
    case 2:
      pTarget = UTIL_FindEntityByClassname(pTarget,"light_environment");
      if(!pTarget) { ALERT(at_console,"no more light_environments\n");
return; }
      else break;
  }
  //...
}

And it's as I suspected, it doesn't even find a single light entity.
The test map I'm working with has two of them, they have different
powerzone settings, but this finds nothing at all.  Any suggestions?

Josh


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to