Advertisement
Kevick

PASSIVA E AGRESSIVA

May 22nd, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1.  
  2. No seu arquivo monster.h, procure por isso:
  3.  
  4. bool isHostile() {return mType->isHostile;}
  5.  
  6. Troque por:
  7. bool isHostile() const {
  8. std::string value;
  9. if(!getStorage("hostile", value))
  10. return mType->isHostile;
  11.  
  12. return booleanString(value);
  13. }
  14.  
  15. No seu monster.cpp, procure por:
  16.  
  17. Monster::selectTarget
  18. Abaixo de:
  19. if(!isTarget(creature))
  20. return false;
  21. Adicione:
  22. if(!isHostile())
  23. return false;
  24.  
  25. Crie um arquivo chamado passive_system.lua no diretório creaturescripts/scripts, cole isso:
  26.  
  27. PASSIVE_BEHAVIOR = {"Deer", "Rabbit"} -- Aqui ficam os monstros que não atacam, mesmo que atacados.
  28. function onCombat(cid, target)
  29. if isMonster(target) then
  30. if not isInArray(PASSIVE_BEHAVIOR, getCreatureName(target)) then
  31. doCreatureSetStorage(target, "hostile", 1)
  32. end
  33. doMonsterSetTarget(target, cid)
  34. end
  35. return true
  36. end
  37.  
  38. No arquivo login.lua:
  39.  
  40. registerCreatureEvent(cid, "PassiveSystem")
  41.  
  42. No arquivo creaturescripts.xml:
  43.  
  44. <event type="combat" name="PassiveSystem" event="script" value="passive_system.lua"/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement