AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Find all brushes in a map (https://forums.alliedmods.net/showthread.php?t=128539)

drekes 06-02-2010 08:41

Find all brushes in a map
 
Hi

I want to know if it is possible to find all the brushes a map has without making a while for all the entity names. I want to find every wall, door, box, just everything. I tried using a 0 index but that doesn't work.

Thanks

joropito 06-02-2010 10:56

Re: Find all brushes in a map
 
Quote:

Originally Posted by drekes (Post 1197888)
Hi

I want to know if it is possible to find all the brushes a map has without making a while for all the entity names. I want to find every wall, door, box, just everything. I tried using a 0 index but that doesn't work.

Thanks

You can, at plugin_init, iterate over all entities (from glb_maxClients+1 to glb_maxEntities). Check if it's a valid entity and then do whatever you want (store in array, print out info, etc).

You can get entity class using pev_classname.

drekes 06-02-2010 12:36

Re: Find all brushes in a map
 
Could you make an example of it? I don't understand it very well.

joropito 06-02-2010 13:10

Re: Find all brushes in a map
 
This is untested, but should work.

PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    new class[
32]
    new 
maxents global_get(glb_maxEntities)
    for(new 
0<= maxentsi++)
    {
        if(!
pev_valid(i))
            continue

        
pev(ipev_classname, class, charsmax(class))
        
server_print("Found entity %i with classname of %s"i, class)
    }
    
server_print("Have a good day!")



drekes 06-02-2010 13:13

Re: Find all brushes in a map
 
Thanks, i understand it now. I'll try it out.

EDIT: works on everything, except some walls, i guess the brushes that aren't an entity. Is it possible to do stuff with them to?

grimvh2 06-02-2010 13:57

Re: Find all brushes in a map
 
the "walls" you know mostly have no classname, only special walls are "func_wall"

drekes 06-02-2010 13:59

Re: Find all brushes in a map
 
Quote:

Originally Posted by grimvh2 (Post 1198114)
the "walls" you know mostly have no classname, only special walls are "func_wall"

Is it possible to find and do something with those to?
i tried "" and "worldspawn", but it didn't worl

joropito 06-02-2010 14:05

Re: Find all brushes in a map
 
Are you sure that they're entities?

Try with this tool

http://forums.space-headed.net/viewtopic.php?f=43&t=111

To list ALL entities issue the command "listent" at console

drekes 06-02-2010 14:07

Re: Find all brushes in a map
 
i'm pretty sure that they aren't entity's but just walls with no classname, like grimvh2 said. But is it possible to do stuff with those walls to? Like in this case render them?

Nice tool, gonna mess around with it now.

wrecked_ 06-02-2010 15:49

Re: Find all brushes in a map
 
Quote:

Originally Posted by drekes (Post 1198132)
i'm pretty sure that they aren't entity's but just walls with no classname, like grimvh2 said. But is it possible to do stuff with those walls to? Like in this case render them?

Nice tool, gonna mess around with it now.

Unfortunately, no. You're not able to really do anything to the worldspawn brushes. Those are basically the map only and not entities. Since they aren't actual entities, you're not able to render them.


All times are GMT -4. The time now is 05:16.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.