Talk:Traveling Merchant

Is it just me or are some of the inventory items not displaying? I see them in the code when I hit "Edit" but the rows don't show up when I view the page. Specifically the last four on the list: Pad Thai, Gi, Magic Hat and Fancy Dishes. Anyone know what's up? Summoningdark (talk) 14:16, 14 February 2014 (UTC)

So I've had the merchant spawn twice, once near the center of the map where spawn is (promptly fell into lava and died), and another at the edge of the map near a pirate ship I built. I think this NPC spawns near other NPCs, rather than near spawn. Can a few other people confirm/disprove this? --Bluemofia (talk) 21:52, 19 February 2014 (UTC)

The probability for the merchant spawning doesn't make sense. For example, If something has a 1/20 chance of spawning and it has 10 chances to spawn, the probability of it spawning is not 1/20 * 10 = 1/2 or 50%. If that were true, then the probability of it not spawning (19/20) would be 19/20 * 10 = 19/2, or 9.5, or 950%. The proper way to calculate the probability is to take the probability that it will not spawn and raise that to the number of spawn chances. aka, (19/20)^10. then, subtract it from one to find the probability of spawn. 1-(19/20)^10 = 0.401 (ish) or about 40%. The same calculation for the given probabilities gives us 1 - (10,799/10,800)^27,000 = 0.9179 or about 92% chance of happening. So, unless the traveling merchant spawns over 90% of the time, something is wrong in the number of chances or the probability per second.


 * It's 1 in 108,000 -- not 1 in 10,800. You left off a zero (unless that was the result of dividing by 10 somewhere in there). For reference, the roll code is this:

if (Main.dayTime && Main.time < 27000.0) {	int num4 = (int)(27000.0 / (double)Main.dayRate); num4 *= 4; if (Main.rand.Next(num4) == 0) {		int num5 = 0; for (int i = 0; i < 200; i++) {			if (Main.npc[i].active && Main.npc[i].townNPC && Main.npc[i].type != 37) {				num5++; }		}		if (num5 >= 2) {			WorldGen.SpawnTravelNPC; }	} }
 * Main.dayRate is always 1. num4 is 27,000, and num4 *= 4 makes num4 into 180,000. Main.rand.next(num4) picks a random number with num4 as the max, and if that random number is zero, SpawnTravelNPC runs (if the check for prerequisite NPCs succeeds). My understanding is that this code runs once per tick, which is 1/60th of a second. This code is from Main.cs. It's possible I'm reading this wrong but in my experience playing the game, the 1 in 4 chance appears to hold true.  Equazcion ( talk ) 22:58, 14 Mar 2014 (UTC)


 * PS. Main.daytime means it is currently a time between dawn and nightfall, and Main.time is the number of ticks since the last dawn or nightfall. There are 54,000 ticks per day (dawn to nightfall), and Main.time being less than 27,000 means "before the daytime halfway point", which would be "before noon" (daytime starts at 4:30am in Terraria).  Equazcion ( talk ) 23:03, 14 Mar 2014 (UTC)

still the chance of him spawning is: 1-(1-1/108000)^27000 =22,12%

Correct pagename
I have no idea how to properly use Wikitext, but surely since the game uses the spelling, "Travelling Merchant", rather than the Americanised "Traveling Merchant", surely the pagename should do likewise? The pagename should not be based off the geographical location of the author, it should be about correct in-game information.
 * The preferred procedure for changing the pagename would be moving the page to the new title. As the page Travelling Merchant however already exists (it being a redirect to Traveling Merchant) it would however have to be deleted first so the other page can take its place. This can only be done by an admin. I fully agree with your suggestion and will ask an admin to fix it. NoseOfCthulhu (talk) 01:53, 2 June 2014 (UTC)