void main()
{//Simulate the native level files functionality
float xPos = getglobalvar("xPos");
void vSpawn;
int xSpawn;
int ySpawn;
int zSpawn;
int at;
at = 300;
if(xPos > at){
if(!getlocalvar(at)){
vSpawn = "Ralf";
xSpawn = 520;
ySpawn = 0;
zSpawn = 230;
spawn01(vSpawn, xSpawn, ySpawn, zSpawn);
//USED ONLY TO FINISH THE PROCESS
setlocalvar(at, 1);
}
}
at = 600;
if(xPos > at){
if(!getlocalvar(at)){
vSpawn = "Ralf";
xSpawn = 520;
ySpawn = 0;
zSpawn = 230;
spawn01(vSpawn, xSpawn, ySpawn, zSpawn);
//USED ONLY TO FINISH THE PROCESS
setlocalvar(at, 1);
}
}
at = 900;
if(xPos > at){
if(!getlocalvar(at)){
vSpawn = "Heavy";
xSpawn = 520;
ySpawn = 0;
zSpawn = 230;
spawn01(vSpawn, xSpawn, ySpawn, zSpawn);
vSpawn = "Heavy";
xSpawn = 560;
ySpawn = 0;
zSpawn = 210;
spawn01(vSpawn, xSpawn, ySpawn, zSpawn);
//USED ONLY TO FINISH THE PROCESS
setlocalvar(at, 1);
}
}
at = 1200;
if(xPos > at){
if(!getlocalvar(at)){
vSpawn = "Yashiro";
xSpawn = 520;
ySpawn = 0;
zSpawn = 210;
spawn01(vSpawn, xSpawn, ySpawn, zSpawn);
vSpawn = "Yashiro";
xSpawn = 560;
ySpawn = 0;
zSpawn = 220;
spawn01(vSpawn, xSpawn, ySpawn, zSpawn);
vSpawn = "Yashiro";
xSpawn = 600;
ySpawn = 0;
zSpawn = 230;
spawn01(vSpawn, xSpawn, ySpawn, zSpawn);
//USED ONLY TO END THE CURRENT LEVEL AFTER THE LAST ENEMIES ARE KILLED
endLevel();
//USED ONLY TO FINISH THE PROCESS
setlocalvar(at, 1);
}
}
}
void spawn01(void vName, float fX, float fY, float fZ, int dir, int map, int mp, int layer, void anim)
{ //spawn01 (Generic spawner)
//Damon Vaughn Caskey
//07/06/2007
//
//Spawns entity next to caller.
//
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: Z location adjustment.
void vSpawn;
float xPos = getglobalvar("xPos");
clearspawnentry();
setspawnentry("name", vName);
fX = xPos+fX;
vSpawn = spawn();
changeentityproperty(vSpawn, "position", fX, fZ, fY);
changeentityproperty(vSpawn, "direction", dir);
changeentityproperty(vSpawn, "offscreenkill", 99999);
//SET CUSTOM MAP
if(map != NULL()){setspawnentry("map", map);}
//SET CUSTOM MP
if(mp != NULL()){setspawnentry("mp", mp);}
//SET CUSTOM LAYER POSITION
if(layer != NULL()){changeentityproperty(vSpawn, "setlayer", layer);}
//SET CUSTOM ANIMATION
if(anim != NULL()){changeentityproperty(vSpawn, "animation", openborconstant(anim));}
return vSpawn; //RETURN SPAWN.
}
void endLevel()
{//Script used to detect the level manager entity and kill him, causing the end of the current level
/*
* Caskey, Damon V.
* 2022-01-26
*
* Example function to enumerate the entity
* collection and take action on each
* if they meet specfifc conditions.
*/
void entity_cursor = NULL();
int entity_count = openborvariant("count_entities");
int entity_index = 0;
int exists = 0;
for(entity_index = 0; entity_index < entity_count; entity_index++){
entity_cursor = getentity(entity_index);
if(!entity_cursor){
continue;
}
exists = getentityproperty(entity_cursor, "exists");
if(!exists){
continue;
}
if(getentityproperty(entity_cursor, "defaultname") != "Manager"){
continue;
}
/* Take your actions here. Sucking in, doing damage, etc. */
killentity(entity_cursor);
}
}