Game Development Community

Adding a new avatar

by Dan Chao · in RTS Starter Kit · 12/22/2005 (7:14 pm) · 3 replies

New question here. I'm adding a new avatar (and eventually making a child class of RTSUnit) but inside the code, my mDataBlock is NULL.

what I did was I made a copy of rifleman.cs and called it riflemanBig.cs and made the appropriate name changes in the c# files:

datablock RTSUnitData(riflemanBigBlock : UnitBaseBlock)
function riflemanBigBlock::onAttack(%this, %attacker, %target)


I also added to server/init.cs
exec("./scripts/avatars/riflemanBig.cs");

In gameConnection.cs->createPlayer(), I simply just set the datablock to:
%data = riflemanBigBlock;


did I miss something?

thanks in advance,
dan

#1
12/23/2005 (10:20 am)
Ah, I figured it out. it seems I missed a few places. good ole rgrep.

for those interested, you have to add a line or two in the following files:
client/scripts/playgui.cs
server/init.cs
scripts/avatars/player.cs
core/game.cs
core/gameConnection.cs
#2
01/02/2006 (3:25 pm)
Cool so let me understand what this was for dan...

Was this to create datablocks to your own units? In other words to replace the units that are included in the demo?
#3
01/02/2006 (3:31 pm)
I was trying to create a whole new avatar, not just the datablock. it was originally the first step in me creating a new child class of RTSUnit called RTSHeroUnit. Since then, I've decided to roll all my changes into RTSUnit since it doesn't really add that much extra stuff and they were things that might be useful to have in RTSUnit for me anyways.

dan