@LabelIndex 420432
@StringIndex 0
class 1 random_spawn_pawn : default_maker {
parameter:
	int	maximum_npc = 0;

handler:
	EventHandler ON_START(i0,def0) {
		if( on_start_spawn == 0 ) {
			return;
		}
		for(i0 = 0; i0 < myself.def_count; i0++) {
			def0 = myself::GetSpawnDefine(i0);
			if( gg::IsNull(def0) == 0 ) {
				if( myself::AtomicIncreaseTotal(def0,1,1) ) {
					def0::Spawn2(1,0,0);
				}
			}
		}
	}

	EventHandler ON_NPC_DELETED(deleted_def,def0,i0,i1,i2,maker0,reply) {
		i2 = gg::Rand(maximum_npc);
		def0 = myself::GetSpawnDefine(i2);
		if( gg::IsNull(def0) == 0 ) {
			if( myself::AtomicIncreaseTotal(def0,1,1) ) {
				def0::Spawn2(1,def0.respawn_time,def0.respawn_rand);
			}
		}
	}

}
