RTS Creature Pack - RTS Starter Kit Scripts
by Ori Cohen · 06/10/2008 (1:48 pm) · 1 comments
Download Code File
RTS Creature Pack with RTSKit
you can get it at the store at www.garagegames.com/products/295
I would like to thanks Guy Allard ->www.garagegames.com/my/home/view.profile.php?qid=18484 for doing these changes!
Extract this zip into your starter.RTS directory. This will create an RTSCreaturePack folder in data\shapes, where the orc and stoneman model directories will be placed.
It will also place stoneMan.cs and orc.cs into server/scripts/avatars, and then replace any modified game scripts.
I have created a directory \data\shapes\RTSCreaturePack\RTSCreatureAnimations to hold the new animation sequences which are shared between the models.
I have renamed the files \data\shapes\RTSCreaturePack\StoneMan\stoneMan.cs to stoneManShape.cs
and
\data\shapes\RTSCreaturePack\Goblin\goblin.cs to goblinShape.cs
in order to make it clear that these are the TSShapeConstructor scripts and to differentiate them from the stoneman.cs and goblin.cs that are placed into server\scripts\avatars. I have also changed the paths to the animation sequences to use the animations stored in different folders, and to rename some of them in-game just to make the choosing of random animations easier.
The skins for the models need to be renamed - I have used blue.stoneman.png, dark.stoneman.png, blue.goblin.png and brown.goblin.png
Users can then change the skin by using, for example setSkinName("brown"); to set a brown skin on a model.
Here is a list of the modifications that I have made to the existing RTSKit scripts:
RTS Creature Pack with RTSKit
you can get it at the store at www.garagegames.com/products/295I would like to thanks Guy Allard ->www.garagegames.com/my/home/view.profile.php?qid=18484 for doing these changes!
Extract this zip into your starter.RTS directory. This will create an RTSCreaturePack folder in data\shapes, where the orc and stoneman model directories will be placed.
It will also place stoneMan.cs and orc.cs into server/scripts/avatars, and then replace any modified game scripts.
I have created a directory \data\shapes\RTSCreaturePack\RTSCreatureAnimations to hold the new animation sequences which are shared between the models.
I have renamed the files \data\shapes\RTSCreaturePack\StoneMan\stoneMan.cs to stoneManShape.cs
and
\data\shapes\RTSCreaturePack\Goblin\goblin.cs to goblinShape.cs
in order to make it clear that these are the TSShapeConstructor scripts and to differentiate them from the stoneman.cs and goblin.cs that are placed into server\scripts\avatars. I have also changed the paths to the animation sequences to use the animations stored in different folders, and to rename some of them in-game just to make the choosing of random animations easier.
The skins for the models need to be renamed - I have used blue.stoneman.png, dark.stoneman.png, blue.goblin.png and brown.goblin.png
Users can then change the skin by using, for example setSkinName("brown"); to set a brown skin on a model.
Here is a list of the modifications that I have made to the existing RTSKit scripts:
file: server/init.cs
function initServer()
after:
exec("./scripts/avatars/shocker.cs");
add:
// RTSCreaturePack >>
exec("./scripts/avatars/stoneMan.cs");
exec("./scripts/avatars/goblin.cs");
// RTSCreaturePack <<file: server/scripts/avatars/base.cs
after:
exec("~/data/shapes/player/player.cs");
add:
// RTSCreaturePack >>
exec("~/data/shapes/RTSCreaturePack/StoneMan/stonemanShape.cs");
exec("~/data/shapes/RTSCreaturePack/goblin/goblinShape.cs");
// RTSCreaturePack <<file: server/scripts/avatars/player.cs
function Player::playDeathAnimation(%this)
after:
%this.setActionThread("destroy", true);
add:
// RTSCreaturePack >>
// choose one of the 11 stock death animations
else if ((strstr(%this.getDatablock().RTSUnitTypeName, "stoneman") != -1) || (%this.getDatablock().RTSUnitTypeName $= "goblin"))
{
%dieAnim = "death" @ getRandom(1, 11);
%this.setActionThread(%dieAnim, true);
}
// RTSCreaturePack <<
and further down the same file,
function Player::playAttackAnimation(%this)
after:
%this.setActionThread("fire");
add:
// RTSCreaturePack >>
// choose one of the 5 attack animations
else if ((strstr(%this.getDatablock().RTSUnitTypeName, "stoneman") != -1) || (%this.getDatablock().RTSUnitTypeName $= "goblin"))
{
%attackAnim = "attack" @ getRandom(1, 5);
while(%attackAnim $= %this.lastAttackAnim) // don't play same attack twice in a row
{
%attackAnim = "attack" @ getRandom(1, 5);
}
%this.setActionThread(%attackAnim, true);
%this.lastAttackAnim = %attackAnim;
}
// RTSCreaturePack <<file: server/scripts/core/game.cs
function onServerCreated()
after:
exec("~/server/scripts/avatars/shocker.cs");
add:
// RTSCreaturePack >>
exec("~/server/scripts/avatars/stoneMan.cs");
exec("~/server/scripts/avatars/goblin.cs");
// RTSCreaturePack <<file: server/scripts/core/gameConnection.cs
function RTSConnection::createPlayer(%this, %spawnPoint, %index)
replace:
switch(mAbs(%index) % 3) // GUY changed to mAbs(%index) due to fixed modulus function
with:
// RTSCreaturePack >>
// switch(mAbs(%index) % 3) // GUY changed to mAbs(%index) due to fixed modulus function
switch(mAbs(%index) % 7) // now 7 unit types
// RTSCreaturePack <<
then, a few lines down,
after:
%data = riflemanBlock;
add:
// RTSCreaturePack >>
case 3:
%data = stoneManBlock;
case 4:
%data = stoneManRightBlock;
case 5:
%data = stoneManBothBlock;
case 6:
%data = goblinBlock;
// RTSCreaturePack <<
Torque Owner Charin