In a follow up to this fantastic question that I've been waiting for some one to ask, I would like to know how I can send d people in an RTS game to different locations. I already have an empty being added with a different property each time I click, but I don't know how to get flocks to only steer toward an object with a certain property, and not just the object.

How can I set an object to only seek empty with property[goto]=1 while anoter group is seeking empty with property[goto]=2, and so forth? This would be really helpful, thanks.

  • $\begingroup$ can you provide a .blend to start with ? $\endgroup$
    – Chebhou
    Apr 5, 2015 at 1:42
  • $\begingroup$ Already done. :D $\endgroup$
    – ruckus
    Apr 5, 2015 at 1:50

1 Answer 1


To make every characters go to a certain target whenever you click the ground we create flag object and set it as a target for the selected characters, when all the characters reaches the flag, it gets deleted

Details :

we have the function main() which is excuted when you MMBclick on the ground this function :

  • creates a new Flag object at cursor position
  • loop through all objects and find the selected ones that have Move property, for each found object :
  • change the Steering actuator target to this new Flag
  • increment the Flag Followers property by one
  • set the object properties Active and Move to True
  • when Active and Move are set the object start seeking the flag

this is done with this part of code :

    flag = scene.addObject("Flag", "Tracker", 0)
            for obj in scene.objects :
                if obj.get('Select', False) and 'Move' in obj.getPropertyNames() :
                    obj.actuators["SeekTracker"].target = flag
                    obj['Move'] = True
                    obj['Active'] = True
                    flag['Followers'] +=1

The Flag has property Followers which indicate how many objects have it as a target, so if it has no followers it should be removed , for this we have a function flag_self_check() which does that, the code part for this is :

def flag_self_check():

        cont = logic.getCurrentController()
        own = cont.owner

        if own['Followers'] == 0 :

but what makes the Followers count goes down ? it is the object, the moving object has a near sensor to detect the flag when the object gets near the flag it stops Moving and decrement the flag Followers count by one

def reach_dest():

        cont = logic.getCurrentController()
        own = cont.owner
        sen = cont.sensors["Near"]

        if sen.positive :
            hit_flag = sen.hitObjectList[0] 
            if hit_flag :
                if hit_flag == target :
                    hit_flag['Followers'] -= 1
                    own['Move'] = False

i have added if hit_flag == target : so moving object don't stop at the wrong flag when passing by


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .