Guest User

Untitled

a guest
Jun 21st, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #define TESTSAY -1000009
  2. #define TESTSAY2 -1000010
  3. #define TESTSAY3 -1000011
  4. #define TESTSAY4 -1000012
  5.  
  6. struct MANGOS_DLL_DECL beispielAI : public ScriptedAI
  7. {
  8. beispielAI(Creature* pCreature) : ScriptedAI(pCreature) {Reset();}
  9.  
  10. bool HasSaid;
  11. uint32 m_uiSay_Timer;
  12.  
  13. void Reset()
  14. {
  15. HasSaid=false;
  16. }
  17.  
  18. void MoveInLineOfSight(Unit *pWho)
  19. {
  20. if(pWho && !HasSaid)
  21. {
  22. switch(urand(0, 3))
  23. {
  24. case 0: DoScriptText(TESTSAY, m_creature, 0);
  25. HasSaid=true;
  26. m_uiSay_Timer = 5000; break;
  27. case 1: DoScriptText(TESTSAY2, m_creature, 0);
  28. HasSaid=true;
  29. m_uiSay_Timer = 5000; break;
  30. case 2: DoScriptText(TESTSAY3, m_creature, 0);
  31. HasSaid=true;
  32. m_uiSay_Timer = 5000; break;
  33. case 3: DoScriptText(TESTSAY4, m_creature, 0);
  34. HasSaid=true;
  35. m_uiSay_Timer = 5000; break;
  36. }
  37. }
  38. }
  39.  
  40. void UpdateAI(const uint32 uiDiff)
  41. {
  42. if (HasSaid && m_uiSay_Timer < uiDiff)
  43. {
  44. HasSaid=false;
  45. }
  46. else
  47. m_uiSay_Timer -= uiDiff;
  48. }
  49.  
  50. };
  51.  
  52. CreatureAI* GetAI_beispiel_code(Creature* pCreature)
  53. {
  54. return new beispielAI(pCreature);
  55. }
Add Comment
Please, Sign In to add comment