if(monster == "random")
{
RandomSelection_Init();
- FOREACH(Monsters, it != MON_Null && !(it.spawnflags & MONSTER_TYPE_PASSIVE),
+ FOREACH(Monsters, it != MON_Null && !(it.spawnflags & MONSTER_TYPE_PASSIVE) && !(it.spawnflags & MON_FLAG_HIDDEN),
{
RandomSelection_AddEnt(it, 1, 1);
});
}
// Monster_Spawn checks if monster is valid
- Monster_Spawn(e, false, monster_id);
+ if(!Monster_Spawn(e, false, monster_id))
+ {
+ delete(e);
+ return NULL; // remove even if told not to, as we didn't spawn any kind of monster
+ }
return e;
}