But, there are a couple problems, I know almost nothing about Python, and I want to get rid of all the unnecasary stuff in the script that only deals with Yo frankie in particular. All I really want this script to do is give the people added their own ID, that way when I fight one I’m not killing them all.
But another problem I am faced with, I don’t know how to send a message that he recieved damaged, and have the ID comunicate that it was only him, does anyone know a good logic setup that would make it to where I
1)attack.
2)message sent saying he was attacked.
3)only character I am attacking recieves damage.
I know, that seems kinda deep, but I hope someone will be able to help me out with this.
Dependent on what you want to achive, it is usually the best to work with references rather than ID’s.
e.g.
obj = raysensor.hitObject
It does not matter if other objects with the same name exist, obj is unique. Since 2.49 you can store the reference in a property:
own[“rayedObject”] = raysensor.hitObject
What you can’t do is send a reference as message, because messages accept strings only.
You can’t keep references after the object died (endObject/endScene/endGame). Which means you can’t save it to file (you can but is worthless).
But you can store object references in dictionaries, lists, other objects, attributes, parameters etc.