Is it possible to use a script that is on one object to modify another object’s properties? Or use two objects on one script? How would you call the owner and controller?
See, I have a plane with text that shows how much ammo you have. And when ammo gets to 0, you shouldn’t be able to shoot. But I don’t know how to make the weapon’s python script react to the other object (plane)'s properties.
I know there’s a simple answer, could you let me know?
well, there are a couple of different ways. but i’ll show you the way i would use (it doesn’t really matter)
first in you’re “weapons” script get the scene
scene=GameLogic.getCurrentScene()
then get the plane/ammo counter object
ammocntr=scene.getObjectList()['OBPlane']
(you’re object might not be named ‘OBPlane’, just chane that part)
finnaly have a check
if ammocntr.ammo<1:
print "bla bla bla'
(where ‘ammo’ is the name of the property that you are using to count ammo)
that should do it, hope it helps
Alrighty, thanks. I just didn’t know the get Scene and Object things. That’s helpful.