What's new

-Tibia 7.60 [7.6] Loot System

Status
Not open for further replies.

Thorge D

Advanced User
Joined
Jul 24, 2014
Messages
300
Reaction score
29
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]NO_VOC_SPEED = atof(getGlobalStringField("speed", 1, "2.0").c_str()); [/CPP]
Wi?c niech poszuka tego:
[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
 

Norus

Active User
Joined
Dec 10, 2010
Messages
92
Reaction score
1
Odp: [7.6] Loot System

Co to robi? Szansa na zdobycie itemku? Jaka jest optymalna napisz z gory thx
 

Baabuseek

Advanced User
Joined
Aug 17, 2008
Messages
449
Reaction score
45
Odp: [7.6] Loot System

zwi?ksza szanse na zdobycie ka?dego przedmiotu(loota) x razy
 

Hol

User
Joined
Aug 14, 2014
Messages
30
Reaction score
0
Odp: [7.6] Loot System

a czy mo?na go ustawia? na 0.5? Bo przy innym jak wpisa?em 0.5 tyle bug?w mia?em ?e to szok. A tego nie sprawdza?em wole si? dowiedzie?.
 

Adrik

User
Joined
Sep 2, 2014
Messages
23
Reaction score
2
Odp: [7.6] Loot System

Doskonale wiesz, ?e nic im nie wyja?ni?e? xD

int = integer
google->translate->integer
 

Hol

User
Joined
Aug 14, 2014
Messages
30
Reaction score
0
Odp: [7.6] Loot System

A jak zrobi? aby mo?na by?o te? te 0,5 ??
 

Adrik

User
Joined
Sep 2, 2014
Messages
23
Reaction score
2
Odp: [7.6] Loot System

Code:
(int)(lootBlock.chancemax*1.05)
(int)(lootBlock.chance1*1.05)

#Down:
1.05 - 105%
1.1 - 110%
etc.
 
Last edited:

Hol

User
Joined
Aug 14, 2014
Messages
30
Reaction score
0
Odp: [7.6] Loot System

a nie:
(int)(lootBlock.chancemax*1.5)
(int)(lootBlock.chance1*1.5)

i pod czym to wkleic?
 

ziemniak262

Active User
Joined
Jul 7, 2009
Messages
69
Reaction score
3
Odp: [7.6] Loot System

Code:
(int)(lootBlock.chancemax*1.05)
(int)(lootBlock.chance1*1.05)

#Down:
1.05 - 105%
1.1 - 110%
etc.
Int to warto?ci ca?kowit?, wi?c zaokr?gli, jak da double zamiast int to b?dzie ok ;3
 
Status
Not open for further replies.
Top