I’m trying to build an inventory and have encountered a problem. My setup and idea behind it goes like this:
I have an Inventory object in the overlay scene. I have an actor in my game scene and a demoobject I want to add to the overlay scene,parent that new object to the inventory and then remove the original from the game scene.
So for the triggering I chose a touch sensor because I know how to build it and know that it works. When the demoobject gets touched by the actor it sends a message to the inventory object, which reads the message, gets the object and should add it to the scene.
Only it doesn’t add it to the overlay scene but to the game scene.
The scripts look like this:
the sending script looks like this:
import bge cont=bge.logic.getCurrentController() obj=cont.owner act=obj.actuators messageact=act print(obj) messageact.body=obj.name overlay=bge.logic.getSceneList() print(overlay) print(messageact.body)
and the recieving script like this:
import bge print("getscalled") overlay=bge.logic.getCurrentScene() con=bge.logic.getCurrentController() inv=con.owner itemget=con.sensors["Message1"].bodies print(itemget) Scenelist=bge.logic.getSceneList() Gamescene=Scenelist print(Gamescene) Item=Gamescene.objects[itemget] print(Item) overlay.addObject(Item,inv,10)
If anyone has suggestions how to solve this or do it otherwise or do it better, please tell me. If you need more info to find the fault, just ask and I’ll do my best to give it to you.