Game Development Community

Damage - Frustrated

by J · in Torque Game Engine · 07/20/2007 (5:42 pm) · 2 replies

Just getting to know the torque system.
I have read threads all day and nothing is helping me out. I have the Torque guide, read clear through it, doesn't really help. Seen a ton of scripts, not getting it....copy and pasting stuff isn't working for me. I want a handle on what does what, especially the fighting system that is all scripted so I know how to control aspects I want in my game...

I just need a simple explanation of how you apply damage to your player....say he steps over the campfire and it burns him....You use a trigger and it applies damage. I don't understand the client to server side of it, nor do I understand how to make your Health Bar Hud change when damage occurs. Tried ten different rescources and I'm tired of everything crashing...

Can someone please lead me in the right direction, a forum or rescource I missed, or show me how to build something like this:

player walks over a campfire....gets burned....health bar indicates health loss...
player gets hit...health bar indicates health loss...

And PLEASE put it in simple terms, broke down, so I can understand what is going on and why you do what you do.

About the author

I used to be obsessed with building my own open-ended RPG and a 3D Side Scroller RPG. But the job/house/girlfriend got in the way. I know, I know. Now I concentrate on doing architectural renderings (with the help of T3D of course) and VBA programming.


#1
07/20/2007 (6:07 pm)
Have you read the GettingStarted.pdf? It explains how to change a GUI element to reflect the players score.

For damage: In the starter.fps you can look at server/scripts/player.cs and the function Armor::damage.
%obj.applyDamage(%damage); Is the line where it takes damage. If you wanted to do that in a trigger its basically the same.

function DefaultTrigger::onEnterTrigger(%this,%trigger,%obj)
{
%obj.applyDamage(50);
Parent::onEnterTrigger(%this,%trigger,%obj);
}

It should update your hud already with the health bar.

[edit] btw: you should post in the private tge forums. the getting started forum is a good place to find help.
#2
07/20/2007 (6:41 pm)
%playerID.applyDamage(%percent_damage)