Spawning duplicate object+armatures, armatures share actions and controls?

Hey Blender artists!

I have an extremely difficult problem that I can’t get past, and I can’t keep working on my game until this problem is fixed. The problem is that I have a zombie map and a spawner that will spawn zombies at a random time. The zombies follow a path to get into the map, so it looks as if the zombies came out of no where. The zombie consists of an invisible cube, which controls the zombies movement and hit box. Parented to that cube is the zombies armature, and parented to the armature is the zombies model mesh. So when I would spawn in the cube to the scene, the armature and mesh would come along with it. However, when there are more than 1 zombies in the scene, each zombies armatures shares their animations. When one zombie gets hit, it plays a hit animation, but so do the other zombies in the scene. However, the cubes of the zombies, which control the movement and have health do not share similar features, and even have separate quantities for properties like health. This is probably because I spawned in the cube and not the armature, but the armature spawned in only because it was parented to the cube.

Any help would be greatly appreciated, and if you still do not understand what I’m talking about, I’ll give you some more information on the problem. All I need to know is how I can make each armatures actions separated from the others in the scene.

Thanks,
-Oliver

What is activating the hit action? is it a message? message is sent and recieved by all messages with the same subject.

Try using groups:
-Add all parts of the zombie to a group.
-Create a empty with the group of the zombie and put it in a inactive layer.
-Spawn the empty with the group.

Is it possible the thing triggering the animations for one zombie is being used by all zombies?

For example, say each cube checks a property for whether to play an animation. They might all be checking the same property when a property should be allocated for each zombie spawned.

Yes, a message is sent to the armature. How can I replace this method?

I did what you said, and then added the empty to the group, however when I spawn in the empty in only spawns the empty and not its group members. How could I spawn in the whole group?

Use Python to get the object that you hit with a raycast or a collision sensor or whatever and set a variable for it. Do you know Python at all? It’s pretty much necessary for any semi-complex non-physics-based game in the BGE. If you don’t know it, there are quite a few tutorials to learn it; I have some tutorials on my site here, and Goran has quite a few video ones on his YouTube channel here.

Yes, however they are all using a message sent by the cube to the armature. All the armature in the scene are linked, so if one message is sent to an armature they all get that message.

I’ll try using Python, and I do have a lot of experience with it, but what I’m trying to fix is the animation the zombie plays once it is hit by the cubes ray. When it is hit, all the armatures in the scene linked to that cube play the same animation all at once.

Okay, I think I see what you mean. You could, then, use Python to get a reference to each cube’s individual armature, and then run its playAction() function.

Okay, cool! Could you help me with the code to getting to the individual armatures?

OR you could just select the armature and the collision box (i believe thats your hit box) and just connect the hit sensor with the armature :slight_smile:

This problem has nothing to do with groups.

The issue is the insufficient communication between the parts of the character. If you use messages all listeners will receive and act on them. As they all are the same they all act at the same time. This is what is mentioned above.

You want a communication to a specific object. As this communication path is constant (means it does not change during the game). You can set it up before game start or right after creation of the objects.

Option A) inter-object connection
Connect logic bricks between several objects:
advantage: very easy and fast to do
disadavantage: it looks chaotic

Option B) startup assembling
As the character knows best how it is constructed, run a Python controller right at the beginning to setup each part of it.
E.g. set up a message sensors “to” field, store the references to each part …
The parts can communicate by accessing the stored references.
Advantage: can be dynamically updated
Disadvantage: requires a Python controller to run first, more complex, more Python code needed to work with stored references.

Option C) character builder
It is like option B) but an other object (builder) assembles one or more character objects. After building the builder is not needed anymore.

Interconnected logic bricks between the Cube and the Armature will assure that animations are local (as Monster said). I think this is the quickest and easiest solution.

Thank you so much Monster! The inter-object connection works! I can’t thank you enough, you really saved me!