@LabelIndex 421258
@StringIndex 63758
class 1 undead_bandmaster_maker : Open_Door_maker {
parameter:
	string	dmgzone1 = "dmgzone1_default";
	string	dmgzone2 = "dmgzone2_default";
	string	dmgzone3 = "dmgzone3_default";
	string	TDoorName3 = "TDoorName3_default";
	string	TDoorName4 = "TDoorName4_default";

handler:
	EventHandler ON_START(def0) {
		myself::AddTimerEx(1000,3000);
		super;
	}

	EventHandler ON_DOOR_EVENT(enabled,i0,i1,def0) {
		if( enabled ) {
			if( myself.enabled ) {
				return;
			}
			myself.enabled = 1;
			for(i0 = 0; i0 < myself.def_count; i0++) {
				def0 = myself::GetSpawnDefine(i0);
				if( gg::IsNull(def0) == 0 ) {
					if( myself::AtomicIncreaseTotal(def0,def0.total,1) ) {
						def0::Spawn2(def0.total,0,0);
						myself::AddTimerEx(1000,3000);
					}
				}
			}
		} else if( myself.enabled == 0 ) {
			return;
		}
		myself.enabled = 0;
		for(i1 = 0; i1 < myself.def_count; i1++) {
			def0 = myself::GetSpawnDefine(i1);
			if( gg::IsNull(def0) == 0 ) {
				def0::Despawn();
			}
		}
	}

	EventHandler ON_TIMER(timer_id,i0,i1,maker0,def0) {
		if( timer_id == 1000 ) {
			def0 = myself::GetSpawnDefine(6);
			def0::SendScriptEvent(10032,6,0);
			def0 = myself::GetSpawnDefine(4);
			def0::SendScriptEvent(10032,4,0);
			def0 = myself::GetSpawnDefine(2);
			def0::SendScriptEvent(10032,2,0);
			def0 = myself::GetSpawnDefine(0);
			def0::SendScriptEvent(10032,0,0);
		}
	}

	EventHandler ON_NPC_DELETED(deleted_def,i0,i1,maker0,maker1,def0,reply) {
		if( reply == 6 ) {
			gg::Area_SetOnOff(dmgzone1,0);
		} else if( reply == 4 ) {
			gg::Area_SetOnOff(dmgzone2,0);
		} else if( reply == 2 ) {
			gg::Area_SetOnOff(dmgzone3,0);
		} else if( reply == 0 ) {
			if( gg::IsSameString(TDoorName3,"TDoorName3_default") == 0 ) {
				gg::Castle_GateOpenClose2(TDoorName3,0);
			}
			if( gg::IsSameString(TDoorName4,"TDoorName4_default") == 0 ) {
				gg::Castle_GateOpenClose2(TDoorName4,0);
			}
			maker1 = gg::GetNpcMaker("godard32_2515_14m1");
			if( gg::IsNull(maker1) == 0 ) {
				gg::SendMakerScriptEvent(maker1,1000,0,0);
			}
			maker1 = gg::GetNpcMaker("godard32_2515_11m1");
			if( gg::IsNull(maker1) == 0 ) {
				gg::SendMakerScriptEvent(maker1,1000,0,0);
			}
			maker1 = gg::GetNpcMaker("godard32_2515_10m1");
			if( gg::IsNull(maker1) == 0 ) {
				gg::SendMakerScriptEvent(maker1,1000,0,0);
			}
			maker1 = gg::GetNpcMaker("godard32_2515_12m1");
			if( gg::IsNull(maker1) == 0 ) {
				gg::SendMakerScriptEvent(maker1,1000,0,0);
			}
			maker1 = gg::GetNpcMaker("godard32_2515_13m1");
			if( gg::IsNull(maker1) == 0 ) {
				gg::SendMakerScriptEvent(maker1,1000,0,0);
			}
			maker1 = gg::GetNpcMaker("godard32_2515_15m1");
			if( gg::IsNull(maker1) == 0 ) {
				gg::SendMakerScriptEvent(maker1,1000,0,0);
			}
			maker1 = gg::GetNpcMaker("godard32_2515_18m1");
			if( gg::IsNull(maker1) == 0 ) {
				gg::SendMakerScriptEvent(maker1,1000,0,0);
			}
		}
	}

}
