I have a “SetScene” actuator, it’s set to change the scene to “Scene2”. How can I change the scene it’s suppossed to set with a python script in realtime?
I have tried this:
scene = con.getActuators()[0]
scene.setScene("Scene3")
It seems that “setScene” doesn’t change the scene the actuator is suppossed to set…?
Figures. I’ve noticed this bug with some other logic bricks too. The near sensor’s property remains the same even after you change it with python. The people working on the python API need to adress this issue.
Yeah I found that annoyin as well. You can still change the scene that the actuator calls in python, but you have to activate the actuator from the same python script to get it to work. Like this:
scene = con.getActuators()[0]
scene.setScene("Scene3")
GameLogic.addActiveActuator(scene, 1)
Yeah I found that annoyin as well. You can still change the scene that the actuator calls in python, but you have to activate the actuator from the same python script to get it to work. Like this:
Code:
scene = con.getActuators()[0]
scene.setScene(“Scene3”)
GameLogic.addActiveActuator(scene, 1)
I know that, I was not showing the whole script. “setScene” is simply not working, when I changed the Scene actuators value manually and ran it using the same script it worked fine…
getActuators() returns a list of all the actuators that are connected, [0] pulls out the first one it finds (not necsisarily the first one you attached).
The 1 in addActiveActuator turn the actuator on, a 0 would tell it to turn the actuator off.
setScene DOES work when you use it with the addActiveActuator function, I use it a lot in my projects.
It returns them in the order that they appear on the screen, ie the top most one on the screen will be at position [0] in the list. Perhaps a better way to retrieve the actuator you want tho is to use the function:
the only time i can get setScene() to work is when the scene you are setting into the logicbrick is the active one, so i guess for now youll have to use multiple actuators