Yep, gEntList works great - I can pull out the exact entities I'm looking
for. I'll try limiting the drop into getValidEntities() to only happen once
every few secs, and to be honest there won't be many entities to parse in
the level - I store a pointer to each valid entity if I need to access them
at all.

If anyone's interested, I'm aiming to implement a Hierarchical Task Network
to control the AI agents for my thesis, so I'll probably be inundating the
list with more engine questions in the next few weeks, unfortunately.
Thankfully, you guys really seem to know your stuff :) I have the actual
planner stuff mostly figured out already (made a prototype in C#) so it's
mostly porting to C++ and then finding the right places to hook it into the
engine now.

I'll probably release the source code when I'm finished so others can dig in
and take a look, and improve it past the proof-of-concept that I'll work it
to.

Cheers again.
Iain

On Tue, Mar 23, 2010 at 5:13 PM, Matt Hoffman
<[email protected]>wrote:

> That sounds like a pretty good one. There's also the ability to look in a
> sphere (Which is actually a box(?)), etc. I used this to create a 3d radar
> that found entities in a  512 sphere and put a debug box over them.
>
> However, looping through the entities (in my case) is expensive to my
> knowledge. Just something you might watch out for.
>
> On Tue, Mar 23, 2010 at 10:08 AM, Iain Breen <[email protected]> wrote:
>
> > Trawled through the hlcoders archives, think I found the answer:
> >
> >
> http://www.mail-archive.com/[email protected]/msg23102.html
> > points
> > to gEntList - I'm testing that now, but please correct me if I'm on the
> > wrong track.
> >
> > Thanks,
> > Iain.
> >
> > ---------- Forwarded message ----------
> > From: Iain Breen <[email protected]>
> > Date: Tue, Mar 23, 2010 at 4:43 PM
> > Subject: Retrieve List of entities in a level
> > To: Discussion of Half-Life Programming <[email protected]
> >
> >
> >
> > Is there a way to retrieve a list of all entities in a level? I've
> created
> > a
> > test level with a custom NPC and a custom Area trigger, so is there some
> > structure that contains pointers to these objects?
> >
> >  Basically, I'm looking to retrieve a boolean from a function
> > inArea(Entity,
> > Area) in the Area class. I have the Area object detecting whether a
> > relevant
> > object is inside or not (for now either the player or the NPC) using
> > inputs/outputs in Hammer, so I need the NPC's think function to be able
> to
> > retrieve the status of inArea() for each area in the level. In the
> future,
> > I'll need to retrieve status from a few more custom entities that I'll be
> > adding, so I need to be able to parse all entities in the level (I'll
> > probably bound this to a certain radius around the NPC).
> >
> > Thanks
> > Iain
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to