Game Development Community

Setting up level load groups and randomizing them

by JesseL · in Torque Game Builder · 08/28/2007 (2:00 pm) · 1 replies

I was working on doing a level load group for difficulty and then setting them up to randomize.

I can see the group and randomizing as being easy. Just use a nameing convention. levelA1, LevelA2, LevelA3, etc. However, everytime I go to try to load the next level or any level for that matter after the game has been started. I get owend by the "Error loading level ~/data/levels/level1.t2d. Invalid file."

I was wondering if anyone else had done something similar that could give me a couple of tips or at least tell me why i'm getting an Invalid file error message.

Thank you in advance

Jesse James Lord

About the author

I just realized that if I wanted to create a cat that caught on fire and ran up a telephone pole and then burst into a blue waterfall. That wouldn't be to hard!


#1
08/29/2007 (7:22 am)
After a lot of playing around I realized that I was missing the "game/data/levels/level1.t2d" instead of using the ~/ or the ./. Wow that took a while.

$basepath = "game/data/levels/";
$characterCreate = 1;
$levelTry = 1;


if $characterCreate = 1
{
     %chlevel = "platform";
}
else if $characterCreate = 2
{
     %chlevel = "astoriod";
}
etc...

if $levelTry = 1
{
     %chTry = "A";
}
else if $levelTry = 2
{
     %chTry = "B";
}
etc...

%var = random(1, 10);

%level = "%chlevel @ %chTry @ %var"

if !%level
{
     endlevel();
     t2dscenewindow2d.loadlevel("$basepath @ %level");
}