Page 1 of 1

merchant quest on a new map

PostPosted: Thu Jan 02, 2003 1:37 pm
by Longshadow
Got a different map than the OSI map. Want to get the merchant quests working. If I modify the file scripts\include\towns.inc to have the towns that are on my map, do I have to also change pkg\npcs\townfolk\merchants\merchant_quest.src because I don't have 13 towns? I see this bit of code
var mytown := FindMyTown (merchant);
var chosentown := mytown;
if (!chosentown or RandomInt (4) = 1)
chosentown := RandomInt (13) + 1;
endif


Say I had only 5 towns. What would I have to change this too? I assume the 13 would become a 5, but what is that RandomInt (4) about?

Anything else I would need to change that I'm not noticing?

Thanks for any help.

PostPosted: Thu Jan 02, 2003 4:25 pm
by Senaldun
I am just guessing here but I think I am right

The 4 is a random variable used to determine if the quest calls for you to deliver the package to the town you are currently in or another town. It has a 75% chance of being in the same town and that 1 stands for the 25% of the package needing to be delivered to another town.

PostPosted: Thu Jan 02, 2003 7:28 pm
by Drocket
Yep, that's basically it.

PostPosted: Fri Jan 03, 2003 1:12 pm
by Longshadow
I changed the towns.inc and the merchant_quest.src and recompiled the merchant_quest.ecl, and now the merchants always say THIS the first time you say quest to one:

"Well, I could... Hmm... No, never mind. Come back later."

Then after that, they will only say THIS:

"I don't have anything I need delivered right now, I'm afraid"

Did I miss anything? Any steps I should have done? Anything I should check? Will they eventually hand out quests?

Thanks.

PostPosted: Mon Jan 06, 2003 5:10 am
by Longshadow
Bumping it to try to get D's attention :P

PostPosted: Mon Jan 06, 2003 6:53 am
by Lyl
Code: Select all
   var townmerchantarray := GetGlobalProperty ("#merchants_of_town_" + chosentown);
   if (!townmerchantarray)
      PrintTextAbovePrivate(merchant, "Well, I could...  Hmm...  No, never mind.  Come back later.", player);
      EraseObjProperty (player, "#merchantquestthing");
      return;
   endif


Basicly there is no list of merchants for the town the merchant wants to send you to.
A merchant adds itself to the global array of merchants for the town it is in when it is created. It uses FindMyTown (which returns an number) to tell what town they are in.


You probably need to rewrite the function FindMyTown to apply to your new areas. And you might also need to respawn(slay) all your merchants after that. And make sure
Code: Select all
   if (!chosentown or RandomInt (4) = 1)
      chosentown := RandomInt (13) + 1;
   endif
matches the new amount of towns you have.



Makes me wonder how accurate these global arrays are after time. There should be something that cleans them, or merchants would try to send people to nonexistant merchants over and over. I would put cleaning code in with
Code: Select all
   repeat
      tries := tries + 1;
      var chosenmerchantserial := townmerchantarray [RandomInt (total_merchants + 1)];
      chosenmerchant := SystemFindObjectBySerial (chosenmerchantserial);
   until (chosenmerchant or tries > 10);
   
   if (!chosenmerchant or chosenmerchant = merchant)
      PrintTextAbovePrivate(merchant, "I have some stuff I need delivered, but I don't think they're in.", player);
      EraseObjProperty (player, "#merchantquestthing");
      return;
   endif