How about making a trigger_multiple -alike brush entity that counts the 
number of entities in it. Everytime something new touches it, it increments 
an integer, and decreases it when the entities leave it.
----- Original Message ----- 
From: <[email protected]>
To: <[email protected]>
Sent: Wednesday, March 11, 2009 8:35 PM
Subject: [hlcoders] Counting entities within a Custom Brush


> I'm new to Source development and would like to get an idea for the
> best way to approach my problem before embarking on writing any code:
>
> In a mulitplayer team-based environment I'd like to count the number
> of specific entities placed within a Custom Brush's radius. The number
> of entities within the brushes radius contributes directly to a
> particular teams score and I'd like to periodically increase a teams
> score over time.
>
> Essentially then, I'm looking to check for the number of entities
> within a Custom Brushes radius at set intervals. In my mind there are
> two ways of approaching this. The first is to have the brushes think()
> function count the entities and deal with them accordingly. The second
> is to have the CGameRules class search the level for any of these
> Custom Brushes and then count the number of entities within them
> (again, at set intervals).
>
> Being new to Source, I imagine the first approach would trigger a
> Logic Entity (such as math_counter). Of course, the problem here is
> that I'd like to allow for multiple Custom Brushes, so I think my
> second solution seems more flexible, in this regard (especially seeing
> as how the number of objects within a teams collection of Custom
> Brushes _can_ result in the victory of a round). How would you
> approach this?
>
> Secondly, what do people consider 'good practice' with regards to
> custom Game Rules? Do you subclass CGameRules (or some equivalent
> class), or do you edit directly (as a number of tutorial on the VALVe
> Wiki suggest?)
>
> Basically, I'd just like feedback from people with more experience to
> see if I'm heading in the right direction. I don't want to jump in at
> the deep end and sink!
>
> _______________________________________________
> 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