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

Feature [TFS 1.2] Combat Parameter - COMBAT_PARAM_PVPDAMAGE

Ninja

Global Moderator
Staff member
Global Moderator
Joined
Apr 6, 2010
Messages
5,947
Solutions
34
Reaction score
1,584
Location
Sweden
TFS[1.2] Combat Parameter - COMBAT_PARAM_PVPDAMAGE
Increase, or decrease spells damage in PvP
Changelog:
  • Support for TFS 1.2 (22/1/2016)
Git Gist: https://gist.github.com/ninjalulz/a02c59318b3ca8291ebf

Spell example
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combat:setParameter(COMBAT_PARAM_PVPDAMAGE, 500)
combat:setParameter(COMBAT_FORMULA_LEVELMAGIC, -1.3, -30, -1.8, 0)

function onCastSpell(creature, variant, isHotkey)
   return combat:execute(creature, variant)
end
 
Last edited:
Right now in Tibia, you deal less damage to a player than you do to a monster.
As far as I know, the default is that players deal 50% damage less to players than they do to monsters.

What Ninja made allows you to change that percentage.
So, if you want a spell to deal the same amount of damage to a player as you would to a creature, you would simply use:
Lua:
setCombatParam(combat, COMBAT_PARAM_PVPDAMAGE, 200)

Ninja, correct me if I am wrong.
 
That's correct Evan. ;)

I'll edit the thread later with a better description since it's clearly that users may not understand what it does.
 
Ninja. Can you make it for 0.3.6pl1 ? Thanks in advance. I will very appreciated your work. Please :(
 
Ninja. Can you make it for 0.3.6pl1 ? Thanks in advance. I will very appreciated your work. Please :(

Of course, I'll send you the edits later when I've got some time.
 
I will wait :)

Place the COMBATPARAM_PVP_DAMAGE under COMBATPARAM_HITCOLOR instead and change the caster in combat.cpp to make it work with 0.3.6pl1

Code:
if(change < 0 && caster && caster->getPlayer() && target->getPlayer() && target->getPlayer()->getSkull() != SKULL_BLACK)
        change = change / 2;
        [COLOR=#ff0000]change *= (params.PVPDamage/100.);[/COLOR]
 
Updated first post with code tags and support for TFS 1.0. :rolleyes:
 
hey can you make for equipments? like an attribute "pvp damage 10%" affecting normal hits and spells? it will be AWESOME
 
Any ideas how should i do it in OTHire distro. There are function check and doPVPDamage
Code:
void Combat::doPVPDamageReduction(int32_t& healthChange, const Player *target) //static
{
    if(healthChange < 0){
        int64_t factor;
        #ifdef __SKULLSYSTEM__
        factor = std::max(g_config.getNumber(ConfigManager::PVP_DAMAGE), int64_t(0));
        #else
        factor = std::max(g_config.getNumber(ConfigManager::PVP_DAMAGE), int64_t(0));
        #endif
        healthChange = (healthChange * factor)/100;
        healthChange *= params.pvpDamage / 100;
    }

}

void Combat::checkPVPDamageReduction(const Creature* attacker, const Creature* target, int32_t& healthChange) //static
{
    if(attacker && attacker->getPlayer() && target->getPlayer() && (attacker != target)){
        #ifdef __SKULLSYSTEM__
        Combat::doPVPDamageReduction(healthChange, target->getPlayer());
        #else
        Combat::doPVPDamageReduction(healthChange);
        #endif
    }
}

Which are called from CombatHealthFunc
Code:
bool Combat::CombatHealthFunc(Creature* caster, Creature* target, const CombatParams& params, void* data)
{
    Combat2Var* var = (Combat2Var*)data;
    int32_t healthChange = random_range(var->minChange, var->maxChange);

    if(g_game.combatBlockHit(params.combatType, caster, target, healthChange, params.blockedByShield, params.blockedByArmor)){
        return false;
    }

    Combat::checkPVPDamageReduction(caster, target, healthChange);

    bool result = g_game.combatChangeHealth(params.combatType, params.hitEffect, params.hitTextColor, caster, target, healthChange);

    if(result){
        CombatConditionFunc(caster, target, params, NULL);
        CombatDispelFunc(caster, target, params, NULL);
    }

    return result;
}

But i cant access combat params inside those functions. I tried to add new parameter to the function check and doPvPDamage to send a combatParam but the dmg was the same.
 

Similar threads

Back
Top