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; }
void Monster::doAttacking(uint32_t interval)
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; } } }
- Monstro não atacando jogador com X storage
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
<event type="target" name="blockTarget" event="script" value="nome_do_arquivo.lua"/>
</monster>
<script> <event name="blockTarget"/> </script>