posso usar pra fazer pra que um monstro ataque apenas certo monstro com tal storage, tb tipo o target fica sempre num monstro?
edit erro nessa linha
if(Creature* creature = attackedCreature->getCreature()![]()
não seria
if(Creature* creature = attackedCreature->getCreature())










info
Grupo: Herói
Registrado: 20/09/12
Posts: 2.6k
Reputação: +1.1k
Gênero: Masculino
Serei breve: com esta pequena modificação, o creatureevent onTarget poderá ser executado por monstros.
Nas sources do seu servidor, abra o arquivo monster.cpp e procure por:
if(it == targetList.end()) { //Target not found in our target list. #ifdef __DEBUG__ std::cout << "Target not found in targetList." << std::endl; #endif return false; }CreatureEventList targetEvents = getCreatureEvents(CREATURE_EVENT_TARGET); for(CreatureEventList::iterator it = targetEvents.begin(); it != targetEvents.end(); ++it) { if(!(*it)->executeTarget(this, creature)) return false; }if(!attackedCreature || (isSummon() && attackedCreature == this)) return;if(Creature* creature = attackedCreature->getCreature()) { CreatureEventList targetEvents = getCreatureEvents(CREATURE_EVENT_TARGET); for(CreatureEventList::iterator it = targetEvents.begin(); it != targetEvents.end(); ++it) { if(!(*it)->executeTarget(this, creature)) { setFollowCreature(NULL); setAttackedCreature(NULL); searchTarget(TARGETSEARCH_NEAREST); break; } } }data/creaturescripts/scripts:
local storage = xxx function onTarget(cid, target) if isMonster(cid) and isPlayer(target) and getPlayerStorageValue(target, storage) > -1 then return false end return true end<script> <event name="blockTarget"/> </script>Editado Setembro 7 por zipter98