Advertisement
Rochet2

Untitled

Dec 2nd, 2012
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "ScriptPCH.h"
  2.  
  3. class Resurrect_creature : public CreatureScript
  4. {
  5. public:
  6.     Resurrect_creature() : CreatureScript("Resurrect_creature") { }
  7.  
  8.     struct Resurrect_creatureAI : public ScriptedAI
  9.     {
  10.         Resurrect_creatureAI(Creature* creature) : ScriptedAI(creature) {}
  11.  
  12.         void MoveInLineOfSight(Unit* who)
  13.         {
  14.             if(!me->IsWithinDistInMap(who, 50.0f)) // limit range
  15.                 return;
  16.             if(who->GetTypeId() != TYPEID_PLAYER) // check that the unit is player
  17.                 return;
  18.             Player* player = who->ToPlayer(); // transform unit to player type
  19.             if(player->isDead()) // check if he is dead
  20.                 player->ResurrectPlayer(100); // resurrect without sickness to 100%
  21.         }
  22.  
  23.     };
  24.  
  25.     CreatureAI* GetAI(Creature* creature) const
  26.     {
  27.         return new Resurrect_creatureAI(creature);
  28.     }
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement