Unique Obj Name Problem

I’m using an actuator to add objects. Each object has the property “health”. I have a ray sensor set to look for said property, and a python script to find the hit target within getObjectList(), and decrease the property health. My problem is it’s decreasing the wrong objects “health” (it’s doing it in spawn order instead). This problem was mentioned in the 2.35a bug fix list;
setObject take KX_GameObject & not string. When applying a target object for an actuator via python this must now be a pointer to the object (such as those returned by GameLogic.getCurrentController().getOwner() or GameLogic.getCurrentScene().getObjectList()) not the name of the target object as a string. An example of where this was a problem is that Objects added to the scene via an AddObject actuator are not assigned a unique name.

  • I don’t fully understand the solution. Any help would be appreciated.

have a look here http://blenderartists.org/forum/showthread.php?t=111541 hopfully youll find your answers there.

I would suggest just naming the added object by consecutive numbers, then have the actuator add the consecutive numbered objects that you can track by name.

Make sense?

I thought this was fixed, or there was a work around?

Hope you find it.

That post looks promising, thanks for the help.

Thanks Siegel, we posted at the same time and I missed yours.