bertosso
Member
Hello, Im having a really strange bug on my server.
When i put the dodge system i got 2 bugs that happens:
1st: My task module stop working.

2nd: When dying the character just stands there.

The client show this errors:

If I disable the dodge system both things work normaly, and i cant think how this things are related, but its what happens.
This is my dodge scripts:
condition.cpp
tools.cpp
luascript.cpp
items.h
items.cpp
game.cpp
enums.h
When i put the dodge system i got 2 bugs that happens:
1st: My task module stop working.

2nd: When dying the character just stands there.

The client show this errors:

If I disable the dodge system both things work normaly, and i cant think how this things are related, but its what happens.
This is my dodge scripts:
condition.cpp
Code:
case CONDITION_PARAM_SPECIALSKILL_DODGECHANCE: {
specialSkills[SPECIALSKILL_DODGECHANCE] = value;
return true;
}
tools.cpp
Code:
std::string getSpecialSkillName(uint8_t skillid)
{
switch (skillid) {
case SPECIALSKILL_CRITICALHITCHANCE:
return "critical hit chance";
case SPECIALSKILL_CRITICALHITAMOUNT:
return "critical extra damage";
case SPECIALSKILL_LIFELEECHCHANCE:
return "hitpoints leech chance";
case SPECIALSKILL_LIFELEECHAMOUNT:
return "hitpoints leech amount";
case SPECIALSKILL_MANALEECHCHANCE:
return "manapoints leech chance";
case SPECIALSKILL_MANALEECHAMOUNT:
return "mana points leech amount";
case SPECIALSKILL_DODGECHANCE:
return "dodge chance";
default:
return "unknown";
}
}
luascript.cpp
Code:
registerEnum(CONDITION_PARAM_SPECIALSKILL_DODGECHANCE)
registerEnum(SPECIALSKILL_DODGECHANCE)
items.h
Code:
ITEM_PARSE_DODGECHANCE,
items.cpp
Code:
"dodgechance", ITEM_PARSE_DODGECHANCE},
case ITEM_PARSE_DODGECHANCE: {
abilities.specialSkills[SPECIALSKILL_DODGECHANCE] = pugi::cast<int32_t>(valueAttribute.value());
break;
}
{"dodgechance", ITEM_PARSE_DODGECHANCE},
game.cpp
Code:
if (Player* targetPlayer = target->getPlayer()) {
int32_t dodgeChance = targetPlayer->getSpecialSkill(SPECIALSKILL_DODGECHANCE);
if (dodgeChance > 0) {
int32_t roll = uniform_random(0, 100);
if (roll < dodgeChance) {
g_game.addMagicEffect(targetPlayer->getPosition(), 174);
// targetPlayer->sendTextMessage(MESSAGE_EVENT_ADVANCE, "You dodged an attack!");
return true;
}
}
}
enums.h
Code:
CONDITION_PARAM_SPECIALSKILL_DODGECHANCE = 64
enum SpecialSkills_t {
SPECIALSKILL_CRITICALHITCHANCE,
SPECIALSKILL_CRITICALHITAMOUNT,
SPECIALSKILL_LIFELEECHCHANCE,
SPECIALSKILL_LIFELEECHAMOUNT,
SPECIALSKILL_MANALEECHCHANCE,
SPECIALSKILL_MANALEECHAMOUNT,
SPECIALSKILL_DODGECHANCE,
SPECIALSKILL_FIRST = SPECIALSKILL_CRITICALHITCHANCE,
SPECIALSKILL_LAST = SPECIALSKILL_DODGECHANCE
};