Game Development Community

How much life is left?

by Dreamer · in Torque Game Engine · 04/05/2005 (9:25 am) · 2 replies

I'm writing an AutoAttack function and I need to determine how much life is left in my player, so if he's really getting wailed on he can stop the attack.
function ServerCmdAutoAttack(%client){
	if(!%client.getSelectedObject()){
		MessageClient(%client,'No target','You have no target to attack!');
		%client.Player.AttackOn = 0;
	}else{
		%targetObject = %client.getSelectedObject();
		while(%targetObject.Damage > 0 && %client.Damage >0 && %client.Player.AttackOn == 1){
			AttackRoll(%client,%targetObject);
		}
		
	}
 }
The above function is exhibiting fall through behavior, which I am attributing to the fact that %client.Damage or %targetObject.Damage is not returning anything or possibly returning 0.

This is making me nuts, can anyone please show me whats wrong here?

#1
04/06/2005 (8:11 am)
Try %obj.getDamageLevel()
#2
04/06/2005 (8:26 am)
Thank you! It took some adjusting to my way of thinking to get everything working properly, but that does seem to have fixed it!