Автор: Vanes May 4 2007, 16:14
видел на некоторые буржуйских шардах подобие этой системы...
так что мне даже обидно за наших, что на русских шардах это еще не сделали...
в общем выкладываю свои скрипты рендомного лута...
система проверенная, работающая 2 года на шарде Валидор2...
к сожалению в нвн2 пока не разобрался как внешний вид шмоток скриптами изменять, потому пришлось вместо одной болванки создавать много и использовать банальные
sBaseItemTag = "vr_belt"+IntToString(Random(18));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
скрипт первый, основной...
используется как инклуд в ондес моба, онюз ящика и т.п.
запускается функцией void RandomLoot(int nCR, object oContainer, string sSpec)
Neverwinter Script Source
// for NWN Shard "Validor 2"
// main script
/* Scripted by Vanes */
#include "vns_loot_iptable"
#include "vns_loot_inc"
#include "vr_inc_code"
struct stItemProperty
{
int n;
itemproperty ip;
int subgrp;
int price;
string s; /* all prices in one string */
int nGC; /* Group Coefficient, f.e. for enhancement nCG=5, +1 enhancement
for every 5 points of CR*/
int nGM; /* Group Multiplier, f.e. for abilities nGM=6, because we have
6 abilities to increase*/ // NOT USED
};
string sCreatedItemTag;
string sAppID;
// Creating bollte/healers kit in loot bag.
// nCR - mob's Chalendge Raiting
void CreateBottleInLoot(int nCR, object oContainer);
// Creating scroll in loot bag.
// nCR - mob's Chalendge Raiting
void CreateScrollInLoot(int nCR, object oContainer);
// Creating money in loot bag.
// nAmount - amount of gold to create.
void CreateMoneyInLoot(int nAmount, object oContainer);
// Creating misc in loot bag.
// nCR - mob's Chalendge Raiting
void CreateMiscInLoot(int nCR, object oContainer);
// Creating "rar" item in loot bag.
// nCR - mob's Chalendge Raiting
void CreateRARInLoot(int nCR, object oContainer);
void CreateMapInLoot(int nCR, object oContainer);
// Creating item in loot.
// nType = 1:"belt", 2:"boots", 3:"cloak", 4:"gauntlet", 5:"ring", 6:"amulet", 7:"helmet",
// 8:"sling", 9:"dart", 10:"shuriken"
// nCR - mob's Chalendge Raiting
void CreateItemInLoot(int nType, int nCR, object oContainer);
// Creating item in loot.
// nCR - mob's Chalendge Raiting
void CreateAmmoInLoot(int nCR, object oContainer);
// 10% - creating items
// 5% - creating scrolls
// 85% - only money
int roulette1(int r1);
//20% - creating weapons
//15% - creating armor
//12% - creating shields
//10% - creating magic items (staffs, rods, wands)
//6% - creating clothes (rings, amulets, cloaks, bracers/gauntlets, helmets, boots, belts
//1% - creating "rar" items
int roulette2();
// "Roulette" for choosing one IP from group.
// nNumber - Group Number (1-enhancement, 2-attack, 301-damage(simple), 302-damage(exotic),
// 4-AC, 5-reduction, 601-resist(simple), 602-resist(exotic), 7-regeneration,
//8-weight_redustion, 9-ability, 10-skill, 1101-save(simple), 1102-save(universal)
// nCR - mob's Chalendge Raiting
// nPoints - remaining points to adding IP
// bMainGroup - flag for main group (first group)
// oItem - item to adding IP.
int MyAddItemProperty (int nTableNumber, int nCR, int nPoints, int bMainGroup, object oItem);
void RandomLoot(int nCR, object oContainer, string sSpec)
{
// nCR = 40; // test
// SendMessageToPC(GetFirstPC(), "nCR=20");
// --- PvP Bonus
int i=1;
if(sSpec=="25%bonus")
if(d4()==1) i=2;
else if(sSpec=="50%bonus")
if(d2()==1) i=2;
else if(sSpec=="75%bonus")
if(d4()!=1) i=2;
int r1 = 0;
if(sSpec=="N5_100%_ELITE_MOB"){
r1=3;
i=5;
}
if(sSpec=="N10_100%_ELITE_MOB"){
r1=3;
i=10;
}
if(sSpec=="100%_TREASURE"){
r1=3;
}
if(FindSubString(sSpec, "100%_NESP_MOB")!=-1){
r1=3;
nCR+=4;
int nNESPLvl = StringToInt(GetStringRight(sSpec, 1));
if(nNESPLvl>=3){
CreateItemOnObject("perfectcrystall", oContainer);
}else if(nNESPLvl==2){
if(d2()==1) CreateItemOnObject("perfectcrystall", oContainer);
}else if(nNESPLvl==1){
if(d4()==1) CreateItemOnObject("perfectcrystall", oContainer);
}
}
//SendMessageToPC(GetFirstPC(), "Loot scrint running...");
switch(roulette1(r1)){
case 1: CreateMoneyInLoot(d10(nCR)*3, oContainer); break; // only money
case 2: CreateMoneyInLoot(d10(nCR)*2, oContainer); // money and misc
CreateMiscInLoot(nCR, oContainer); break;
case 3: CreateMoneyInLoot(d10(nCR)*2, oContainer); // money and item
while(i>0){
//SendMessageToPC(GetFirstPC(), "item in loot");
// --- Lost Property Fix
sCreatedItemTag = "";
sAppID = "";
switch(roulette2()){
case 1: CreateRARInLoot(nCR, oContainer); break; // "rar" items
case 2: CreateItemInLoot(1, nCR, oContainer); break; // belts
case 3: CreateItemInLoot(2, nCR, oContainer); break; // boots
case 4: CreateItemInLoot(3, nCR, oContainer); break; // cloaks
case 5: CreateItemInLoot(4, nCR, oContainer); break; // bracers/gauntlets
case 6: CreateItemInLoot(5, nCR, oContainer); break; // rings
case 7: CreateItemInLoot(6, nCR, oContainer); break; // amulets
case 8: CreateItemInLoot(7, nCR, oContainer); break; // helmets
case 9: CreateItemInLoot(8, nCR, oContainer); break; // magic items
case 10: CreateItemInLoot(9, nCR, oContainer); break; // shields
case 11: CreateItemInLoot(10, nCR, oContainer); break; // armor
case 12: CreateItemInLoot(11, nCR, oContainer); break; // ranged weapons
case 13: CreateItemInLoot(12, nCR, oContainer); break; // weapons
}
i--;
}
break;
case 4: CreateMoneyInLoot(d10(nCR)*2, oContainer); // money & ammo
while(i>0){
CreateAmmoInLoot(nCR, oContainer);
i--;
}
break;
}
CreateMapInLoot(nCR, oContainer);
if(d2()==1) CreateScrollInLoot(nCR, oContainer);
if(d2()==1) CreateBottleInLoot(nCR, oContainer);
}
// ---------------------------------------------------------------
int roulette1(int r1)
{
//return 3; // test
if(r1!=0) return r1;
int dice = d100(1);
if(dice==5 || dice==15 || dice==25 || dice==35 || dice==45 || dice==55 ||
dice==65 || dice==75 || dice==85 || dice==95 ||
dice==6 || dice==16 || dice==26 || dice==36 || dice==46 || dice==56 ||
dice==66 || dice==76 || dice==86 || dice==96 ||
dice==7 || dice==17 || dice==27 || dice==37 || dice==47 || dice==57 ||
dice==67 || dice==77 || dice==87 || dice==97 ||
dice==8 || dice==18 || dice==28 || dice==38 || dice==48 || dice==58 ||
dice==68 || dice==78 || dice==88 || dice==98) return 3; // money & item
if(dice==13 || dice==53) return 2; // money & misc
if(dice==20 || dice==40 || dice==60 || dice==80 || dice==90 ||
dice==10 || dice==30 || dice==50 || dice==70 || dice==100) return 4; // money & ammo
return 1; // only money
}
// ---------------------------------------------------------------
int roulette2()
{
int dice = d100(1);
if(dice<=15) return 13; // weapons
if(dice<=22) return 12; // ranged weapons
if(dice<=37) return 11; // armor
if(dice<=47) return 10; // shields
if(dice<=57) return 9; // magic items
if(dice<=63) return 8; // helmets
if(dice<=69) return 7; // amulets
if(dice<=75) return 6; // rings
if(dice<=81) return 5; // bracers/gauntlets
if(dice<=87) return 4; // cloaks
if(dice<=93) return 3; // boots
if(dice<=99) return 2; // belts
return 1; // "rar" items
//return 11;
}
// ---------------------------------------------------------------
void CreateMoneyInLoot(int nAmount, object oContainer)
{
object oKiller = GetLastKiller();
object oBag = GetLocalObject(oKiller, "nMoneyBag");
int nPercent = GetLocalInt(oBag, "nPercent");
int nMoney = GetLocalInt(oBag, "nAmount");
int nPart = nAmount*nPercent/100;
SetLocalInt(oBag, "nAmount", nMoney+nPart);
SetFirstName(oBag, "Money Bag: "+IntToString(nMoney+nPart)+"gp");
SendMessageToPC(oKiller, "Money Bag: added "+IntToString(nPart)+"gp.");
CreateItemOnObject("nw_it_gold001", oContainer, nAmount-nPart);
}
// ---------------------------------------------------------------
void CreateMapInLoot(int nCR, object oContainer)
{
// --- 10% chance of drop map in loot
if(d20()!=10) return;
object oMap;
int nDice, nNumItems;
nDice = d100();
if(nDice<=10) nNumItems = 5;
else if(nDice<=30) nNumItems = 4;
else if(nDice<=60) nNumItems = 3;
else if(nDice<=100) nNumItems = 2;
if(nCR<15) return;
if(nCR<20){
// 20th lvl map
oMap = CreateItemOnObject("vr_unindmap", oContainer);
CopyObject(oMap, GetLocation(oContainer), oContainer, GetTag(oMap)+"1"+IntToString(nNumItems));
DestroyObject(oMap);
return;
}
if(nCR<25){
nDice = d2();
if(nDice==1){ // 20th lvl map
oMap = CreateItemOnObject("vr_unindmap", oContainer);
CopyObject(oMap, GetLocation(oContainer), oContainer, GetTag(oMap)+"1"+IntToString(nNumItems));
DestroyObject(oMap);
return;
}else{ // 25th lvl map
oMap = CreateItemOnObject("vr_unindmap", oContainer);
CopyObject(oMap, GetLocation(oContainer), oContainer, GetTag(oMap)+"2"+IntToString(nNumItems));
DestroyObject(oMap);
return;
}
return;
}
if(nCR<30){
nDice = d2();
if(nDice==1){ // 25th lvl map
oMap = CreateItemOnObject("vr_unindmap", oContainer);
CopyObject(oMap, GetLocation(oContainer), oContainer, GetTag(oMap)+"2"+IntToString(nNumItems));
DestroyObject(oMap);
return;
}else{ // 30th lvl map
oMap = CreateItemOnObject("vr_unindmap", oContainer);
CopyObject(oMap, GetLocation(oContainer), oContainer, GetTag(oMap)+"3"+IntToString(nNumItems));
DestroyObject(oMap);
return;
}
return;
}
if(/*nCR<35*/TRUE){
nDice = d2();
if(nDice==1){ // 30th lvl map
oMap = CreateItemOnObject("vr_unindmap", oContainer);
CopyObject(oMap, GetLocation(oContainer), oContainer, GetTag(oMap)+"3"+IntToString(nNumItems));
DestroyObject(oMap);
return;
}else{ // 35th lvl map
oMap = CreateItemOnObject("vr_unindmap", oContainer);
CopyObject(oMap, GetLocation(oContainer), oContainer, GetTag(oMap)+"4"+IntToString(nNumItems));
DestroyObject(oMap);
return;
}
return;
}
return;
}
// ---------------------------------------------------------------
void CreateBottleInLoot(int nCR, object oContainer)
{
// Simple Bottles
if(d2()==1) CreateItemOnObject("vr_potion_simple_"+IntToString(Random(12)+1), oContainer);
// Good Bottles
if(d10()<=2) CreateItemOnObject("vr_potion_good_"+IntToString(Random(5)+1), oContainer);
// Random Bottles
if(d20()==1) CreateItemOnObject("vr_potion_random_"+IntToString(Random(14)+1), oContainer);
// Cure Bottles
if(d10()<=2){
int nRandom = Random(100);
if(nCR<=5){
if(nRandom<=80) CreateItemOnObject("vr_potion_cure_l_"+IntToString(Random(4)+1), oContainer);
else CreateItemOnObject("vr_potion_cure_m_"+IntToString(Random(5)+1), oContainer);
}else if(nCR<=10){
if(nRandom<=20) CreateItemOnObject("vr_potion_cure_l_"+IntToString(Random(4)+1), oContainer);
else if(nRandom<=90) CreateItemOnObject("vr_potion_cure_m_"+IntToString(Random(5)+1), oContainer);
else CreateItemOnObject("vr_potion_cure_h_"+IntToString(Random(4)+1), oContainer);
}else if(nCR<=15){
if(nRandom<=5) CreateItemOnObject("vr_potion_cure_l_"+IntToString(Random(4)+1), oContainer);
else if(nRandom<=70) CreateItemOnObject("vr_potion_cure_m_"+IntToString(Random(5)+1), oContainer);
else if(nRandom<=98) CreateItemOnObject("vr_potion_cure_h_"+IntToString(Random(4)+1), oContainer);
else CreateItemOnObject("vr_potion_cure_r_"+IntToString(Random(4)+1), oContainer);
}else if(nCR<=20){
if(nRandom<=40) CreateItemOnObject("vr_potion_cure_m_"+IntToString(Random(5)+1), oContainer);
else if(nRandom<=95) CreateItemOnObject("vr_potion_cure_h_"+IntToString(Random(4)+1), oContainer);
else CreateItemOnObject("vr_potion_cure_r_"+IntToString(Random(4)+1), oContainer);
}else{
if(nRandom<=30) CreateItemOnObject("vr_potion_cure_m_"+IntToString(Random(5)+1), oContainer);
else if(nRandom<=90) CreateItemOnObject("vr_potion_cure_h_"+IntToString(Random(4)+1), oContainer);
else CreateItemOnObject("vr_potion_cure_r_"+IntToString(Random(4)+1), oContainer);
}
}
}
// ---------------------------------------------------------------
void CreateScrollInLoot(int nCR, object oContainer)
{
int nChance;
// lvl 0 scroll
if(nCR==1){
if(d4()==1) CreateItemOnObject("vr_scroll_lvl0_"+IntToString(Random(8)+1), oContainer);
}else if(nCR==2){
if(d10()==1) CreateItemOnObject("vr_scroll_lvl0_"+IntToString(Random(8)+1), oContainer);
}
// lvl 1 scroll
nChance = 50;
nChance = nChance - 2*(nCR-1);
if(nChance<=10) nChance = 10;
if(Random(100)<nChance) CreateItemOnObject("vr_scroll_lvl1_"+IntToString(Random(41)+1), oContainer);
// lvl 2 scroll
nChance = 45;
if(nCR<3) nChance = nChance - 10*(3-nCR);
else if(nCR>3){
nChance = nChance - 2*(nCR-3);
if(nChance<=10) nChance = 10;
}
if(Random(100)<nChance) CreateItemOnObject("vr_scroll_lvl2_"+IntToString(Random(45)+1), oContainer);
// lvl 3 scroll
nChance = 40;
if(nCR<5) nChance = nChance - 8*(5-nCR);
else if(nCR>5){
nChance = nChance - 2*(nCR-5);
if(nChance<=10) nChance = 10;
}
if(Random(100)<nChance) CreateItemOnObject("vr_scroll_lvl3_"+IntToString(Random(49)+1), oContainer);
// lvl 4 scroll
nChance = 35;
if(nCR<7) nChance = nChance - 8*(7-nCR);
else if(nCR>7){
nChance = nChance - 2*(nCR-7);
if(nChance<=8) nChance = 8;
}
if(Random(100)<nChance) CreateItemOnObject("vr_scroll_lvl4_"+IntToString(Random(34)+1), oContainer);
// lvl 5 scroll
nChance = 30;
if(nCR<9) nChance = nChance - 7*(9-nCR);
else if(nCR>9){
nChance = nChance - 2*(nCR-9);
if(nChance<=8) nChance = 8;
}
if(Random(100)<nChance) CreateItemOnObject("vr_scroll_lvl5_"+IntToString(Random(29)+1), oContainer);
// lvl 6 scroll
nChance = 25;
if(nCR<11) nChance = nChance - 7*(11-nCR);
else if(nCR>11){
nChance = nChance - 2*(nCR-11);
if(nChance<=8) nChance = 8;
}
if(Random(100)<nChance) CreateItemOnObject("vr_scroll_lvl6_"+IntToString(Random(34)+1), oContainer);
// lvl 7 scroll
nChance = 20;
if(nCR<13) nChance = nChance - 6*(13-nCR);
else if(nCR>13){
nChance = nChance - 2*(nCR-13);
if(nChance<=6) nChance = 6;
}
if(Random(100)<nChance) CreateItemOnObject("vr_scroll_lvl7_"+IntToString(Random(25)+1), oContainer);
// lvl 8 scroll
nChance = 15;
if(nCR<15) nChance = nChance - 6*(15-nCR);
else if(nCR>15){
nChance = nChance - 2*(nCR-15);
if(nChance<=6) nChance = 6;
}
if(Random(100)<nChance) CreateItemOnObject("vr_scroll_lvl8_"+IntToString(Random(21)+1), oContainer);
// lvl 9 scroll
nChance = 10;
if(nCR<17) nChance = nChance - 5*(17-nCR);
else if(nCR>17){
nChance = nChance - 2*(nCR-17);
if(nChance<=6) nChance = 4;
}
if(Random(100)<nChance) CreateItemOnObject("vr_scroll_lvl9_"+IntToString(Random(20)+1), oContainer);
}
// ---------------------------------------------------------------
void CreateMiscInLoot(int nCR, object oContainer)
{
string sResRef;
switch(Random(25)+1){
case 1: sResRef = "mis_barskin"; break;
case 2: sResRef = "mis_battletide"; break;
case 3: sResRef = "mis_strength"; break;
case 4: sResRef = "mis_clarity"; break;
case 5: sResRef = "mis_dexterity"; break;
case 6: sResRef = "mis_displacement"; break;
case 7: sResRef = "mis_charisma"; break;
case 8: sResRef = "mis_endurance"; break;
case 9: sResRef = "mis_flame"; break;
case 10: sResRef = "mis_intelligence"; break;
case 11: sResRef = "mis_ghostly"; break;
case 12: sResRef = "mis_magicwep"; break;
case 13: sResRef = "mis_invissphere"; break;
case 14: sResRef = "mis_haste"; break;
case 15: sResRef = "mis_invisibility"; break;
case 16: sResRef = "mis_keen"; break;
case 17: sResRef = "mis_magearmor"; break;
case 18: sResRef = "mis_wisdom"; break;
case 19: sResRef = "mis_prayer"; break;
case 20: sResRef = "mis_aliprotect"; break;
case 21: sResRef = "mis_elemprotect"; break;
case 22: sResRef = "mis_shield"; break;
case 23: sResRef = "mis_ss"; break;
case 24: sResRef = "mis_remblind"; break;
case 25: sResRef = "mis_entropic"; break;
}
CreateItemOnObject(sResRef, oContainer);
}
// ---------------------------------------------------------------
void CreateRARInLoot(int nCR, object oContainer)
{
CreateMiscInLoot(nCR, oContainer);
}
// ---------------------------------------------------------------
void CreateAmmoInLoot(int nCR, object oContainer)
{
string sResRef;
int nStackSize;
int nMin, nRandom;
if(nCR<5) return;
if(nCR>=20){
nMin=8;
nRandom=16;
}else{
switch(nCR){
case 5: nMin=1; nRandom=7; break;
case 6: nMin=1; nRandom=7; break;
case 7: nMin=1; nRandom=7; break;
case 8: nMin=1; nRandom=7; break;
case 9: nMin=1; nRandom=7; break;
case 10: nMin=1; nRandom=10; break;
case 11: nMin=1; nRandom=10; break;
case 12: nMin=1; nRandom=10; break;
case 13: nMin=6; nRandom=10; break;
case 14: nMin=6; nRandom=10; break;
case 15: nMin=6; nRandom=10; break;
case 16: nMin=6; nRandom=16; break;
case 17: nMin=6; nRandom=16; break;
case 18: nMin=6; nRandom=16; break;
case 19: nMin=6; nRandom=16; break;
}
}
nRandom = nMin+Random(nRandom-nMin+1);
switch(nRandom){
case 1: sResRef="am_ar_1d10acid"; nStackSize=99; break;
case 2: sResRef="am_ar_1d10cold"; nStackSize=99; break;
case 3: sResRef="am_ar_1d10fire"; nStackSize=99; break;
case 4: sResRef="am_ar_1d10elec"; nStackSize=99; break;
case 5: sResRef="am_ar_1d10sonic"; nStackSize=99; break;
case 6: sResRef="am_ar_1d10pierc"; nStackSize=66; break;
case 7: sResRef="am_ar_1d10neg"; nStackSize=66; break;
case 8: sResRef="am_ar_1d10div"; nStackSize=33; break;
case 9: sResRef="am_ar_1d10magic"; nStackSize=33; break;
case 10: sResRef="am_ar_1d10pos"; nStackSize=33; break;
case 11: sResRef="am_ar_2d10acid"; nStackSize=66; break;
case 12: sResRef="am_ar_2d10cold"; nStackSize=66; break;
case 13: sResRef="am_ar_2d10fire"; nStackSize=66; break;
case 14: sResRef="am_ar_2d10elec"; nStackSize=66; break;
case 15: sResRef="am_ar_2d10sonic"; nStackSize=66; break;
case 16: sResRef="am_ar_2d10neg"; nStackSize=33; break;
}
CreateItemOnObject(sResRef, oContainer, nStackSize);
}
// ---------------------------------------------------------------
// Creating item in loot.
// nType = 1:"belt", 2:"boots", 3:"cloak", 4:"gauntlet", 5:"ring", 6:"amulet", 7:"helmet",
// 8:"sling", 9:"dart", 10:"shuriken"
// nCR - mob's Chalendge Raiting
void CreateItemInLoot(int nType, int nCR, object oContainer)
{
object oBaseItem, oItem; // Created Item
int nAppNumber; // Appearance Number
struct stItemProperty IPParam;
int nRemainPoints = nCR;
int nTableNumber;
string sTag, sBaseItemTag;
/* "*[quantity of sections]*_
[groups_in_1st_section]:[1st_group_number]-[chance_to_be_choosed]%,
[2nd_group_number]-[chance_to_be_choosed]%,
[Nth_group_number]-[chance_to_be_choosed]%;
[groups_in_2nd_section]: ... .*/
string sGroupLine; // order of cheked group for every type of item.
switch(nType){
case 1: // BELT
sBaseItemTag = "vr_belt"+IntToString(Random(18));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_belt");
nAppNumber = Random(9)+1;
sAppID = IntToString(nAppNumber);
//oItem = CopyItemAndModify(oBaseItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppNumber);
//DestroyObject(oBaseItem);
oItem = oBaseItem;
sGroupLine = "*2*_";
/* stats resist(simp&exotic) hp */
sGroupLine += "3:0009-040%,0601-040%,0017-020%;";
/* AC save(simp&univers) skills regen */
sGroupLine += "5:0004-050%,1101-022%,1102-005%,0010-017%,0007-016%.";
break;
case 2: ; // BOOTS
sBaseItemTag = "vr_boots"+IntToString(Random(29));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_boots");
nAppNumber = (Random(4)+1)*10+Random(3)+1;
sAppID = IntToString(nAppNumber);
//oItem = CopyItemAndModify(oBaseItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppNumber);
//DestroyObject(oBaseItem);
oItem = oBaseItem;
sGroupLine = "*3*_";
/* AC stats */
sGroupLine += "2:0004-050%,0009-050%;";
/* resist(simp&exotic) skills hp */
sGroupLine += "3:0601-030%,0010-050%,0017-020%;";
//sGroupLine += "4:0601-020%,0602-010%,0005-030%,0010-040%;";
/* regen save(simp&univers) */
sGroupLine += "3:0007-050%,1101-035%,1102-015%.";
break;
case 3: // CLOAK
sBaseItemTag = "vr_cloak"+IntToString(Random(22));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_cloak");
nAppNumber = Random(14)+1;
sAppID = IntToString(nAppNumber);
//oItem = CopyItemAndModify(oBaseItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppNumber);
//DestroyObject(oBaseItem);
oItem = oBaseItem;
sGroupLine = "*3*_";
/* AC save(simp&univers) hp */
sGroupLine += "4:0004-035%,1101-025%,1102-010%,0017-030%;";
/* skills stats */
sGroupLine += "2:0010-050%,0009-050%;";
/* resist(simp&exotic) regen */
sGroupLine += "3:0601-040%,0007-030%,0016-030%.";
//sGroupLine += "4:0005-025%,0601-017%,0602-008%,0007-025%.";
break;
case 4: // GAUNTLET/BRACERS
switch(d2()){
case 1: sBaseItemTag = "vr_bracer"+IntToString(Random(11));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_bracer");
nAppNumber = Random(12)+1;
sAppID = IntToString(nAppNumber);
sGroupLine = "*3*_";
/* skills AC */
sGroupLine += "2:0010-070%,0004-030%;";
/* stats resist(simp&exotic) */
sGroupLine += "2:0009-050%,0601-050%;";
//sGroupLine += "4:0301-030%,0302-020%,0009-025%,0004-025%";
/* save(simp&univers) regen hp */
sGroupLine += "4:1101-025%,1102-015%,0007-030%,0017-030%.";
//sGroupLine += "6:1101-017%,1102-008%,0007-025%,0601-015%,0602-008%,0005-025%.";
break;
case 2: sBaseItemTag = "vr_gauntlet"+IntToString(Random(32));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_gauntlet");
nAppNumber = Random(11)+1;
sAppID = IntToString(nAppNumber);
sGroupLine = "*3*_";
/* skills attack */
sGroupLine += "3:0010-030%,0002-035%,0016-035%;";
/* damage(simp&exotic) stats AC */
sGroupLine += "3:0301-050%,0009-030%,0004-020%;";
// sGroupLine += "4:0301-030%,0302-020%,0009-025%,0004-025%";
/* save(simp&univers) regen resist(simp&exotic) */
sGroupLine += "4:1101-025%,1102-015%,0007-030%,0601-030%.";
//sGroupLine += "6:1101-017%,1102-008%,0007-025%,0601-015%,0602-008%,0005-025%.";
break;
}
//oItem = CopyItemAndModify(oBaseItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppNumber);
//DestroyObject(oBaseItem);
oItem = oBaseItem;
break;
case 5: // RING
sBaseItemTag = "vr_ring"+IntToString(Random(38));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_ring");
nAppNumber = Random(36)+1;
sAppID = IntToString(nAppNumber);
//oItem = CopyItemAndModify(oBaseItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppNumber);
//DestroyObject(oBaseItem);
oItem = oBaseItem;
sGroupLine = "*2*_";
/* save(simp&univers) AC resist(simp&exotic) */
sGroupLine += "4:1101-035%,1102-015%,0004-025%,0601-025%;";
//sGroupLine += "5:1101-035%,1102-015%,0004-025%,0601-017%,0602-008%;";
/* stats skills regen hp */
sGroupLine += "4:0009-025%,0010-030%,0007-030%,0017-015%.";
break;
case 6: // AMULET
sBaseItemTag = "vr_amulet"+IntToString(Random(26));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_amulet");
nAppNumber = Random(28)+1;
sAppID = IntToString(nAppNumber);
//oItem = CopyItemAndModify(oBaseItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppNumber);
//DestroyObject(oBaseItem);
oItem = oBaseItem;
sGroupLine = "*2*_";
/* save(simp&univers) AC resist(simp&exotic) */
sGroupLine += "4:1101-035%,1102-015%,0004-025%,0601-025%;";
//sGroupLine += "5:1101-035%,1102-015%,0004-025%,0601-017%,0602-008%;";
/* stats skills regen hp */
sGroupLine += "5:0009-020%,0010-020%,0007-020%,0016-020%,0017-020%.";
break;
case 7: // HELMET
oItem = CreateBaseHelmetModel(oContainer);
//SendMessageToPC(GetFirstPC(), "vr_helmet");
sGroupLine = "*3*_";
/* AC skills hp */
sGroupLine += "3:0004-040%,0010-040%,0017-020%;";
/* resist(simp&exotic) stats */
sGroupLine += "3:0601-040%,0009-030%,0016-030%;";
//sGroupLine += "4:0005-034%,0601-022%,0602-011%,0009-033%;";
/* save(simp&univers) regen */
sGroupLine += "3:1101-035%,1102-015%,0007-050%.";
break;
case 8: // MAGIC ITEMS // OR WEAPON
if (d3() != 3)
{
oItem = CreateBaseWeaponModel(oContainer);
//SendMessageToPC(GetFirstPC(), "vr_weapon");
sGroupLine = "*3*_";
/* enchncement */
// sGroupLine += "1:0001-100%;";
sGroupLine += "1:0002-100%;";
/* damage(simp&exotic) */
// sGroupLine += "2:0301-066%,0302-034%;";
sGroupLine += "1:0301-100%;";
/* massiv crit, vamp reg, keen */
sGroupLine += "3:0013-040%,0014-040%,0015-20%.";
break;
}
else
{
oItem = CreateBaseStaffModel(oContainer);
//SendMessageToPC(GetFirstPC(), "vr_weapon");
sGroupLine = "*3*_";
/* AC stats feats */
sGroupLine += "3:0004-025%,0009-025%,0016-050%;";
/* save(simp&universal) skills */
sGroupLine += "3:1101-035%,1102-015%,0010-050%;";
/* damage reduct regen */
sGroupLine += "2:0601-050%,0007-050%.";
break;
}
case 9: // SHIELD
switch(d3()){
case 1: sBaseItemTag = "vr_lshield"+IntToString(Random(16));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_lshield");
nAppNumber = (Random(4)+1)*10+Random(3)+1;
sAppID = IntToString(nAppNumber);
break;
case 2: sBaseItemTag = "vr_hshield"+IntToString(Random(12));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_hshield");
nAppNumber = (Random(4)+1)*10+Random(3)+1;
sAppID = IntToString(nAppNumber);
break;
case 3: sBaseItemTag = "vr_tshield"+IntToString(Random(18));
oBaseItem = CreateItemOnObject(sBaseItemTag, oContainer);
//SendMessageToPC(GetFirstPC(), "vr_tshield");
nAppNumber = (Random(4)+1)*10+Random(3)+1;
sAppID = IntToString(nAppNumber);
break;
}
//oItem = CopyItemAndModify(oBaseItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppNumber);
//DestroyObject(oBaseItem);
oItem = oBaseItem;
sGroupLine = "*2*_";
/* AC resist(simp&exotic) */
sGroupLine += "3:0004-070%,0601-020%,0017-010%;";
//sGroupLine += "3:0005-050%,0601-035%,0602-015%;";
/* save(simp&univers) stats skills */
sGroupLine += "4:1101-022%,1102-011%,0009-034%,0010-033%.";
break;
case 10: // ARMOR
oItem = CreateBaseArmorModel(oContainer);
//SendMessageToPC(GetFirstPC(), "vr_armor");
sGroupLine = "*3*_";
/* AC */
sGroupLine += "1:0004-100%;";
/* save(simp&univers) stats skills */
sGroupLine += "4:1101-022%,1102-011%,0009-034%,0010-033%;";
/* resist(simp&exotic) */
sGroupLine += "2:0601-50%,0017-050%.";
//sGroupLine += "3:0005-050%,0601-035%,0602-015%;";
break;
case 11: // RANGED WEAPONS
oItem = CreateBaseRangedWeaponModel(oContainer);
//SendMessageToPC(GetFirstPC(), "vr_weapon");
sTag = GetTag(oItem);
// if((GetBaseItemType(oItem)==BASE_ITEM_SHURIKEN)||(GetBaseItemType(oItem)==BASE_ITEM_DART)||(GetBaseItemType(oItem)==BASE_ITEM_THROWINGAXE))
if((GetBaseItemType(oItem)==BASE_ITEM_DART)||(GetBaseItemType(oItem)==BASE_ITEM_THROWINGAXE))
{
sGroupLine = "*2*_";
/* attack */
sGroupLine += "1:0002-100%;";
/* damage(simp&exotic) */
// sGroupLine += "2:0301-066%,0302-034%.";
sGroupLine += "1:0302-100%.";
} else {
sGroupLine = "*3*_";
/* attack */
sGroupLine += "1:0002-100%;";
/* mighty */
sGroupLine += "1:0012-100%;";
/* massiv crit */
sGroupLine += "1:0014-100%.";
}
break;
case 12: // WEAPONS
oItem = CreateBaseWeaponModel(oContainer);
//SendMessageToPC(GetFirstPC(), "vr_weapon");
sGroupLine = "*3*_";
/* enchncement */
// sGroupLine += "1:0001-100%;";
sGroupLine += "1:0002-100%;";
/* damage(simp&exotic) */
// sGroupLine += "2:0301-066%,0302-034%;";
sGroupLine += "1:0301-100%;";
/* massiv crit, vamp reg, keen */
sGroupLine += "3:0013-040%,0014-040%,0015-20%.";
break;
}
int nSection; // [quantity of sections]
int nGroup; // [groups_in_Nth_section]
int nTable; // [Nth_group_number]
int nPercent; // [chance_to_be_choosed]
int i = 1; // SectionCount
int j; // GroupCount
int p = 1;
int nLength = GetStringLength(sGroupLine);
int nDice;
int bSkip = FALSE;
int nPrice;
nSection = StringToInt(GetSubString(sGroupLine, 1, 1));
nLength = nLength - 4;
string sFullGroupLine = GetSubString(sGroupLine, 4, nLength);
sGroupLine = sFullGroupLine;
while((i<=nSection)&&(nRemainPoints>0)){
nGroup = StringToInt(GetSubString(sGroupLine, 0, 1));
nLength = nLength - 2;
sGroupLine = GetSubString(sGroupLine, 2, nLength);
nDice = d100();
nPercent = 0;
for(j=1; j<=nGroup; j++){
nTable = StringToInt(GetSubString(sGroupLine, 0, 4));
nPercent = nPercent + StringToInt(GetSubString(sGroupLine, 5, 3));
nLength = nLength - 10;
sGroupLine = GetSubString(sGroupLine, 10, nLength);
if((nDice<=nPercent)&&!(bSkip)){
if(i==1) {
nPrice = MyAddItemProperty(nTable, nCR, nRemainPoints, TRUE, oItem);
if(nPrice>0)
nRemainPoints = nRemainPoints - nPrice;
} else {
nPrice = MyAddItemProperty(nTable, nCR, nRemainPoints, FALSE, oItem);
if(nPrice>0)
nRemainPoints = nRemainPoints - nPrice;
}
bSkip = TRUE;
}
}
bSkip = FALSE;
i++;
if((i>nSection)&&(nRemainPoints>5)&&(p<=4)){
i=1;
sGroupLine = sFullGroupLine;
p++;
//SendMessageToPC(GetFirstPC(), GetName(oItem)+" "+IntToString(nRemainPoints));
}
}
//SendMessageToPC(GetFirstPC(), "s1="+sCreatedItemTag);
sCreatedItemTag = DecodeItemTag(sCreatedItemTag,0);
//SendMessageToPC(GetFirstPC(), "s2="+sCreatedItemTag);
switch(GetStringLength(sAppID)){
case 1: sAppID = "S000000"+sAppID; break;
case 2: sAppID = "S00000"+sAppID; break;
case 3: sAppID = "S0000"+sAppID; break;
case 4: sAppID = "S000"+sAppID; break;
case 5: sAppID = "S00"+sAppID; break;
case 6: sAppID = "S0"+sAppID; break;
case 7: sAppID = "S"+sAppID; break;
}
sCreatedItemTag += sAppID;
//SendMessageToPC(GetFirstPC(), "lootitemtag="+GetTag(oItem));
if(GetIsItemPropertyValid(GetFirstItemProperty(oItem))){
object oNewItem = CopyObject(oItem, GetLocation(oContainer), oContainer, sCreatedItemTag);
}
// --- for craft system ---
//SetItemCharges(oNewItem, 1);
//SendMessageToPC(GetFirstPC(), "name "+GetName(oNewItem));
//SendMessageToPC(GetFirstPC(), "sAppID "+sAppID);
//SendMessageToPC(GetFirstPC(), "sCreatedItemTag "+sCreatedItemTag);
//SendMessageToPC(GetFirstPC(), "TAG "+GetTag(oNewItem));
DestroyObject(oItem);
}
// ---------------------------------------------------------------
int MyAddItemProperty (int nTableNumber, int nCR, int nPoints, int bMainGroup, object oItem)
{
int e = 0;
struct stItemProperty IPParam = GetIPFromTable(nTableNumber, 0, 0, 0);
int nN = IPParam.n; // quantity of IP in group
int nSubGrp = IPParam.subgrp;
string S = IPParam.s;
int nSLength = GetStringLength(S);
int nGC = IPParam.nGC; /* Group Coefficient, f.e. for enhancement nCG=5,
+1 enhancement for every 5 points of CR*/
int nGM; /* Group Multiplier, f.e. for abilities nGM=6, because we have
6 abilities to increase*/ // NOT USED
if(bMainGroup){
// e = nCR/nGC; // find highest itemproperty fo current mob's CR
e = nPoints/nGC;
if(e>=nN) e=nN;
switch(d4()){ // choosing number of itemproperty
case 1: break;
case 2: e=e-1; break;
case 3: e=e-2; break;
case 4: e=e-3; break;
}
if(e<0) e=0;
// if((nGM>1)&(e>0)) e=nGM*(e-1)+Random(nGM)+1;
}else{
while(e<=(nSLength+1)/3){
if(nPoints<StringToInt(GetSubString(S, e*3, 2))) break;
e++;
}
if(e!=0) e = Random(e)/*+1*/;
}
if(e!=0 || (nTableNumber == 16 && bMainGroup)){
IPParam = GetIPFromTable(nTableNumber, nSubGrp, e, GetBaseItemType(oItem));
int nIPToAddType = GetItemPropertyType(IPParam.ip);
int nIPToAddSubType = GetItemPropertySubType(IPParam.ip);
int nIPType, nIPSubType;
itemproperty ip = GetFirstItemProperty(oItem);
nIPType = GetItemPropertyType(ip);
nIPSubType = GetItemPropertySubType(ip);
while(GetIsItemPropertyValid(ip)){
if(nIPToAddType==nIPType){
if(nIPToAddSubType==-1){
IPParam.price = -1;
}else{
if(nIPToAddSubType==nIPSubType){
IPParam.price = -1;
}
}
}
ip = GetNextItemProperty(oItem);
nIPType = GetItemPropertyType(ip);
nIPSubType = GetItemPropertySubType(ip);
}
if(IPParam.price>0){
sCreatedItemTag += IntToString(nTableNumber)+"_"+
IntToString(nSubGrp)+"_"+
IntToString(e)+"x";
AddItemProperty(DURATION_TYPE_PERMANENT, IPParam.ip, oItem);
}
}
return IPParam.price;
}
скрипт второй...
в НВН2 мало используется, в нвн2 же на его функциях были завязаны изменения внешнего вида шмоток...
Neverwinter Script Source
// script for "RLS" (Random Loot System)
/* Scripted by Vanes */
object CreateBaseWeaponModel(object oContainer)
{
object oItem;
object oNewItem;
int kTop, kMiddle, kBottom, kColor;
int nRandom1 = Random(15)+1;
//int nRandom2 = Random(4)+1;
int nAppID;
switch(nRandom1){ // Item Table
case 1: oItem = CreateItemOnObject("vr_grtaxe"+IntToString(Random(14)), oContainer); // Great Axe
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 2: oItem = CreateItemOnObject("vr_waraxe"+IntToString(Random(6)), oContainer); // Dwarfen Waraxe
kTop = 8; kMiddle = 6; kBottom = 6; kColor = 4; break;
case 3: oItem = CreateItemOnObject("vr_btlaxe"+IntToString(Random(11)), oContainer); // Battle Axe
kTop = 8; kMiddle = 6; kBottom = 6; kColor = 4; break;
case 4: oItem = CreateItemOnObject("vr_bastard"+IntToString(Random(12)), oContainer);// Bastard Sword
kTop = 6; kMiddle = 6; kBottom = 6; kColor = 4; break;
case 5: oItem = CreateItemOnObject("vr_lngswrd"+IntToString(Random(15)), oContainer);// Long Sword
kTop = 8; kMiddle = 8; kBottom = 8; kColor = 4; break;
case 6: oItem = CreateItemOnObject("vr_katana"+IntToString(Random(12)), oContainer); // Katana
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 7: oItem = CreateItemOnObject("vr_rapier"+IntToString(Random(12)), oContainer);// Rapier
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 8: oItem = CreateItemOnObject("vr_scimitr"+IntToString(Random(12)), oContainer);// Scimitar
kTop = 5; kMiddle = 5; kBottom = 5; kColor = 4; break;
case 9: oItem = CreateItemOnObject("vr_whammer"+IntToString(Random(8)), oContainer);// Warhammer
kTop = 6; kMiddle = 6; kBottom = 6; kColor = 4; break;
case 10: oItem = CreateItemOnObject("vr_mrnstar"+IntToString(Random(10)), oContainer);// Morningstar
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 11: oItem = CreateItemOnObject("vr_scythe"+IntToString(Random(12)), oContainer);// Scythe
kTop = 3; kMiddle = 3; kBottom = 3; kColor = 4; break;
case 12: oItem = CreateItemOnObject("vr_kama"+IntToString(Random(11)), oContainer); // Kama
kTop = 1; kMiddle = 1; kBottom = 1; kColor = 4; break;
case 13: oItem = CreateItemOnObject("vr_grtswrd"+IntToString(Random(13)), oContainer);// Greatsword
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 14: oItem = CreateItemOnObject("vr_kukri"+IntToString(Random(10)), oContainer);// Kukri
kTop = 1; kMiddle = 1; kBottom = 1; kColor = 1; break;
case 15: oItem = CreateItemOnObject("vr_falchion"+IntToString(Random(7)), oContainer);// Falchion
kTop = 1; kMiddle = 1; kBottom = 1; kColor = 1; break;
/*case 20: oItem = CreateItemOnObject("vr_spear", oContainer); // Spear
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 11: oItem = CreateItemOnObject("vr_srtswrd", oContainer);// Short Sword
kTop = 6; kMiddle = 6; kBottom = 6; kColor = 4; break;
case 12: oItem = CreateItemOnObject("vr_club", oContainer); // Club
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 14: oItem = CreateItemOnObject("vr_mace", oContainer); // Mace
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 16: oItem = CreateItemOnObject("vr_qrtstff", oContainer);// Quarterstaff
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 18: oItem = CreateItemOnObject("vr_whip", oContainer); // Whip
kTop = 1; kMiddle = 1; kBottom = 1; kColor = 1; break;
case 3: oItem = CreateItemOnObject("vr_hndaxe", oContainer); // Handaxe
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 14: oItem = CreateItemOnObject("vr_hflail", oContainer);// Heavy Flail
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 15: oItem = CreateItemOnObject("vr_lflail", oContainer);// Light Flail
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 16: oItem = CreateItemOnObject("vr_lhammer", oContainer);// Light Hammer
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 20: oItem = CreateItemOnObject("vr_dmace", oContainer); // Dire Mace
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 21: oItem = CreateItemOnObject("vr_daxe", oContainer); // Dire Axe
kTop = 3; kMiddle = 3; kBottom = 3; kColor = 4; break;
case 23: oItem = CreateItemOnObject("vr_tbswrd", oContainer);// Two-Bladed Sword
kTop = 3; kMiddle = 3; kBottom = 3; kColor = 4; break;
case 25: oItem = CreateItemOnObject("vr_kukri", oContainer); // Kukri
kTop = 1; kMiddle = 1; kBottom = 1; kColor = 4; break;
case 26: oItem = CreateItemOnObject("vr_sickle", oContainer);// Sickle
kTop = 1; kMiddle = 1; kBottom = 1; kColor = 4; break;
case 28: oItem = CreateItemOnObject("vr_halberd", oContainer);// Halberd
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
*/
}
// ----- Modify Item's Model -----
/* if(kTop!=0){ // not working with sling, dart and shuriken
// changing model type
nAppID = Random(kTop)+1;
sAppID = IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL,
ITEM_APPR_WEAPON_MODEL_TOP, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kMiddle)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL,
ITEM_APPR_WEAPON_MODEL_MIDDLE, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kBottom)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL,
ITEM_APPR_WEAPON_MODEL_BOTTOM, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
// changing color
nAppID = Random(kColor)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR,
ITEM_APPR_WEAPON_MODEL_TOP, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kColor)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR,
ITEM_APPR_WEAPON_MODEL_MIDDLE, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kColor)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR,
ITEM_APPR_WEAPON_MODEL_BOTTOM, nAppID);
DestroyObject(oItem);
sAppID = "W0" + sAppID;
}*/
return oItem; //oNewItem;
}
// ---------------------------------------------------------------
object CreateBaseHelmetModel(object oContainer)
{
object oItem, oNewItem;
int nHelmType = Random (32) + 1;
if(nHelmType<10) sAppID = "H00"+IntToString(nHelmType);
else sAppID = "H0"+IntToString(nHelmType);
int nHelmColor1 = Random (63);
int nHelmColor2 = nHelmColor1;//Random (63);
int nHelmColor3 = nHelmColor1;//Random (63);
if(nHelmColor1<10) sAppID += "000"+IntToString(nHelmColor1);
else sAppID += "00"+IntToString(nHelmColor1);
oItem = CreateItemOnObject("vr_helmet"+IntToString(Random(47)), oContainer);
/*oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_MODEL, 0, nHelmType);
DestroyObject (oItem);
oItem = oNewItem;
oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL1, nHelmColor1);
DestroyObject (oItem);
oItem = oNewItem;
oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL2, nHelmColor2);
DestroyObject (oItem);
oItem = oNewItem;
oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH2, nHelmColor3);
DestroyObject (oItem);*/
return oItem; //oNewItem;
}
// ---------------------------------------------------------------
object CreateBaseArmorModel(object oContainer)
{
object oItem, oNewItem;
int nAppID;
int nRandom1 = Random(11)+1;
//int nRandom2 = Random(5)+1;
switch(nRandom1){
case 1: oItem = CreateItemOnObject("vr_0armor"+IntToString(Random(15)), oContainer); break;
case 2: oItem = CreateItemOnObject("vr_0armor"+IntToString(Random(15)), oContainer); break;
case 3: oItem = CreateItemOnObject("vr_0armor"+IntToString(Random(15)), oContainer); break;
case 4: oItem = CreateItemOnObject("vr_1armor"+IntToString(Random(12)), oContainer); break;
case 5: oItem = CreateItemOnObject("vr_2armor"+IntToString(Random(16)), oContainer); break;
case 6: oItem = CreateItemOnObject("vr_3armor"+IntToString(Random(11)), oContainer); break;
case 7: oItem = CreateItemOnObject("vr_4armor"+IntToString(Random(11)), oContainer); break;
case 8: oItem = CreateItemOnObject("vr_5armor"+IntToString(Random(8)), oContainer); break;
case 9: oItem = CreateItemOnObject("vr_6armor"+IntToString(Random(6)), oContainer); break;
case 10: oItem = CreateItemOnObject("vr_7armor"+IntToString(Random(6)), oContainer); break;
case 11: oItem = CreateItemOnObject("vr_8armor"+IntToString(Random(6)), oContainer); break;
}
/*
nAppID = Random(63)+1;
if(nAppID<10) sAppID = "0";
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL1, nAppID);
DestroyObject (oItem);
oItem = oNewItem;
oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL2, nAppID);
DestroyObject (oItem);
oItem = oNewItem;
nAppID = Random(63)+1;
if(nAppID<10) sAppID += "0";
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH1, nAppID);
DestroyObject (oItem);
oItem = oNewItem;
oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH1, nAppID);
DestroyObject (oItem);
oItem = oNewItem;
nAppID = Random(63)+1;
if(nAppID<10) sAppID += "0";
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER1, nAppID);
DestroyObject (oItem);
oItem = oNewItem;
oNewItem = CopyItemAndModify (oItem, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER2, nAppID);
DestroyObject (oItem);
sAppID = "A0"+sAppID;*/
return oItem;//oNewItem;
}
object CreateBaseRangedWeaponModel(object oContainer)
{
object oItem;
object oNewItem;
int kTop, kMiddle, kBottom, kColor;
int nRandom = Random(3)+1;
int nAppID;
switch(nRandom){ // Item Table
case 1: oItem = CreateItemOnObject("vr_lngbow"+IntToString(Random(13)), oContainer); // Longbow
kTop = 8; kMiddle = 8; kBottom = 8; kColor = 4; break;
case 2: oItem = CreateItemOnObject("vr_srtbow"+IntToString(Random(11)), oContainer);// Shortbow
kTop = 6; kMiddle = 6; kBottom = 6; kColor = 4; break;
case 3: oItem = CreateItemOnObject("vr_lngbow"+IntToString(Random(13)), oContainer); // Longbow
kTop = 8; kMiddle = 8; kBottom = 8; kColor = 4; break;
/*
case 1: oItem = CreateItemOnObject("vr_hcrsbow", oContainer);// Heavy Crossbow
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 5: oItem = CreateItemOnObject("vr_dart", oContainer, 50); // Dart
kTop = 0; kMiddle = 0; kBottom = 0; kColor = 4; break;
case 4: oItem = CreateItemOnObject("vr_thraxe", oContainer, 50);// Throwing Axe
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 5: oItem = CreateItemOnObject("vr_lcrsbow", oContainer);// Light Crossbow
kTop = 4; kMiddle = 4; kBottom = 4; kColor = 4; break;
case 6: oItem = CreateItemOnObject("vr_sling", oContainer); // Sling
kTop = 0; kMiddle = 0; kBottom = 0; kColor = 4; break;
case 7: oItem = CreateItemOnObject("vr_dart", oContainer, 50); // Dart
kTop = 0; kMiddle = 0; kBottom = 0; kColor = 4; break;
case 8: oItem = CreateItemOnObject("vr_shrken", oContainer, 50);//Shuriken
kTop = 0; kMiddle = 0; kBottom = 0; kColor = 4; break;*/
}
// ----- Modify Item's with Simple Model (sling, dart, suriken) -----
/*if(nRandom==5){ // sling
nAppID = (Random(4)+1)*10+Random(4)+1;
sAppID = IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppID);
DestroyObject(oItem);
return oNewItem;
}
if(nRandom==6){ // dart
nAppID = (Random(4)+1)*10+Random(3)+1;
sAppID = IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppID);
DestroyObject(oItem);
return oNewItem;
}
if(nRandom==7){ // shuriken
nAppID = (Random(4)+1)*10+Random(3)+1;
sAppID = IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nAppID);
DestroyObject(oItem);
return oNewItem;
}*/
// ----- Modify Item's Model -----
/* if(kTop!=0){ // not working with sling, dart and shuriken
// changing model type
nAppID = Random(kTop)+1;
sAppID = IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL,
ITEM_APPR_WEAPON_MODEL_TOP, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kMiddle)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL,
ITEM_APPR_WEAPON_MODEL_MIDDLE, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kBottom)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL,
ITEM_APPR_WEAPON_MODEL_BOTTOM, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
// changing color
nAppID = Random(kColor)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR,
ITEM_APPR_WEAPON_MODEL_TOP, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kColor)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR,
ITEM_APPR_WEAPON_MODEL_MIDDLE, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kColor)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR,
ITEM_APPR_WEAPON_MODEL_BOTTOM, nAppID);
DestroyObject(oItem);
sAppID = "W0" + sAppID;
}
else
{
sAppID = "W0000000";
}*/
return oItem;//oNewItem;
}
object CreateBaseStaffModel(object oContainer)
{
object oItem = CreateItemOnObject("vr_staff", oContainer);;
object oNewItem;
int kTop = 6, kMiddle = 6, kBottom = 6, kColor = 6;
int nAppID;
// ----- Modify Item's Model -----
nAppID = Random(kTop)+1;
sAppID = IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL,
ITEM_APPR_WEAPON_MODEL_TOP, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kMiddle)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL,
ITEM_APPR_WEAPON_MODEL_MIDDLE, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kBottom)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL,
ITEM_APPR_WEAPON_MODEL_BOTTOM, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
// changing color
nAppID = Random(kColor)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR,
ITEM_APPR_WEAPON_MODEL_TOP, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kColor)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR,
ITEM_APPR_WEAPON_MODEL_MIDDLE, nAppID);
DestroyObject(oItem);
oItem = oNewItem;
nAppID = Random(kColor)+1;
sAppID += IntToString(nAppID);
oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR,
ITEM_APPR_WEAPON_MODEL_BOTTOM, nAppID);
DestroyObject(oItem);
sAppID = "W0" + sAppID;
return oNewItem;
}
третий скрипт - таблица св-в, которые могут быть добавлены на шмотки...
Neverwinter Script Source
// script for "RLS" (Random Loot System)
/* Scripted by Vanes */
// Return Item Property and its price.
struct stItemProperty GetIPFromTable (int nGroupNumber, int nSubGrp, int nIPNumber, int nBaseItemType)
{
int nRandomInGroup;
struct stItemProperty IPParam;
int n;
itemproperty ip;
int nPrice;
string s;
int nGC; /* Group Coefficient, f.e. for enhancement nCG=5,
+1 enhancement for every 5 points of CR*/
int nGM; /* Group Multiplier, f.e. for abilities nGM=6, because we have
6 abilities to increase*/ //NOT USED
switch(nGroupNumber){
/*
case 1: // ----- ENHANCEMENT BONUS TABLE -----
n = 7; // don't forget to change this variable, then adding new IP in table
s = "05_10_15_20_25_30_35"; //how much IP costs
nGC = 5; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp = 0;
switch(nIPNumber){
case 1: ip=ItemPropertyEnhancementBonus(1); nPrice=3; break;
case 2: ip=ItemPropertyEnhancementBonus(2); nPrice=4; break;
case 3: ip=ItemPropertyEnhancementBonus(3); nPrice=5; break;
case 4: ip=ItemPropertyEnhancementBonus(4); nPrice=6; break;
case 5: ip=ItemPropertyEnhancementBonus(5); nPrice=7; break;
case 6: ip=ItemPropertyEnhancementBonus(6); nPrice=8; break;
case 7: ip=ItemPropertyEnhancementBonus(7); nPrice=9; break;
}
break;
*/
case 2: // ----- ATTACK BONUS TABLE
n = 7; // don't forget to change this variable, then adding new IP in table
s = "03_06_09_12_15_18_21"; //how much IP costs
nGC = 5; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp = 0;
switch(nIPNumber){
case 1: ip=ItemPropertyAttackBonus(1); nPrice=3; break;
case 2: ip=ItemPropertyAttackBonus(2); nPrice=6; break;
case 3: ip=ItemPropertyAttackBonus(3); nPrice=9; break;
case 4: ip=ItemPropertyAttackBonus(4); nPrice=12; break;
case 5: ip=ItemPropertyAttackBonus(5); nPrice=15; break;
case 6: ip=ItemPropertyAttackBonus(6); nPrice=18; break;
case 7: ip=ItemPropertyAttackBonus(7); nPrice=21; break;
}
break;
case 301: // ----- DAMAGE BONUS TABLE (SIMPLE)----- CANN'T BE USED AS MAIN GROUP
n = 7; // don't forget to change this variable, then adding new IP in table
// s = "02_03_04_05_06_07"; //how much IP costs
s = "01_02_03_04_05_06_07"; //how much IP costs
nGC = 1; // Group Coefficient
nGM = 1; // Group Multiplier
if(nSubGrp==0) nSubGrp=Random(5)+1;
switch(nSubGrp){
case 1: nRandomInGroup = IP_CONST_DAMAGETYPE_ACID; break;
case 2: nRandomInGroup = IP_CONST_DAMAGETYPE_COLD; break;
case 3: nRandomInGroup = IP_CONST_DAMAGETYPE_ELECTRICAL; break;
case 4: nRandomInGroup = IP_CONST_DAMAGETYPE_FIRE; break;
case 5: nRandomInGroup = IP_CONST_DAMAGETYPE_SONIC; break;
/*
case 6:
{
int nDT = StringToInt(Get2DAString("baseitems", "WeaponType", nBaseItemType));
nRandomInGroup = IP_CONST_DAMAGETYPE_SLASHING;
if (nDT == 1) nRandomInGroup = IP_CONST_DAMAGETYPE_PIERCING;
if (nDT == 2) nRandomInGroup = IP_CONST_DAMAGETYPE_BLUDGEONING;
break;
}
case 6: nRandomInGroup = IP_CONST_DAMAGETYPE_BLUDGEONING; break;
case 7: nRandomInGroup = IP_CONST_DAMAGETYPE_PIERCING; break;
case 8: nRandomInGroup = IP_CONST_DAMAGETYPE_SLASHING; break;
*/
}
switch(nIPNumber){
case 1: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_2);
nPrice=1; break;
case 2: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_1d4);
nPrice=2; break;
case 3: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_1d6);
nPrice=3; break;
case 4: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_1d8);
nPrice=4; break;
case 5: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_5);
nPrice=5; break;
case 6: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_1d10);
nPrice=6; break;
case 7: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_7);
nPrice=7; break;
}
break;
case 302: // ----- DAMAGE BONUS TABLE (EXOTIC)----- CANN'T BE USED AS MAIN GROUP
n = 6; // don't forget to change this variable, then adding new IP in table
s = "03_04_05_06_07_08"; //how much IP costs
nGC = 1; // Group Coefficient
nGM = 1; // Group Multiplier
if(nSubGrp==0) nSubGrp=d4();
switch(nSubGrp){
case 1: nRandomInGroup = IP_CONST_DAMAGETYPE_DIVINE; break;
case 2: nRandomInGroup = IP_CONST_DAMAGETYPE_POSITIVE; break;
case 3: nRandomInGroup = IP_CONST_DAMAGETYPE_NEGATIVE; break;
case 4: nRandomInGroup = IP_CONST_DAMAGETYPE_MAGICAL; break;
}
switch(nIPNumber){
case 1: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_2);
nPrice=3; break;
case 2: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_1d4);
nPrice=4; break;
case 3: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_1d6);
nPrice=5; break;
case 4: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_1d8);
nPrice=6; break;
case 5: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_5);
nPrice=7; break;
case 6: ip=ItemPropertyDamageBonus(nRandomInGroup,IP_CONST_DAMAGEBONUS_1d10);
nPrice=8; break;
}
break;
case 4: // ----- AC BONUS TABLE -----
n = 6; // don't forget to change this variable, then adding new IP in table
s = "03_06_09_12_15_18"; //how much IP costs
nGC = 3; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp=0;
switch(nIPNumber){
case 1: ip=ItemPropertyACBonus(1); nPrice=3; break;
case 2: ip=ItemPropertyACBonus(2); nPrice=6; break;
case 3: ip=ItemPropertyACBonus(3); nPrice=9; break;
case 4: ip=ItemPropertyACBonus(4); nPrice=12; break;
case 5: ip=ItemPropertyACBonus(5); nPrice=15; break;
case 6: ip=ItemPropertyACBonus(6); nPrice=18; break;
//case 7: ip=ItemPropertyACBonus(7); nPrice=35; break;
}
break;
/*
case 5: // ----- DAMAGE REDUCTION TABLE ----- CANN'T BE USED AS MAIN GROUP
n = 7; // don't forget to change this variable, then adding new IP in table
s = "03_06_09_12_15_18_21"; //how much IP costs
nGC = 1; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp=0;
switch(nIPNumber){
case 1: nRandomInGroup = IP_CONST_DAMAGEREDUCTION_1; nPrice=3; break;
case 2: nRandomInGroup = IP_CONST_DAMAGEREDUCTION_2; nPrice=6; break;
case 3: nRandomInGroup = IP_CONST_DAMAGEREDUCTION_3; nPrice=9; break;
case 4: nRandomInGroup = IP_CONST_DAMAGEREDUCTION_4; nPrice=12; break;
case 5: nRandomInGroup = IP_CONST_DAMAGEREDUCTION_5; nPrice=15; break;
case 6: nRandomInGroup = IP_CONST_DAMAGEREDUCTION_6; nPrice=18; break;
case 7: nRandomInGroup = IP_CONST_DAMAGEREDUCTION_7; nPrice=21; break;
}
ip = ItemPropertyDamageReduction(nRandomInGroup, IP_CONST_DAMAGESOAK_5_HP);
break;
*/
case 601: // ----- DAMAGE RESIST TABLE (SIMPLE)----- CANN'T BE USED AS MAIN GROUP
n = 5; // don't forget to change this variable, then adding new IP in table
s = "03_06_09_12_15"; //how much IP costs
nGC = 3; // Group Coefficient
nGM = 1; // Group Multiplier
if(nSubGrp==0) nSubGrp=Random(5)+1;
switch(nSubGrp){
case 1: nRandomInGroup = IP_CONST_DAMAGETYPE_ACID; break;
case 2: nRandomInGroup = IP_CONST_DAMAGETYPE_COLD; break;
case 3: nRandomInGroup = IP_CONST_DAMAGETYPE_ELECTRICAL; break;
case 4: nRandomInGroup = IP_CONST_DAMAGETYPE_FIRE; break;
case 5: nRandomInGroup = IP_CONST_DAMAGETYPE_SONIC; break;
///case 6: nRandomInGroup = IP_CONST_DAMAGETYPE_BLUDGEONING; break;
///case 7: nRandomInGroup = IP_CONST_DAMAGETYPE_PIERCING; break;
///case 8: nRandomInGroup = IP_CONST_DAMAGETYPE_SLASHING; break;
}
switch(nIPNumber){
case 1: ip=ItemPropertyDamageResistance(nRandomInGroup,IP_CONST_DAMAGERESIST_5);
nPrice = 3; break;
case 2: ip=ItemPropertyDamageResistance(nRandomInGroup,IP_CONST_DAMAGERESIST_10);
nPrice = 6; break;
case 3: ip=ItemPropertyDamageResistance(nRandomInGroup,IP_CONST_DAMAGERESIST_15);
nPrice = 9; break;
case 4: ip=ItemPropertyDamageResistance(nRandomInGroup,IP_CONST_DAMAGERESIST_20);
nPrice = 12; break;
case 5: ip=ItemPropertyDamageResistance(nRandomInGroup,IP_CONST_DAMAGERESIST_25);
nPrice = 15; break;
}
break;
/*
case 602: // ----- DAMAGE RESIST TABLE (EXOTIC)----- CANN'T BE USED AS MAIN GROUP
n = 1; // don't forget to change this variable, then adding new IP in table
s = "08"; //how much IP costs
nGC = 1; // Group Coefficient
nGM = 1; // Group Multiplier
if(nSubGrp==0) nSubGrp=d4();
switch(nSubGrp){
case 1: nRandomInGroup = IP_CONST_DAMAGETYPE_DIVINE; break;
case 2: nRandomInGroup = IP_CONST_DAMAGETYPE_POSITIVE; break;
case 3: nRandomInGroup = IP_CONST_DAMAGETYPE_NEGATIVE; break;
case 4: nRandomInGroup = IP_CONST_DAMAGETYPE_MAGICAL; break;
}
nIPNumber = 1;
ip=ItemPropertyDamageResistance(nRandomInGroup,IP_CONST_DAMAGERESIST_5);
nPrice = 8;
break;
*/
case 7: // ----- REGENERATION TABLE ----- CANN'T BE USED AS MAIN GROUP
n = 5; // don't forget to change this variable, then adding new IP in table
s = "04_08_12_16_20"; //how much IP costs
nGC = 4; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp=0;
switch(nIPNumber){
case 1: ip=ItemPropertyRegeneration(1); nPrice=4; break;
case 2: ip=ItemPropertyRegeneration(2); nPrice=8; break;
case 3: ip=ItemPropertyRegeneration(3); nPrice=12; break;
case 4: ip=ItemPropertyRegeneration(4); nPrice=16; break;
case 5: ip=ItemPropertyRegeneration(5); nPrice=20; break;
}
break;
case 8: // ----- WEIGHT REDUCTION TABLE ----- CANN'T BE USED AS MAIN GROUP
n = 4; // don't forget to change this variable, then adding new IP in table
s = "02_04_06_08"; //how much IP costs
nGC = 2; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp=0;
switch(nIPNumber){
case 1: nRandomInGroup = IP_CONST_REDUCEDWEIGHT_20_PERCENT; nPrice=2; break;
case 2: nRandomInGroup = IP_CONST_REDUCEDWEIGHT_40_PERCENT; nPrice=4; break;
case 3: nRandomInGroup = IP_CONST_REDUCEDWEIGHT_60_PERCENT; nPrice=6; break;
case 4: nRandomInGroup = IP_CONST_REDUCEDWEIGHT_80_PERCENT; nPrice=8; break;
}
ip = ItemPropertyWeightReduction(nRandomInGroup);
break;
case 9: // ----- ABILITY BONUS TABLE -----
n = 6; // don't forget to change this variable, then adding new IP in table
s = "02_04_06_08_10_12"; //how much IP costs
nGC = 2; // Group Coefficient
nGM = 1; // Group Multiplier
if(nSubGrp==0) nSubGrp=d6();
switch(nSubGrp){
case 1: nRandomInGroup = IP_CONST_ABILITY_CHA; break;
case 2: nRandomInGroup = IP_CONST_ABILITY_CON; break;
case 3: nRandomInGroup = IP_CONST_ABILITY_DEX; break;
case 4: nRandomInGroup = IP_CONST_ABILITY_INT; break;
case 5: nRandomInGroup = IP_CONST_ABILITY_STR; break;
case 6: nRandomInGroup = IP_CONST_ABILITY_WIS; break;
}
switch(nIPNumber){
case 1: ip=ItemPropertyAbilityBonus(nRandomInGroup, 1); nPrice=2; break;
case 2: ip=ItemPropertyAbilityBonus(nRandomInGroup, 2); nPrice=4; break;
case 3: ip=ItemPropertyAbilityBonus(nRandomInGroup, 3); nPrice=6; break;
case 4: ip=ItemPropertyAbilityBonus(nRandomInGroup, 4); nPrice=8; break;
case 5: ip=ItemPropertyAbilityBonus(nRandomInGroup, 5); nPrice=10; break;
case 6: ip=ItemPropertyAbilityBonus(nRandomInGroup, 6); nPrice=12; break;
}
break;
case 10: // ----- SKILL BONUS TABLE (SIMPLE)----- CANN'T BE USED AS MAIN GROUP
n = 3; // don't forget to change this variable, then adding new IP in table
s = "02_04_06"; //how much IP costs
nGC = 2; // Group Coefficient
nGM = 1; // Group Multiplier
if(nSubGrp==0) nSubGrp=Random(10)+1;
switch(nSubGrp){
case 1: nRandomInGroup = SKILL_HIDE; break;
case 2: nRandomInGroup = SKILL_MOVE_SILENTLY; break;
case 3: nRandomInGroup = SKILL_SPOT; break;
case 4: nRandomInGroup = SKILL_LISTEN; break;
//case 5: nRandomInGroup = SKILL_DISCIPLINE; break;
case 5: nRandomInGroup = SKILL_PARRY; break;
case 6: nRandomInGroup = SKILL_CONCENTRATION; break;
case 7: nRandomInGroup = SKILL_HEAL; break;
case 8: nRandomInGroup = SKILL_TUMBLE; break;
case 9: nRandomInGroup = SKILL_SPELLCRAFT; break;
case 10: nRandomInGroup = SKILL_TAUNT; break;
}
switch(nIPNumber){
case 1: ip=ItemPropertySkillBonus(nRandomInGroup, 4); nPrice=2; break;
case 2: ip=ItemPropertySkillBonus(nRandomInGroup, 8); nPrice=4; break;
case 3: ip=ItemPropertySkillBonus(nRandomInGroup, 12); nPrice=6; break;
}
break;
case 1101: // ----- SAVING THROW TABLE (SIMPLE)-----
n = 5; // don't forget to change this variable, then adding new IP in table
s = "02_04_06_08_10"; //how much IP costs
nGC = 2; // Group Coefficient
nGM = 1; // Group Multiplier
if(nSubGrp==0) nSubGrp=d3();
switch(nSubGrp){
case 1: nRandomInGroup = IP_CONST_SAVEBASETYPE_FORTITUDE; break;
case 2: nRandomInGroup = IP_CONST_SAVEBASETYPE_REFLEX; break;
case 3: nRandomInGroup = IP_CONST_SAVEBASETYPE_WILL; break;
}
switch(nIPNumber){
case 1: ip=ItemPropertyBonusSavingThrow(nRandomInGroup, 1); nPrice=2; break;
case 2: ip=ItemPropertyBonusSavingThrow(nRandomInGroup, 2); nPrice=4; break;
case 3: ip=ItemPropertyBonusSavingThrow(nRandomInGroup, 3); nPrice=6; break;
case 4: ip=ItemPropertyBonusSavingThrow(nRandomInGroup, 4); nPrice=8; break;
case 5: ip=ItemPropertyBonusSavingThrow(nRandomInGroup, 5); nPrice=10; break;
}
break;
case 1102: // ----- SAVING THROW TABLE (UNIVERSAL)-----
n = 3; // don't forget to change this variable, then adding new IP in table
s = "02_07_12"; //how much IP costs
nGC = 5; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp = 0;
nRandomInGroup = IP_CONST_SAVEVS_UNIVERSAL;
switch(nIPNumber){
case 1: ip=ItemPropertyBonusSavingThrowVsX(nRandomInGroup, 1); nPrice=2; break;
case 2: ip=ItemPropertyBonusSavingThrowVsX(nRandomInGroup, 2); nPrice=7; break;
case 3: ip=ItemPropertyBonusSavingThrowVsX(nRandomInGroup, 3); nPrice=12; break;
//case 4: ip=ItemPropertyBonusSavingThrowVsX(nRandomInGroup, 4); nPrice=20; break;
//case 5: ip=ItemPropertyBonusSavingThrowVsX(nRandomInGroup, 5); nPrice=25; break;
}
break;
case 12: // ----- MIGHTY -----
n = 5; // don't forget to change this variable, then adding new IP in table
s = "01_02_03_04_05"; //how much IP costs
nGC = 1; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp = 0;
switch(nIPNumber){
case 1: ip=ItemPropertyMaxRangeStrengthMod(1); nPrice=1; break;
case 2: ip=ItemPropertyMaxRangeStrengthMod(2); nPrice=2; break;
case 3: ip=ItemPropertyMaxRangeStrengthMod(3); nPrice=3; break;
case 4: ip=ItemPropertyMaxRangeStrengthMod(4); nPrice=4; break;
case 5: ip=ItemPropertyMaxRangeStrengthMod(5); nPrice=5; break;
}
break;
case 13: // ----- VAMPIRIC REGENERATION -----
n = 5; // don't forget to change this variable, then adding new IP in table
s = "01_02_03_04_05"; //how much IP costs
nGC = 1; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp = 0;
switch(nIPNumber){
case 1: ip=ItemPropertyVampiricRegeneration(1); nPrice=1; break;
case 2: ip=ItemPropertyVampiricRegeneration(2); nPrice=2; break;
case 3: ip=ItemPropertyVampiricRegeneration(3); nPrice=3; break;
case 4: ip=ItemPropertyVampiricRegeneration(4); nPrice=4; break;
case 5: ip=ItemPropertyVampiricRegeneration(5); nPrice=5; break;
}
break;
case 14: // ----- MASSIV CRITICAL -----
n = 5; // don't forget to change this variable, then adding new IP in table
s = "01_02_03_04_05"; //how much IP costs
nGC = 1; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp = 0;
switch(nIPNumber){
case 1: ip=ItemPropertyMassiveCritical(IP_CONST_DAMAGEBONUS_2); nPrice=1; break;
case 2: ip=ItemPropertyMassiveCritical(IP_CONST_DAMAGEBONUS_4); nPrice=2; break;
case 3: ip=ItemPropertyMassiveCritical(IP_CONST_DAMAGEBONUS_6); nPrice=3; break;
case 4: ip=ItemPropertyMassiveCritical(IP_CONST_DAMAGEBONUS_8); nPrice=4; break;
case 5: ip=ItemPropertyMassiveCritical(IP_CONST_DAMAGEBONUS_10); nPrice=5; break;
}
break;
case 15: // ----- KEEN -----
n = 1; // don't forget to change this variable, then adding new IP in table
s = "05"; //how much IP costs
nGC = 10; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp = 0;
switch(nIPNumber){
case 1: ip=ItemPropertyKeen(); nPrice=5; break;
}
break;
case 16: // ----- BONUS FEAT: SPELL FOCUS -----
n = 1; // don't forget to change this variable, then adding new IP in table
s = "05"; //how much IP costs
nGC = 5; // Group Coefficient
nGM = 1; // Group Multiplier
if(nSubGrp==0) nSubGrp = Random(7)+1;
switch(nSubGrp){
case 1: ip=ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLFOCUSABJ); nPrice=5; break;
case 2: ip=ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLFOCUSCON); nPrice=5; break;
case 3: ip=ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLFOCUSDIV); nPrice=5; break;
case 4: ip=ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLFOCUSENC); nPrice=5; break;
case 5: ip=ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLFOCUSEVO); nPrice=5; break;
case 6: ip=ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLFOCUSILL); nPrice=5; break;
case 7: ip=ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLFOCUSNEC); nPrice=5; break;
//case 8: ip=ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLFOCUSNEC); nPrice=15; break;
}
break;
case 17: // ----- BONUS HITPOINTS -----
n = 5; // don't forget to change this variable, then adding new IP in table
s = "02_04_06_8_10"; //how much IP costs
nGC = 2; // Group Coefficient
nGM = 1; // Group Multiplier
nSubGrp = 0;
switch(nIPNumber){
case 1: ip=ItemPropertyBonusHitpoints(4); nPrice=2; break;
case 2: ip=ItemPropertyBonusHitpoints(8); nPrice=4; break;
case 3: ip=ItemPropertyBonusHitpoints(12); nPrice=6; break;
case 4: ip=ItemPropertyBonusHitpoints(16); nPrice=8; break;
case 5: ip=ItemPropertyBonusHitpoints(20); nPrice=10; break;
}
break;
}
IPParam.n = n;
IPParam.ip = ip;
IPParam.subgrp = nSubGrp;
IPParam.price = nPrice;
IPParam.s = s;
IPParam.nGC = nGC;
return IPParam;
}
понятно что в стандартных банках вещей шмотки созданные RLS сохраняться не будут...
для того, чтобы они сохранялись, нужно в БД банка добавить еще одно поле - список св-в на шмотке (обычно это локальная переменная на шмотке, хотя в нвн1 я для пущей надежности все хранил в теге итема)...
+ ко всему в скрипте переноса вещей из БД в ящик игрока нужно использовать функцию:
Neverwinter Script Source
#include "vns_loot_iptable"
#include "nwnx_sql"
object UpdateItemFromRLS(object oItem, string sBankItemStats)
{
string sIPList = sBankItemStats;
string sIP;
int nPos, nSubPos, n1, n2, n3;
struct stItemProperty IPParam;
int nLength = GetStringLength(sBankItemStats);
int nDebugI = 0;
while(nLength!=0 && nDebugI<=10){
nPos = FindSubString(sIPList, "x");
if(nPos!=-1){ // adding IP
//SendMessageToPC(oPC, "add ip...");
sIP = GetSubString(sIPList, 0, nPos+1);
nSubPos = FindSubString(sIP, "_");
n1 = StringToInt(GetSubString(sIP, 0, nSubPos+1));
sIP = GetStringRight(sIP, GetStringLength(sIP) - (nSubPos+1));
nSubPos = FindSubString(sIP, "_");
n2 = StringToInt(GetSubString(sIP, 0, nSubPos+1));
sIP = GetStringRight(sIP, GetStringLength(sIP) - (nSubPos+1));
n3 = StringToInt(GetSubString(sIP, 0, GetStringLength(sIP)-1));
IPParam = GetIPFromTable(n1, n2, n3, GetBaseItemType(oItem));
AddItemProperty(DURATION_TYPE_PERMANENT, IPParam.ip, oItem);
nLength = GetStringLength(sIPList) - (nPos+1);
sIPList = GetStringRight(sIPList, nLength);
}else{
nLength = 0;
nDebugI = 11;
}
nDebugI++;
}
return oItem;
}