All pastes #770710 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-12 15:04 UTC
rendered paste body
    void OnDied(Unit * mKiller)
    {
	voidvalker = voidwalker + 1;   // make the voidwalker death count
	RegisterAIUpdateEvent(400);    // open the door when 4 void have died
    }

	void AIUpdate()
	{
	   if(voidwalker == 4)    // open door after 4 voids have died
	   {
			GameObject *pDoor = _unit->GetMapMgr()->GetInterface()->GetObjectNearestCoords<GameObject, TYPEID_GAMEOBJECT>(
            18972, -129.034f, 2166.16f, 129.187f);
			if(pDoor == 0)
		        return;
		    pDoor->SetUInt32Value(GAMEOBJECT_FLAGS, 1);
			pDoor->SetUInt32Value(GAMEOBJECT_STATE, 0);
			voidwalker = 0;    // to reset voidwalker
			RemoveAIUpdateEvent();
	   }
	   RemoveAIUpdateEvent();
	}
protected:
int voidwalker;

};