• 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+ [Problem,question] 0 dmg in pvp. About different hit effect when you are in pvp

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
993
Solutions
5
Reaction score
55
I'm using TFS 1.2
And today i went to test pvp with friend and i was confused when i saw that when you fight 1x1 one player can deal damage with melee weapon and other just deal zero (DIDN'T TRIED SPELLS). And second think i was wondering is it possible to apply different hiteffect when you are in fight againts other people? I mean check if you are in pvp and if yes it sends some kind of effect.

  • I haven't changed anything in source that can affect pvp
  • My server is pretty much in default stage if we talk about .lua
  • config.lua haven't changed anything its absolutely default stage
  • Yes i marked skull when i tried to attack player
Server i use: [8.60] The Forgotten Server 1.2
 
Solution
Probably i miss understood something i meant if i delete the whole your script and replace it with Vulcan_ it sends the text. So i dont know where exactly is the problem. I didnt tried to delete only if (attacker && attacker->getPlayer() && target->getPlayer() && damage.primary.type == COMBAT_PHYSICALDAMAGE)
Ok try this
C++:
      uint8_t hitEffect;
       if (message.primary.value) {
           combatGetTypeInfo(damage.primary.type, target, message.primary.color, hitEffect);
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.primary.type == COMBAT_PHYSICALDAMAGE)
           {
               Position effectPos = targetPos;
               effectPos.x++;
               effectPos.y++...
he means vocations.xml
have you tested with 100% nothing changed on a newly compiled tfs?
you need to make sure that nothing you've changed is to blame
Aaaa. I didnt tried with default server. Maybe its my fault i dont know. But with vocation.xml i'm not sure what could be wrong. I tried with these two chars
Code:
    </vocation>
        <vocation id="42" name="Test2" description="Test2" gaincap="10" gainhp="60" gainmana="60" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="300" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="42">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
Code:
    </vocation>
        <vocation id="38" name="Test1" description="Test1" gaincap="10" gainhp="60" gainmana="60" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="300" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="38">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
So Test2 had no dmg, but Test1 had dmg, so i dont see any differences why its not working. Btw these two has transforms, and this is the last forms of that transform.
 
vocations.xml seems fine, but to make sure did you test with other vocations too? or just test1 and test2?
if there's nothing wrong with vocations the only thing left is either something you changed or the source (doubtful, never seen anybody have this problem yet)
 
vocations.xml seems fine, but to make sure did you test with other vocations too? or just test1 and test2?
if there's nothing wrong with vocations the only thing left is either something you changed or the source (doubtful, never seen anybody have this problem yet)
I didn't tried with other vocations only test1 and test2. If you can tell me which part of source is related with pvp then i could tell did i changed something.
 
it would probably be easier to just tell what you changed rather than me list out all of the functions that deal with combat because there's a lot
 
it would probably be easier to just tell what you changed rather than me list out all of the functions that deal with combat because there's a lot
Let me see. So first think i changed is hiteffect looktype. Then i changed void Player::doAttacking its more like updated then changed. Then i changed void Player::eek:nBlockHit()
Thats it.
 
From
Code:
void Player::doAttacking(uint32_t)
{
if (lastAttack == 0) {
lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
}
if (hasCondition(CONDITION_PACIFIED)) {
return;
}
if ((OTSYS_TIME() - lastAttack) >= getAttackSpeed()) {
bool result = false;
Item* tool = getWeapon();
const Weapon* weapon = g_weapons->getWeapon(tool);
if (weapon) {
if (!weapon->interruptSwing()) {
result = weapon->useWeapon(this, tool, attackedCreature);
} else if (!canDoAction()) {
uint32_t delay = getNextActionTime();
SchedulerTask* task = createSchedulerTask(delay, std::bind(&Game::checkCreatureAttack,
&g_game, getID()));
setNextActionTask(task);
} else {
result = weapon->useWeapon(this, tool, attackedCreature);
}
} else {
result = Weapon::useFist(this, attackedCreature);
}
if (result) {
lastAttack = OTSYS_TIME();
}
}
}
To
Code:
void Player::doAttacking(uint32_t)
{
    if (lastAttack == 0) {
        lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
    }

    if (hasCondition(CONDITION_PACIFIED)) {
        return;
    }

    if ((OTSYS_TIME() - lastAttack) >= getAttackSpeed()) {
        bool result = false;

        Item* tool = getWeapon();
        const Weapon* weapon = g_weapons->getWeapon(tool);
        uint32_t delay = getAttackSpeed();

        if (weapon) {
            if (!weapon->interruptSwing()) {
                result = weapon->useWeapon(this, tool, attackedCreature);
            } else if (!canDoAction()) {
                delay = getNextActionTime();
            } else {
                result = weapon->useWeapon(this, tool, attackedCreature);
            }
        } else {
            result = Weapon::useFist(this, attackedCreature);
        }

        SchedulerTask* task = createSchedulerTask(std::max<uint32_t>(SCHEDULER_MINTICKS, delay), std::bind(&Game::checkCreatureAttack, &g_game, getID()));
        g_scheduler.addEvent(task);

        if (result) {
            lastAttack = OTSYS_TIME();
        }
    }
}
From
Code:
void Player::onBlockHit()
{
    if (shieldBlockCount > 0) {
        --shieldBlockCount;
        if (hasShield()){
            addSkillAdvance(SKILL_SHIELD, 1);
        }
    }
}
To
Code:
void Player::onBlockHit()
{
    addSkillAdvance(SKILL_SHIELD, 1);
}
 
could you try reverting onblockhit and see if it changes?
otherwise i'm out of ideas, if reverting doesn't work i'd recommend testing a fully clean source and seeing if you can reproduce the bug
 
Edit: Everything works now i dont know where problem was i'm really confused why that time it doesnt worked. But now everything is fine.

So i have last question how to apply different effect when players are in pvp?I mentioned on this thread
 
Back
Top