Game Development Community

ApplyRepair() isnt working right

by Snaggz · in Torque Game Engine · 08/10/2007 (10:45 am) · 2 replies

I am trying to use applyRepair() for a potion in my game and my AIPlayer and it wont let me applyrepair



I try:

playerBot.applyDamage(50);
playerBot.setRepairRate(0);
playerBot.applyRepair(50);

in the console and it wont repair still.
I go to playerBot.getRepairRate() and it says 0 and I still cant applyRepair(50).
Is it something with the AI player that the shape dosent repair right? heres my data Block:

datablock PlayerData( PBot : PlayerShape )

#1
08/10/2007 (3:54 pm)
For applyRepair to work, you need to have the "repairRate" set in the dataBlock. Try setting it to 0.25 and then using applyRepair and you'll see it repair over a short amount of time.

setRepairRate is used to auto repair when it is non zero at the rate it is set to. So you either use setRepairRate with a non-zero value to repair constantly (until you set it back to 0 anyway) over time. Or, you use applyRepair which will repair at the repairRate specified in the dataBlock
#2
08/10/2007 (4:30 pm)
It works!!!

Hehe the Maurina Torque guide book says something about setting it to 0 first...

anyways thanks a lot Gary