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

How can I use isSummon in C++?

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
i have this function in my sources:

Player* player = attackedCreature->getPlayer();
std::string value;
std::string check = "1";
if (getName() == "Rat" && player && ( !(player->getStorage("400",value)) || check != value ) )
{
setFollowCreature(NULL);
setAttackedCreature(NULL);
searchTarget(TARGETSEARCH_NEAREST);

}


If a player have storage 400 and value 1, the monster Rat will atack a player [OK]
If a player have storage 400 and value different 1, the monster rat dont attack a player [OK]
but if the player have a summon, the rat will attack the summon, Independent if player have or not a storage 400!

How can I change this script to monster rat check if target is a summon, and if is a summon, dont attack?
 
This is possible through Lua. I find it hard to believe that adding something content related like that will benefit the general tfs "code base" since you're not exactly adding any maintainable or reusable code. Therefore, for purposes like these, use Lua.
 
Should it attack the summon or not?
This is possible through Lua. I find it hard to believe that adding something content related like that will benefit the general tfs "code base" since you're not exactly adding any maintainable or reusable code. Therefore, for purposes like these, use Lua.

in the script, the monster Rat can attack a player summon... how i can change for monster can't attack a summon of a player?

edit: if use in lua
if isSummon (target) then
return false
end

it doesn't work!
 
use attackedCreature->getMaster and check if the master is player and check the storage of this player (the master). (You really should do that in lua w/e maybe create a new event for that purpose of searching targets.).
 
use attackedCreature->getMaster and check if the master is player and check the storage of this player (the master). (You really should do that in lua w/e maybe create a new event for that purpose of searching targets.).
pode montar a função pra mim?
 
Back
Top