Hello all,
I 've a problem with the edit object actuator.
I want to create a tile map game (like starcraft %|
), 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
%| ) 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??
?
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
https://blenderartists.org/forum/viewtopic.php?p=272991#272991
Jason Lin
Damn.
Jason, thanks for your answer (very fast
: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