4 #include "../../dpdefs/progsdefs.qh"
7 #include "sv_monsters.qh"
9 #include "../../server/autocvars.qh"
10 #include "../../server/defs.qh"
12 entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag)
14 // ensure spawnfunc database is initialized
15 //initialize_field_db();
20 e.spawnflags = MONSTERFLAG_SPAWNED;
23 e.spawnflags |= MONSTERFLAG_NORESPAWN;
26 e.spawnflags |= MONSTERFLAG_INVINCIBLE;
30 if(monster == "random")
32 RandomSelection_Init();
33 for(i = MON_FIRST; i <= MON_LAST; ++i)
34 RandomSelection_Add(world, 0, (get_monsterinfo(i)).netname, 1, 1);
36 monster = RandomSelection_chosen_string;
43 for(i = MON_FIRST; i <= MON_LAST; ++i)
45 mon = get_monsterinfo(i);
46 if(mon.netname == monster)
49 monster_id = mon.monsterid; // we have the monster, old monster id is no longer required
54 monster = (get_monsterinfo(MON_FIRST)).netname;
59 monster = (get_monsterinfo(monster_id)).netname;
61 e.realowner = spawnedby;
64 e.monster_moveflags = moveflag;
66 if(IS_PLAYER(spawnedby))
68 if(teamplay && autocvar_g_monsters_teams)
69 e.team = spawnedby.team; // colors handled in spawn code
71 if(autocvar_g_monsters_owners)
72 e.monster_owner = own; // using .owner makes the monster non-solid for its master
74 e.angles = spawnedby.angles;
77 //monster = strcat("$ spawnfunc_monster_", monster);
79 entity oldself = self;
81 monster_initialize(monster_id);
84 //target_spawn_edit_entity(e, monster, world, world, world, world, world);