Edit:
I got this system but for 7.6 can anyone change it for tfs 0.3.6pl1? Or it will work on TFS 0.3.6pl1?
And if anyone can change something in this script for that it always are secure mode on (player can't do secure mode off) but if you just change it for 0.3.6pl1 it will be great.
How it works?
Secure mode off - you can't kill and attack anyone.
Secure mode on - you can attack with spells and kill only the marked player, if you use spells like AOE and it hits some player but you don't marked him, you dont deal him dmg and don't get skull (it just ignore player)
I got this system but for 7.6 can anyone change it for tfs 0.3.6pl1? Or it will work on TFS 0.3.6pl1?
And if anyone can change something in this script for that it always are secure mode on (player can't do secure mode off) but if you just change it for 0.3.6pl1 it will be great.
How it works?
Secure mode off - you can't kill and attack anyone.
Secure mode on - you can attack with spells and kill only the marked player, if you use spells like AOE and it hits some player but you don't marked him, you dont deal him dmg and don't get skull (it just ignore player)
i got this system but for 7.6 can anyone change it for tfs 0.3.6pl1? Or it will work on tfs 0.3.6pl1?
And if anyone can change something in this script for that it always are secure mode on (player can't do secure mode off) but if you just change that for tfs 0.3.6pl1 it will be gr
written by baabuseek with credits to conan for testing.
Here is script:
In game.cpp below:
PHP:#ifdef yur_rings_amulets damage = applyamulets(targetplayer, damage, me->attacktype); #endif //yur_rings_amulets
add
PHP:#ifdef _ng_bbk_pvp__ pvparena = ispvparena(attackplayer) && ispvparena(targetplayer); creature *monster = dynamic_cast<monster*>(targetcreature); if (damage > 0) { creature *targetmonster = dynamic_cast<creature*>(targetcreature); if(attackplayer && attackplayer->atkmode == 1 && !pvparena) { if(targetplayer == targetmonster) { if(targetplayer->party == 0 || attackplayer->party == 0 && attackplayer->party != targetplayer->party){ damage = 0; } } } } if (attackplayer && !monster && damage > 0) { creature *attackedcreature = game->getplayerbyid(attackplayer->attackedcreature); if(attackplayer->atkmode == 0 && attackplayer->access <= g_config.access_protect && !pvparena) { if(attackedcreature != targetplayer) { if(targetplayer->party == 0 || attackplayer->party == 0 && attackplayer->party != targetplayer->party){ damage = 0; } } } } #endif //_ng_bbk_pvp__
slighty below below that:
PHP:if (damage > 0) { if(attackplayer && attackplayer->access < g_config.access_protect) {
change that:
PHP:if(targetplayer && targetplayer != attackplayer && game->getworldtype() != world_type_no_pvp)
for:
PHP:#ifdef _ng_bbk_pvp__ if(targetplayer && targetplayer != attackplayer && game->getworldtype() != world_type_no_pvp && damage != 0 && !pvparena) #else if(targetplayer && targetplayer != attackplayer && game->getworldtype() != world_type_no_pvp) #endif //_ng_bbk_pvp__
again little below
PHP:attackplayer->pzlocked = true; }
change that:
PHP:if(targetcreature->access < g_config.access_protect && targetplayer && game->getworldtype() != world_type_no_pvp)
for
PHP:#ifdef _ng_bbk_pvp__ if(targetcreature->access < g_config.access_protect && targetplayer && game->getworldtype() != world_type_no_pvp && !pvparena) #else if(targetcreature->access < g_config.access_protect && targetplayer && game->getworldtype() != world_type_no_pvp) #endif //_ng_bbk_pvp__
still in game.cpp, find
PHP:case fight_magicdist: If((std::abs(creature->pos.x-attackedcreature->pos.x) <= 8) && (std::abs(creature->pos.y-attackedcreature->pos.y) <= 5) && (creature->pos.z == attackedcreature->pos.z)) { //if(map->canthrowitemto(creature->pos, attackedcreature->pos, false, true)) if(map->canthrowobjectto(creature->pos, attackedcreature->pos, block_projectile) == ret_noerror) inreach = true; } break; }
and below this change that line:
PHP:if (player && player->access < g_config.access_protect)
for
PHP:#ifdef _ng_bbk_pvp__ bool pvparena = false; pvparena = ispvparena(player) && ispvparena(attackedplayer); if (player && player->access < g_config.access_protect && !pvparena) #else if (player && player->access < g_config.access_protect) #endif //_ng_bbk_pvp__
below this
PHP:player->sendicons(); if(attackedplayer) player->pzlocked = true; }[php] change that: [php]if(attackedplayer && attackedplayer->access < g_config.access_protect)
for
PHP:#ifdef _ng_bbk_pvp__ if(attackedplayer && attackedplayer->access < g_config.access_protect && !pvparena) #else if(attackedplayer && attackedplayer->access < g_config.access_protect) #endif //_ng_bbk_pvp__
still in game.cpp in function
PHP:void game::checkcreatureattacking(unsigned long id)
find that
PHP:else { if (creature->attackedcreature != 0) { creature *attackedcreature = getcreaturebyid(creature->attackedcreature);
and under that add:
PHP:#ifdef _ng_bbk_pvp__ player *player = dynamic_cast<player*>(creature); player *attackedplayer = dynamic_cast<player*>(attackedcreature); bool pvparena = false; pvparena = ispvparena(player) && ispvparena(attackedplayer); if(player && player->atkmode == 1 && attackedplayer && !pvparena) { if(attackedplayer->party == 0 || player->party == 0 && player->party != attackedplayer->party){ player->sendcancelattacking(); player->sendtextmessage(msg_smallinfo, "turn off secure mode if you really want to attack unmarked players."); playersetattackedcreature(player, 0); return; } } #endif //_ng_bbk_pvp__[php] in function: [php]void game::onpvp(creature* creature, creature* attacked, bool murder)
under that:
PHP:if (player->party != 0 && attackedplayer->party != 0 && player->party == attackedplayer->party) return;
add:
PHP:#ifdef _ng_bbk_pvp__ bool pvparena = false; pvparena = ispvparena(player) && ispvparena(attackedplayer); if (pvparena) return; creature *attackedcreature = getcreaturebyid(player->attackedcreature); if(player->atkmode == 0) { if(attackedcreature != attackedplayer) { return; } } if (player->atkmode == 1) return; #endif //_ng_bbk_pvp__
at the bottom game.cpp add:
PHP:#ifdef _ng_bbk_pvp__ bool game::ispvparena(creature* c) { if (!c) return false; tile *tile = map->gettile(c->pos); return tile && tile->ispvparena(); } #endif //_ng_bbk_pvp__
now in game.h below that:
PHP:class game { public: Game(); ~game();
add
PHP:#ifdef _ng_bbk_pvp__ bool ispvparena(creature* c); #endif //_ng_bbk_pvp__
now in player.cpp below that
PHP:guildid = 0;
add
PHP:#ifdef _ng_bbk_pvp__ atkmode = 0; #endif //_ng_bbk_pvp__
now in protocol76.cpp (i dont have it in tfs 0.3.6pl1) below:
PHP:void protocol76::parsemodes(networkmessage &msg) {
change that:
PHP:#ifdef yur_fight_mode player->setfightmode(msg.getbyte()); #endif //yur_fight_mode //player->fightmode = msg.getbyte(); //player->followmode = msg.getbyte(); }
for
PHP:#ifdef yur_fight_mode player->setfightmode(msg.getbyte()); #endif //yur_fight_mode player->followmode = msg.getbyte(); #ifdef _ng_bbk_pvp__ player->atkmode = msg.getbyte(); #endif //_ng_bbk_pvp__ }
now in player.h below:
PHP:class player : Public creature { public:
add
PHP:#ifdef _ng_bbk_pvp__ bool atkmode; #endif //_ng_bbk_pvp__ char followmode;
next change that:
PHP:char fightmode, followmode;
for
PHP:char fightmode;
at the bottom of project add:
PHP:-d_ng_bbk_pvp__
rebuild all!
Last edited: