- 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