A horable bug!!

I was wrighting a script for an enemies AI and a horrable thing happened. The game ran as expexted for about 2 seconds and then all of the textures went out, just as if the lights disapeared! the weirdest thing. The .blend is to big to post but here is the script it Hapened after i added lines 39 -41


import math
objectlist = GameLogic.getCurrentScene().getObjectList()
controller = GameLogic.getCurrentController()
EP = controller.getOwner()
p1 = objectlist["OBp1"]
pg = objectlist["OBenemy goal"]
eh = objectlist["OBEnemy Home"]
Ray = controller.getSensor("Ray") 
Rayp1 = controller.getSensor("Ray p1")
N10T = controller.getSensor("Near 10 True")
N20F = controller.getSensor("Near 20 False")
N3T = controller.getSensor("Near 3 True")
#if N10T.isPositive():
 #setattr(EP,"Motive", True)
if not N3T.isPositive():
 if not Rayp1.isPositive():
  if Ray.isPositive() and getattr(EP,"Motive"):
   setattr(EP,"Point",True)
   setattr(EP,"Motive",False)
   
  #here is where the problem happened. 
  if not Ray.isPositive() not N20F.isPositive:
   setattr(EP,"Point",False)
   setattr(EP,"Move",True)
  
  
 if Rayp1.isPositive():
  print "p1 spoted"
if N3T.isPositive():
 setattr(EP,"Motive", False)
 setattr(EP,"Move", False)
 
if N20F.isPositive:
 p1pos = p1.getPosition()
 pg.setPosition(p1pos)
 
if not N20F.isPositive:
 pepos = eh.getPosition()
 pg.setPosition(pepos)

“if not Ray.isPositive() not N20F.isPositive:” <<wrong line

must add “and” / “or”:
“if not Ray.isPositive() and not N20F.isPositive():”
“if not Ray.isPositive() or not N20F.isPositive():”

Ya I realized that in the counsal, but it did not help it happened when i parented an object to my player, I don’t know why. So i just parented to the armature instead and its working now but it was realy wierd.

What Blender version are you using?
This looks like pre-2.49 API.

Do not use getPosition()/setPosition() it is deprecated and inconsistent. Better use worldPosition/localPosition.
Since 2.49 properties access is in dictionary style: gameObject[“propname”]

BTW: Your variable names are really confusing.

I just forgot: Your data might be to much for your GPU. Test it on another PC.

Here’s the 2.5/2.6 api.


import math
import bge

scene = bge.logic.getCurrentScene()
controller = bge.logic.getCurrentController()

objectlist = scene.objects
EP = controller.owner

p1 = objectlist["p1"]
pg = objectlist["enemy goal"]
eh = objectlist["Enemy Home"]
Ray = controller.sensors["Ray"]
Rayp1 = controller.sensors["Ray p1"]
N10T = controller.sensors["Near 10 True"]
N20F = controller.sensors["Near 20 False"]
N3T = controller.sensors["Near 3 True"]
#if N10T.positive:
 #EP["Motive"] = True
 
if not N3T.positive:
	if not Rayp1.positive:
		if Ray.positive and EP["Motive"]:
			EP["Point"] = True
			EP["Motive"] = False
		   
		#here is where the problem happened. 
		if not ray.positive not N20F.positive:
			EP["Point"] = False
			EP["Move"] = True
  
  
	else:
		print("p1 spoted)"

 else:
	 EP["Motive"] = False
	 EP["Move"] = False
 
if N20F.positive:
	p1pos = p1.worldPosition
	pg.worldPosition = p1pos
 
else:
	pepos = eh.worldPosition
	pg.worldPosition = pepos