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( 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; };