Extending the strategy tutorial
by John Coyne · in Torque Game Builder · 02/10/2006 (7:59 am) · 4 replies
Hi
I tried adding another unit to the strategy tutorial. An infant type that grows and can be later turned into a worker or soldier. I also spawn 2 infants near each base at the start of the game. The problem is that selecting the infant type throws up an unknown application error, then gives me the "ok to terminate", "cancel to debug". I cant see any reason for the error, although i expect its in objectTypes.cs
Here are the changes i made:
data.cs
...........
//Initialise the units in each clan
function loadClans()
{
//create 2 random infants
for(%cnt = 0;%cnt<=1;%cnt++)
{
createRandomInfant("Squares");
createRandomInfant("Circles");
}
}
function createRandomInfant(%team)
{
%pos = %team.base.getPosition();
%posX = getWord(%pos, 0);
%posY = getWord(%pos, 1);
%posY = %posY + (getRandom(30)-15);
%posX = %posX + (getRandom(30)-15);
%pos = %posX SPC %posY;
if(%team $= "Squares")
{
gameData.spawnObject("SquaresInfant", "Squares", %pos, "SquaresInfant");
}
else
{
gameData.spawnObject("CirclesInfant", "Circles", %pos, "CirclesInfant");
}
}
in objectTypes.cs
...........................
new ScriptObject(Infant : Entity){
superClass = Entity;
size = "5 5";
speed = 12;
hitPointsMax = 60;
gender = "female";
};
new ScriptObject(CirclesInfant : Infant){
class = Infant;
};
new ScriptObject(SquaresInfant : Infant){
class = Infant;
};
The only unusual thing i can see in the console is this:
--------- Initializing MOD: T2D ---------
Loading compiled script strategy/gameScripts/game.cs.
Loading compiled script strategy/data/content/datablocks.cs.
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (ForestMossImageMap) disabled 'filter-padding' as it was unnecessary!
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (ThickGrassImageMap) disabled 'filter-padding' as it was unnecessary!
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (borderImageMap) disabled 'filter-padding' as it was unnecessary!
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (CityImageMap) disabled 'filter-padding' as it was unnecessary!
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (goldMineImageMap) disabled 'filter-padding' as it was unnecessary!
I tried adding another unit to the strategy tutorial. An infant type that grows and can be later turned into a worker or soldier. I also spawn 2 infants near each base at the start of the game. The problem is that selecting the infant type throws up an unknown application error, then gives me the "ok to terminate", "cancel to debug". I cant see any reason for the error, although i expect its in objectTypes.cs
Here are the changes i made:
data.cs
...........
//Initialise the units in each clan
function loadClans()
{
//create 2 random infants
for(%cnt = 0;%cnt<=1;%cnt++)
{
createRandomInfant("Squares");
createRandomInfant("Circles");
}
}
function createRandomInfant(%team)
{
%pos = %team.base.getPosition();
%posX = getWord(%pos, 0);
%posY = getWord(%pos, 1);
%posY = %posY + (getRandom(30)-15);
%posX = %posX + (getRandom(30)-15);
%pos = %posX SPC %posY;
if(%team $= "Squares")
{
gameData.spawnObject("SquaresInfant", "Squares", %pos, "SquaresInfant");
}
else
{
gameData.spawnObject("CirclesInfant", "Circles", %pos, "CirclesInfant");
}
}
in objectTypes.cs
...........................
new ScriptObject(Infant : Entity){
superClass = Entity;
size = "5 5";
speed = 12;
hitPointsMax = 60;
gender = "female";
};
new ScriptObject(CirclesInfant : Infant){
class = Infant;
};
new ScriptObject(SquaresInfant : Infant){
class = Infant;
};
The only unusual thing i can see in the console is this:
--------- Initializing MOD: T2D ---------
Loading compiled script strategy/gameScripts/game.cs.
Loading compiled script strategy/data/content/datablocks.cs.
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (ForestMossImageMap) disabled 'filter-padding' as it was unnecessary!
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (ThickGrassImageMap) disabled 'filter-padding' as it was unnecessary!
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (borderImageMap) disabled 'filter-padding' as it was unnecessary!
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (CityImageMap) disabled 'filter-padding' as it was unnecessary!
t2dImageMapDatablock::calculateFullImageMap() - ImageMap (goldMineImageMap) disabled 'filter-padding' as it was unnecessary!
About the author
#2
www.garagegames.com/mg/forums/result.thread.php?qt=39039
Basically, change your %name variables so they are not identical to %type. So "SquaresInfant" to "SquareInfant" for example.
02/10/2006 (9:49 am)
John, I had the same problem a while back. I figured out the solution here (scroll to the bottom posts):www.garagegames.com/mg/forums/result.thread.php?qt=39039
Basically, change your %name variables so they are not identical to %type. So "SquaresInfant" to "SquareInfant" for example.
#3
02/11/2006 (7:55 am)
Thanks, thats it sorted now. :)
#4
02/12/2006 (1:00 am)
Thanks for pposting this Mike, I ran into this problem developing the strategy game and the strategy tut, I beleive its a problem with Torque GUI objects and it having issues referencing objects that really aren't torque GUIs. I was going to put a warning for that exact problem in the tut but in the couple weeks it took for me to document the entire tutorial I forgot lol... thanks for figuring this out and sharing it with others :)
Torque Owner Dave D
This will stop those annoying messages.
I haven't fully done that startegy tut yet, so I can't help out to much there.