@LabelIndex 425977
@StringIndex 0
class 1 maker_castle_pailaka_npc : inzone_maker {
parameter:
	string	maker_name_invader1 = "c_pailaka_invader1";
	string	maker_name_invader2 = "c_pailaka_invader2";
	string	maker_name_invader3 = "c_pailaka_invader3";

handler:
	EventHandler ON_INSTANT_ZONE_EVENT(inzone_type_id,inzone_id,event_id,reply,i0,def0) {
		myself.enabled = reply;
		if( reply == 1 ) {
			myself::AddTimerEx(3029,1);
			myself.i_ai0 = 0;
			myself.i_ai1 = 0;
			myself::AddTimerEx(3030,( ( 2 * 60 ) * 1000 ));
		} else if( reply == 0 ) {
			for(i0 = 0; i0 < myself.def_count; i0++) {
				def0 = myself::GetSpawnDefine(i0);
				if( gg::IsNull(def0) == 0 ) {
					def0::Despawn();
				}
			}
		}
	}

	EventHandler ON_SCRIPT_EVENT(script_event_arg1,script_event_arg2,script_event_arg3,def0,i0,i1,maker0) {
		super;
		if( script_event_arg1 == 2117009 ) {
			for(i0 = 0; i0 < myself.def_count; i0++) {
				def0 = myself::GetSpawnDefine(i0);
				if( gg::IsNull(def0) == 0 ) {
					def0::SendScriptEvent(2117009,0,0);
				}
			}
		}
	}

	EventHandler ON_TIMER(timer_id,i0,i1,maker0,def0) {
		if( timer_id == 3030 ) {
			i0 = myself::GetInZoneID();
			maker0 = gg::InstantZone_GetNpcMaker(i0,myself.name);
			if( gg::IsNull(maker0) == 0 ) {
				gg::SendMakerScriptEvent(maker0,1001,0,0);
			}
		} else if( timer_id == 3029 ) {
			if( myself.i_ai0 == 26 && myself.i_ai1 == 0 ) {
				i0 = myself::GetInZoneID();
				for(i0 = 0; i0 < myself.def_count; i0++) {
					def0 = myself::GetSpawnDefine(i0);
					if( gg::IsNull(def0) == 0 ) {
						def0::SendScriptEvent(2117007,0,0);
					}
				}
				maker0 = gg::InstantZone_GetNpcMaker(i0,maker_name_invader1);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,2117007,0,0);
				}
				maker0 = gg::InstantZone_GetNpcMaker(i0,maker_name_invader2);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,2117007,0,0);
				}
				maker0 = gg::InstantZone_GetNpcMaker(i0,maker_name_invader3);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,2117007,0,0);
				}
			} else if( myself.i_ai0 != 26 && myself.i_ai1 == 0 ) {
				myself.i_ai0 = ( myself.i_ai0 + 1 );
				myself::AddTimerEx(3029,( ( 1 * 60 ) * 1000 ));
			}
		}
	}

	EventHandler ON_NPC_DELETED(deleted_def,i0,i1,maker0,reply,died,def0) {
		if( died == 1 && myself.i_ai1 == 0 ) {
			myself.i_ai1 = 1;
			i0 = myself::GetInZoneID();
			maker0 = gg::InstantZone_GetNpcMaker(i0,maker_name_invader1);
			if( gg::IsNull(maker0) == 0 ) {
				gg::SendMakerScriptEvent(maker0,2117003,0,0);
			}
			maker0 = gg::InstantZone_GetNpcMaker(i0,maker_name_invader2);
			if( gg::IsNull(maker0) == 0 ) {
				gg::SendMakerScriptEvent(maker0,2117003,0,0);
			}
			maker0 = gg::InstantZone_GetNpcMaker(i0,maker_name_invader3);
			if( gg::IsNull(maker0) == 0 ) {
				gg::SendMakerScriptEvent(maker0,2117003,0,0);
			}
		}
	}

}
