Advertisement
Rochet2

Fixed script

Apr 25th, 2012
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "ScriptPCH.h"
  2.  
  3. enum eNums
  4. {
  5.     SPELL_ICEARMOR = 36881,
  6.     SPELL_FROSTBOLT = 59251,
  7.     SPELL_PESTILENCE = 50842,
  8.     SPELL_ENRAGE = 54287
  9.  
  10. };
  11.  
  12. class example : public CreatureScript
  13. {
  14.     public:
  15.     example() : CreatureScript("example"){}
  16.  
  17.     struct exampleAI : public ScriptedAI
  18.     {
  19.         exampleAI(Creature *c) : ScriptedAI(c) {} // typo found in Creature
  20.  
  21.         uint32 Icearmor_Timer;
  22.         uint32 Frostbolt_Timer;
  23.         uint32 Pestilence_Timer;
  24.         uint32 Enrage_Timer;
  25.         uint32 Phase; // Defined Phase
  26.  
  27.         void Reset()
  28.         {
  29.             Icearmor_Timer = 0;
  30.             Frostbolt_Timer = 0;
  31.             Pestilence_Timer = 5000;
  32.             Enrage_Timer = 1500;
  33.                
  34.             Phase = 1; // Phase was undefined
  35.         }
  36.  
  37.         void KilledUnit(Unit * /*victim*/)
  38.         {
  39.         }
  40.            
  41.         void JustDied(Unit * /*victim*/)
  42.         {
  43.         }
  44.  
  45.         void EnterCombat(Unit * /*who*/)
  46.         {
  47.             me->MonsterYell("if you see this then it works good job!", LANG_UNIVERSAL, NULL); // fixed typo in function name
  48.         }
  49.  
  50.         void UpdateAI(const uint32 uiDiff)
  51.         {
  52.             if (!me->getVictim())
  53.             {
  54.                 if (Icearmor_Timer <= uiDiff)
  55.                 {
  56.                     DoCast(me, SPELL_ICEARMOR);
  57.                     Icearmor_Timer = 18000000;
  58.                 }
  59.                 else
  60.                     Icearmor_Timer -= uiDiff;
  61.             }
  62.                
  63.             if (!UpdateVictim())
  64.                 return;
  65.                
  66.             if (Enrage_Timer <= uiDiff) // fixed typo in uiDiff
  67.             {
  68.                 DoCast(me, SPELL_ENRAGE);
  69.             }
  70.  
  71.             if (Phase == 1 && me->GetHealthPct() <= 55) // fixed () error and made it simpler
  72.             {
  73.                 Phase = 2;
  74.             }
  75.                        
  76.             if (Phase == 1) // Fixed typo in Phase
  77.             {
  78.                        
  79.                 if (Frostbolt_Timer <= uiDiff)
  80.                 {
  81.                         DoCast(me->getVictim(), SPELL_FROSTBOLT);
  82.                         Frostbolt_Timer = 3000;
  83.                 }
  84.                 else
  85.                         Frostbolt_Timer -= uiDiff;
  86.                 if (Pestilence_Timer <= uiDiff) // Deleted ; causing errors
  87.                 {
  88.                     if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) // Fixed typo in pTarget and fixed SelectTarget function
  89.                         DoCast(pTarget, SPELL_PESTILENCE);
  90.                     Pestilence_Timer = 10000;
  91.                 }
  92.                 else
  93.                     Pestilence_Timer -= uiDiff;
  94.             }
  95.                            
  96.             if (Phase == 2)
  97.             {
  98.                 DoCast(me->getVictim(), SPELL_FROSTBOLT);
  99.                 Frostbolt_Timer = 3000; // missing ;
  100.             }
  101.             else
  102.                 Frostbolt_Timer -= uiDiff; // uiDiff typo
  103.             DoMeleeAttackIfReady(); // not inside a hook, fixed
  104.         }
  105.        
  106.         CreatureAI* GetAI_example(Creature* pCreature) const // was possibly in wrong place
  107.         {
  108.             return new exampleAI(pCreature);
  109.         };
  110.     };
  111. };
  112.  
  113. void AddSC_example()
  114. {
  115.     new example();
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement