Grab properties from another object

I have done this before, but I forget how to now. I have 2 objects. One is an ‘empty’ and the other is named ‘gun’. The empty has a property named “ammo”. What i want to do is add a sensor on the gun that is a property and basically says “empty’s ammo property is 0”. I know I have done this before, it was something like OB.empty.ammo for the property field or something like that. Does anyone know the proper syntax? I am using 2.49

as far as i know there are two way to do this.

  1. select both the gun and the empty> add a sensor to the empty> change to property sensor> in the property field enter ammo> and a controller to the “GUN” object> wire the property sensor to the controller> DONE!

  2. add a sensor controller and actuator to the gun object> wire them together> select true pulse mode for the sensor> change the actuator to a property actuator> change it from add to “copy”> in the top Prop field enter ammo> in the OB field enter"empty"> in the bottom property field enter ammo> add a propety named ammo to the Gun object> DONE!

either way isnt very complex, but i explained it in depth. hope this helps

Oh ya, that top one rings a bell, thanks!

or in python gun[‘ammo’] if you have already defined gun.