Yan18
Member
- Joined
- Jun 14, 2014
- Messages
- 104
- Solutions
- 3
- Reaction score
- 16
*OBS: This tutorial just works in TFS 1.X as said in the title.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*OBS: This tutorial just works in TFS 1.X as said in the title.
Hello folks!
I was searching a topic that the player can't attack their summons and I didn't find out and I tried to solve my problem myself and I figured out how can do it!
Let's go start the tutorial!!!
Follow the next steps:
1- Open your source and look for the file combat.cpp and open it
2 - Look for the function:
C++:
ReturnValue Combat::canTargetCreature(Player* attacker, Creature* target)
3- Add the code below inside the function found in the previous step:
C++:
// BLOCK THAT THE PLAYER(MASTER) CAN'T ATTACK THEIR SUMMONS //
if (attacker->getPlayer() && target->getCreature()->isSummon())
{
return RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE;
}
// BLOCK THAT THE SUMMONS OF PLAYER(MASTER) CAN'T ATTACK ANOTHER PLAYER //
if (attacker->getCreature()->isSummon() && target->getCreature()->getPlayer())
{
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER;
}
4- Compile your source
It's finish! A simple resource, but useful! Now you can play and be happy 😄.
Last edited: