SHOW:
|
|
- or go back to the newest paste.
1 | - | class example_creature : public CreatureScript |
1 | + | #include "ScriptPCH.h" |
2 | ||
3 | - | public: |
3 | + | class Resurrect_creature : public CreatureScript |
4 | { | |
5 | - | example_creature() |
5 | + | public: |
6 | - | : CreatureScript("example_creature") |
6 | + | Resurrect_creature() : CreatureScript("Resurrect_creature") { } |
7 | ||
8 | struct Resurrect_creatureAI : public ScriptedAI | |
9 | { | |
10 | - | struct example_creatureAI : public ScriptedAI |
10 | + | Resurrect_creatureAI(Creature* creature) : ScriptedAI(creature) {} |
11 | ||
12 | - | example_creatureAI(Creature* creature) : ScriptedAI(creature) {} |
12 | + | void MoveInLineOfSight(Unit* who) |
13 | { | |
14 | - | void MoveInLineOfSight(Unit* who) |
14 | + | if(!me->IsWithinDistInMap(who, 50.0f)) // limit range |
15 | - | { |
15 | + | return; |
16 | - | if(who-> |
16 | + | if(who->GetTypeId() != TYPEID_PLAYER) // check that the unit is player |
17 | - | } |
17 | + | return; |
18 | Player* player = who->ToPlayer(); // transform unit to player type | |
19 | - | }; |
19 | + | if(player->isDead()) // check if he is dead |
20 | player->ResurrectPlayer(100); // resurrect without sickness to 100% | |
21 | - | CreatureAI* GetAI(Creature* creature) const |
21 | + | |
22 | ||
23 | - | return new example_creatureAI(creature); |
23 | + | }; |
24 | ||
25 | CreatureAI* GetAI(Creature* creature) const | |
26 | { | |
27 | return new Resurrect_creatureAI(creature); | |
28 | } | |
29 | }; |