need help with property's

i have a question if i have a property on my enemy and the property is a int with 150
the property is set as hp for my enemy his life if i shoot it it drains life (hp) property
now al i wanna have is a property Text plane above the monster that shows the hp of the monster
but the plane with the Text is another object

how kan i sent the hp of the monster to the plane with the Text in it as a int ??
so i have all set up the plane with the texture with a @ in it so mayby this helps
is there some way with python or message bricks or something i know a bit python but
the monster is on the ground and above is his health what i wanna show in numbers

please help me im not that good at typing cuz im not english so dont mind my text

A bar might be easier to implement and more user-friendly. You can have the bar change it’s width over time with an IPO. Using a brick, you can set the index of the IPO to the health.

but when im have a hp property om my monster can i still use the health bar as the same of the hp property of my monster cus how do i sent my data of the hp property to the health bar

If you want to use python, i would do this:

make your two objects: the enemy and the number/text object thing.

on the text object, make an int property called ‘Text’. now attach the following script to it:


import GameLogic as g
cont = g.getCurrentController()
own = cont.getOwner()

enemy = g.getCurrentScene().getObjectList()["OBenemy"]

own.Text = enemy.health

:]

I assume that you know how to do text in the gameengine, so I won’t cover that. If you don’t use the search feature of the forums.

The Text property doesn’t have to be a string, it can be an int. Just make sure that the “text” option is set to that face, and that the property is called “Text” (with the capital T, and without quotes). It can be an int, float, or string (maybe a bool? haven’t tested.) Then you can manipulate it with a property actuator and it will be reflected as text.

thx but the script works fine thanks for your help