AI enemy spawn points

Hey i have a zombie that is going to spawn when a delay actuator activates.

The zombie have a propherty of 100, and when the gun raycast and mouse click the health will add a “-1” to it, and when it reaches 0 the zombie will “end object”

The zombie works perfect, but when i make a “delay-and-add object” the propherty settings gets mixed upp so the propherty doest substract -1 when i hit him.

The “add object” logic is copying the object i have selected from the other layer.

Is there a way to spawn an object and keep the setting? or prevent blender from making a new propherty to every copy?

Or why can i basicly fix this problem?

Ty in advance

Store the number somewhere outside the enemy as it does not belong to the single instance but to all enemies.

This storage can be another object, a module, a python data structure.

umm im not sure how to do that, also teh raycast is only making dammage if it hits material “zombie” and the zombie have that material, but when it gets dublicated in the game, will not the material turn in to a “zombie.001”?

The enemy detection does not matter in this case.

Why do you want to give the enemy the same health as the previous one? It will be zero as you killed the enemy. Maybe I do misunderstand your request.

okay ill give you my project here.

The zombie is in the other layer, the big box around teh zombie is gonna be where the raycast will collide with, and the propherty numbers above the zombie is just for me to se if the zombie gets hurt or not ( will be removed later) but when he gets hit the number should start lower down

http://www.pasteall.org/blend/28106

I will look at this when I’m at home.

So you want when the current enemy is dead the new enemy starts with 100 again or should it continue with 0 (as the previous enemy)?

I do not understand the file. Cube.008 does not add an object as there is no object set. Which one is it supposed to be?

I can see you have quite much inter-object connections. As you see this makes it look very complicated. It also means each connection is a dependency from one object to another. This itself is not a big deal as long as the objects belong to each other e.g. the status text and the object.

But there is a dependency between the gun object and the zombie box. This can’t be correct as you create a connection to an inactive object (the zombie box is in layer 2).

I guess you want to perform the hit operation. This is a dynamic operation as you do not know beforehand what will be hit in-game. Here you need a Python controller that reads the sensor and deals with the hit object. You can’t use the primitive logic bricks only.

must be some way, but ty anyways. yea the cube.008 is supped to add the zombie walking cube but for the moment it wasnt set for that

I think he just needs to get the specific zombie that gets hit as a simple material check will subtract health from ALL zombies added. You will need to use python. Ray sensors have a hitObject.


ray = own.sensors["Ray"]
if ray.positive:
    ray.hitObject["Health"] -= 1

Something like that. If you aren’t familiar with Python scripting yet you should look up a couple tutorials on it first.