Is there any place where you could see how to use an actuator in python. For example I’d like to add an overlay scene with python, how?
You connect the python controller to the actuator. Make this setup:
Sensor => Python Controller => Scene Actuator - Scene Actuator set to overlay called “overlay”
In your script put this:
import GameLogic as g
cont = g.getCurrentController()
own = cont.getOwner()
overlay = cont.getActuator("overlay") # "overlay" is the name of the actuator
g.addActiveActuator(overlay,1) # activate actuator (replace 1 with 0 to deactivate)
That’s how I would do it. Remember that the actuator should be set up like for normal useage. I apologize if I mispelled anything.
Hi Abel,
You need not go anywhere to see how to do things in Python. Python is self documented.
Cont= GameLogic.getCurrentController()
print dir(Cont)
Own = Cont.getOwner()
print dir(Own)
Act = Cont.getActuator(“Act”)
print dir(Act)
the print dir() can be used with any object. It prints out the functions that can be used for the object in the console window. Try it out. You can use it for any object. So easy.
nice tip thanks for all help