Nathan, thanks for offering this! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid="
" border="0" alt="onya.gif" />
I've been wondering about the random item variables for my sneaky trader mod. He's a walking vendor, and has about twenty items to offer - I only want him to actually carry about ten. SOME of these items should be more rare than others.
This is the original code for a walking vendor:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> case "Items":
if(CheckAttribute(Pchar, "quest.tutorial.Spyglass"))
{
TakeNItems(Npchar,"blade1", Rand(4)+1);
TakeNItems(Npchar,"blade2", Rand(4)+1);
TakeNItems(Npchar,"blade3", Rand(4)+1);
TakeNItems(Npchar,"blade4", Rand(4)+1);
TakeNItems(Npchar,"blade5", Rand(4)+1);
TakeNItems(Npchar,"spyglass2", 1);
TakeNItems(Npchar,"potion1", Rand(10)+1);
TakeNItems(Npchar,"potion2", Rand(3)+1);
TakeNItems(Npchar,"jewelry1", Rand(4)+1);
TakeNItems(Npchar,"jewelry2", Rand(4)+1);
TakeNItems(Npchar,"jewelry4", Rand(4)+1);
TakeNItems(Npchar,"indian4", Rand(4)+1);
TakeNItems(Npchar,"indian13", Rand(4)+1);
// DeleteAttribute(Pchar, "quest.tutorial.Spyglass");
}
else
{
if (npchar.quest.Meeting != lastspeak_date)
{
GiveItemToTrader(npchar);
npchar.quest.Meeting = lastspeak_date;
}
}
NextDiag.CurrentNode = NextDiag.TempNode;
DialogExit();
LaunchItemsTrade(NPChar);
break;<!--c2--></div><!--ec2-->And this is what I fiddled together but have not tested yet.:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> case "Items":
TakeNItems(Npchar,"lockpick", Rand(4)+1);
TakeNItems(Npchar,"prybar", Rand(4)+1);
TakeNItems(Npchar,"compass", Rand(4)+1);
TakeNItems(Npchar,"deed", Rand(4)+1);
TakeNItems(Npchar,"corvette", Rand(4)+1);
TakeNItems(Npchar,"idol3", Rand(3)+1);
TakeNItems(Npchar,"stolen1", Rand(10)+1);
TakeNItems(Npchar,"stolen2", Rand(3)+1);
TakeNItems(Npchar,"sword", Rand(4)+1);
TakeNItems(Npchar,"gun", Rand(4)+1);
TakeNItems(Npchar,"idol1", Rand(4)+1);
TakeNItems(Npchar,"idol2", Rand(4)+1);
TakeNItems(Npchar,"map", Rand(4)+1);
TakeNItems(Npchar,"keys", Rand(4)+1);
TakeNItems(Npchar,"stolen3", Rand(4)+1);
TakeNItems(Npchar,"stolen4", Rand(4)+1);
TakeNItems(Npchar,"wallet", Rand(4)+1);
TakeNItems(Npchar,"map2", Rand(4)+1);
TakeNItems(Npchar,"map3", Rand(4)+1);
TakeNItems(Npchar,"map4", Rand(4)+1);
Diag.CurrentNode = Diag.TempNode;
DialogExit();
LaunchItemsTrade(NPChar);
break;<!--c2--></div><!--ec2-->Right now the rand numbers don't really mean anything to me. Please, can you explain to me how they work so I can do this correctly?
Thanks! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid="
" border="0" alt="par-ty.gif" />