Destroy the car or something else?
by CodingChris · in Torque Game Engine · 01/13/2007 (8:47 am) · 3 replies
Hi,
simple question. Which function is called when a car gets the full damage? I searched startert.fps already for something like this, but it does nothing.
Please help.
simple question. Which function is called when a car gets the full damage? I searched startert.fps already for something like this, but it does nothing.
Please help.
About the author
#2
01/13/2007 (11:44 pm)
I now made this, but it doesn't work.function WheeledVehicleData::onDamage(%this,%obj,%amount)
{
if(%damage >= %this.maxDamage) {
if(%obj.getDamageState() !$= "Destroyed") {
%obj.setDamageState(Destroyed);
}
}
}
#3
01/14/2007 (8:32 am)
Try thisfunction WheeledVehicleData::onDamage(%this,%obj,%amount)
{
%damage = %obj.getDamageLevel();
if (%damage >= %this.maxDamage)
{
if(%obj.getDamageState() !$= "Destroyed")
{
%obj.setDamageState(Destroyed);
}
}
}
Torque 3D Owner Billy L
It works something like this.
when the damage is bigger or equal to the destroyedlevel
you set the setdamagestate(destroyed) when you set this
then you can use the callback yourcar::onDestroyed.
The destroyedlevel you set in the cars datablock.