Initial Commit
Initial Commit [v1.32PRC8]
This commit is contained in:
387
_module/nss/en4_specchest3.nss
Normal file
387
_module/nss/en4_specchest3.nss
Normal file
@@ -0,0 +1,387 @@
|
||||
#include "rd_treasure"
|
||||
#include "nw_o2_coninclude"
|
||||
|
||||
void GenerateWeapon(object oChest, object oPC);
|
||||
void GenerateArmor(object oChest, object oPC);
|
||||
void GenerateMagicItem(object oChest);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastOpener();
|
||||
|
||||
if (!GetIsObjectValid(GetObjectByTag("Lair2Spawn")) && GetLocalInt(OBJECT_SELF,"EN4DoOnce") == 0)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF,"EN4DoOnce",1);
|
||||
if (Random(4)==0)
|
||||
{
|
||||
object oPartyMember = GetFirstFactionMember(oPC, TRUE);
|
||||
while (GetIsObjectValid(oPartyMember) == TRUE)
|
||||
{
|
||||
GenerateMagicItem(oPartyMember);
|
||||
GenerateMagicItem(oPartyMember);
|
||||
oPartyMember = GetNextFactionMember(oPC, TRUE);
|
||||
}
|
||||
} else {
|
||||
object oPartyMember = GetFirstFactionMember(oPC, TRUE);
|
||||
while (GetIsObjectValid(oPartyMember) == TRUE)
|
||||
{
|
||||
GetArtifact(OBJECT_SELF);
|
||||
oPartyMember = GetNextFactionMember(oPC, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GenerateMagicItem(object oChest)
|
||||
{
|
||||
int iArmor;
|
||||
int iRandom;
|
||||
int iRandom2;
|
||||
int iShield;
|
||||
int iEnchant;
|
||||
int iLevel;
|
||||
int iEnchantments;
|
||||
int iIndex;
|
||||
int iPosition;
|
||||
int iBuild;
|
||||
string sTag;
|
||||
itemproperty iProperty;
|
||||
object oItem;
|
||||
object oPC;
|
||||
|
||||
oPC = GetRandomTreasurePC();
|
||||
iBuild = 0;
|
||||
iRandom = Random(3)+1;
|
||||
|
||||
switch (iRandom)
|
||||
{
|
||||
case 1: GetWeaponType(oPC);
|
||||
sTag = "en3_" + GetWeaponTag(oPC);
|
||||
iBuild = 1;
|
||||
break;
|
||||
case 2: iBuild = 2;
|
||||
iArmor = ENGetArmorType(oPC);
|
||||
sTag = GetArmorTag(iArmor);
|
||||
break;
|
||||
case 3: GetMiscMagic(oChest);
|
||||
break;
|
||||
}
|
||||
|
||||
iLevel = GetLevelByPosition(1,oPC) +
|
||||
GetLevelByPosition(2,oPC) +
|
||||
GetLevelByPosition(3,oPC);
|
||||
|
||||
if (iBuild>0)
|
||||
{
|
||||
|
||||
iRandom = Random(100)+1 + iLevel/3;
|
||||
|
||||
if (iRandom <=60)
|
||||
iEnchant = 1;
|
||||
else if (iRandom <=80)
|
||||
iEnchant= 2;
|
||||
else if (iRandom <=90)
|
||||
iEnchant = 3;
|
||||
else if (iRandom <=95)
|
||||
iEnchant = 4;
|
||||
else if (iRandom <=99)
|
||||
iEnchant = 5;
|
||||
else
|
||||
iEnchant = Random(5) + 6;
|
||||
|
||||
if (iLevel > 20)
|
||||
if (Random(100) < (iLevel-20))
|
||||
iEnchant = iEnchant + Random(10)+1;
|
||||
|
||||
if (iBuild == 1)
|
||||
{
|
||||
sTag = sTag + "2";
|
||||
oItem=CreateItemOnObject(sTag,oChest,1);
|
||||
if (IPGetIsRangedWeapon(oItem))
|
||||
{
|
||||
iProperty=ItemPropertyAttackBonus(iEnchant);
|
||||
IPSafeAddItemProperty(oItem,iProperty);
|
||||
iProperty=ItemPropertyMaxRangeStrengthMod(iEnchant);
|
||||
}
|
||||
else
|
||||
{
|
||||
iProperty=ItemPropertyEnhancementBonus(iEnchant);
|
||||
}
|
||||
}
|
||||
|
||||
if (iBuild == 2)
|
||||
{
|
||||
sTag = sTag + IntToString(Random(3)+2);
|
||||
oItem=CreateItemOnObject(sTag,oChest,1);
|
||||
iProperty=ItemPropertyACBonus(iEnchant);
|
||||
}
|
||||
|
||||
|
||||
IPSafeAddItemProperty(oItem,iProperty);
|
||||
|
||||
iEnchantments = GetNumEnchantments(iLevel);
|
||||
|
||||
iIndex=0;
|
||||
|
||||
while (iIndex < iEnchantments)
|
||||
{
|
||||
iIndex++;
|
||||
if (iBuild==1)
|
||||
if (GetTag(oItem) == "en3_monkgloves1" || sTag == "en3_monkgloves2")
|
||||
iProperty = MonkWeaponProperty(iEnchant);
|
||||
else if (IPGetIsRangedWeapon(oItem))
|
||||
iProperty = RangedWeaponProperty(iEnchant);
|
||||
else
|
||||
iProperty = WeaponProperty(iEnchant);
|
||||
else
|
||||
iProperty = ArmorProperty(iEnchant);
|
||||
IPSafeAddItemProperty(oItem,iProperty);
|
||||
}
|
||||
}
|
||||
|
||||
if (IPGetIsRangedWeapon(oItem))
|
||||
{
|
||||
if (sTag == "en3_hxbow2" || sTag == "en3_lxbow2")
|
||||
{
|
||||
GetAmmo(oChest,"en3_bolt1",iEnchant);
|
||||
}
|
||||
|
||||
if (sTag == "en3_longbow2" || sTag == "en3_sbow2")
|
||||
{
|
||||
GetAmmo(oChest,"en3_arrow1",iEnchant);
|
||||
}
|
||||
if (sTag == "en3_sling2")
|
||||
{
|
||||
GetAmmo(oChest,"en3_bullet1",iEnchant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenerateWeapon(object oChest, object oPC)
|
||||
{
|
||||
int iArmor;
|
||||
int iRandom;
|
||||
int iRandom2;
|
||||
int iShield;
|
||||
int iEnchant;
|
||||
int iLevel;
|
||||
int iEnchantments;
|
||||
int iIndex;
|
||||
int iPosition;
|
||||
int iBuild;
|
||||
string sTag;
|
||||
itemproperty iProperty;
|
||||
object oItem;
|
||||
//object oPC;
|
||||
|
||||
//oPC = GetRandomTreasurePC();
|
||||
iBuild = 0;
|
||||
|
||||
GetWeaponType(oPC);
|
||||
sTag = "en3_" + GetWeaponTag(oPC);
|
||||
iBuild = 1;
|
||||
|
||||
iLevel = GetLevelByPosition(1,oPC) +
|
||||
GetLevelByPosition(2,oPC) +
|
||||
GetLevelByPosition(3,oPC);
|
||||
|
||||
if (iBuild>0)
|
||||
{
|
||||
|
||||
iRandom = Random(100)+1 + iLevel/3;
|
||||
|
||||
if (iRandom <=60)
|
||||
iEnchant = 1;
|
||||
else if (iRandom <=80)
|
||||
iEnchant= 2;
|
||||
else if (iRandom <=90)
|
||||
iEnchant = 3;
|
||||
else if (iRandom <=95)
|
||||
iEnchant = 4;
|
||||
else if (iRandom <=99)
|
||||
iEnchant = 5;
|
||||
else
|
||||
iEnchant = Random(5) + 6;
|
||||
|
||||
if (iLevel > 20)
|
||||
if (Random(100) < (iLevel-20))
|
||||
iEnchant = iEnchant + Random(10)+1;
|
||||
|
||||
if (iBuild == 1)
|
||||
{
|
||||
sTag = sTag + "2";
|
||||
oItem=CreateItemOnObject(sTag,oChest,1);
|
||||
if (IPGetIsRangedWeapon(oItem))
|
||||
{
|
||||
iProperty=ItemPropertyAttackBonus(iEnchant);
|
||||
IPSafeAddItemProperty(oItem,iProperty);
|
||||
iProperty=ItemPropertyMaxRangeStrengthMod(iEnchant);
|
||||
}
|
||||
else
|
||||
{
|
||||
iProperty=ItemPropertyEnhancementBonus(iEnchant);
|
||||
}
|
||||
}
|
||||
|
||||
if (iBuild == 2)
|
||||
{
|
||||
sTag = sTag + IntToString(Random(3)+2);
|
||||
oItem=CreateItemOnObject(sTag,oChest,1);
|
||||
iProperty=ItemPropertyACBonus(iEnchant);
|
||||
}
|
||||
|
||||
|
||||
IPSafeAddItemProperty(oItem,iProperty);
|
||||
|
||||
iEnchantments = GetNumEnchantments(iLevel);
|
||||
|
||||
iIndex=0;
|
||||
|
||||
while (iIndex < iEnchantments)
|
||||
{
|
||||
iIndex++;
|
||||
if (iBuild==1)
|
||||
if (GetTag(oItem) == "en3_monkgloves1" || sTag == "en3_monkgloves2")
|
||||
iProperty = MonkWeaponProperty(iEnchant);
|
||||
else if (IPGetIsRangedWeapon(oItem))
|
||||
iProperty = RangedWeaponProperty(iEnchant);
|
||||
else
|
||||
iProperty = WeaponProperty(iEnchant);
|
||||
else
|
||||
iProperty = ArmorProperty(iEnchant);
|
||||
IPSafeAddItemProperty(oItem,iProperty);
|
||||
}
|
||||
}
|
||||
|
||||
if (IPGetIsRangedWeapon(oItem))
|
||||
{
|
||||
if (sTag == "en3_hxbow2" || sTag == "en3_lxbow2")
|
||||
{
|
||||
GetAmmo(oChest,"en3_bolt1",iEnchant);
|
||||
}
|
||||
|
||||
if (sTag == "en3_longbow2" || sTag == "en3_sbow2")
|
||||
{
|
||||
GetAmmo(oChest,"en3_arrow1",iEnchant);
|
||||
}
|
||||
if (sTag == "en3_sling2")
|
||||
{
|
||||
GetAmmo(oChest,"en3_bullet1",iEnchant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateArmor(object oChest, object oPC)
|
||||
{
|
||||
int iArmor;
|
||||
int iRandom;
|
||||
int iRandom2;
|
||||
int iShield;
|
||||
int iEnchant;
|
||||
int iLevel;
|
||||
int iEnchantments;
|
||||
int iIndex;
|
||||
int iPosition;
|
||||
int iBuild;
|
||||
string sTag;
|
||||
itemproperty iProperty;
|
||||
object oItem;
|
||||
//object oPC;
|
||||
|
||||
//oPC = GetRandomTreasurePC();
|
||||
|
||||
iBuild = 2;
|
||||
iArmor = ENGetArmorType(oPC);
|
||||
sTag = GetArmorTag(iArmor);
|
||||
|
||||
iLevel = GetLevelByPosition(1,oPC) +
|
||||
GetLevelByPosition(2,oPC) +
|
||||
GetLevelByPosition(3,oPC);
|
||||
|
||||
if (iBuild>0)
|
||||
{
|
||||
|
||||
iRandom = Random(100)+1 + iLevel/3;
|
||||
|
||||
if (iRandom <=60)
|
||||
iEnchant = 1;
|
||||
else if (iRandom <=80)
|
||||
iEnchant= 2;
|
||||
else if (iRandom <=90)
|
||||
iEnchant = 3;
|
||||
else if (iRandom <=95)
|
||||
iEnchant = 4;
|
||||
else if (iRandom <=99)
|
||||
iEnchant = 5;
|
||||
else
|
||||
iEnchant = Random(5) + 6;
|
||||
|
||||
if (iLevel > 20)
|
||||
if (Random(100) < (iLevel-20))
|
||||
iEnchant = iEnchant + Random(10)+1;
|
||||
|
||||
if (iBuild == 1)
|
||||
{
|
||||
sTag = sTag + "2";
|
||||
oItem=CreateItemOnObject(sTag,oChest,1);
|
||||
if (IPGetIsRangedWeapon(oItem))
|
||||
{
|
||||
iProperty=ItemPropertyAttackBonus(iEnchant);
|
||||
IPSafeAddItemProperty(oItem,iProperty);
|
||||
iProperty=ItemPropertyMaxRangeStrengthMod(iEnchant);
|
||||
}
|
||||
else
|
||||
{
|
||||
iProperty=ItemPropertyEnhancementBonus(iEnchant);
|
||||
}
|
||||
}
|
||||
|
||||
if (iBuild == 2)
|
||||
{
|
||||
sTag = sTag + IntToString(Random(3)+2);
|
||||
oItem=CreateItemOnObject(sTag,oChest,1);
|
||||
iProperty=ItemPropertyACBonus(iEnchant);
|
||||
}
|
||||
|
||||
|
||||
IPSafeAddItemProperty(oItem,iProperty);
|
||||
|
||||
iEnchantments = GetNumEnchantments(iLevel);
|
||||
|
||||
iIndex=0;
|
||||
|
||||
while (iIndex < iEnchantments)
|
||||
{
|
||||
iIndex++;
|
||||
if (iBuild==1)
|
||||
if (GetTag(oItem) == "en3_monkgloves1" || sTag == "en3_monkgloves2")
|
||||
iProperty = MonkWeaponProperty(iEnchant);
|
||||
else if (IPGetIsRangedWeapon(oItem))
|
||||
iProperty = RangedWeaponProperty(iEnchant);
|
||||
else
|
||||
iProperty = WeaponProperty(iEnchant);
|
||||
else
|
||||
iProperty = ArmorProperty(iEnchant);
|
||||
IPSafeAddItemProperty(oItem,iProperty);
|
||||
}
|
||||
}
|
||||
|
||||
if (IPGetIsRangedWeapon(oItem))
|
||||
{
|
||||
if (sTag == "en3_hxbow2" || sTag == "en3_lxbow2")
|
||||
{
|
||||
GetAmmo(oChest,"en3_bolt1",iEnchant);
|
||||
}
|
||||
|
||||
if (sTag == "en3_longbow2" || sTag == "en3_sbow2")
|
||||
{
|
||||
GetAmmo(oChest,"en3_arrow1",iEnchant);
|
||||
}
|
||||
if (sTag == "en3_sling2")
|
||||
{
|
||||
GetAmmo(oChest,"en3_bullet1",iEnchant);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user