EN4_PRC8/_module/nss/tm1_enter.nss

68 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

#include "rd_misc"
#include "rd_treasure"
void main()
{
location lLoc;
object oPC;
int iRandom;
int iCount;
oPC = GetEnteringObject();
if (GetLocalInt(OBJECT_SELF,"DoOnce") == 0)
{
SetLocalInt(OBJECT_SELF,"DoOnce",1);
if (Random(100)<25)
{
SetLocalInt(OBJECT_SELF,"CustomMerchant",1);
lLoc = GetLocation(GetObjectByTag("en4_cm2"));
CreateObject(OBJECT_TYPE_CREATURE,"mer_cm2",lLoc);
}
}
if (GetIsPC(oPC))
{
if (GetLocalInt(oPC,"DW1") == 0)
{
SetLocalInt(oPC,"DW1",1);
if (GetLocalInt(OBJECT_SELF,"CustomMerchant") == 1)
{
object oStore = GetObjectByTag("en4_cm2_mer");
iRandom=Random(4)+1;
iCount = 0;
while (iCount <= iRandom)
{
GetMagicItem(oStore,TRUE,TRUE,5);
iCount++;
}
iRandom=Random(4)+1;
iCount = 0;
while (iCount <= iRandom)
{
GetMagicItem(oStore,TRUE,TRUE);
iCount++;
}
iRandom=Random(3)+1;
iCount = 0;
while (iCount <= iRandom)
{
CreateRandomItem(oStore);
iCount++;
}
iRandom=Random(2)+1;
iCount = 0;
while (iCount <= iRandom)
{
GetMiscMagic(oStore);
iCount++;
}
iRandom=Random(2);
if (iRandom == 1)
GetRareItem(oStore);
}
}
}
}