node object geting list of properties with python

i am working on an rts game i need the ai bots to get the list of the objects with a propertie

Try this:


for i in range(0,len(List)):
    obj = List[i]
    if hasattr(obj,"property to look for"):
        if own.getDistanceTo(obj) < 500: # Max Distance

    gl.List #List of objects
    print gl.List

And if you want to find the nearest object add this at the bottom:

lt = len(gl.enemyList)
    enemyRanges = []
    if lt > 0:                        
        for i in range(0,len(gl.enemyList)):
            enemy = List[gl.enemyList[i]]
            dist = own.getDistanceTo(enemy)
        own['target'] = OB' + enemyRanges[0][1][2:]

And lastly, a link to my A* pathfinding demo -

thank you so much dude :slight_smile: