other properties than the current ones?

hm, I know how to retrieve an object’s property with getCurrentController(). But how do I get another objects property (which is not the ‘current’ one running the script)?

Haunt_House

i toll ya =P all objects must be connect to the script in order to get their information…

heres the simple script

cont = GameLogic.getController()
own = cont.getOwner()

health = own.health

but this would create an error if any object connected to the script does no have property ‘health’… so, youll need something like this:

cont = GameLogic.getController()
own = cont.getOwner

plist = own.names

for a in plist:
…line = “GameLogic.” + a + “=” + str(eval(“own.” + a))
…exec(line)

the dots are a tab-in by the way…
now each object connected to the script should have a property named “names” with a list value that contains all that objects properties you want to store like is a sphere has properties health, and bullets, its ‘names’ string property would have value of [‘health’,‘bullets’]… that is in brackets, and with quotes around each property name… now heres how the script works

plist = own.names, this gets the property ‘names’ and stores it under plist, so now:
plist = [‘health’,‘bullets’]

for a in plist:, this searches through the list ‘plist’ and replaces the ‘a’ with each value in the list, one at a time

line = “GameLogic.” + a + “=” + str(eval(“own.” + a)), this would output the string “GameLogic.health = own.health”, if health = 100, then the exec() line turns it into:
GameLogic.health = 100
now that property is stored, it now goes on to the next property in the list, and does this for all opbjects connected to the script

to make an objects property equal the store python variable, it would look like:
own.health = GameLogic.health

it just reverses it… hope this helped, hope i typed it right =\

Thank you very much, Blengine.

The global variables were the missing bit.

Haunt_House