List of issues I need some help with? seek/spawn/paths?

Hi folks,

I need some help with a few issues I have come across during production of my game.

These problems could be due to my overall experience of BGE, but I’m sure you all aware of the problems I am having. Any help would be great thank you.

  1. Seeking newly spawned in units from another layer. I’m guessing this has something to do with object being named “object.001” etc when they are being spawned in but I cant get anything to seek any object from another layer.

  2. Creating paths for objects, I have created everything for an object to move on a path, and this happens during playback from the timeline, but when the game engine is engaged the object hits dead center. I have done every tutorial I can but for some reason when I get everything setup the object goes to dead center. I’m guessing this has something to do with finalizing the path or something?

These problems are holding my game back so I hope you understand my frustration. But I also know Blender has a very large learning curve. And most terms are new to me. Been using blender for about 3/4 years so any help on these issues would be greatly appreciated.

Thank you.

SM.

Not sure how this ended in artists? should be in BGE…

SM

I moved your post to Game Engine-support and discussion…
Might get better responses there.

1 Like

Cheers, I’m unsure how it got here :slight_smile: might of been duel tabs in web browser sorry for inconvenience.

1 Like

Not a problem, just helping out to get the best chance to find you a solution…

I would help out but I know zilch about BGE…

1 Like

This post was for this forum, maybe to much hooch!! :wink: :slight_smile:

Are you a python user?

No?

Yes?
you should look into a* pathfinding

Also what is your goal? thing you want to make? char follow 1 thing or multiple etc…?

As for following you will need python to spawn in an object then use that data to let something search/follow it.

1 Like

Thank you, I watched it. I can code this stuff but I’m looking to make some basic commands to basic objects. This is the mad world of blender “old washed out BGE”.

This video is completely not what I need. I need to be able to seek spawned units from other layers, and follow the path of a “path” with an object.

SM.

And I have my own python :wink:

What path? nodes or…?

seeking objects is not hard, you know python so go trough the objects, put the objects you want to look for into a list, now you can select an object from that list to seek to.

so for example you can do…:

def test(cont):
    
    own = cont.owner
    
    #grab the objects one time at start
    if not 'first_time' in own:
        own['obj_to_seek'] = [obj for obj in own.scene.objects if 'property' in obj]
        own['first_time'] = True
    
    #now do with it what you like
        
    own['obj_to_seek'][0] #first entry
    
    #or
    
    for obj in own['obj_to_seek']:
        if obj['look_for']: #look_for property in the object set to true then..
            #code to search for the obj
            own['search_object'] = obj
            

    if own['search_object']:
        #let the player or something search for that object here
        #or follow the path to it

I know my python…

I can seek anything I want in the “engine” but I cant from another layer?

I’m guessing as a n00b here. But is it just the Boolean numbers?
If I’m getting that right.

SM.

Ill show you more close up and I don’t know python. thanks for the help.

SM.

Hmm ok.

so you use a steering brick then?

def test(cont):
    
    own = cont.owner
    
    #spawn object
    added = own.scene.addObject('name_of_obj_to_spawn', 'spawn_location', 0) # 0 = no duration so unlimited time
    
    #if you using the steering brick then you can set the taget like this
    
    steer_brick = cont.actuators['the name of steering brick here']
    steer_brick.target = added
    
    cont.activate(steer_brick)

i believe this are the commands for the steering brick, not completely sure due to i don’t use bricks.

Thanks for the help. But I thought all this code was gone from Blender “BGE”…

No why? BGE stays BGE, bge 2.79 or upbge 0.2.5 all use the same coding. The code won’t be removed, changed yes, some things have been added or changed a tiny bit but other then that the code is (t)here forever.

However the BGE itself has been removed from blender version 2.8 and up, so if you want to use the evee render then you should download upbge 0.3.0 and even then the python code is still there to be used. (maybe not everything, dunno not using 0.3.0 myself).

1 Like

Sure you can. Your logic brick is probably still referencing the original object. You can use Python to change the target to the newly spawned object.

Try not to reference things by object name. Instead, keep a reference to the object made by the “add object” by invoking it in Python and capturing the last created object.

1 Like

once you start adding objects, logic bricks become quickly useless.