Need some help with torque scripting.
by Brent Corr · in Torque Game Engine Advanced · 08/03/2009 (6:58 am) · 3 replies
I got TGEA not too long ago (like 3 days) and I was looking over some of the stuff that I could modify. I came across this command: energyPerDamagePoint
I've got no idea what that means. It is located in the player.cs file. Could someone tell me what it is and how it is used?
I've got no idea what that means. It is located in the player.cs file. Could someone tell me what it is and how it is used?
About the author
Security Professional
#2
08/03/2009 (8:08 am)
Ok Thanks.
#3
In the player datablock:
In PlayerData::onDamage() could also be Armor::onDamage(), find this line
Now to test it. In game, shoot your feet, and you will see your energy dip down as you get damaged. With a little extra coding you can make it so a player will heal over time... but only so long as he has energy, or be unable to move without energy, unable to use energy weapons unable to use magic, etc, etc.
But as Rene mentioned this field isn't exposed to any kind of networking so it might not work in a multiplayer environment.
08/03/2009 (12:25 pm)
Actually... it's rather simple to hook this up to drain energy as you get damaged. In the player datablock:
maxDamage = 100; maxEnergy = 60; repairRate = 0.01; energyPerDamagePoint = 75.0; // Change this to suit your needs
In PlayerData::onDamage() could also be Armor::onDamage(), find this line
if (%delta > 0 && %obj.getState() !$= "Dead") {and directly after it add this line%obj.setEnergyLevel(%obj.getEnergyLevel() - (%delta*%this.energyPerDamagePoint));
Now to test it. In game, shoot your feet, and you will see your energy dip down as you get damaged. With a little extra coding you can make it so a player will heal over time... but only so long as he has energy, or be unable to move without energy, unable to use energy weapons unable to use magic, etc, etc.
But as Rene mentioned this field isn't exposed to any kind of networking so it might not work in a multiplayer environment.
Associate Rene Damm
AFAIK, this is something that's been lingering around since TGE but never actually been hooked up and used.
energyPerDamage point is a field declared in StaticShapeData but is not actually used and not even exposed to script or sync'ed in network updates.
So, in short: this thing is probably safe to ignore entirely.