GameLogic (object adding)

Hello all,

I 've a problem with the edit object actuator.

I want to create a tile map game (like starcraft %| :expressionless: ), and I think the best (and fastest ) developpement solution consists in creating all model units in an inactive layer, and calling instances of them as much as needed during the game.

First, I did a simple test to see how it works. A script, linked to an empty object with an edit object actuator, is supposed to perform generations of some objects from an inactive layer.
I used the setObject method in my script. The problem is when I quit after object is created, Blender 2.34 crashes with an “abnormal program termination program”.

The console sys Exception exceptions.TypeError: ‘argument 1 must be KX_GameObject, not str’ in’garbage collection’ ignored

Here is my (simple :wink: %| ) code :

import GameLogic
toto = GameLogic.getCUrrentController().getActuators()[0]
#the edit object actuator

toto.setObject(‘Cylinder’)#a stuff in another layer
GameLogic.addActiveActuator(toto,1)

What’s going wrong?? :expressionless: ?

:expressionless: Yeah, it was almost like the problem I had. Blender 2.34 still has some bugs and I guess this is one of them. The logic brick edit object only adds the default object that you put into the parameter with no problem. But if you specify another object in python then you get an error.

I already filed it as a bug report a while ago. It’s been assigned to Kester so hopefully it’ll be fixed on the next Blender release. Take a look at the bug report here.

http://projects.blender.org/tracker/?func=detail&atid=125&aid=1522&group_id=9

Also the topic on elysiun here
http://www.elysiun.com/forum/viewtopic.php?p=272991#272991

Jason Lin

Damn.

Jason, thanks for your answer (very fast :stuck_out_tongue: :Z !). Do you have another solution to create an object during the game depending of a “pre-existing model” ?

I’ve just tried to copy the data of the model object with Object.Get(‘my_model’).getData() into a new object, and link it to the scene, but this one is only created after the game ends. I must have missed something.

Well basically that’s just the edit object actuator. If you use 2.25 with your python code, it should work. You could then change back to using the newer version of Blender whenever it comes out when the bugs fixed.

Haven’t found a way to fix it.

Jason Lin