As the title, player do dmg to other players by ue without pk turned on, but only with ue, to use normal spells/atk players he need to turn on pk so whats the reason that ue makes the dmg? Is it fault of spell?
Here's example of one ue spell:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -125.0, 0, -150.0, 0)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 5)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 5)
arr1 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}
arr2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}
arr3 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}
local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)
local function onCastSpell1(parameters)
doCombat(parameters.cid, parameters.combat1, parameters.var)
end
local function onCastSpell2(parameters)
doCombat(parameters.cid, parameters.combat2, parameters.var)
end
local function onCastSpell3(parameters)
doCombat(parameters.cid, parameters.combat3, parameters.var)
end
function onCastSpell(cid, var)
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3 }
addEvent(onCastSpell1, 0, parameters)
addEvent(onCastSpell2, 0, parameters)
addEvent(onCastSpell3, 150, parameters)
return true
end[/CODE]
But i dont see here nothing wrong?
Do i need to add any script that gonna want PK on to do dmg on players? Or maybe something at source?
oh i forgot : tibia 8,6 tfs 0.4 rev 3777
Looks like its fault of that combat area cuz even whis staff makes dmg to player so whats wrong here ;x
Same, kame/flash blabla also do dmg to player w/o pk turned on ;x dunno what is going on, and yea ofc it generate skull after that but why it does dmg w/o pk turned on thats the prob
Maybe is it fault that worldtype = "open" ? so like pvp enforced?
I found this at source:[code]
if(worldType == "open" || worldType == "2" || worldType == "openpvp")
{
g_game.setWorldType(WORLDTYPE_OPEN);
std::clog << "Open PvP" << std::endl;
}
else if(worldType == "optional" || worldType == "1" || worldType == "optionalpvp")
{
g_game.setWorldType(WORLDTYPE_OPTIONAL);
std::clog << "Optional PvP" << std::endl;
But then if i set to optional then even if i turn PK on on char, cant attack 2nd char
Or maybe its possible with one of those errors?
Those are warnings while i compile source:
Well problem is i got pretty much of those warnings cuz i been trying to change skills etc and thats why im asking cuz my skills grows so fast even with config script for them+they have no limit ;/ one guy have 300+ fishing (energy def at my ots/ while i had it on windows it been fine, but now while using vps and compiled for linux thats happend ;x)
Okay so i post all i have of them for now:
luascript.h:
In file included from baseevents.h:22:0,
from actions.h:20,
from actions.cpp:20:
luascript.h: In member function ‘virtual bool Action::executeUse(Player*, Item*, const PositionEx&, const PositionEx&, bool, uint32_t)’:
luascript.h:277:106: warning: ‘<anonymous>.PositionEx::stackpos’ may be used uninitialized in this function [-Wmaybe-uninitialized]
L, const PositionEx& position) {pushPosition(L, position, position.stackpos);}
[/CODE]
As i guess its about push, works but dunno can it cause any bug?
game.cpp:
[CODE]game.cpp: In member function ‘bool Game::combatChangeHealth(CombatType_t, Creature*, Creature*, int64_t, MagicEffect_t, Color_t, bool)’:
game.cpp:4431:39: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
sprintf(buffer, "+%d", healthChange);
^
game.cpp:4456:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (random_range(1, 500) <= critx) //use that random function if it works for you, but I used to always use the uniform_random(int,int) func on tfs
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
game.cpp:4483:38: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
sprintf(buffer, "%d", manaDamage);
^
game.cpp:4664:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
sprintf(buffer, "%d", damage);
^
game.cpp: In member function ‘bool Game::combatChangeMana(Creature*, Creature*, int64_t)’:
game.cpp:4697:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
sprintf(buffer, "+%d", manaChange);
^
game.cpp:4735:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
sprintf(buffer, "%d", manaLoss);
^
game.cpp: In constructor ‘Game::Game()’:
game.cpp:80:24: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
globalSaveMessage[i] = false;
~~~~~~~~~~~~~~~~~~~~~^~~~~~~
game.cpp:79:23: note: within this loop
for(int32_t i = 0; i < 3; i++)
~~^~~
In file included from game.cpp:18:0:
game.h: In member function ‘void Game::globalSave()’:
game.h:615:78: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
setGlobalSaveMessage(int16_t key, bool value) {globalSaveMessage[key] = value;}
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
game.cpp:6384:23: note: within this loop
for(int16_t i = 0; i < 3; i++)
~~^~~
[/CODE]
Most of them are int64 not 32, cuz of hp/mp% but the other? Ah and critical skill there too
item.cpp:
[CODE]item.cpp: In member function ‘virtual Attr_ReadValue Item::readAttr(AttrTypes_t, PropStream&)’:
item.cpp:649:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
break;
^
item.cpp:652:3: note: here
default:
^~~~~~~[/CODE]
No idea
manager.cpp:
[CODE]
manager.cpp: In member function ‘virtual void ProtocolManager::parsePacket(NetworkMessage&)’:
manager.cpp:254:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
}
^
manager.cpp:257:3: note: here
case MP_MSG_CHAT_REQUEST:
^~~~
[/CODE]
Same here...
monster.cpp:
[CODE]
monster.cpp: In member function ‘bool Monster::isFriend(const Creature*)’:
monster.cpp:315:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if(creature->getPlayer() && !targetPlayers)
^~
monster.cpp:318:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if(!isSummon() || !master->getPlayer())
^~
[/CODE]
delete if?
player.cpp:
[CODE]
player.cpp: In member function ‘int32_t Player::getWeaponSkill(const Item*) const’:
player.cpp:400:60: warning: left operand of comma operator has no effect [-Wunused-value]
return getSkill(SKILL_SWORD, SKILL_LEVEL) && (SKILL_AXE,SKILL_LEVEL);
^~~~~~~~~~~
player.cpp:406:60: warning: left operand of comma operator has no effect [-Wunused-value]
return getSkill(SKILL_AXE, SKILL_LEVEL) && (SKILL_SWORD,SKILL_LEVEL);
^~~~~~~~~~~
player.cpp:409:60: warning: left operand of comma operator has no effect [-Wunused-value]
return getSkill(SKILL_AXE, SKILL_LEVEL) && (SKILL_SWORD,SKILL_LEVEL);
^~~~~~~~~~~
player.cpp: In member function ‘virtual void Player::drainHealth(Creature*, CombatType_t, int64_t)’:
player.cpp:1870:143: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
s.", damage, (damage != 1 ? "s" : ""), attacker->getNameDescription().c_str());
^
player.cpp:1872:80: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
sprintf(buffer, "You lose %lld hitpoint%s.", damage, (damage != 1 ? "s" : ""));
^
player.cpp: In member function ‘virtual void Player::drainMana(Creature*, CombatType_t, int64_t)’:
player.cpp:1883:111: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
na blocking an attack by %s.", damage, attacker->getNameDescription().c_str());
^
player.cpp:1885:46: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
sprintf(buffer, "You lose %d mana.", damage);
^
player.cpp: In member function ‘virtual void Player::onAttackedCreatureDrain(Creature*, int64_t)’:
player.cpp:3858:93: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
, "You deal %lld damage to %s.", points, target->getNameDescription().c_str());
^
player.cpp: In member function ‘virtual void Player::onSummonAttackedCreatureDrain(Creature*, Creature*, int64_t)’:
player.cpp:3867:124: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘int64_t {aka long int}’ [-Wformat=]
%s.", summon->getName().c_str(), points, target->getNameDescription().c_str());
^
player.cpp: In member function ‘ItemVector Player::getWeapons() const’:
player.cpp:345:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
if(item->getAmmoType() != AMMO_NONE)
^~
player.cpp:348:4: note: here
case WEAPON_SWORD:
^~~~
player.cpp: In member function ‘void Player::manageAccount(const string&)’:
player.cpp:4870:20: warning: iteration 11 invokes undefined behavior [-Waggressive-loop-optimizations]
talkState[i] = false;
~~~~~~~~~~~~~^~~~~~~
player.cpp:4869:26: note: within this loop
for(int8_t i = 2; i <= 14; i++)
~~^~~~~
[/CODE]
As i said few of them are here cuz i changed skills from fist etc to crit blabla, and made to advance 2 skills from 1 weap
protocolgame.cpp:
[CODE]
protocolgame.cpp: In member function ‘void ProtocolGame::sendMagicEffect(const Position&, uint8_t)’:
protocolgame.cpp:2260:10: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if(type > MAGIC_EFFECT_LAST || !canSee(pos))
~~~~~^~~~~~~~~~~~~~~~~~~
protocolgame.cpp: In member function ‘void ProtocolGame::AddCreatureSpeak(NetworkMessage_ptr, const Creature*, SpeakClasses, std::__cxx11::string, uint16_t, uint32_t, Position*, ProtocolGame*)’:
protocolgame.cpp:2978:158: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
CustomFlag(PlayerCustomFlag_HideLevel) && (pg == NULL || pg != NULL && !pg->getIsCast()))
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
[/CODE]
weapons.cpp:
[CODE]
weapons.cpp: In member function ‘bool Weapons::loadDefaults()’:
weapons.cpp:85:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if(it->ammoType != AMMO_NONE)
^~
weapons.cpp:88:5: note: here
case WEAPON_AMMO:
^~~~[/CODE]