T3D 2.0 - Player::UpdateHealth ?
by Richard Hebblewhite · in Torque 3D Professional · 03/31/2013 (4:40 pm) · 8 replies
I know I lost an hours' kip last night but I must really be losing it!
Silly Question:
How exactly is the player health HUD being updated in this version ? I've trawled through the scripts and cannot seem to find the mechanism that actually updates the players numerical health HUD!
The updateHealth function no longer exists so far as I can see, so I'm assuming the Armor::Damage function is now somehow related to it...
Silly Question:
How exactly is the player health HUD being updated in this version ? I've trawled through the scripts and cannot seem to find the mechanism that actually updates the players numerical health HUD!
The updateHealth function no longer exists so far as I can see, so I'm assuming the Armor::Damage function is now somehow related to it...
About the author
Senior Lecturer at Glyndwr University, Wrexham. Director of RareBit Interactive & Programme Director for Computer Game, Immersive Technology and Creative Computing Programmes.
#2
This is the first time I've really started to have a good look at the latest version of T3D. I've recently started porting 3 or 4 of my v1.2 projects over and have been noticing little changes here and there.
One thing I'll say - v2.0 has a definite 5-7 frames per second performance improvement - nice work.
04/01/2013 (9:37 am)
Thanks for the heads up!This is the first time I've really started to have a good look at the latest version of T3D. I've recently started porting 3 or 4 of my v1.2 projects over and have been noticing little changes here and there.
One thing I'll say - v2.0 has a definite 5-7 frames per second performance improvement - nice work.
#3
I have a series of GUI images that used to be dependant on the previous method.
Cheers!
04/07/2013 (3:52 pm)
Using the new method, what's the easiest way of grabbing the current health value of the player via torque script ?I have a series of GUI images that used to be dependant on the previous method.
Cheers!
#4
04/07/2013 (4:08 pm)
Same as it was before:%maxDamage = %player.getDatablock().maxDamage; %damageLevel = %player.getDamageLevel(); %curHealth = %maxDamage - %damageLevel;
#5
Thanks - I've taken the original "updateHealth" function and used "player::setDamageDirection" function to invoke it.
It's a work around but means that my HUD images are activated when player damage is taken - the problem is that they aren't being removed once the health is topped up again!
04/08/2013 (7:08 am)
Hey Michael,Thanks - I've taken the original "updateHealth" function and used "player::setDamageDirection" function to invoke it.
It's a work around but means that my HUD images are activated when player damage is taken - the problem is that they aren't being removed once the health is topped up again!
#6
You'll likely have to look at where you are giving the player more health and send a call to updateHealth() to then refresh your HUD. The health kit/patch had a really ugly schedule hack that allowed it to update the old scripted text hud...
04/08/2013 (7:47 am)
One of the problems with the scripted health hud is that you had to track down each event in which health could be changed: damage, death, use of healthkit, etc., and send a call to the updateHealth() method. Which is why it was replaced -- the engine was automatically aware of these events so the new HUD control didn't need all of the event work-arounds. Since the scripted version was replaced all of the old event calls were removed.You'll likely have to look at where you are giving the player more health and send a call to updateHealth() to then refresh your HUD. The health kit/patch had a really ugly schedule hack that allowed it to update the old scripted text hud...
#7
I had a feeling that finding a suitable place to call the updateHealth function would be tricky! I'm currently using the "repairRate" field on the player datablock to automatically regenerate the health since it's the cheapest method.
For now, I can disable that and stick with health pick-ups until I find a better solution!
04/08/2013 (7:58 am)
Basically I've cobbled together a COD style blood HUD that *ideally* will fade in and out depending on damage level.I had a feeling that finding a suitable place to call the updateHealth function would be tricky! I'm currently using the "repairRate" field on the player datablock to automatically regenerate the health since it's the cheapest method.
For now, I can disable that and stick with health pick-ups until I find a better solution!
#8
04/08/2013 (8:15 am)
I never did get around to it since I knew we were going to replace the scripted HUD, but my planned solution to the hacky healthkit update would've been to implement a callback for when applyRepair() was used.
Associate Michael Hall
Distracted...