• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling How to send "sendExtendedOpcode" to target.

whiteblXK

Active Member
Joined
Apr 20, 2011
Messages
315
Solutions
9
Reaction score
32
Location
Poland
Hello, I have "sendExtendedOpcode(124, "Radial Blur")" and I want send in function
Code:
void Player::sendCritical() const
to target.
For test I use "target->sendExtendedOpcode(124, "Radial Blur");" but it doesn't work.

Here is my function:
http://wklej.org/hash/ab5501419ad/


PS: Anyone know how to add addEvent in C++ with sendExtendedOpcode for target?
 
Check from where sendCritical is called. The function sendCritical does not have any information about the target which the critical hit was performed on.
It just sends a effect on the position of the attacker.
 
int32_t WeaponMelee::getWeaponDamage(const Player* player, const Creature*, const Item* item, bool maxDamage /*= false*/) const
to
int32_t WeaponMelee::getWeaponDamage(const Player* player, const Creature* target, const Item* item, bool maxDamage /*= false*/) const

int32_t WeaponWand::getWeaponDamage(const Player* player, const Creature*, const Item*, bool maxDamage /* = false*/) const
to
int32_t WeaponWand::getWeaponDamage(const Player* player, const Creature* target, const Item*, bool maxDamage /* = false*/) const

player->sendCritical();
to
player->sendCritical(target);

void sendCritical() const;
to
void sendCritical(Creature* target) const;

Code:
void Player::sendCritical() const
{
    if(g_config.getBool(ConfigManager::DISPLAY_CRITICAL_HIT))
        g_game.addAnimatedText(getPosition(), COLOR_DARKRED, "CRITICAL!");
}
to
Code:
void Player::sendCritical(Creature* target) const
{
    if(g_config.getBool(ConfigManager::DISPLAY_CRITICAL_HIT))
        g_game.addAnimatedText(getPosition(), COLOR_DARKRED, "CRITICAL!");

    Player* targetPlayer = target->getPlayer();
    if(targetPlayer)
        targetPlayer->sendExtendedOpcode(124, "Radial Blur");
}
 
Thanks for helping me.
I have errors:
Code:
r3884\src\weapons.cpp:636: error: invalid conversion from 'const Creature*' to 'Creature*'
r3884\src\weapons.cpp:636: error:  initializing argument 1 of 'void Player::sendCritical(Creature*) const'
r3884\src\weapons.cpp: In member function 'virtual int32_t WeaponDistance::getWeaponDamage(const Player*, const Creature*, const Item*, bool) const':
r3884\src\weapons.cpp:912: error: invalid conversion from 'const Creature*' to 'Creature*'
r3884\src\weapons.cpp:912: error:  initializing argument 1 of 'void Player::sendCritical(Creature*) const'
r3884\src\weapons.cpp: In member function 'virtual int32_t WeaponWand::getWeaponDamage(const Player*, const Creature*, const Item*, bool) const':
r3884\src\weapons.cpp:1002: error: invalid conversion from 'const Creature*' to 'Creature*'
r3884\src\weapons.cpp:1002: error:  initializing argument 1 of 'void Player::sendCritical(Creature*) const'
 
Back
Top