"Grouping" of objects?

Hey guys

Ok I have a bunch of objects that make up a character
These include the armature, the mesh, hit sensors etc.

What I would like is to be able to make references to these different objects inside code
For example, if the sensor detects a hit, I would like to send a message to the skeleton to make it play the “i got hit” animation

Now, I need the reference to these objects to be in such a way that it doesnt just use the object’s name, because I want this character to be able to duplicate.
eg. if i just say “make hit sensor1 message armature1”, when i duplicate it, it will say “make hit sensor2 message armature2”, when I actually need “make hit sensor2 message armature2”

Is there some way I can “group” these objects so I can achieve this reference?
Example of random code I made up for the sensor>armature example:
(code is inside hit sensor)


if (blah and blah2 are true)
 message_actuator.recipent = this.group.armature
 activate message_actuator

Sorry if I over-explained everything and complicated it, but I just wanted you to know exactly what I meant instead of just saying “hey guize lol can plz tlme how to make stuff go ingroups tkxhtxbye” :evilgrin:

You can link logicbricks between objects by selecting all of the objects at once. No Python is required… just draw lines between sensors/actuators/controllers, the different objects will show based on their names.

-Sam

Or if it is possible you parent the objects together that they build a tree. Then you can traverse throught the tree with
KX_GameObject.parent,
KX_GameObject.children and
KX_GameObject.childrenRecursive.

You just to make sure it stops traversing at the root object.

You could check the Mouse Orbiter look for OrbiterLib.setupOrbitParent().

I hope it helps

Thanks, that helps heaps!

Woot for being able to program without having to look at a mess of confusing lines!