@LabelIndex 102295
@StringIndex 11842
class 0 npc_native : default_npc {
parameter:
	int	DoomSkill = 458752001;
	int	silhouette = 1025543;
	string	ai_type = "devil_called_by_native";

handler:
	EventHandler CREATED() {
		myself.i_ai0 = 100;
		myself.i_ai1 = 0;
	}

	EventHandler MY_DYING(c0) {
		c0 = myself::GetLastAttacker();
		if( myself::IsNullCreature(c0) == 0 ) {
			myself::CreateOnePrivateEx(silhouette,ai_type,0,0,gg::FloatToInt(myself.sm.x),gg::FloatToInt(myself.sm.y),gg::FloatToInt(myself.sm.z),0,1000,gg::GetIndexFromCreature(c0),0);
		} else {
			myself::CreateOnePrivateEx(silhouette,ai_type,0,0,gg::FloatToInt(myself.sm.x),gg::FloatToInt(myself.sm.y),gg::FloatToInt(myself.sm.z),0,0,0,0);
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id,f0,i0) {
		if( timer_id == 1000 ) {
			if( myself::IsMyBossAlive() == 0 ) {
				myself::Despawn();
			}
			i0 = ( gg::FloatToInt(( ( myself.sm.hp / myself.sm.max_hp ) * 100 )) - 1 );
			if( i0 <= 0 ) {
				myself::Suicide();
			} else {
				gg::SetNpcParam(myself.sm,9,( ( i0 * myself.sm.max_hp ) / 100 ));
			}
			if( myself.i_ai1 == 1 ) {
				myself::AddTimerEx(1000,1000);
			}
		}
	}

	EventHandler NO_DESIRE() {
		if( myself::IsMyBossAlive() != 0 ) {
			myself::AddFollowDesire(myself.boss,5);
		}
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2,script_event_arg3) {
		if( script_event_arg1 == 0 ) {
			if( myself.i_ai1 == 1 ) {
				myself.i_ai1 = 0;
			}
		}
		if( script_event_arg1 == 1 ) {
			if( myself.i_ai1 == 0 ) {
				myself.i_ai1 = 1;
				myself::Say(gg::MakeFString(1800136,"","","","",""));
				myself::AddTimerEx(1000,1000);
			}
		}
		if( script_event_arg1 == 3 ) {
			myself::Despawn();
		}
	}

}
