• 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++...
Yea now it sends effect perfectly so it has last problem it doesnt show text damage. No i just used your code i didn't combined them. But i tried to add message.primary.color = TEXTCOLOR_BLUE; didnt helped probably i have to add something dunno what
If you remove my code, it shows the text? If so, its really weird because we just changed hitEffect. Did you change anything about the texts in another code?
 
If you remove my code, it shows the text? If so, its really weird because we just changed hitEffect. Did you change anything about the texts in another code?
Yea it shows the text if i delete your code. I'm not sure but maybe combatGetTypeInfo should be after
Code:
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.primary.type == COMBAT_PHYSICALDAMAGE)
           {
               hitEffect = CONST_ME_STEPSHORIZONTAL;
               Position effectPos = targetPos;
               effectPos.x++;
               effectPos.y++;
               addMagicEffect(list, effectPos, hitEffect);
           }
?
 
Yea it shows the text if i delete your code. I'm not sure but maybe combatGetTypeInfo should be after
Code:
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.primary.type == COMBAT_PHYSICALDAMAGE)
           {
               hitEffect = CONST_ME_STEPSHORIZONTAL;
               Position effectPos = targetPos;
               effectPos.x++;
               effectPos.y++;
               addMagicEffect(list, effectPos, hitEffect);
           }
?
Well, you can try it.
C++:
    uint8_t hitEffect;
       if (message.primary.value) {
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.primary.type == COMBAT_PHYSICALDAMAGE)
           {
               Position effectPos = targetPos;
               effectPos.x++;
               effectPos.y++;
               addMagicEffect(list, effectPos, CONST_ME_STEPSHORIZONTAL);
           }
           combatGetTypeInfo(damage.primary.type, target, message.primary.color, hitEffect);
           if (hitEffect != CONST_ME_NONE) {
               addMagicEffect(list, targetPos, hitEffect);
           }
       }

       if (message.secondary.value) {
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.secondary.type == COMBAT_PHYSICALDAMAGE)
           {
               Position effectPos = targetPos;
               effectPos.x++;
               effectPos.y++;
               addMagicEffect(list, effectPos, CONST_ME_STEPSHORIZONTAL);
           }
           combatGetTypeInfo(damage.secondary.type, target, message.secondary.color, hitEffect);
           if (hitEffect != CONST_ME_NONE) {
               addMagicEffect(list, targetPos, hitEffect);
           }
       }
-- edited to fix secondary color
@edit 2: i noticed that this would show 2 effects, but tell me if it fixs the text
 
Last edited:
Well, you can try it.
C++:
    uint8_t hitEffect;
       if (message.primary.value) {
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.primary.type == COMBAT_PHYSICALDAMAGE)
           {
               Position effectPos = targetPos;
               effectPos.x++;
               effectPos.y++;
               addMagicEffect(list, effectPos, CONST_ME_STEPSHORIZONTAL);
           }
           combatGetTypeInfo(damage.primary.type, target, message.primary.color, hitEffect);
           if (hitEffect != CONST_ME_NONE) {
               addMagicEffect(list, targetPos, hitEffect);
           }
       }

       if (message.secondary.value) {
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.secondary.type == COMBAT_PHYSICALDAMAGE)
           {
               Position effectPos = targetPos;
               effectPos.x++;
               effectPos.y++;
               addMagicEffect(list, effectPos, CONST_ME_STEPSHORIZONTAL);
           }
           combatGetTypeInfo(damage.secondary.type, target, message.secondary.color, hitEffect);
           if (hitEffect != CONST_ME_NONE) {
               addMagicEffect(list, targetPos, hitEffect);
           }
       }
-- edited to fix secondary color
Nah didn't helped i though if i executing combatGetTypeInfo before the message. thats why its not working but i was wrong :D :D Hmmmmm dunno what to do next
 
Nah didn't helped i though if i executing combatGetTypeInfo before the message. thats why its not working but i was wrong :D :D Hmmmmm dunno what to do next
But you're saying that if you delete the content from
C++:
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.primary.type == COMBAT_PHYSICALDAMAGE)
it fixs the text? If yes, can you give me the whole function to take a look?
 
But you're saying that if you delete the content from
C++:
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.primary.type == COMBAT_PHYSICALDAMAGE)
it fixs the text?
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)
 
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++;
               addMagicEffect(list, effectPos, CONST_ME_STEPSHORIZONTAL);
           }
           else if (hitEffect != CONST_ME_NONE) {
               addMagicEffect(list, targetPos, hitEffect);
           }
            std::ostringstream strPrimaryDamage;
            strPrimaryDamage << message.primary.value;
           addAnimatedText(strPrimaryDamage.str(), targetPos, message.primary.color);
       }
       if (message.secondary.value) {
           combatGetTypeInfo(damage.secondary.type, target, message.secondary.color, hitEffect);
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.secondary.type == COMBAT_PHYSICALDAMAGE)
           {
               Position effectPos = targetPos;
               effectPos.x++;
               effectPos.y++;
               addMagicEffect(list, effectPos, CONST_ME_STEPSHORIZONTAL);
           }
           else if (hitEffect != CONST_ME_NONE) {
               addMagicEffect(list, targetPos, hitEffect);
           }
            std::ostringstream strSecondaryDamage;
            strSecondaryDamage << message.secondary.value;
           addAnimatedText(strSecondaryDamage.str(), targetPos, message.secondary.color);
       }
 
Solution
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++;
               addMagicEffect(list, effectPos, CONST_ME_STEPSHORIZONTAL);
           }
           else if (hitEffect != CONST_ME_NONE) {
               addMagicEffect(list, targetPos, hitEffect);
           }
            std::ostringstream strPrimaryDamage;
            strPrimaryDamage << message.primary.value;
           addAnimatedText(strPrimaryDamage.str(), targetPos, message.primary.color);
       }
       if (message.secondary.value) {
           combatGetTypeInfo(damage.secondary.type, target, message.secondary.color, hitEffect);
           if (attacker && attacker->getPlayer() && target->getPlayer() && damage.secondary.type == COMBAT_PHYSICALDAMAGE)
           {
               Position effectPos = targetPos;
               effectPos.x++;
               effectPos.y++;
               addMagicEffect(list, effectPos, CONST_ME_STEPSHORIZONTAL);
           }
           else if (hitEffect != CONST_ME_NONE) {
               addMagicEffect(list, targetPos, hitEffect);
           }
            std::ostringstream strSecondaryDamage;
            strSecondaryDamage << message.secondary.value;
           addAnimatedText(strSecondaryDamage.str(), targetPos, message.secondary.color);
       }
Thanks bruh :) everything is perfect 10/10
 
Back
Top