I haven’t been able to get theaddObject python script to work.
I think this might be a bug that’s new in 2.64… or maybe I’m just failing here somewhere.
null named shooter in layer 1
sensors: delay 10 connected to
controller: python - running shooter.py (this file)
cone named bullet in layer 2
the problem is that if we show layer 2, we get a value error
which says " scene.addObject(object,other,time): KX_Scene (first argument):
object must be set in an inactive layer
but, if we hide layer 2, then we get another error:
Key Error: “CList[key]: ‘‘bullet’’ key not in list”
'cuz it’s in a hidden layer.
I really need this to work so I can do stuff with my objects
after I spawn 'em… OR in general, spawn them from the
import bge sce = bge.logic.getCurrentScene() shooter = sce.objects["shooter"] bullet = sce.objects["bullet"] shell = sce.addObject(bullet, shooter, 0)
add object error.blend (381 KB)