• 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!

Feature [TFS 1.X] Player Can't Attack Their Summons and Their Summons Can't Attack Another Player

Yan18

Member
Joined
Jun 14, 2014
Messages
104
Solutions
3
Reaction score
17


*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:
@Yan18 can u teach me how to change it into summons not attacking owner or party members and viceversa?
 

*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 😄.

I just tried it on tfs 1.5 nekiro 860 and it had no effect
 
Back
Top