I am using Python, and am looking for a method to get all actuators in a scene…
Can you get all actuators in a scene?
something like scene.getActuators()
or… Can logic brick connections be made using a script?
something like owner.getActuators()
I’ve been using the controller method, getActuators() which gets a list of all the connected actuators. I then use for act in actuators to cycle through all the actuators. Its working great.
My problem boils down to the fact that when I duplicate objects connected to the python script, they aren’t connected by default. This means every new object has to be connected. Its a LOD script, its working great, and I intend to use it on nearly every object in the game. Its a huge amount of work to connect them by hand.
Can you get actuators through a object rather than a controller. I can get the whole scenew, and I can get an object from the scene, I just can’t get to its actuators.
Any help appreciated.
##########Here’s the script, if anyones curious####
#AirSpeedAuto LOD script
import GameLogic as ga
import string as string
co = ga.getCurrentController()
acts = co.getActuators()
for act in acts:
print “Actuator name:” + act.getName()
if act.getName() == “LOD”:
ob = act.getOwner()
cam = ga.getCurrentScene().active_camera
print “Camera’s name is:” + cam.name
def Depth(pos, plane):
return pos*plane + pos*plane + pos*plane + plane
depth = Depth(ob.position, cam.world_to_camera) print "Depth is:" print depth try: lodX = ob.lodAdjust nothing = 0 print "lodX is:" print lodX except: lodX= 1 if depth > -20*lodX: newLod = "_LodH" elif depth > -80*lodX: newLod = "_LodM" else: newLod = "_LodL" name = ob.getName() print "Object name:" + name length =len(name) print length stripname = name[2:length-4] print "Stripped Object name:" + stripname meshName = stripname + newLod print "LOD Object name:" + meshName act.setMesh(meshName) ga.addActiveActuator(act,1)