1. Autor: Renewal
2. Link do oryginalnego tematu:
3. Opis: Loot System(drop rate) sprawny w 100%
4. Kod:
W luascript.h pod:
[CPP]~LuaScript();[/CPP]
wklej:
[CPP]int DROP_RATE;[/CPP]
W luascript.cpp pod tym:
[CPP]NO_VOC_SPEED = atof(getGlobalStringField("speed", 1, "2.0").c_str());[/CPP]
Z powodu, ?e nie ka?dy ma zainstalowany taki fast attack nie znajdzie tego fragmentu:
[CPP]MANA_MUL[VOCATION_KNIGHT] = atoi(getGlobalStringField("manamul", VOCATION_KNIGHT+1, "1").c_str());
#endif //YUR_MULTIPLIERS[/CPP]
i wklei pod tym to ni?ej.
wklej:
[CPP]DROP_RATE = getGlobalNumber("droprate",1);[/CPP]
W monsters.cpp podmie? to:
[CPP]Item* tmpItem = NULL;
if(Item::items[lootBlock.id].stackable == true){
unsigned long randvalue = Monster::getRandom();
unsigned long n = 1;
if(randvalue < lootBlock.chance1){
if(randvalue < lootBlock.chancemax){
n = lootBlock.countmax;
}
else{
//if chancemax < randvalue < chance1
n = (unsigned char)(randvalue % lootBlock.countmax + 1);
}
tmpItem = Item::CreateItem(lootBlock.id, (unsigned short)n);
}
}
else{
if(Monster::getRandom() < lootBlock.chance1){
tmpItem = Item::CreateItem(lootBlock.id);
}
}
return tmpItem;[/CPP]
na to:
[CPP]Item* tmpItem = NULL;
if(Item::items[lootBlock.id].stackable == true){
unsigned long randvalue = Monster::getRandom();
unsigned long n = 1;
if(randvalue < (lootBlock.chance1 * g_config.DROP_RATE)){
if(randvalue < lootBlock.chancemax * g_config.DROP_RATE){
n = lootBlock.countmax;
}
else{
//if chancemax < randvalue < chance1
n = (unsigned char)(randvalue % lootBlock.countmax + 1);
}
tmpItem = Item::CreateItem(lootBlock.id, (unsigned short)n);
}
}
else{
if(Monster::getRandom() < lootBlock.chance1 * g_config.DROP_RATE){
tmpItem = Item::CreateItem(lootBlock.id);
}
}
return tmpItem;[/CPP]
Teraz w config.lua doda? ta linijk?:
[LUA]droprate = 1[/LUA]
Kod testowany na silniku: YurOTS_094f
2. Link do oryginalnego tematu:
3. Opis: Loot System(drop rate) sprawny w 100%
4. Kod:
W luascript.h pod:
[CPP]~LuaScript();[/CPP]
wklej:
[CPP]int DROP_RATE;[/CPP]
W luascript.cpp pod tym:
[CPP]NO_VOC_SPEED = atof(getGlobalStringField("speed", 1, "2.0").c_str());[/CPP]
Z powodu, ?e nie ka?dy ma zainstalowany taki fast attack nie znajdzie tego fragmentu:
Wi?c niech poszuka tego:[CPP]NO_VOC_SPEED = atof(getGlobalStringField("speed", 1, "2.0").c_str()); [/CPP]
[CPP]MANA_MUL[VOCATION_KNIGHT] = atoi(getGlobalStringField("manamul", VOCATION_KNIGHT+1, "1").c_str());
#endif //YUR_MULTIPLIERS[/CPP]
i wklei pod tym to ni?ej.
wklej:
[CPP]DROP_RATE = getGlobalNumber("droprate",1);[/CPP]
W monsters.cpp podmie? to:
[CPP]Item* tmpItem = NULL;
if(Item::items[lootBlock.id].stackable == true){
unsigned long randvalue = Monster::getRandom();
unsigned long n = 1;
if(randvalue < lootBlock.chance1){
if(randvalue < lootBlock.chancemax){
n = lootBlock.countmax;
}
else{
//if chancemax < randvalue < chance1
n = (unsigned char)(randvalue % lootBlock.countmax + 1);
}
tmpItem = Item::CreateItem(lootBlock.id, (unsigned short)n);
}
}
else{
if(Monster::getRandom() < lootBlock.chance1){
tmpItem = Item::CreateItem(lootBlock.id);
}
}
return tmpItem;[/CPP]
na to:
[CPP]Item* tmpItem = NULL;
if(Item::items[lootBlock.id].stackable == true){
unsigned long randvalue = Monster::getRandom();
unsigned long n = 1;
if(randvalue < (lootBlock.chance1 * g_config.DROP_RATE)){
if(randvalue < lootBlock.chancemax * g_config.DROP_RATE){
n = lootBlock.countmax;
}
else{
//if chancemax < randvalue < chance1
n = (unsigned char)(randvalue % lootBlock.countmax + 1);
}
tmpItem = Item::CreateItem(lootBlock.id, (unsigned short)n);
}
}
else{
if(Monster::getRandom() < lootBlock.chance1 * g_config.DROP_RATE){
tmpItem = Item::CreateItem(lootBlock.id);
}
}
return tmpItem;[/CPP]
Teraz w config.lua doda? ta linijk?:
[LUA]droprate = 1[/LUA]
Kod testowany na silniku: YurOTS_094f