1 entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag)
3 // ensure spawnfunc database is initialized
4 //initialize_field_db();
9 e.spawnflags = MONSTERFLAG_SPAWNED;
12 e.spawnflags |= MONSTERFLAG_NORESPAWN;
15 e.spawnflags |= MONSTERFLAG_INVINCIBLE;
19 if(monster == "random")
21 RandomSelection_Init();
22 for(i = MON_FIRST; i <= MON_LAST; ++i)
23 RandomSelection_Add(world, 0, (get_monsterinfo(i)).netname, 1, 1);
25 monster = RandomSelection_chosen_string;
32 for(i = MON_FIRST; i <= MON_LAST; ++i)
34 mon = get_monsterinfo(i);
35 if(mon.netname == monster)
38 monster_id = mon.monsterid; // we have the monster, old monster id is no longer required
43 monster = (get_monsterinfo(MON_FIRST)).netname;
48 monster = (get_monsterinfo(monster_id)).netname;
50 e.realowner = spawnedby;
53 e.monster_moveflags = moveflag;
55 if(IS_PLAYER(spawnedby))
57 if(teamplay && autocvar_g_monsters_teams)
58 e.team = spawnedby.team; // colors handled in spawn code
60 if(autocvar_g_monsters_owners)
61 e.monster_owner = own; // using .owner makes the monster non-solid for its master
63 e.angles = spawnedby.angles;
66 //monster = strcat("$ spawnfunc_monster_", monster);
68 entity oldself = self;
70 monster_initialize(monster_id);
73 //target_spawn_edit_entity(e, monster, world, world, world, world, world);