GhostWD
I'm in love with the var_dump()
- Joined
- Jan 25, 2009
- Messages
- 185
- Solutions
- 6
- Reaction score
- 29
Hi there,
I've got problem to solve, idk how to refere to attacker at isTarget method in monster.cpp
Bolded code must check if player(attacker) have storage value if yes = true
Thank's in advance for helping with that!
Ok i have better approache to this problem when i will be back at home i will edit this post with results
now i've got this code and when player with storage 8000, 1 is in range of mobster it's attacked by him and even if storage 8000 is ~= 1 still attacking exception is if player have storage 8000, -1 then monster is not attacking(like i want too make for other values than 1) TFS 0.4
I've got problem to solve, idk how to refere to attacker at isTarget method in monster.cpp
Code:
bool Monster::isTarget(Creature* creature)
{
if(creature->isSagaMonster()){
return (!creature->isRemoved() && creature->isAttackable() && (creature->isSagaMonster() && [b]getStorage(8000, creature->sagaNumber)[/b]) && creature->getZone() != ZONE_PROTECTION
&& canSeeCreature(creature) && creature->getPosition().z == getPosition().z);
}else{
return (!creature->isRemoved() && creature->isAttackable() && creature->getZone() != ZONE_PROTECTION
&& canSeeCreature(creature) && creature->getPosition().z == getPosition().z);
}
}
Thank's in advance for helping with that!
Ok i have better approache to this problem when i will be back at home i will edit this post with results
Code:
bool Monster::isOpponent(const Creature* creature)
{
std::string keyes = "8000";
std::string valueses = "1";
//std::string value = sagaNumber();
// && creature->getStorage("8000", value)
if(!creature->getStorage(keyes, valueses)){
return false;
}
if(creature->getStorage(keyes, valueses)){
std::string keyes = "8000";
std::string valueses = "1";
return (isSummon() && master->getPlayer() && creature != master) || ((creature->getPlayer()
&& !creature->getPlayer()->hasFlag(PlayerFlag_IgnoredByMonsters) && creature->getStorage(keyes , valueses)) ||
(creature->getMaster() && creature->getPlayerMaster()));
}
return (isSummon() && master->getPlayer() && creature != master) || ((creature->getPlayer()
&& !creature->getPlayer()->hasFlag(PlayerFlag_IgnoredByMonsters)) ||
(creature->getMaster() && creature->getPlayerMaster()));
getstorage func is
bool Creature::getStorage(const std::string& key, std::string& value) const
{
StorageMap::const_iterator it = storageMap.find(key);
if(it != storageMap.end())
{
value = it->second;
return true;
}
value = "-1";
return false;
}
}
now i've got this code and when player with storage 8000, 1 is in range of mobster it's attacked by him and even if storage 8000 is ~= 1 still attacking exception is if player have storage 8000, -1 then monster is not attacking(like i want too make for other values than 1) TFS 0.4
Last edited: