Game Development Community

RTS Groups / Squads

by Michael Hojna · in Torque Game Engine · 03/17/2006 (11:49 am) · 2 replies

Got the TGE and RTS pack. All is going well....

However, I would like a way to create squads of units, very simular to selecting a group and assigning it to a number. I still want the grouping feature above squads to control multiple squads and each unit in the squad to be and individual player/unit with hp/weapon/armor, although you must command the entire squad.

Can anyone point me in the right direction on how to accomplish?

Thanks...

About the author

Recent Threads


#1
03/17/2006 (3:31 pm)
Hi,
I am doing the exact same thing as you having squads to control insted of/aswell as single units
my plan is to make an instance of simdatablock, name it squad data and an array to list the members handles and have seperate variables for commander and addition handle.

The hard bit being addding the squad objects to the selection stack because of the functions called on it in the engine (in a hidden away file in terrain/terrselection.cc) so you need to add a function called squadselecton or somthing similar and have that call the functions that used to be called on the rts unit for each member.

An as for commanding the squads you can just have a function with the exact same name and parameters and call its members eg

function RTSSquadData::setMoveDestination($squad,%dest)
{

    for (%count =1; (%count>=%squad.squadmembermax); %count++);
    {
        if(!%squad.member[%count]=0)
        {
	%squad.member[%count].SetMoveDestination(%dest);
        }

     }

}
thats only an example there will probably need to be alot more complex move stuff

I am actually working on this at the moment but my c++ is pants, if i did finish it I would probably submit it as a resource
If you would like to help you could
#2
03/17/2006 (3:35 pm)
And you should really move this thread to the RTS SDK private forums otherwise you cannot post any code