L2 Shrine strongly condemns the aggression of the barbaric russian federation. 🇺🇦 Slava Ukraini! 🇺🇦

Recommended Posts

All these days shadai didnt spawn,could you please check it? npc is camped every single night either by me or my clanmates but npc didnt spawn yet,it's not that we missed him or something ,we're talking about 10+ nights ( i lost counting but HB is lvl9 more than 2.5 days )

Link to post
Share on other sites

I read some forum posts from officials, on some servers they had same issue 17 nights without Shadai. Something is wrong and that's for sure. 20% means 1 out of 5. 

Lets say we are extremely unlucky as everything else, that means even 1 out of 10 he should spawn at least once.. but thats already 15+ nights without NPC..

Link to post
Share on other sites

Everything seems right... I'll add some logging tomorrow so I can show you why he doesn't spawn

EDIT: In fact, I'm standing just right next to him - on top of one of HB citadel towers - where ncsoft hides him when Rand(100) gets > 19 on spawn/start of the night:

set_compiler_opt base_event_type(@NTYPE_NPC_EVENT)

class npc_shhadai : citizen {
parameter:
	int	on_oasis = 20;
	int	PosX = 9032;
	int	PosY = 253063;
	int	PosZ = -1928;
	int	PosX_temp = 16882;
	int	PosY_temp = 238952;
	int	PosZ_temp = 9776;

handler:
	EventHandler CREATED(i0)
	{
		i0 = GetL2Time(2);
		if( i0 )
		{
			if( Rand(100) < on_oasis )
			{
				InstantTeleport(myself.sm, PosX, PosY, PosZ);
				myself.i_ai3 = 1;
				myself.i_ai4 = 0;
			}
			else
			{
				InstantTeleport(myself.sm, PosX_temp, PosY_temp, PosZ_temp);
				myself.i_ai3 = -1;
			}
		}
		else
		{
			InstantTeleport(myself.sm, PosX_temp, PosY_temp, PosZ_temp);
			myself.i_ai3 = 0;
		}
		AddTimerEx(5003, 10000);
		super;
	}

	EventHandler TALKED(talker,ask,reply)
	{
		ShowPage(talker, "shhadai001.htm");
	}

	EventHandler MENU_SELECTED(talker,ask,reply)
	{
		if( ask == -1006 )
		{
			if( reply == 1 )
			{
				ShowPage(talker, "shhadai002.htm");
			}
		}
		else if( ask == -303 )
		{
			if( reply == 617 || reply == 616 || reply == 624 || reply == 625 )
			{
				ShowMultisell(reply, talker);
			}
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0)
	{
		if( timer_id == 5003 )
		{
			i0 = GetL2Time(2);
			if( i0 )
			{
				if( myself.i_ai3 == 1 )
				{
					if( Rand(100) > 50 )
					{
						myself.i_ai4 = myself.i_ai4 + 1;
					}
					if( myself.i_ai4 == 20 )
					{
						Shout(MakeFString(1800137, "", "", "", "", ""));
						myself.i_ai4 = 0;
					}
				}
				else if( myself.i_ai3 == -1 )
				{
				}
				else if( Rand(100) < on_oasis )
				{
					InstantTeleport(myself.sm, PosX, PosY, PosZ);
					myself.i_ai3 = 1;
				}
				else
				{
					InstantTeleport(myself.sm, PosX_temp, PosY_temp, PosZ_temp);
					myself.i_ai3 = -1;
				}
			}
			else if( myself.i_ai3 == 1 )
			{
				InstantTeleport(myself.sm, PosX_temp, PosY_temp, PosZ_temp);
				myself.i_ai3 = 0;
			}
			else if( myself.i_ai3 == -1 )
			{
				myself.i_ai3 = 0;
			}
			AddTimerEx(5003, 10000);
		}
		super;
	}
}

 

Link to post
Share on other sites
6 hours ago, Gogita said:

Lets say we are extremely unlucky as everything else, that means even 1 out of 10 he should spawn at least once.. but thats already 15+ nights without NPC..

nah, probabily is not working like that, 15 nights is still very small sample. When there will be lets say 1000+ nights the spawn will be close to 20% and if not we could discuss it than. (well nobody will count when he acually spawns ^^ )

Link to post
Share on other sites

10 nights in row without shadai has chance 10,7%

15 nights in row has chance 3.51%.

 

Chance looks as 20% but if Rand function is badly written it can give most numbers around 50 and only few numbers from ends.

Maybe change

if( Rand(100) < on_oasis )

for

if(40 < Rand(100) < 60 )

highly increase spawn chance :D

Link to post
Share on other sites

We got lvl 10 before midday 2 days ago. With hb lvl increasing delay it means lvl 9 is since more than 3 days => 18 nights in l2 already passed 6 per each day.
20% chance so its 0.8^18 chance to still not appear => 1.8% . Well k, since getRandom functions was always bad, and our "badluck" it is possible.
Checked already /loc of main x/y/z position and its correct, cant check the temporary pos, but if u say its a roof of one steel cit tower and "int PosZ_temp = 9776;" is high its true i guess. Since there is no any issue with location, only idea i can find in this code is
 

12 hours ago, Emca said:

i0 = GetL2Time(2);
if( i0 )

Time in code is number 0-86400 (not 00:00 format, atleast i guess) and shouldnt it be  "  if( i0 == 0 ) " .
In that way "if" s are getting skipped, code skip also getRandom function etc. and creating only npc with

 

12 hours ago, Emca said:

else
{
InstantTeleport(myself.sm, PosX_temp, PosY_temp, PosZ_temp);
myself.i_ai3 = 0;
}

which is outside of
if(i0)
{
}.
Well my programing skill are bad,totally when i know only c++/android/php and the thing i found may be correct code w/o issues i guess are there.
It might be our badluck only, 1.8% is not that low ( LR had 0.5^11 => 0.048% chance to redrop zariche 11 times in a row, an it happend so...)

  • Like 1
Link to post
Share on other sites
1 hour ago, Eldax said:

Time in code is number 0-86400 (not 00:00 format, atleast i guess) and shouldnt it be  "  if( i0 == 0 ) " .

GetL2Time(2) returns day=0/night=1

i0 = GetL2Time(2);
if (i0) {
    // this gets executed in night
}

 

Link to post
Share on other sites
  • 2 weeks later...
  • Emca locked this topic
Guest
This topic is now closed to further replies.