#include "rd_treasure" void SetupDynamicMerchant(); void AddToDynamicMerchant(); void AddMoreToDynamicMerchant(); int StartingConditional() { int iResult; iResult = FALSE; if (GetLocalInt(OBJECT_SELF,"StoreOpened") == 0) { SetupDynamicMerchant(); SetLocalInt(OBJECT_SELF,"StoreOpened",1); SetLocalInt(OBJECT_SELF,GetName(GetPCSpeaker()),1); } if (GetLocalInt(OBJECT_SELF,GetName(GetPCSpeaker())) == 0) { AddToDynamicMerchant(); SetLocalInt(OBJECT_SELF,GetName(GetPCSpeaker()),1); } if (GetHitDice(GetPCSpeaker())>9 && GetLocalInt(OBJECT_SELF,"StoreOpened_10") == 0) { AddMoreToDynamicMerchant(); SetLocalInt(OBJECT_SELF,"StoreOpened_10",1); } if (GetHitDice(GetPCSpeaker())>19 && GetLocalInt(OBJECT_SELF,"StoreOpened_20") == 0) { AddMoreToDynamicMerchant(); SetLocalInt(OBJECT_SELF,"StoreOpened_20",1); } if (GetHitDice(GetPCSpeaker())>29 && GetLocalInt(OBJECT_SELF,"StoreOpened_30") == 0) { AddMoreToDynamicMerchant(); SetLocalInt(OBJECT_SELF,"StoreOpened_30",1); } return iResult; } void SetupDynamicMerchant() { int iCount; int iRandom; object oStore; oStore = GetObjectByTag("en4_evilcustom"); iRandom=Random(3)+2; iCount = 0; while (iCount <= iRandom) { GetMagicItem(oStore,TRUE,TRUE,5); iCount++; } iRandom=Random(5)+8; iCount = 0; while (iCount <= iRandom) { GetMagicItem(oStore,TRUE,TRUE); iCount++; } iRandom=Random(5)+3; iCount = 0; while (iCount <= iRandom) { GetMiscMagic(oStore); iCount++; } iRandom=Random(2)+1; iCount = 0; while (iCount <= iRandom) { GetMinorMagicItem(oStore); iCount++; } iRandom=Random(8)+3; iCount = 0; while (iCount <= iRandom) { CreateRandomItem(oStore); iCount++; } iRandom=Random(4)+1; iCount = 0; while (iCount <= iRandom) { GetRareItem(oStore); iCount++; } GetNegativeItem(oStore); } void AddToDynamicMerchant() { object oStore; oStore = GetObjectByTag("en4_evilcustom"); GetMagicItem(oStore,TRUE,TRUE,5); GetMagicItem(oStore,TRUE,TRUE,5); GetMagicItem(oStore,TRUE,TRUE,5); GetMagicItem(oStore,TRUE,TRUE,5); } void AddMoreToDynamicMerchant() { int iCount; int iRandom; object oStore; oStore = GetObjectByTag("en4_evilcustom"); iRandom=Random(3); iCount = 0; while (iCount <= iRandom) { GetMagicItem(oStore,TRUE,TRUE,5); iCount++; } iRandom=Random(4)+2; iCount = 0; while (iCount <= iRandom) { GetMagicItem(oStore,TRUE,TRUE); iCount++; } iRandom=Random(3)+1; iCount = 0; while (iCount <= iRandom) { GetMiscMagic(oStore); iCount++; } iRandom=Random(4)+1; iCount = 0; while (iCount <= iRandom) { CreateRandomItem(oStore); iCount++; } iRandom=Random(2); iCount = 0; while (iCount <= iRandom) { GetRareItem(oStore); iCount++; } }