@LabelIndex 101343
@StringIndex 0
class 0 default_trap : default_npc {
parameter:
	int	show_created = 0;
	int	show_detected = 0;
	int	show_activated = 0;
	int	show_step_in = 0;
	int	show_step_out = 0;
	int	show_defused = 0;
	int	IsDetected = 1;
	int	IsDefused = 1;
	int	timer = 0;

handler:
	EventHandler CREATED() {
		myself::AddTimerEx(1002,( 10 * 1000 ));
	}

	EventHandler TRAP_DETECTED(i0,i1) {
		if( IsDetected == 1 ) {
			myself::SetWorldTrapVisibleByClassId(myself.sm.class_id,show_detected);
		}
	}

	EventHandler TRAP_ACTIVATED(i0) {
		myself::SetWorldTrapVisibleByClassId(myself.sm.class_id,show_activated);
	}

	EventHandler TRAP_STEP_IN(i0,i1,c0) {
		c0 = gg::GetCreatureFromID(i0);
		myself::SetWorldTrapVisibleByClassId(myself.sm.class_id,show_step_in);
		if( timer > 0 ) {
			myself::AddTimerEx(1001,( timer * 1000 ));
		}
	}

	EventHandler TRAP_STEP_OUT(i0,i1,c0) {
		c0 = gg::GetCreatureFromID(i0);
		myself::SetWorldTrapVisibleByClassId(myself.sm.class_id,show_step_out);
	}

	EventHandler TRAP_DEFUSED(i0) {
		if( IsDefused == 1 ) {
			myself::SetWorldTrapVisibleByClassId(myself.sm.class_id,show_defused);
		}
		myself::DefuseWorldTrapByClassId(myself.sm.id,myself.sm.class_id);
		if( timer > 0 ) {
			myself::AddTimerEx(1001,( timer * 1000 ));
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id) {
		if( timer_id == 1001 ) {
			if( myself.m_WorldTrapState == 0 ) {
				myself::ActivateWorldTrapByClassId(myself.sm.id,myself.sm.class_id);
			}
		} else if( timer_id == 1002 ) {
			myself::ActivateWorldTrapByClassId(myself.sm.id,myself.sm.class_id);
		}
	}

}
