gegge6265 Posted March 29, 2014 Share Posted March 29, 2014 hello! I have a problem with scripting a boss (i'm not going to ask to do the code for me, but why it doesn't work) i used CreatureAI and then i changed into BossAI since i tested archavon and it works, i looked at the code and the difference that i saw is that my old boss had CreatureAI, archavon has BossAI #include "ScriptMgr.h" #include "ObjectMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "Player.h" #include "Vehicle.h" enum Spells { SPELL_PESTATERRA = 106807, SPELL_INSCIMMIATO = 106651, SPELL_ESPLOSIONE_BARILI = 107351, SPELL_BATTLE_SHOUT = 6673 }; class boss_uggaugga : public CreatureScript { public : boss_uggaugga() :CreatureScript("boss_uggaugga") {} CreatureAI* GetAI(Creature* creature) const { return new boss_uggauggaAI(creature); } struct boss_uggauggaAI : public BossAI { boss_uggauggaAI(Creature* creature) : BossAI(creature, 56637) { } //chiamato solo una volta //qua i timer uint32 timer_inscimmiato = 0; uint32 timer_pestaterra = 0; uint32 timer_barili = 0; uint32 timer_shout = 0; uint32 counter = 0; //qua i timer void Reset() OVERRIDE { timer_pestaterra = 10000; timer_shout = 300000; } void EnterCombat(Unit* who) //chiamato solo 1 volta quando inizia il fight { //fallo parlare } void EnterEvadeMode() OVERRIDE { } void ReceiveEmote(Player* /*player*/, uint32 uiTextEmote) OVERRIDE { } void UpdateAI(uint32 uiDiff) OVERRIDE { if (!me->GetVictim()) { if (timer_shout <= uiDiff) { DoCast(me, SPELL_BATTLE_SHOUT, true); timer_shout = 300000; } else timer_shout -= uiDiff; } //fuori combat if (!UpdateVictim()) return; //ora il codice del fight if (((me->GetHealth() / me->GetMaxHealth())*100 <= 90 && counter == 0) || ((me->GetHealth() / me->GetMaxHealth())*100 <= 60 && counter == 1)|| ((me->GetHealth() / me->GetMaxHealth())*100 <= 30 && counter == 2)) { DoCast(me, SPELL_INSCIMMIATO, true); //dopo la spell il boss summona barili.. creare la classe del barile per comandarlo Creature* barile = DoSpawnCreature(56682, 100, 0, 0, me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0); counter++; } if (timer_pestaterra <= uiDiff) { DoCastVictim(SPELL_PESTATERRA, true); timer_pestaterra = urand(6000, 12000); } else timer_pestaterra -= uiDiff; DoMeleeAttackIfReady(); } }; }; class barile : public CreatureScript { public: barile() :CreatureScript("barile") {} CreatureAI* GetAI(Creature* creature) const { return new barileAI(creature); } struct barileAI : public BossAI { barileAI(Creature* creature) : BossAI(creature, 56682) { } // qua i timer void Reset() OVERRIDE { me->GetMotionMaster()->MovePoint(100, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); } void MovementInform(uint32 type, uint32 id) { if (id != 100) return; float x = 0, y = 0; //GetPositionWithDistInOrientation(me, 5.0f, me->GetOrientation(), x, y); me->GetMotionMaster()->MovePoint(100, x, y, me->GetPositionZ()); } bool CheckIfAgainstWall() { float x = 0, y = 0; //GetPositionWithDistInOrientation(me, 5.0f, me->GetOrientation(), x, y); if (!me->IsWithinLOS(x, y, me->GetPositionZ())) return true; return false; } bool CheckIfAgainstUnit() { if (me->SelectNearbyTarget(NULL, 1.0f)) return true; return false; } void DoExplode() { if (Vehicle* barrel = me->GetVehicleKit()) barrel->RemoveAllPassengers(); me->Kill(me); me->CastSpell(me, SPELL_ESPLOSIONE_BARILI, true); } void EnterCombat(Unit* who) //chiamato solo 1 volta quando inizia il fight { //fallo parlare } void EnterEvadeMode() OVERRIDE { } void ReceiveEmote(Player* /*player*/, uint32 uiTextEmote) OVERRIDE { } void UpdateAI(uint32 uiDiff) OVERRIDE { if (CheckIfAgainstWall() || CheckIfAgainstUnit()) DoExplode(); } }; }; void AddSC_boss_uggaugga() { new boss_uggaugga(); new barile(); } Quote Link to comment Share on other sites More sharing options...
gegge6265 Posted March 29, 2014 Author Share Posted March 29, 2014 ok i forgot to put the script in the scriptloader.. LOL sorry XD Quote Link to comment Share on other sites More sharing options...
Admin/Master Developers SkyFire Posted April 3, 2014 Admin/Master Developers Share Posted April 3, 2014 Derp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.