Game Development Community

Creating RTS Units

by Emil Diego · in RTS Starter Kit · 06/09/2005 (7:07 am) · 1 replies

I have downloaded and installed the RTS starter kit. I have been playing around with it for weeks and have created some textures, 3D models and interfaces. I have come to the point where I want to start placing some units. The docs start to get a little vague on how to do that. I have read the docs on the RTSUnit data block and I have created one for one of my units. It is getting included and compiled by the engine.

Here are my questions:
1) how do i create an instance of that unit? (Script or Tools)
2) Does anyone know of any resources specifically for RTS Style games?

Here is the file:
datablock RTSUnitData(terranScoutBlock : UnitBaseBlock)
{
shapeFile = "~/data/shapes/ships/terran/terran_scout.dts";

baseDamage = 50;
attackDelay = 32;
damagePlus = 3;

armor = 1;

moveSpeed = 4;

range = 12;

maxDamage = 250; //maxDamage = health
vision = 100;

boundingBox = "2.0 2.0 2.0";
};

function terranScoutBlock::onAttack(%this, %attacker, %target)
{
%damage = %attacker.getDataBlock().baseDamage;
if(%attacker.getNetModifier().baseDamage)
%damage *= %attacker.getNetModifier().baseDamage;

%armor = %target.getDataBlock().armor;
if(%target.getNetModifier().armor)
%armor *= %target.getNetModifier().armor;

if(%damage > %armor)
%damage -= %armor;
else
%damage = 0;

%target.applyDamage(%damage);
}

#1
06/09/2005 (7:36 am)
Hi Emil,
I think the easiest way to help you, is to point you to this rts resource http://www.garagegames.com/mg/forums/result.thread.php?qt=23546
The resource by Stephen Zepp is realy cool, it has all the code to place units from a click of a button, it is more of a resource gather, got enough resources, build unit type of thing it will proberley help out more than I can explain (well have trouble explaining), and it has a basic menu, system and other dts building models, which may help you out with placing your own units and linking them into the menu system etc

I hope this helps you out for now