I am working on a level that will take random pieces of terrains and place them together side by side to generate a kind of random map each time the level loads

Here is my code
_func_create_level(3); //called after level load in main after wait(2)

function _func_create_level(var lSize)
{
VECTOR temp;

//create level
level_size = lSize * lSize; // Makes a Perfect Square

while(level_size != 0)
{
//Grab a random terrain piece and create map
ter_piece = integer(random(numb_terrain));

vec_set(temp, vector(a, b, 0));

if(ter_piece == 0) {ent_createlocal("t1.hmp", temp, act_terrain);}
if(ter_piece == 1) {ent_createlocal("t2.hmp", temp, act_terrain);}
if(ter_piece == 2) {ent_createlocal("t3.hmp", temp, act_terrain);}
if(ter_piece == 3) {ent_createlocal("t4.hmp", temp, act_terrain);}
if(ter_piece == 4) {ent_createlocal("t5.hmp", temp, act_terrain);}
if(ter_piece == 5) {ent_createlocal("t6.hmp", temp, act_terrain);}
if(ter_piece == 6) {ent_createlocal("t7.hmp", temp, act_terrain);}
if(ter_piece == 7) {ent_createlocal("t8.hmp", temp, act_terrain);}
if(ter_piece == 8) {ent_createlocal("t9.hmp", temp, act_terrain);}

wait(3);

if(tLeft != lSize)
{
a+=1504;
tLeft +=1;
}
else
{
a = 0;
b+=1504;
tLeft = 1;
}

wait(1);
level_size -=1;
}
}

The problem I seem to be having is the level will not load the same terrain file twice so, I have random holes in the level

I was thinking this would be an easy code. if level_size is 4 it would create 16 tiles in a square after each tile is made position is changed and the next tile is created until all tiles are made...but like I said its making random holes, and the only thing I can figure out is it will not make the same tile twice ???



edit: I placed a test panel to give me the terrain number it was suppose to be loading...I am correct it is will not load the same model file.. if one piece is loaded it will not load another piece with the same .hmp file........now if anyone can give me a clue why.....

Last edited by lostzac; 08/08/08 05:21.

John C Leutz II