class 2 default_maker : (null)
{
parameter:
	int	on_start_spawn = 1;

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

	EventHandler ON_NPC_DELETED(deleted_def,i0,i1,maker0)
	{
		i0 = myself::DecreaseTotal(1);
		deleted_def::DecCount(1);
		if( deleted_def.respawn_time != 0 )
		{
			if( myself::IncreaseTotal(1) )
			{
				deleted_def::IncCount(1);
				deleted_def::Spawn(1,deleted_def.respawn_time);
			}
		}
	}

	EventHandler ON_SCRIPT_EVENT(script_event_arg1,script_event_arg2,script_event_arg3,def0,i0,i1)
	{
		switch(script_event_arg1)
		{
			case 1000:
			{
				for(i0 = 0; i0 < myself.def_count; i0 = ( i0 + 1 ))
				{
					def0 = myself::GetSpawnDefine(i0);
					if( gg::IsNull(def0) == 0 )
					{
						def0::Despawn();
					}
				}
				break;
			}
			case 1001:
			{
				for(i0 = 0; i0 < myself.def_count; i0 = ( i0 + 1 ))
				{
					def0 = myself::GetSpawnDefine(i0);
					if( gg::IsNull(def0) == 0 )
					{
						i1 = ( def0.total - def0.npc_count );
						if( i1 > 0 )
						{
							if( myself::IncreaseTotal(i1) )
							{
								def0::IncCount(i1);
								def0::Spawn(i1,script_event_arg2);
							}
						}
					}
				}
				break;
			}
		}
	}

}
