UtherAI(Creature* pCreature) : CreatureAIScript(pCreature) { _unit->GetAIInterface()->addWayPoint(CreateWaypoint(1, 0, Flag_Run)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(2, 0, Flag_Run)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(3, 90000, Flag_Run)); check = true; }
UTHER_AI(Creature* pCreature) : CreatureAIScript(pCreature) { _unit->GetAIInterface()->addWayPoint(CreateWaypoint(1, 0, RUN)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(2, 0, RUN)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(3, 90000, RUN)); check = true; }
Volkhan(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { mInstance = GetInstanceScript(); AddSpell(SPELL_HEAT, Target_WoundedFriendly, 15, 1.5f, 15); mStomp = AddSpell(SPELL_SHATTERING_STOMP, Target_Self, 0, 3, 0 ); mStomp->AddEmote("I will crush you beneath my boots!", Text_Yell, 13963); mStomp->AddEmote("All my work... undone!", Text_Yell, 13964); AddEmote(Event_OnCombatStart, "It is you who have destroyed my children? You... shall... pay!", Text_Yell, 13960); AddEmote(Event_OnTargetDied, "The armies of iron will conquer all!", Text_Yell, 13965); AddEmote(Event_OnTargetDied, "Ha, pathetic!", Text_Yell, 13966); AddEmote(Event_OnTargetDied, "You have cost me too much work!", Text_Yell, 13967); AddEmote(Event_OnDied, "The master was right... to be concerned.", Text_Yell, 13968); m_cVolkhanWP.x = 1328.666870f; m_cVolkhanWP.y = -97.022758f; m_cVolkhanWP.z = 56.675297f; m_cVolkhanWP.o = 2.235341f; SetMoveType( Move_DontMoveWP ); AddWaypoint( CreateWaypoint( 1, 0, Flag_Run, m_cVolkhanWP ) ); mStompTimer = INVALIDATE_TIMER; mPhase = 0; }
ShadeOfTheHorsemanAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { SetCanEnterCombat(false); _unit->SetMount(22653); //Spells mSummon = AddSpell(SHADE_OF_THE_HORSEMAN_SUMMON, Target_Self, 0, 0, 0); //Emotes AddEmote(Event_OnDied, "So eager you are, for my blood to spill. Yet to vanquish me, 'tis my head you must kill!", Text_Yell, 11969); Emote("Prepare yourselves, the bells have tolled! Shelter your weak, your young, and your old! Each of you shall pay the final sum. Cry for mercy, the reckoning has come!", Text_Yell, 11966); //On Spawn? switch(_unit->GetMapMgr()->GetAreaID(_unit->GetPositionX(), _unit->GetPositionY())) { case 87: // Goldshire { WPCount = 30; WayPoints = WaypointGoldshire; } break; } for(int i = 1 ; i <= WPCount ; ++i) { AddWaypoint(CreateWaypoint(i, 0, WayPoints[i].addition, WayPoints[i])); } }
EnslavedNetherwingDrakeAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { Movement::LocationWithFlag WayPoint = { _unit->GetPositionX(), _unit->GetPositionY() + 30, _unit->GetPositionZ() + 100, _unit->GetOrientation(), Movement::WP_MOVE_TYPE_FLY }; SetCanMove(false); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_FEIGN_DEATH | UNIT_FLAG_NOT_ATTACKABLE_2); AddWaypoint(CreateWaypoint(1, 0, WayPoint)); }
EnslavedNetherwingDrakeAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { LocationExtra WayPoint = { _unit->GetPositionX(), _unit->GetPositionY() + 30, _unit->GetPositionZ() + 100, _unit->GetOrientation(), Flag_Fly }; SetCanMove(false); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_FEIGN_DEATH | UNIT_FLAG_NOT_ATTACKABLE_2); AddWaypoint(CreateWaypoint(1, 0, Flag_Fly, WayPoint)); }
ThrallAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { SetWaypointMoveType(Movement::WP_MOVEMENT_SCRIPT_DONTMOVEWP); for (uint8 i = 1; i < MAX_THRALLWP1; ++i) AddWaypoint(CreateWaypoint(i, 0, Movement::WP_MOVE_TYPE_WALK, ThrallWP1[i])); m_currentWp = 0; }
explicit The_Plains_Vision(Creature* pCreature) : CreatureAIScript(pCreature) { WPCount = 22; getCreature()->GetAIInterface()->SetAllowedToEnterCombat(false); for (uint8 i = 1; i < WPCount; ++i) AddWaypoint(CreateWaypoint(i, 0, Movement::WP_MOVE_TYPE_RUN, WaypointPlainVision[i])); }
void SendWaypoint(TRobo *Robot, int x, int y, int z) { char package[BUFFER_SIZE]; int nbytes; int socket; CreateWaypoint(package, &nbytes, x, y, z); socket = get_socket(table, Robot->robot_name); write(socket, package, nbytes); }
ThrallAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { SetMoveType(Move_DontMoveWP); for (uint8 i = 1; i < MAX_THRALLWP1; ++i) AddWaypoint(CreateWaypoint(i, 0, Flag_Walk, ThrallWP1[i])); m_currentWp = 0; }
DeathbringerJovaanAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { mJovaanTimer = INVALIDATE_TIMER; mJovaanPhase = -1; for(int i = 1; i < 5; ++i) { AddWaypoint(CreateWaypoint(i, DeathbringerJovaanWP[i].WaitTime, DeathbringerJovaanWP[i].mCoords.addition, DeathbringerJovaanWP[i].mCoords)); } }
explicit LakkaAI(Creature* pCreature) : CreatureAIScript(pCreature) { SetWaypointMoveType(Movement::WP_MOVEMENT_SCRIPT_NONE); //WPs for (uint8 i = 1; i < 4; ++i) { AddWaypoint(CreateWaypoint(i, 0, LakkaWaypoint[i].wp_flag, LakkaWaypoint[i].wp_location)); } }
WaypointInterface* AIPluginInterface::CreateWaypointNoDuplicates(const osg::Vec3& pos, float radius, const dtDAL::ObjectType& type) { WaypointInterface* result = GetClosestWaypoint(pos, radius); if(result == NULL) { result = CreateWaypoint(pos, type); } return result; }
The_Plains_Vision(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { WPCount = 22; WayPoints = WaypointPlainVision; _unit->GetAIInterface()->SetAllowedToEnterCombat(false); for (int i = 1; i < WPCount; ++i) { AddWaypoint(CreateWaypoint(i, 0, WayPoints[i].addition, WayPoints[i])); } }
DofNaralexAI(Creature* pCreature) : MoonScriptBossAI(pCreature) { // --- Initialization --- for (int i = 1; i < 39; i++) AddWaypoint(CreateWaypoint(i, 0, Flag_Run, ToNaralex[i])); SetMoveType(Move_DontMoveWP); // Awakening Spell Awakening = AddSpell(6271, Target_Self, 0, 0, 0, 0, 0, false, "Step back and be ready!, I'll try to Awake Naralex", Text_Say); SpawnTimer = NULL; }
explicit VHCreatureAI(Creature* pCreature) : CreatureAIScript(pCreature) { //this->CreateWaypoint(1, 0, 0, VH_DOOR_ATTACK_POSITION); //this->SetWaypointToMove(1); //this->MoveTo(VH_DOOR_ATTACK_POSITION.x, VH_DOOR_ATTACK_POSITION.y, VH_DOOR_ATTACK_POSITION.z, true); //_unit->GetAIInterface()->UpdateMove(); for (int i = 1; i < 3; ++i) { AddWaypoint(CreateWaypoint(i, 0, AttackerWP[i].wp_flag, AttackerWP[i].wp_location)); } getCreature()->GetAIInterface()->setWaypointScriptType(Movement::WP_MOVEMENT_SCRIPT_FORWARDTHENSTOP); getCreature()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I am alive!"); }
FellFireFiendAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { _unit->GetAIInterface()->SetAllowedToEnterCombat( false ); Player* randPlr = static_cast<Player*>(GetBestPlayerTarget()); Coords _coord; _coord.mX = randPlr->GetPositionX(); _coord.mY = randPlr->GetPositionY(); _coord.mZ = randPlr->GetPositionZ(); _coord.mO = randPlr->GetOrientation(); AddWaypoint( CreateWaypoint( 1, 0, Flag_Run, _coord ) ); mForceDied = false; };
Waypoint* psPathNetwork::CreateWaypoint(iDataConnection *db, csString& name, csVector3& pos, csString& sectorName, float radius, csString& flags) { Waypoint *wp = CreateWaypoint(name,pos,sectorName,radius,flags); if (!wp->Create(db)) { delete wp; return NULL; } return wp; }
explicit DofNaralexAI(Creature* pCreature) : CreatureAIScript(pCreature) { Mutanus = nullptr; for (uint8 i = 1; i < 39; ++i) { AddWaypoint(CreateWaypoint(i, 0, Movement::WP_MOVE_TYPE_RUN, ToNaralex[i])); } SetWaypointMoveType(Movement::WP_MOVEMENT_SCRIPT_NONE); // Awakening Spell Awakening = addAISpell(6271, 0.0f, TARGET_SELF); Awakening->addEmote("Step back and be ready!, I'll try to Awake Naralex", CHAT_MSG_MONSTER_SAY, 0); SpawnTimer = 0; }
ARTHAS_AI(Creature* pCreature) : CreatureAIScript(pCreature) { _unit->GetAIInterface()->addWayPoint(CreateWaypoint(1, 10500, RUN)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(2, 0, RUN)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(3, 0, RUN)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(4, 0, RUN)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(5, 0, RUN)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(6, 0, RUN)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(7, 0, RUN)); _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_SCRIPTIDLE); _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); phase = 0; }
The_Plains_Vision(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { auto area = _unit->GetArea(); switch (area->id) { case 222: // Mulgore { WPCount = 23; WayPoints = WaypointPlainVision; _unit->GetAIInterface()->SetAllowedToEnterCombat(false); } break; } for (int i = 1; i <= WPCount; ++i) { AddWaypoint(CreateWaypoint(i, 0, WayPoints[i].addition, WayPoints[i])); } }
OnyxiaAI(Creature* pCreature) : CreatureAIScript(pCreature) { m_phase = 1; m_entry = pCreature->GetEntry(); m_useSpell = true; m_eFlamesCooldown = 1; m_whelpCooldown = 7; m_aoeFearCooldown = 30; m_fCastCount = 5; _unit->GetAIInterface()->setMoveType(4); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(1, 2000, Flag_Run)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(2, 0, Flag_Fly)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(3, 0, Flag_Fly)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(4, 0, Flag_Fly)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(5, 0, Flag_Fly)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(6, 0, Flag_Fly)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(7, 0, Flag_Fly)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(8, 0, Flag_Fly)); infoFear = dbcSpell.LookupEntry(AOE_FEAR); infoCleave = dbcSpell.LookupEntry(CLEAVE); infoFBreath = dbcSpell.LookupEntry(FLAME_BREATH); infoKAway = dbcSpell.LookupEntry(KNOCK_AWAY); infoSFireball = dbcSpell.LookupEntry(SCRIPTABLE_FIREBALL); infoWBuffet = dbcSpell.LookupEntry(WING_BUFFET); infoDeepBreath = dbcSpell.LookupEntry(DEEP_BREATH); if (!infoFear || !infoCleave || !infoFBreath || !infoKAway || !infoSFireball || !infoWBuffet || !infoDeepBreath) m_useSpell = false; _unit->GetAIInterface()->setOutOfCombatRange(200000); m_fBreath = false; m_kAway = false; m_wBuffet = false; m_Cleave = false; m_currentWP = 0; }
RandomWaypointPathFinder::DirectionList RandomWaypointPathFinder::ComputePath() { int avatarX = this->_avatar->GetPosition().x / Map::_MAP_SCALE; int avatarY = this->_avatar->GetPosition().y / Map::_MAP_SCALE; DirectionList directions; if (this->_waypoints.size() == 0) { // Create a waypont at the avatar pos node_type * node = new node_type; node->X() = this->_avatar->GetPosition().x / Map::_MAP_SCALE; node->Y() = this->_avatar->GetPosition().y / Map::_MAP_SCALE; if (this->_edgeMap[node->Y()][node->X()] == 0) { node->GetData().dist = abs(node->X() - this->_goalX) + abs(node->Y() - this->_goalY); if (this->_maxDepth < node->GetData().dist) this->_maxDepth = node->GetData().dist; this->_edgeMap[node->Y()][node->X()] = node; this->_nodeList.push_back(node); this->_nbNode++; CreateEdge(this->_map, node); } else delete node; CreateWaypoint(); if (this->_waypoints.size() == 0 && this->_currentGridResolution) { this->_currentGridResolution >>= 1; this->CreateGraph(this->_map, this->_currentGridResolution); CreateEdge(this->_map, this->_edgeMap[this->_goalY][this->_goalX]); std::cout << "Create new waypoint : " << this->_nbNode << " resolution : " << this->_currentGridResolution << std::endl; }