Well I got something going the way I wanted and going well but now Im facing an error @hyperbatata mentioned. Im getting, “SystemError: val = gameOb[key]: KX_GameObject, Blender Game Engine data has been freed, cannot use this python variable” - in line 41 which is the last code i wrote below
I know it has something to do with restarting the HUD scene or the MAIN scene but how do i fix this??
Here is a brief what’s going on:
I have an empty named “GData” with a python module attached “AsgData.Update” in the HUD scene. (the MAIN scene adds the HUD scene as an overlay"])
Now in the MAIN scene (where the charater is), when the character dies I first remove the HUD scene then restart the MAIN scene. (by default it will add back up the HUD scene as an overlay).
Now the code:
my python modue "AsgData.Update is atached to a ‘tap’ always sensor so once added it loads
{in AsgData.py} - attached to an empty in the HUD scene i mentioned
import GameLogic as g
c = g.getCurrentController()
o = c.owner
objL = g.getCurrentScene().objects
MAIN scene object ------------
sl = g.getSceneList()
SceneList={}
for i in sl:
SceneList[i.name]=i
MAINscn = SceneList[“MAIN”]
objLM = MAINscn.objects
PwrAsg = objL[“PwrAsgn”] #this is another empty “PwrAsgn” in the HUD scene that has these property “PowerObt”
Player = objLM[“PlayerBase”]
def Update():
Player[“PowerPlc”] = PwrAsg[“PowerObt”] #I cant pass the property to the player ‘after restarting’ cause of the error