Linking logic and call actuators

Hey guys, I’ve seen in various tutorials that more then a few objects are linked to the same logic bricks, the only thing separating them is the name which you can click to show or hide the logic associated to that object. I’m not sure on how to do this.

Now, I’ve find out that you can call attributes from another object by using GameLogic.getCurrentScene().objects[“OBCube”]

But I can’t call up actuators from another object to edit, (I.E. setObject() in an edit object actuator). Just wondering if anyone had an idea on how to go about this. It’s really frustrating that there are no functions that calls up objects like me = cont.owner, but for outside logic, but I’m currently looking for a way around it now.

The actuators and sensors are connected to the controllers not the objects.

when people link the logic they creat a dummy mesh or a dummy empty and then either duplicate it or link it to the other objects.

you should look at the yo frankie logic.

  • edited *

Yes I understand this, but how can you call a controller from another object in the same script?

when people link the logic they creat a dummy mesh or a dummy empty and then either duplicate it or link it to the other objects.

you should look at the yo frankie logic.
Yeah, I have all the blend tut files for that, but does it explain how to do it? I’m still learning all the aspects of blender, stuff I do know and stuff I’m still learning. Think you could leave an example?

how can you call a controller from another object in the same script?

you can trigger that controller by sending a message => sendMessage()
or changing a property on the owner of the controller => myobject[“active”]=1

Your controller would have to be able to get that message (message sensor) or check for the property value change :
if owner[“active”]==1:
activate actuator

Does it help?

Or you can select both objects and connect the sensors and controllers.

Well, how do I link the sensors and controllers >.< I guess I’ll just have to look around to figure it out

Cray: It’s not activating it being the problem, it’s setting the object to add for an actuator in a different controller. But I figure I could make a message sensor go off with the body being the name of the object and have the script extract the name and use it to add object.

Also, is it possible to add objects from another .blend file within a script, or do I have to have all objects within the scene first?

You have to have all the objects in the scene. blender cant import during runtime.

You can access that actuator directly.

import GameLogic as G

cont = G.getCurrentController()
own = cont.owner
scene = G.getCurrentScene()
player = scene.objects[“OBmainCharacter”]
swing = player.sensors[‘swing’]

Now you can manipulate the sensor swing, which is attached to a separate object, just like you can effect any other sensor attached to this object. I haven’t tried with an actuator but there’s no reason it shouldn’t work.