• 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!

TFS 1.X+ Nekiro’s 8.0 TFS 1.5 elemental damage on weapons is posible?

pips

Intermediate OT User
Joined
Jul 29, 2009
Messages
241
Solutions
14
Reaction score
122
So, as the title says. Can I “turn on” elemental damage of weapons on this distro? Actually, weapons already do elemental damage (extra damage), but it don’t have the animations of it. When i hit a mob with a elemental weapon, i do deal dmg to him, but on the screen it only pops up a red zero on the mob..
Post automatically merged:

So, i've made some changes (below) and it's working. But, sometimes (just sometimes) it's still send 2 magic effects and idk why.. if someone that understands a lil more of C++ and could help me, i would appreciate :) thx.

from:
Lua:
realDamage = damage.primary.value + damage.secondary.value;
        if (realDamage == 0) {
            return true;
        }
        if (spectators.empty()) {
            map.getSpectators(spectators, targetPos, true, true);
        }
        //message.primary.value = damage.primary.value;
        //message.secondary.value = damage.secondary.value;
        coloredText.text = std::to_string(damage.primary.value);
        uint8_t hitEffect;
        //if (message.primary.value) {
        if (!coloredText.text.empty()) {
            //combatGetTypeInfo(damage.primary.type, target, message.primary.color, hitEffect);
            combatGetTypeInfo(damage.primary.type, target, coloredText.color, hitEffect);
            if (hitEffect != CONST_ME_NONE) {
                addMagicEffect(spectators, targetPos, hitEffect);
            }
        }
        /*if (message.secondary.value) {
            combatGetTypeInfo(damage.secondary.type, target, message.secondary.color, hitEffect);
            if (hitEffect != CONST_ME_NONE) {
                addMagicEffect(spectators, targetPos, hitEffect);
            }
        }*/
        if (coloredText.color != TEXTCOLOR_NONE) {
        //if (message.primary.color != TEXTCOLOR_NONE || message.secondary.color != TEXTCOLOR_NONE) {
            auto damageString = fmt::format("{:d} hitpoint{:s}", realDamage, realDamage != 1 ? "s" : "");
            std::string spectatorMessage;
            for (Creature* spectator : spectators) {
                Player* tmpPlayer = spectator->getPlayer();
                if (tmpPlayer->getPosition().z != targetPos.z) {
                    continue;
                }
                if (tmpPlayer == attackerPlayer && attackerPlayer != targetPlayer) {
                    //message.type = MESSAGE_DAMAGE_DEALT;
                    message.type = MESSAGE_EVENT_DEFAULT;
                    message.text = fmt::format("{:s} loses {:s} due to your attack.", target->getNameDescription(), damageString);
                    message.text[0] = std::toupper(message.text[0]);
                } else if (tmpPlayer == targetPlayer) {
                    //message.type = MESSAGE_DAMAGE_RECEIVED;
                    message.type = MESSAGE_EVENT_DEFAULT;
                    if (!attacker) {
                        message.text = fmt::format("You lose {:s}.", damageString);
                    } else if (targetPlayer == attackerPlayer) {
                        message.text = fmt::format("You lose {:s} due to your own attack.", damageString);
                    } else {
                        message.text = fmt::format("You lose {:s} due to an attack by {:s}.", damageString, attacker->getNameDescription());
                    }
                } else {
                    //message.type = MESSAGE_DAMAGE_OTHERS;
                    message.type = MESSAGE_EVENT_DEFAULT;
                    if (spectatorMessage.empty()) {
                        if (!attacker) {
                            spectatorMessage = fmt::format("{:s} loses {:s}.", target->getNameDescription(), damageString);
                        } else if (attacker == target) {
                            spectatorMessage = fmt::format("{:s} loses {:s} due to {:s} own attack.", target->getNameDescription(), damageString, targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her" : "his") : "its");
                        } else {
                            spectatorMessage = fmt::format("{:s} loses {:s} due to an attack by {:s}.", target->getNameDescription(), damageString, attacker->getNameDescription());
                        }
                        spectatorMessage[0] = std::toupper(spectatorMessage[0]);
                    }
                    message.text = spectatorMessage;
                }
                tmpPlayer->sendTextMessage(message);
                tmpPlayer->sendColoredText(coloredText);
            }
        }

to:
Lua:
realDamage = damage.primary.value + damage.secondary.value;
        if (realDamage == 0) {
            return true;
        }
        if (spectators.empty()) {
            map.getSpectators(spectators, targetPos, true, true);
        }
        message.primary.value = damage.primary.value;
        message.secondary.value = damage.secondary.value;
        coloredText.text = std::to_string(realDamage);
        uint8_t hitEffect;
        if (message.primary.value && message.secondary.value == 0) {
        // if (!coloredText.text.empty()) {
            combatGetTypeInfo(damage.primary.type, target, message.primary.color, hitEffect);
            // combatGetTypeInfo(damage.primary.type, target, coloredText.color, hitEffect);
            if (hitEffect != CONST_ME_NONE) {
                addMagicEffect(spectators, targetPos, hitEffect);
                coloredText.color = message.primary.color;
            }
        }
        if (message.secondary.value != 0) {
            combatGetTypeInfo(damage.secondary.type, target, message.secondary.color, hitEffect);
            if (hitEffect != CONST_ME_NONE) {
                addMagicEffect(spectators, targetPos, hitEffect);
                coloredText.color = message.secondary.color;
            }
        }
        // if (coloredText.color != TEXTCOLOR_NONE) {
        if (message.primary.color != TEXTCOLOR_NONE || message.secondary.color != TEXTCOLOR_NONE) {
            auto damageString = fmt::format("{:d} hitpoint{:s}", realDamage, realDamage != 1 ? "s" : "");
            std::string spectatorMessage;
            for (Creature* spectator : spectators) {
                Player* tmpPlayer = spectator->getPlayer();
                if (tmpPlayer->getPosition().z != targetPos.z) {
                    continue;
                }
                if (tmpPlayer == attackerPlayer && attackerPlayer != targetPlayer) {
                    //message.type = MESSAGE_DAMAGE_DEALT;
                    message.type = MESSAGE_EVENT_DEFAULT;
                    message.text = fmt::format("{:s} loses {:s} due to your attack.", target->getNameDescription(), damageString);
                    message.text[0] = std::toupper(message.text[0]);
                } else if (tmpPlayer == targetPlayer) {
                    //message.type = MESSAGE_DAMAGE_RECEIVED;
                    message.type = MESSAGE_EVENT_DEFAULT;
                    if (!attacker) {
                        message.text = fmt::format("You lose {:s}.", damageString);
                    } else if (targetPlayer == attackerPlayer) {
                        message.text = fmt::format("You lose {:s} due to your own attack.", damageString);
                    } else {
                        message.text = fmt::format("You lose {:s} due to an attack by {:s}.", damageString, attacker->getNameDescription());
                    }
                } else {
                    //message.type = MESSAGE_DAMAGE_OTHERS;
                    message.type = MESSAGE_EVENT_DEFAULT;
                    if (spectatorMessage.empty()) {
                        if (!attacker) {
                            spectatorMessage = fmt::format("{:s} loses {:s}.", target->getNameDescription(), damageString);
                        } else if (attacker == target) {
                            spectatorMessage = fmt::format("{:s} loses {:s} due to {:s} own attack.", target->getNameDescription(), damageString, targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her" : "his") : "its");
                        } else {
                            spectatorMessage = fmt::format("{:s} loses {:s} due to an attack by {:s}.", target->getNameDescription(), damageString, attacker->getNameDescription());
                        }
                        spectatorMessage[0] = std::toupper(spectatorMessage[0]);
                    }
                    message.text = spectatorMessage;
                }
                tmpPlayer->sendTextMessage(message);
                tmpPlayer->sendColoredText(coloredText);
            }
        }
 
Last edited:
Back
Top