Game Development Community

Chapter 22 Page 622 adapting score to triggering

by Marvin Hawkins · in Torque Game Engine · 12/27/2005 (6:18 pm) · 0 replies

Hi,

I have kind of an odd request. What I am tring to do is adapt the code for scoring (p 622) to an RTS enviornment. I don't care about the lap or coin parts. I am mainly concerned with keeping track of kills so that the computer knows when to end the game.

A good example would be the trigger system from the starcraft map editor. What I'm trying to do is create a function that checks to see how many enemy units or structures of a certain type are left. If that type of unit is 0 then the game ends and cycles to the next mission.

In plain code it would look like this: ( I ghess)

datablock enemyhero(%obj, other stuff, probably the model definition)
{
Stuff that handles the behavior of the object and various living and dead event
}

function unitdeadtrigger

{
If Enemys_Left = 0
{
wait()
EndGame()
}
Else
{
}

what's the best way to do this?