void AIUpdate() { SetAllowMelee(false); SetCanMove(false); timmer++; if (summoningst == true && (timmer == 20 || timmer == 60 || timmer == 100)) { SpawnCreature(CN_SHADOWSWORD_BERSERKER, 1871, 650, 71, 0, false); SpawnCreature(CN_SHADOWSWORD_FURY_MAGE, 1871, 650, 71, 0, false); SpawnCreature(CN_SHADOWSWORD_FURY_MAGE, 1748, 700, 71, 0, false); SpawnCreature(CN_SHADOWSWORD_BERSERKER, 1748, 700, 71, 0, false); } if (timmer == 120) { timmer = 0; summoningst = true; switch (spawnplace) { case 1: { SpawnCreature(CN_VOID_SENTINEL, 1800, 652, 71, 0, false); ++spawnplace; }break; case 2: { SpawnCreature(CN_VOID_SENTINEL, 1798, 605, 71, 0, false); ++spawnplace; }break; case 3: { SpawnCreature(CN_VOID_SENTINEL, 1826, 650, 71, 0, false); ++spawnplace; }break; case 4: { SpawnCreature(CN_VOID_SENTINEL, 1783, 625, 71, 0, false); ++spawnplace; }break; case 5: { SpawnCreature(CN_VOID_SENTINEL, 1816, 595, 71, 0, false); ++spawnplace; }break; case 6: { SpawnCreature(CN_VOID_SENTINEL, 1844, 641, 71, 0, false); spawnplace = 1; }break; } } if (GetHealthPercent() <= 35) { SpawnCreature(CN_ENTROPIUS, true); Despawn(100,0); } ParentClass::AIUpdate(); }
void AIUpdate() { if(Ogre == NULL) return; if(GetRange(Ogre) <= 5) { Ogre->SetDisplayWeaponIds(28562, 0); Ogre->GetUnit()->SetEmoteState(92); Ogre->GetUnit()->SetFaction(35); Ogre->GetUnit()->SetStandState(STANDSTATE_SIT); NdGo = GetNearestGameObject(184315); if(NdGo == NULL) return; NdGo->Despawn(0, 0); Ogre->Despawn(60 * 1000, 3 * 60 * 1000); if(plr == NULL) return; QuestLogEntry* qle = plr->GetQuestLogForEntry(10512); if(qle != NULL && qle->GetMobCount(0) < qle->GetQuest()->required_mobcount[0]) { qle->SetMobCount(0, qle->GetMobCount(0) + 1); qle->SendUpdateAddKill(0); qle->UpdatePlayerFields(); } Despawn(0, 0); return; } ParentClass::AIUpdate(); }
void AIUpdate() { if(plr == NULL || plr->isDead() || !plr->HasAura(FROST_TOMB_SPELL)) Despawn( 0, 0 ); ParentClass::AIUpdate(); };
void OnReachWP(uint32 iWaypointId, bool bForwards) { if (iWaypointId == 1) { Despawn(0, 3*60*1000); } }
void Reset() { CheckTeronTimer = 10000; ShadowBoltTimer = 2000; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); TeronGUID = 0; TeronGUID = pInstance->GetData64(DATA_TERONGOREFIEND); Creature* c_Teron = NULL; if(TeronGUID!= 0) c_Teron = Creature::GetCreature((*me),TeronGUID); if(c_Teron) { me->setFaction(c_Teron->getFaction()); if(c_Teron->getVictim()) { me->Attack(c_Teron->getVictim(),false); DoZoneInCombat(); float x,y,z; me->GetPosition(x,y,z); me->GetMotionMaster()->MovePoint(0,x,y,z+HIGH); }else { Despawn(); } } }
void sstSequence::Update( float timeStep ) { UNUSED(timeStep); // no using of timeStep in this case; we want to use actual times from sysTimer. float musicTime = m_mode->GetMusicTime(); m_currentTransform = GetTransformAtTime( musicTime ); const float c_rocketTime = 3.0f; while ( m_nextBeat < m_beatCount && musicTime + c_rocketTime > m_beat[m_nextBeat] ) { sstRocket *r = m_mode->GetAvailableRocket(); if ( r ) { m_rocket[m_nextBeat] = r; vsTransform2D transformAtImpact = GetTransformAtTime( m_beat[m_nextBeat] ); r->Spawn( transformAtImpact.ApplyTo(m_segment[m_nextBeat].m_position), m_beat[m_nextBeat] - musicTime, this, m_nextBeat ); } m_nextBeat++; } if ( musicTime > m_end ) Despawn(); }
void Summon::OnRemoveInRangeObject(Object* object) { if ((owner != NULL) && (object->GetGUID() == owner->GetGUID())) Despawn(1, 0); Creature::OnRemoveInRangeObject(object); }
void AIUpdate() { if( Ogre == NULL ) return; if( GetRange( Ogre ) <= 5 ) { Ogre->SetDisplayWeaponIds( 28562, 0); Ogre->GetUnit()->SetUInt32Value( UNIT_NPC_EMOTESTATE, 92 ); Ogre->GetUnit()->SetUInt32Value( UNIT_FIELD_FACTIONTEMPLATE, 35 ); Ogre->GetUnit()->SetStandState( STANDSTATE_SIT ); Ogre->GetUnit()->_setFaction(); GameObject *GO = GetNearestGameObject(184315); if( GO ) GO->Despawn(0); Ogre->Despawn(60*1000, 3*60*1000); QuestLogEntry * qle = NULL; if( plr ) qle = plr->GetQuestLogForEntry( 10512 ); if( qle!=NULL && qle->GetMobCount( 0 ) < qle->GetQuest()->required_mobcount[0] ) { qle->SetMobCount( 0, qle->GetMobCount( 0 )+1); qle->SendUpdateAddKill( 0 ); qle->UpdatePlayerFields(); } Despawn(0, 0); } ParentClass::AIUpdate(); }
void OnDied( Unit* pKiller ) { ParentClass::OnDied( pKiller ); if( !mForceDied ) ApplyAura( FELFIRE_FISSION ); Despawn( 10000, 0 ); };
void MoonScriptCreatureAI::OnDied(Unit *pKiller) { RandomEmote(mOnDiedEmotes); CancelAllSpells(); CancelAllTimers(); RemoveAllAuras(); if( mDespawnWhenInactive ) Despawn(DEFAULT_DESPAWN_TIMER); }
void OnDied(Unit* pKilled) { if (plr != NULL && plr->HasAura(FROST_TOMB_SPELL)) plr->RemoveAura(FROST_TOMB_SPELL); ParentClass::OnDied(pKilled); Despawn(1); };
void AIUpdate() { if (KilJaedan->GetHealthPercent() <= 25) { //die Despawn(100,0); } ParentClass::AIUpdate(); }
CoreHoundAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { if(IsMagmadarDead[_unit->GetInstanceID()] == true) { Despawn(0, 0); return; } AddSpell(COREHOUND_SERRATEDBITE, Target_RandomPlayer, 10, 0, 0, 0, 10); }
void UpdateAI(const uint32 diff) { if(CheckTeronTimer < diff) { Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID)); if(Teron && Teron->isInCombat()) { DoZoneInCombat(); Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID)); if((Teron) && (!Teron->isAlive() || Teron->IsInEvadeMode())) Despawn(); float newX, newY, newZ; m_creature->GetRandomPoint(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(), 3.0, newX, newY, newZ); newZ = (newZ < 200.0) ? (newZ + 1.0) : newZ; m_creature->GetMotionMaster()->MovePoint(1, newX, newY, newZ); m_creature->SetSpeed(MOVE_RUN, 0.1); } else Despawn(); CheckTeronTimer = 5000; } else CheckTeronTimer -= diff; if(ShadowBoltTimer < diff) { Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID)); if(!Teron) return; if(Unit *target = ((ScriptedAI*)Teron->AI())->SelectUnit(SELECT_TARGET_RANDOM, 0, 200, true)) DoCast(target, SPELL_SHADOWBOLT); ShadowBoltTimer = 1500+rand()%1000; } else ShadowBoltTimer -= diff; return; }
void MoonScriptCreatureAI::OnCombatStop(Unit *pTarget) { CancelAllSpells(); CancelAllTimers(); RemoveAllAuras(); SetCanMove(true); SetBehavior(Behavior_Default); if( mDespawnWhenInactive ) Despawn(DEFAULT_DESPAWN_TIMER); }
void ArcScriptCreatureAI::OnCombatStop(Unit* pTarget) { CancelAllSpells(); CancelAllTimers(); RemoveAllAuras(); SetBehavior(Behavior_Default); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); if( mDespawnWhenInactive ) Despawn(DEFAULT_DESPAWN_TIMER); }
void MoonScriptCreatureAI::OnCombatStop(Unit* pTarget) { CancelAllSpells(); CancelAllTimers(); RemoveAllAuras(); SetCanMove(true); SetBehavior(Behavior_Default); //_unit->GetAIInterface()->SetAIState(STATE_IDLE); // Fix for stucking mobs that don't regen RemoveAIUpdateEvent(); if( mDespawnWhenInactive ) Despawn(DEFAULT_DESPAWN_TIMER); }
void OnLoad() { SetCanEnterCombat(false); SetCanMove(false); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Despawn(4500, 0); RegisterAIUpdateEvent(500); m_part = 0; ParentClass::OnLoad(); };
void AIUpdate() { if(IsTimerFinished(mRazuunTimer)) { switch(mRazuunPhase) { case 0: { _unit->Emote(EMOTE_ONESHOT_TALK); _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Doom Lord Kazzak will be pleased. You are to increase the pace of your attacks. Destroy the orcish and dwarven strongholds with all haste."); mRazuunPhase = 1; ResetTimer(mRazuunTimer, 9000); } break; case 1: { _unit->Emote(EMOTE_ONESHOT_TALK); _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Don't worry about that. I've increased production at the Deathforge. You'll have all the infernals you need to carry out your orders. Don't fail, Jovaan."); mRazuunPhase = 2; ResetTimer(mRazuunTimer, 15000); } break; case 2: { _unit->Emote(EMOTE_ONESHOT_QUESTION); _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Yes?"); mRazuunPhase = 3; ResetTimer(mRazuunTimer, 8000); } break; case 3: { _unit->Emote(EMOTE_ONESHOT_QUESTION); _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Crate? I didn't send you a crate, Jovaan. Don't you have more important things to worry about? Go see to them!"); mRazuunPhase = 4; ResetTimer(mRazuunTimer, 5000); } break; case 4: { mRazuunPhase = -1; RemoveTimer(mRazuunTimer); Despawn(0, 0); return; } break; } } ParentClass::AIUpdate(); }
void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; if (id == 57) { Despawn(); return; } ++CurrWP; ContinueWP = true; }
void Reset() { Map* pMap = me->GetMap(); if (pMap && pMap->IsDungeon()) { bReset=true; Map::PlayerList const &players = pMap->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if(itr->getSource()) if(itr->getSource()->isAlive()) bReset=false; } } Despawn(); uiAttackTimer = 3500; }
void Creature::OnRemoveInRangeObject(Object* pObj) { if(totemOwner == pObj) // player gone out of range of the totem { // Expire next loop. event_ModifyTimeLeft(EVENT_TOTEM_EXPIRE, 1); } if(m_escorter == pObj) { // we lost our escorter, return to the spawn. m_aiInterface->StopMovement(10000); DestroyCustomWaypointMap(); Despawn(1000, 1000); } Unit::OnRemoveInRangeObject(pObj); }
void Reset() { float x, y, z; me->GetPosition(x, y, z); //this visual aura some under ground me->SetPosition(x, y, z + 0.35f, 0.0f); Despawn(); Creature* debuff = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 14500); if (debuff) { debuff->SetDisplayId(me->GetDisplayId()); debuff->CastSpell(debuff, SPELL_PUMPKIN_AURA_GREEN, false); CAST_AI(mob_wisp_invis::mob_wisp_invisAI, debuff->AI())->SetType(1); debuffGUID = debuff->GetGUID(); } sprouted = false; DoCast(me, SPELL_PUMPKIN_AURA, true); DoCast(me, SPELL_SPROUTING); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); }
void OnReachWP(uint32 iWaypointId, bool bForwards) { switch(iWaypointId) { case 3: { RegisterAIUpdateEvent(1000); _unit->Emote(EMOTE_ONESHOT_POINT); mJovaanPhase = 0; mJovaanTimer = AddTimer(1500); } break; case 4: { Despawn(1, 0); } break; } }
AncientCoreHoundAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { if(IsMagmadarDead[_unit->GetInstanceID()] == true) { Despawn(0, 0); return; } AddSpell(ACHOUND_LAVA_BREATH, Target_Self, 20, 0, 3); AddSpell(ACHOUND_VICIOUS_BITE, Target_Self, 20, 0, 0); switch( RandomUInt(5) ) { case 0: AddSpell(ACHOUND_GROUND_STOMP, Target_Self, 20, 0, 15); break; case 1: AddSpell(ACHOUND_ANCIENT_DREAD, Target_Self, 20, 0, 15); break; case 2: AddSpell(ACHOUND_ANCIENT_DESPAIR, Target_Self, 20, 0, 15); break; case 3: AddSpell(ACHOUND_CAUTERIZING_FLAMES, Target_Self, 20, 0, 15); break; case 4: AddSpell(ACHOUND_WITHERING_HEAT, Target_Self, 20, 0, 15); break; case 5: AddSpell(ACHOUND_ANCIENT_HYSTERIA, Target_Self, 20, 0, 15); break; } }
void Creature::RemoveFromWorld(bool addrespawnevent, bool free_guid) { RemoveAllAuras(); if(IsPet()) /* Is a pet: IsPet() actually returns false on a pet? o_X */ { if(IsInWorld()) Unit::RemoveFromWorld(true); SafeDelete(); return; } if(IsInWorld()) { uint32 delay = 0; if(addrespawnevent && proto && proto->RespawnTime > 0) delay = proto->RespawnTime; Despawn(0, delay); } }
PurifyingTotemAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { SetCanEnterCombat( false ); SetCanMove( false ); Despawn(8000, 0); }
void CMobController::DoRoamTick(time_point tick) { // If there's someone on our enmity list, go from roaming -> engaging if (PMob->PEnmityContainer->GetHighestEnmity() != nullptr && !(PMob->m_roamFlags & ROAMFLAG_IGNORE)) { Engage(PMob->PEnmityContainer->GetHighestEnmity()->targid); return; } else if (PMob->m_OwnerID.id != 0 && !(PMob->m_roamFlags & ROAMFLAG_IGNORE)) { // i'm claimed by someone and need hate towards this person PTarget = (CBattleEntity*)PMob->GetEntity(PMob->m_OwnerID.targid, TYPE_PC | TYPE_MOB | TYPE_PET); battleutils::ClaimMob(PMob, PTarget); Engage(PTarget->targid); return; } //#TODO else if (PMob->GetDespawnTime() > time_point::min() && PMob->GetDespawnTime() < m_Tick) { Despawn(); return; } if (PMob->m_roamFlags & ROAMFLAG_IGNORE) { // don't claim me if I ignore PMob->m_OwnerID.clean(); } //skip roaming if waiting if (m_Tick >= m_WaitTime) { // don't aggro a little bit after I just disengaged PMob->m_neutral = PMob->CanBeNeutral() && m_Tick <= m_NeutralTime + 10s; if (PMob->PAI->PathFind->IsFollowingPath()) { FollowRoamPath(); } else if (m_Tick >= m_LastActionTime + std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_ROAM_COOL))) { // lets buff up or move around if (PMob->CalledForHelp()) { PMob->CallForHelp(false); } // can't rest with poison or disease if (PMob->CanRest()) { // recover 10% health if (PMob->Rest(0.1f)) { // health updated PMob->updatemask |= UPDATE_HP; } if (PMob->GetHPP() == 100) { // at max health undirty exp PMob->m_giveExp = true; } } // if I just disengaged check if I should despawn if (PMob->IsFarFromHome()) { if (PMob->CanRoamHome() && PMob->PAI->PathFind->PathTo(PMob->m_SpawnPoint)) { // walk back to spawn if too far away // limit total path to just 10 or // else we'll move straight back to spawn PMob->PAI->PathFind->LimitDistance(10.0f); FollowRoamPath(); // move back every 5 seconds m_LastActionTime = m_Tick - (std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_ROAM_COOL)) + 10s); } else if (!PMob->getMobMod(MOBMOD_NO_DESPAWN) != 0 && !map_config.mob_no_despawn) { PMob->PAI->Despawn(); return; } } else { if (PMob->getMobMod(MOBMOD_SPECIAL_SKILL) != 0 && m_Tick >= m_LastSpecialTime + std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_SPECIAL_COOL)) && TrySpecialSkill()) { // I spawned a pet } else if (PMob->GetMJob() == JOB_SMN && CanCastSpells() && PMob->SpellContainer->HasBuffSpells() && m_Tick >= m_LastMagicTime + std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_MAGIC_COOL))) { // summon pet CastSpell(PMob->SpellContainer->GetBuffSpell()); } else if (CanCastSpells() && dsprand::GetRandomNumber(10) < 3 && PMob->SpellContainer->HasBuffSpells()) { // cast buff CastSpell(PMob->SpellContainer->GetBuffSpell()); } else if ((PMob->m_roamFlags & ROAMFLAG_AMBUSH)) { //#TODO: #AIToScript move to scripts // stay underground PMob->HideName(true); PMob->HideModel(true); PMob->animationsub = 0; PMob->updatemask |= UPDATE_HP; } else if ((PMob->m_roamFlags & ROAMFLAG_STEALTH)) { // hidden name PMob->HideName(true); PMob->Untargetable(true); PMob->updatemask |= UPDATE_HP; } else if (PMob->m_roamFlags & ROAMFLAG_EVENT) { // allow custom event action luautils::OnMobRoamAction(PMob); m_LastActionTime = m_Tick; } else if (PMob->CanRoam() && PMob->PAI->PathFind->RoamAround(PMob->m_SpawnPoint, PMob->GetRoamDistance(), PMob->getMobMod(MOBMOD_ROAM_TURNS), PMob->m_roamFlags)) { //#TODO: #AIToScript (event probably) if (PMob->m_roamFlags & ROAMFLAG_WORM) { // move down PMob->animationsub = 1; PMob->HideName(true); // don't move around until i'm fully in the ground Wait(2s); } else { FollowRoamPath(); } } else { m_LastActionTime = m_Tick; } } } } if (m_Tick >= m_LastRoamScript + 3s) { luautils::OnMobRoam(PMob); m_LastRoamScript = m_Tick; } }
void OnDied(Unit * mKiller) { Despawn(100,0); ParentClass::OnDied(mKiller); }
void OnDied(Unit * mKiller) { _unit->CastSpell(_unit, dbcSpell.LookupEntry(SPELL_FELFIRE_FISSION), true); Despawn(100,0); ParentClass::OnDied(mKiller); }