class 1 zakens_gatekeeper_exit : default_npc
{
parameter:
int InGameHour = 0;
int CheckTimerID = 5121;
int CheckTimer = 1000;
int WaitTimerID = 3711;
int WaitTimer = 1000;
int TelSpawnPointID = 7811;
int IsNight = 1;
handler:
EventHandler TALKED( talker, i0, i1 )
{
if( myself.i_ai0 == 1 )
{
myself::InstantTeleport( talker, 52587, 219102, -3224 );
return;
}
if( myself.i_ai0 == 0 )
{
myself::Say( talker.name + " how you come here?" );
return;
}
else
{
myself::Say( talker.name + " go away from me!" );
}
super;
}
EventHandler CREATED()
{
myself::AddTimerEx( WaitTimerID, WaitTimer );
myself.i_ai0 = 0;
super;
}
EventHandler NO_DESIRE()
{
}
EventHandler TIMER_FIRED_EX( timer_id, i0, i1, i2 )
{
i0 = gg::GetL2Time( 0 );
i1 = gg::GetL2Time( 1 );
i2 = gg::GetL2Time( 2 );
if( timer_id == WaitTimerID )
{
if( i2 )
{
if( IsNight == 1 )
{
myself::AddTimerEx( CheckTimerID, CheckTimer );
}
if( IsNight == 0 )
{
myself::AddTimerEx( WaitTimerID, WaitTimer );
}
}
else
{
myself::AddTimerEx( WaitTimerID, WaitTimer );
}
}
else if( timer_id == CheckTimerID )
{
if( i0 == InGameHour && gg::GetL2Time( 1 ) == 5 )
{
myself::InstantTeleport( myself.sm, 52342, 219181, -3232 );
myself::AddTimerEx( TelSpawnPointID, 2 * 60 * 1000 );
myself.i_ai0 = 1;
}
else
{
myself::AddTimerEx( WaitTimerID, WaitTimer );
}
}
else if( timer_id == TelSpawnPointID )
{
myself::InstantTeleport( myself.sm, 191895, 87799, 1720 );
myself::AddTimerEx( WaitTimerID, WaitTimer );
myself.i_ai0 = 0;
}
super;
}
}
class 1 zakens_gatekeeper_enter : default_npc
{
parameter:
int InGameHour = 0;
int CheckTimerID = 1231;
int CheckTimer = 1000;
int WaitTimerID = 2311;
int WaitTimer = 1000;
int TelSpawnPointID = 3211;
int IsNight = 1;
int PrivateEx = 1023042;
handler:
EventHandler TALKED( talker, i0, i1 )
{
if( myself.i_ai0 == 1 )
{
myself::InstantTeleport( talker, 52306, 219155, -3224 );
return;
}
if( myself.i_ai0 == 0 )
{
myself::Say( talker.name + " how you come here?" );
return;
}
else
{
myself::Say( talker.name + " go away from me!" );
}
super;
}
EventHandler CREATED()
{
myself::AddTimerEx( WaitTimerID, WaitTimer );
myself::CreateOnePrivateEx( PrivateEx, "zakens_gatekeeper_exit", 0, 0, myself::FloatToInt( myself.sm.x + 10 ), myself::FloatToInt( myself.sm.y + 10 ), myself::FloatToInt( myself.sm.z ), 0, 0, 0, 0 );
myself.i_ai0 = 0;
super;
}
EventHandler NO_DESIRE()
{
}
EventHandler TIMER_FIRED_EX( timer_id, i0, i1, i2 )
{
i0 = gg::GetL2Time( 0 );
i1 = gg::GetL2Time( 1 );
i2 = gg::GetL2Time( 2 );
if( timer_id == WaitTimerID )
{
if( i2 )
{
if( IsNight == 1 )
{
myself::AddTimerEx( CheckTimerID, CheckTimer );
}
if( IsNight == 0 )
{
myself::AddTimerEx( WaitTimerID, WaitTimer );
}
}
else
{
myself::AddTimerEx( WaitTimerID, WaitTimer );
}
}
else if( timer_id == CheckTimerID )
{
if( i0 == InGameHour && gg::GetL2Time( 1 ) == 5 )
{
myself::InstantTeleport( myself.sm, 52486, 219103, -3232 );
myself::AddTimerEx( TelSpawnPointID, 2 * 60 * 1000 );
myself.i_ai0 = 1;
}
else
{
myself::AddTimerEx( WaitTimerID, WaitTimer );
}
}
else if( timer_id == TelSpawnPointID )
{
myself::InstantTeleport( myself.sm, 191892, 87732, 1720 );
myself::AddTimerEx( WaitTimerID, WaitTimer );
myself.i_ai0 = 0;
}
super;
}
}