Posted By: Ditje
[solved] leaving for-loop after first turn - where is my mistake - 08/09/10 09:36
I can`t see the wood because of the trees (german adage)
Following statement doesn`t work, beacuse enemy_distance get not counted up. But I don`t know why. There must be a very basic mistake in my thoughts.
Ditje
Edit: if I remove wait(1) - I get entities until crash.
I create more entities by this loops(9-40). The ent_create functions of this entities don`t call a function yet and their loops work fine.
Following statement doesn`t work, beacuse enemy_distance get not counted up. But I don`t know why. There must be a very basic mistake in my thoughts.
Ditje
Code:
... var enemy_distance = 2; ... // Welle 1 var i; for(i=1; i<9; i++) { if(enemy_distance >= 2) { if(i %2 == 0) { enemy[i] = ent_create("bee2.mdl", vector(-50, 1000, 500), start_bee_wave1); enemy_distance = 0; } else { enemy[i] = ent_create("bee1.mdl", vector(-50, 1000, 500), start_bee_wave1); enemy_distance = 0; } } else enemy_distance += time_step; } ... wait(1); ...
Edit: if I remove wait(1) - I get entities until crash.
I create more entities by this loops(9-40). The ent_create functions of this entities don`t call a function yet and their loops work fine.
Code:
for(i=9; i<17; i++) { if(i %2 == 0) enemy[i] = ent_create("bee2.mdl", vector(epos[i][0], -epos[i][1], epos[i][2]), NULL); else ent_create("capture.mdl", vector(epos[i][0], -epos[i][1], epos[i][2]), NULL); }