Hey Guys,
I tried to do a little Tower defense Game, but faced a Problem while Spawning enemys. The first one does as it should, the second one (Same object, same logic bricks, same script) doesn’t and produces following error:
BlockquotePython script error - object ‘enemy.001’, controller ‘Python’:
Traceback (most recent call last):
File “C:\Users\x\Desktop\tower defense.blend\enemy.py”, line 53, in main
File “C:\Users\x\Desktop\tower defense.blend\enemy.py”, line 25, in state_normal
ValueError: Steering not in this python controllers actuator list
Does somebody know what is wrong and how i can fix it?
Since i cannot upload a file right now heres my code for the enemy.
from bge import logic, events, types
#Sensoren und Aktuatoren verfügbar machen
cont = logic.getCurrentController()
scene = logic.getCurrentScene()
#obj = cont.owner
own = cont.owner
path = cont.actuators["Steering"]
assign = cont.actuators["assign"]
end = cont.actuators["end"]
class Enemy(types.KX_GameObject):
def __init__(self,own):
self.holder = None
self.cont = logic.getCurrentController()
#print(self.cont.actuators)
self.main = self.state_normal
#states
def state_normal(self):
#cont = logic.getCurrentController()
self.cont.activate(path)
pass
def state_gehalten(self):
cont.deactivate(path)
cont.activate(assign)
def state_kill(self):
cont.activate(end)
def kill(self):
self.main = self.state_kill
def halten(self, holder):
self.holder = holder
self.main = self.state_gehalten
def get_holder(self):
return self.holder
def main(cont):
cont = logic.getCurrentController()
own = cont.owner
if not "init" in own: #hier alles rein was nur einmal ausgeführt werden soll
own["init"] = True
own = Enemy(own)
own.main()
Thanks for your help (and mind my english, its not my mother tongue)
Gerrit