]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/spawn.qc
Use a spawnflag to check if the monster has re-spawned
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / spawn.qc
index 3fe8567aee36c8f178616d76e8dad81fd234fae7..924a728a07678ed0101b537a35ba07a8997f8d69 100644 (file)
@@ -4,6 +4,7 @@ entity spawnmonster (string monster, float monster_id, entity spawnedby, entity
        initialize_field_db();
 
        entity e = spawn();
+       float i;
 
        e.spawnflags = MONSTERFLAG_SPAWNED;
 
@@ -12,9 +13,18 @@ entity spawnmonster (string monster, float monster_id, entity spawnedby, entity
 
        setorigin(e, orig);
 
+       if(monster == "random")
+       {
+               RandomSelection_Init();
+               for(i = MON_FIRST; i <= MON_LAST; ++i)
+                       RandomSelection_Add(world, 0, (get_monsterinfo(i)).netname, 1, 1);
+
+               monster = RandomSelection_chosen_string;
+       }
+
        if(monster != "")
        {
-               float i, found = 0;
+               float found = 0;
                entity mon;
                for(i = MON_FIRST; i <= MON_LAST; ++i)
                {