Player Damage in Lava
by Dirk Hoffmann · in Torque Game Engine · 10/11/2005 (11:44 pm) · 5 replies
Hello,
I just created a level with a water-block as lava. I tried to realize, that each time the player is in contact with the lava, a certain amount of damage is applied to him. I wasn't successful and have no idea how to put this to live.
Does anyone have a idea, if and how this could be realized in torque script??
Sincerely
Dirk
I just created a level with a water-block as lava. I tried to realize, that each time the player is in contact with the lava, a certain amount of damage is applied to him. I wasn't successful and have no idea how to put this to live.
Does anyone have a idea, if and how this could be realized in torque script??
Sincerely
Dirk
#2
Thanks a lot. It seems to work fine that way.
Unfortunately the player-damage in the game is always the same amount, regardless of the value I assign to $DamageLava.
The corresponding lines in the script look like this:
$DamageLava = 100.00;
...
function HumanMaleAvatar::onEnterLiquid(%this, %obj, %coverage, %type)
{
switch(%type)
{
10/13/2005 (11:26 pm)
Hi Marco,Thanks a lot. It seems to work fine that way.
Unfortunately the player-damage in the game is always the same amount, regardless of the value I assign to $DamageLava.
The corresponding lines in the script look like this:
$DamageLava = 100.00;
...
function HumanMaleAvatar::onEnterLiquid(%this, %obj, %coverage, %type)
{
switch(%type)
{
#4
So look at your player.cs file again and find the maxDamage this is the max damage that can be done. If your DamageLava > maxDamage, then its clamped.
eg: if you maxDamage is set to 50 and your DamageLava is set to 100. You will get a single onDamage call to your player in script with a value of 50, and then no more.
in the above example, if you set your DamageLava to 25, then you would get two onDamage calls with values of 25. Or if you set your DamageLava to 10, then you would get 5 calls to OnDamage each with values of 10.
edit: Added more to example
10/14/2005 (7:31 am)
Damage is clamped between 0.0f and the maxDamage set in your datablock for that object. So look at your player.cs file again and find the maxDamage this is the max damage that can be done. If your DamageLava > maxDamage, then its clamped.
eg: if you maxDamage is set to 50 and your DamageLava is set to 100. You will get a single onDamage call to your player in script with a value of 50, and then no more.
in the above example, if you set your DamageLava to 25, then you would get two onDamage calls with values of 25. Or if you set your DamageLava to 10, then you would get 5 calls to OnDamage each with values of 10.
edit: Added more to example
#5
The maxDamage value is at 100. DamageLava is set to 50, and I also checked the value in the console. The substracted value in the game is something at 25( Only from looking at the GUI bar). Even if I change the DamageLava to lets say 75 or 100, still only those 25 is substracted!!?
Thank you
Dirk
10/14/2005 (9:38 am)
I think you got me wrong.The maxDamage value is at 100. DamageLava is set to 50, and I also checked the value in the console. The substracted value in the game is something at 25( Only from looking at the GUI bar). Even if I change the DamageLava to lets say 75 or 100, still only those 25 is substracted!!?
Thank you
Dirk
Torque 3D Owner Marco Meier
Slickware Games
Nearly on top of the file you will find a line something like this:
$DamageLava = 0.01;
This is the damage which will be applied to the player when he enters the Lava.
The get a little further, also in player.cs, take a look at the function Armor::onEnterLiquid.
Ok, I hope that helps a little bit...