Game Development Community

Error adding new unit types to RTS game

by Emil Diego · in RTS Starter Kit · 03/15/2007 (1:09 pm) · 6 replies

I'm getting an error when I try and add new unit types to the game.
This is the error I keep getting:
Object 'terranScoutBlock' is not a member of the 'GameBaseData' data block class

Here is the Data Block definition for the unit i am trying to create.
datablock RTSUnitData(terranScoutBlock : UnitBaseBlock)
{
shapeFile = "~/data/shapes/units/terran/starbase_small.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";
};

I modified the RTSConnectoin::createPlayer function to create the TerranScoutBlok units, but I keep getting the above error. anyone have any ideas?

Thanks in advance.

#1
03/16/2007 (12:17 am)
Make sure you are calling the .CS file in the game.cs file

Also, ensure you are referencing the datablock you have created in the GameConnection.cs

I think that is it, and should work.
#2
03/16/2007 (5:16 am)
I have included the file. I placed it in starter.RTS\server\init.cs
exec("./scripts/avatars/terran_scout.cs");

That's where all the other files in the avatar directory seemed to be getting including. Should I also include it in /scripts/core/game.cs ??

What's the reason for having it included in both files ??
#3
03/18/2007 (6:53 pm)
Your terran_scout.cs

should be placed in the "~server/avatars/"

in the game.cs

you should be doing the "exec(~..../terran_scout.cs");
#4
03/20/2007 (8:34 pm)
Path shouldn't matter, the easiest way to avoid calling everything twice use use a file already called to do the exec(). I put mine in player and some other places.
#5
03/21/2007 (5:14 am)
I included the terrain_scout.cs in games.cs and now it seems to work ok. I am just wondering why I need to include the same terrain_scout.cs from init.cs and game.cs. All the other avatar files are included from both place as well and I was just wondering what the reason behind that is.
#6
03/22/2007 (1:15 pm)
Honestly I don't really remember why.
I wanted to change it, but got lazy and just used the work around.