AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Get all childrens of entity (https://forums.alliedmods.net/showthread.php?t=330205)

Ilusion9 01-24-2021 07:55

Get all childrens of entity
 
PHP Code:

void LoopThroughAllEntityChildrens(int entity)
{
    
int child entity;
    while ((
child GetEntPropEnt(childProp_Data"m_hMoveChild")) != -1)
    {
        
// do something with child here

        
int peer child;
        while ((
peer GetEntPropEnt(peerProp_Data"m_hMovePeer")) != -1)
        {
            
// do something with child here

            
LoopThroughAllEntityChildrens(peer);
        }
    }


This code loops through all childrens of entity.
If we have something like this:

HTML Code:


Func_Door
        Trigger_Hurt (Func_Door is parent)
                Env_Laser (Trigger_Hurt is parent)
                Env_Spark (Trigger_Hurt is parent)
                        Trigger_Push (Env_Spark is parent)
        Trigger_Multiple (Func_Door is parent)

We can retrieve all entities in this list and do something with them.

Bacardi 02-02-2021 19:59

Re: Get all childrens of entity
 
cool loop


All times are GMT -4. The time now is 00:37.

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