[Question] scripting Ahune

Hi all,

I try to make a script to the Midsummer fire festival’s Ahune boss, but I have some problems.

I watch a few videos and read some stuffs about the fight, so I figured out its a bit like XT’s script from Ulduar.

So I used it for a sample. But Im not sure this is the best way to do that, so I have some questions about that.

I used it because I dont know how other way can I refer to a script summoned creature. If anyone has any suggestion, I love to hear it.

Anyway, I have a problem with this solution too.

I made a compileable code, but it isnt work, maybe i massed up with the flags, or i left something out, i dont no.

But there’s the code and the sql for the creatures, it’s probably not perfect, but it have to work eventually.

Please dont judge me for this /emoticons/default_biggrin.png

So there’s the code:

[CODE]/*

  • Copyright (C) 2008-2011 TrinityCore http://www.trinitycore.org/

  • Copyright (C) 2006-2009 ScriptDev2 https://scriptdev2.svn.sourceforge.net/

  • This program is free software; you can redistribute it and/or modify it

  • under the terms of the GNU General Public License as published by the

  • Free Software Foundation; either version 2 of the License, or (at your

  • option) any later version.

  • This program is distributed in the hope that it will be useful, but WITHOUT

  • ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

  • FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for

  • more details.

  • You should have received a copy of the GNU General Public License along

  • with this program. If not, see http://www.gnu.org/licenses/.

*/

/* ScriptData

SDName: Boss_Ahune

SD%Complete: 80

SDComment:

SDCategory: Slave Pens / Midsummer fest event

EndScriptData */

#include “ScriptPCH.h”

enum Spells

{

SPELL_SUM_VISUAL	= 45937,

SPELL_AHUNES_SHIELD	= 45954,

SPELL_COLD_SLAP		= 46198,

SPELL_ICE_SPEAR		= 0,

SPELL_FROST_AURA	= 45937,

SPELL_BONFIRE		= 45930,

SPELL_AHUNE_GHOST	= 46809,


SPELL_SUMM_CHEST	= 46622,

};

enum Minions

{

NPC_AHUNITE_HAILSTONE	= 25755,

NPC_AHUNITE_FROSTWIND	= 25757,

NPC_AHUNTIE_COLD_WAVE	= 25756,

};

enum Phases

{

PHASE_1		= 1,

PHASE_2		= 2,

};

enum Timers

{

TIMER_COLD_SLAP		= 500,

TIMER_ICE_SPEAR		= 6000,

TIMER_SUMM_ADDS		= 5000,

TIMER_SUMM_MINION	= 20000,

TIMER_SUBMERGE		= 90000,

TIMER_MERGE		= 25000,

};

enum Encounters

{

BOSS_AHUNE		= 1,

};

const Position Pos[3] =

{

{-98.27f, -215.39f, -1.27f, 1.46f},

{-90.66f, -208.18f, -1.14f, 1.74f},

{-103.97f, -208.33f, -1.28f, 1.59f},

};

class boss_ahune : public CreatureScript

{

public:

	boss_ahune() : CreatureScript("boss_ahune") { }


	struct boss_ahuneAI : public BossAI

	{

		boss_ahuneAI(Creature *pCreature) : BossAI(pCreature, BOSS_AHUNE), vehicle(me->GetVehicleKit())

        {

			me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);

			me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_GRIP, true);

			me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);

        }


		Phases phase;

		Vehicle *vehicle;


		uint32 uiColdSlapTimer;

		uint32 uiIceSpearTimer;

		uint32 uiSummAddsTimer;

		uint32 uiSummMinionTimer;

		uint32 uiSubmergeTimer;

		uint32 uiMergeTimer;



		void Reset()

		{

			_Reset();

			phase = PHASE_1;

			vehicle->Reset();


		};


		void JustDied(Unit * /*victim*/) 

		{

			_JustDied();

			DoCast(me,SPELL_SUMM_CHEST,true);

		};


		void EnterCombat(Unit* /*pWho*/)

		{

			_EnterCombat();

			phase = PHASE_1;

			DoZoneInCombat();

			DoCast(me,SPELL_SUM_VISUAL,true);

			DoCast(me,SPELL_AHUNES_SHIELD,true);

			me->SetReactState(REACT_AGGRESSIVE);


			uiColdSlapTimer = TIMER_COLD_SLAP;

			uiIceSpearTimer = TIMER_ICE_SPEAR;

			uiSummAddsTimer = TIMER_SUMM_ADDS;

			uiSummMinionTimer = TIMER_SUMM_MINION;

			uiSubmergeTimer = TIMER_SUBMERGE;

			uiMergeTimer = TIMER_MERGE;


		};


		void DamageTaken(Unit *pDone, uint32 &damage)

		{

			if (Unit *pFrozenCore = vehicle->GetPassenger(0))

			{

				if (damage > me->GetHealth())

					damage = me->GetHealth();


				if (pDone)

					pDone->DealDamage(pFrozenCore, damage);

			}

		}


		void UpdateAI(const uint32 diff)

		{


			if (!UpdateVictim())

				return;


			if (phase == PHASE_1)

			{

				if (uiColdSlapTimer <= diff)

				{

					if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0, 8, true))

						DoCast(pTarget, SPELL_COLD_SLAP);


					uiColdSlapTimer = TIMER_COLD_SLAP;


				} else uiColdSlapTimer -= diff;

				/*			//not yet implemented

				if (uiIceSpearTimer <= diff)

				{

					if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80, true))

						DoCast(pTarget, SPELL_ICE_SPEAR);


					uiIceSpearTimer = TIMER_ICE_SPEAR;


				} else uiIceSpearTimer -= diff;

				*/

				if (uiSummAddsTimer <= diff)

				{

					me->SummonCreature(NPC_AHUNITE_FROSTWIND, Pos[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);

					me->SummonCreature(NPC_AHUNTIE_COLD_WAVE, Pos[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);


					uiSummAddsTimer = TIMER_SUMM_ADDS;


				} else uiSummAddsTimer -= diff;


				if (uiSummMinionTimer <= diff)

				{

					me->SummonCreature(NPC_AHUNITE_HAILSTONE, Pos[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);


					uiSummMinionTimer = TIMER_SUMM_MINION;


				} else uiSummMinionTimer -= diff;


				if (uiSubmergeTimer <= diff)

				{

					//set p2

					phase = PHASE_2;

					DoCast(me,SPELL_BONFIRE,true);


					//set ahune untouchable

					me->AttackStop();

					me->SetReactState(REACT_PASSIVE);

					me->InterruptNonMeleeSpells(false);

					me->setFaction(35);

					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

					me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);

					me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);


					//expose core

					if (Unit *FrozenCore = vehicle->GetPassenger(0))

						FrozenCore->ToCreature()->AI()->DoAction(0);


					uiSubmergeTimer = TIMER_SUBMERGE;


				} else uiSubmergeTimer -= diff;

			}

			else

			{

				if (uiMergeTimer <= diff)

				{

					//set p1

					phase = PHASE_1;


					//set ahune touchable again

					me->SetReactState(REACT_AGGRESSIVE);

					me->setFaction(14);

					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

					me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);

					me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);


					//unexpose core

					if (Unit *FrozenCore = vehicle->GetPassenger(1))

						FrozenCore->ToCreature()->AI()->DoAction(1);


					uiMergeTimer = TIMER_MERGE;


				} else uiMergeTimer -= diff;

			}


			DoMeleeAttackIfReady();


		}


	};


    CreatureAI* GetAI(Creature* pCreature) const

    {

        return new boss_ahuneAI(pCreature);

    }

};

class npc_frozen_core : public CreatureScript

{

public:

	npc_frozen_core() : CreatureScript("npc_frozen_core") { }


	struct npc_frozen_coreAI : public ScriptedAI

	{

		npc_frozen_coreAI(Creature* pCreature) : ScriptedAI(pCreature)

        {

			me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);

			me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_GRIP, true);

        }



		void Reset()

		{

			me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);

		};


		void JustDied(Unit * /*victim*/) 

		{

			me->DespawnOrUnsummon();

		};


		void EnterCombat(Unit* /*pWho*/)

		{;

			me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);

		};


		void DamageTaken(Unit *pDone, uint32 &damage)

		{

			if (Unit *pAhune = me->ToTempSummon()->GetSummoner())

				{

					if (damage > me->GetHealth())

						damage = me->GetHealth();


					if (pDone)

						pDone->DealDamage(pAhune, damage);

				}

			DoCast(me,SPELL_AHUNE_GHOST);

		};


		void DoAction(const int32 action)

		{

			if (action == 0)

			{

				me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

				me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

				me->ChangeSeat(1);

			}


			if (action == 1)

			{

				me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);

				me->ChangeSeat(0);

			}

		};


	};


    CreatureAI* GetAI(Creature* pCreature) const

    {

        return new npc_frozen_coreAI(pCreature);

    }

};

void AddSC_boss_ahune()

{

new boss_ahune();

new npc_frozen_core();

}[/CODE]

and the sql

[CODE]INSERT INTO creature_template (entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName, WDBVerified) VALUES

	('25740','0','0','0','0','0','23344','0','0','0','Ahune','The Frost Lord','','0','82','82','2','14','14','0','1.2','1.14286','1','1','650','1125','0','320','3.2','2000','0','1','32832','8','0','0','0','0','0','0','0','0','4','108','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','353','0','0','','0','1','40','1','1','0','0','0','0','0','0','0','0','1','0','0','1','boss_ahune','12340'),

	('25865','0','0','0','0','0','23447','0','0','0','Frozen Core','','','0','82','82','0','14','14','0','1','1.14286','1','1','2','2','0','24','7.5','2000','0','1','32768','8','0','0','0','0','0','1','1','0','4','524396','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','1','95','1','1','0','0','0','0','0','0','0','0','1','0','0','0','npc_frozen_core','12340');

INSERT INTO vehicle_template_accessory VALUES

	(25740,25865,0,1,"Ahune's Frozen Core",6,30000);[/CODE]

Please let me know, if you have any thoughts, thanks.

This is not a vehicle /emoticons/default_smile.png U can use xt002 system without adding a vehicle hack.

i need it cause i cant refer any other way to the frozen core, and i need to feedback the damage both ways.

You could also store the GUID of the Creature who summoned the Core. Then you can use this GUID to refer to Ahune.

You could create a variable called AhuneGUID (uint64), then use this function to get Ahunes GUID:


            void IsSummonedBy(Unit* summoner)

            {

                if (summoner->GetTypeId() == TYPEID_UNIT && summoner->GetEntry() == NPC_AHUNE) //NPC_AHUNE = Ahnunes ID

                    AhuneGUID = summoner->GetGUID();

            }

Then you could get Ahune everywhere in your Script by using


Creature* Ahune = Unit::GetCreature(*me, AhuneGUID);

You can play with visibility of boss and core /emoticons/default_smile.png

the problem is not to get Ahune’s guid, but get the Frozen Core’s guid, which is summoned by script

yeah i could, but it isnt solve anything.

maybe

[CODE]if (Creature* pCore = m_creature->SummonCreature()

if(Creature * pCore = pInstance->instance->GetCreature(pCoreGuid))[/CODE]
and then use pCore

then, instead of IsSummonedBy in the Core’s script, you can use


            void JustSummoned(Creature* Summon)

            {

                summons.Summon(Summon);

                Summon->setFaction(me->getFaction());


                if (Summon->GetEntry() == NPC_FROZEN_CORE)

                    FrozenCoreGUID = Summon->GetGUID();

            }

in Ahunes Script.

then, instead of IsSummonedBy in the Core’s script, you can use


            void JustSummoned(Creature* Summon)

            {

                summons.Summon(Summon);


                if (Summon->GetEntry() == NPC_FROZEN_CORE)

                    FrozenCoreGUID = Summon->GetGUID();

            }

in Ahunes Script.

All right then, i try it tomorrow, when i sober up /emoticons/default_biggrin.png

i let u know the outcome. /emoticons/default_smile.png

@Pesthuf:

void JustSummoned(Creature* summoned) { summons.Summon(summoned); if (Summon->GetEntry() == NPC_FROZEN_CORE) FrozenCoreGUID = Summon->GetGUID(); }

Cleaned up code from Hungarian notations, I will convert it to new scripting (event)style after school if you want me to. Might be that I missed some in my hurry. /emoticons/default_wink.png

[spoiler][code]/*

  • Copyright (C) 2008-2011 TrinityCore http://www.trinitycore.org/
  • Copyright (C) 2006-2009 ScriptDev2 https://scriptdev2.svn.sourceforge.net/
  • This program is free software; you can redistribute it and/or modify it
  • under the terms of the GNU General Public License as published by the
  • Free Software Foundation; either version 2 of the License, or (at your
  • option) any later version.
  • This program is distributed in the hope that it will be useful, but WITHOUT
  • ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  • FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  • more details.
  • You should have received a copy of the GNU General Public License along
  • with this program. If not, see http://www.gnu.org/licenses/.
    */

/* ScriptData
SDName: Boss_Ahune
SD%Complete: 80
SDComment:
SDCategory: Slave Pens / Midsummer fest event
EndScriptData */

#include “ScriptPCH.h”

enum Spells
{
SPELL_SUM_VISUAL = 45937,
SPELL_AHUNES_SHIELD = 45954,
SPELL_COLD_SLAP = 46198,
SPELL_ICE_SPEAR = 0,
SPELL_FROST_AURA = 45937,
SPELL_BONFIRE = 45930,
SPELL_AHUNE_GHOST = 46809,

SPELL_SUMM_CHEST           = 46622,

};

enum Minions
{
NPC_AHUNITE_HAILSTONE = 25755,
NPC_AHUNITE_FROSTWIND = 25757,
NPC_AHUNTIE_COLD_WAVE = 25756,
};

enum Phases
{
PHASE_1 = 1,
PHASE_2 = 2,
};

enum Timers
{
TIMER_COLD_SLAP = 500,
TIMER_ICE_SPEAR = 6000,
TIMER_SUMM_ADDS = 5000,
TIMER_SUMM_MINION = 20000,
TIMER_SUBMERGE = 90000,
TIMER_MERGE = 25000,
};

enum Encounters
{
BOSS_AHUNE = 1,
};

const Position MovePos[3] =
{
{-98.27f, -215.39f, -1.27f, 1.46f},
{-90.66f, -208.18f, -1.14f, 1.74f},
{-103.97f, -208.33f, -1.28f, 1.59f},
};

class boss_ahune : public CreatureScript
{
public:
boss_ahune() : CreatureScript(“boss_ahune”) { }

    struct boss_ahuneAI : public BossAI
    {
        boss_ahuneAI(Creature* creature) : BossAI(creature, BOSS_AHUNE), vehicle(me->GetVehicleKit())
        {
            me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
            me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_GRIP, true);
            me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
        }

        Phases phase;
        Vehicle* vehicle;

        uint32 uiColdSlapTimer;
        uint32 uiIceSpearTimer;
        uint32 uiSummAddsTimer;
        uint32 uiSummMinionTimer;
        uint32 uiSubmergeTimer;
        uint32 uiMergeTimer;


        void Reset()
        {
            _Reset();
            phase = PHASE_1;
            vehicle->Reset();

        };

        void JustDied(Unit * /*victim*/) 
        {
            _JustDied();
            DoCast(me, SPELL_SUMM_CHEST, true);
        };

        void EnterCombat(Unit* /*who*/)
        {
            _EnterCombat();
            phase = PHASE_1;
            DoZoneInCombat();
            DoCast(me, SPELL_SUM_VISUAL, true);
            DoCast(me, SPELL_AHUNES_SHIELD, true);
            me->SetReactState(REACT_AGGRESSIVE);

            uiColdSlapTimer = TIMER_COLD_SLAP;
            uiIceSpearTimer = TIMER_ICE_SPEAR;
            uiSummAddsTimer = TIMER_SUMM_ADDS;
            uiSummMinionTimer = TIMER_SUMM_MINION;
            uiSubmergeTimer = TIMER_SUBMERGE;
            uiMergeTimer = TIMER_MERGE;

        };

        void DamageTaken(Unit* Done, uint32 &damage)
        {
            if (Unit* FrozenCore = vehicle->GetPassenger(0))
            {
                if (damage > me->GetHealth())
                    damage = me->GetHealth();

                if (Done)
                    Done->DealDamage(FrozenCore, damage);
            }
        }

        void UpdateAI(const uint32 diff)
        {

            if (!UpdateVictim())
                return;

            if (phase == PHASE_1)
            {
                if (uiColdSlapTimer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 8, true))
                        DoCast(target, SPELL_COLD_SLAP);

                    uiColdSlapTimer = TIMER_COLD_SLAP;

                } else uiColdSlapTimer -= diff;
                /*            //not yet implemented
                if (uiIceSpearTimer <= diff)
                {
                    if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80, true))
                        DoCast(pTarget, SPELL_ICE_SPEAR);

                    uiIceSpearTimer = TIMER_ICE_SPEAR;

                } else uiIceSpearTimer -= diff;
                */
                if (uiSummAddsTimer <= diff)
                {
                    me->SummonCreature(NPC_AHUNITE_FROSTWIND, MovePos[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
                    me->SummonCreature(NPC_AHUNTIE_COLD_WAVE, MovePos[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);

                    uiSummAddsTimer = TIMER_SUMM_ADDS;

                } else uiSummAddsTimer -= diff;

                if (uiSummMinionTimer <= diff)
                {
                    me->SummonCreature(NPC_AHUNITE_HAILSTONE, MovePos[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);

                    uiSummMinionTimer = TIMER_SUMM_MINION;

                } else uiSummMinionTimer -= diff;

                if (uiSubmergeTimer <= diff)
                {
                    //set p2
                    phase = PHASE_2;
                    DoCast(me,SPELL_BONFIRE,true);

                    // set ahune untouchable
                    me->AttackStop();
                    me->SetReactState(REACT_PASSIVE);
                    me->InterruptNonMeleeSpells(false);
                    me->setFaction(35);
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);
                    me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);

                    //expose core
                    if (Unit *FrozenCore = vehicle->GetPassenger(0))
                        FrozenCore->ToCreature()->AI()->DoAction(0);

                    uiSubmergeTimer = TIMER_SUBMERGE;

                } else uiSubmergeTimer -= diff;
            }
            else
            {
                if (uiMergeTimer <= diff)
                {
                    //set p1
                    phase = PHASE_1;

                    //set ahune touchable again
                    me->SetReactState(REACT_AGGRESSIVE);
                    me->setFaction(14);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
                    me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);

                    //unexpose core
                    if (Unit *FrozenCore = vehicle->GetPassenger(1))
                        FrozenCore->ToCreature()->AI()->DoAction(1);

                    uiMergeTimer = TIMER_MERGE;

                } else uiMergeTimer -= diff;
            }

            DoMeleeAttackIfReady();

        }

    };

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_ahuneAI(pCreature);
    }

};

class npc_frozen_core : public CreatureScript
{
public:
npc_frozen_core() : CreatureScript(“npc_frozen_core”) { }

    struct npc_frozen_coreAI : public ScriptedAI
    {
        npc_frozen_coreAI(Creature* creature) : ScriptedAI(creature)
        {
            me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
            me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_GRIP, true);
        }


        void Reset()
        {
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
        };

        void JustDied(Unit * /*victim*/) 
        {
            me->DespawnOrUnsummon();
        };

        void EnterCombat(Unit* /*who*/)
        {;
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
        };

        void DamageTaken(Unit *Done, uint32 &damage)
        {
            if (Unit *Ahune = me->ToTempSummon()->GetSummoner())
                {
                    if (damage > me->GetHealth())
                        damage = me->GetHealth();

                    if (Done)
                        Done->DealDamage(Ahune, damage);
                }
            DoCast(me,SPELL_AHUNE_GHOST);
        };

        void DoAction(const int32 action)
        {
            if (action == 0)
            {
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->ChangeSeat(1);
            }

            if (action == 1)
            {
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
                me->ChangeSeat(0);
            }
        };

    };

    CreatureAI* GetAI(Creature* creature) const
    {
        return new npc_frozen_coreAI(creature);
    }

};

void AddSC_boss_ahune()
{
new boss_ahune();
new npc_frozen_core();
}
[/CODE]

Edit: where the fuck is instance_slave_penis.cpp?!

i made a new event style code without the vehicle hack, but i still have problems with that.

i used the code u suggested, but it crashed the core when i interacted the boss, so i leave out the damage feedback part.

when i tried again, the EnterCombat() worked well, but the UpdateAI() still not, so i dont know what i messed up again…

theres the new one:

[CODE]/*

  • Copyright (C) 2008-2011 TrinityCore http://www.trinitycore.org/

  • Copyright (C) 2006-2009 ScriptDev2 https://scriptdev2.svn.sourceforge.net/

  • This program is free software; you can redistribute it and/or modify it

  • under the terms of the GNU General Public License as published by the

  • Free Software Foundation; either version 2 of the License, or (at your

  • option) any later version.

  • This program is distributed in the hope that it will be useful, but WITHOUT

  • ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

  • FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for

  • more details.

  • You should have received a copy of the GNU General Public License along

  • with this program. If not, see http://www.gnu.org/licenses/.

*/

/* ScriptData

SDName: Boss_Ahune

SD%Complete: 0

SDComment:

SDCategory: Slave Pens / Midsummer fest event

EndScriptData */

#include “ScriptPCH.h”

enum Spells

{

SPELL_SUM_VISUAL		= 45937,

SPELL_AHUNES_SHIELD		= 45954,

SPELL_COLD_SLAP			= 46198,

SPELL_ICE_SPEAR			= 0,

SPELL_FROST_AURA		= 45937,

SPELL_BONFIRE			= 45930,

SPELL_AHUNE_GHOST		= 46809,


SPELL_SUMM_CHEST		= 46622,

};

enum Minions

{

NPC_AHUNITE_HAILSTONE	= 25755,

NPC_AHUNITE_FROSTWIND	= 25757,

NPC_AHUNTIE_COLD_WAVE	= 25756,

NPC_FROZEN_CORE			= 25865,

};

enum Phases

{

PHASE_1					= 1,

PHASE_2					= 2,

};

enum Events

{

EVENT_COLD_SLAP			= 1,

EVENT_ICE_SPEAR			= 2,

EVENT_SUMM_ADDS			= 3,

EVENT_SUMM_MINION		= 4,

EVENT_SUBMERGE			= 5,

EVENT_MERGE				= 6,

};

enum Encounters

{

BOSS_AHUNE				= 1,

};

const Position Pos[3] =

{

{-98.27f, -215.39f, -1.27f, 1.46f},

{-90.66f, -208.18f, -1.14f, 1.74f},

{-103.97f, -208.33f, -1.28f, 1.59f},

};

class boss_ahune : public CreatureScript

{

public:

	boss_ahune() : CreatureScript("boss_ahune") { }


	struct boss_ahuneAI : public BossAI

	{

		boss_ahuneAI(Creature *pCreature) : BossAI(pCreature, BOSS_AHUNE)

        {

			me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);

			me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_GRIP, true);

			me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);

        };


		Phases phase;

		Creature* pFrozenCore;



		void Reset()

		{

			_Reset();

			phase = PHASE_1;


			me->SetReactState(REACT_AGGRESSIVE);

			me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);

			me->SetVisible(true);

			me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);

			me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);

		};


		void JustDied(Unit * /*victim*/) 

		{

			_JustDied();

			DoCast(me,SPELL_SUMM_CHEST,true);

		};


		void EnterCombat(Unit* /*pWho*/)

		{

			_EnterCombat();


			phase = PHASE_1;

			events.SetPhase(PHASE_1);


			me->SummonCreature(NPC_FROZEN_CORE, Pos[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);


			DoZoneInCombat();

			DoCast(me,SPELL_SUM_VISUAL,true);

			DoCast(me,SPELL_AHUNES_SHIELD,true);


			events.ScheduleEvent(EVENT_COLD_SLAP, 500, 0, PHASE_1);

			events.ScheduleEvent(EVENT_ICE_SPEAR, 6000, 0, PHASE_1);

			events.ScheduleEvent(EVENT_SUMM_ADDS, 5000, 0, PHASE_1);

			events.ScheduleEvent(EVENT_SUMM_MINION, 20000, 0, PHASE_1);

			events.ScheduleEvent(EVENT_SUBMERGE, 90000, 0, PHASE_1);


		};

		/*

		void JustSummoned(Creature* Summon)

        {

            summons.Summon(Summon);


            if (Summon->GetEntry() == NPC_FROZEN_CORE)

			{

                uint64 FrozenCoreGUID = Summon->GetGUID();

				pFrozenCore = Unit::GetCreature(*me,FrozenCoreGUID);

			}

        };*/

		/*

		void DamageTaken(Unit *pDone, uint32 &damage)

		{

			if (pFrozenCore)

			{

				if (damage > me->GetHealth())

					damage = me->GetHealth();


				if (pDone)

					pDone->DealDamage(pFrozenCore, damage);

			}

		};

		*/

		void UpdateAI(const uint32 diff)

		{


			if (!UpdateVictim())

				return;


			events.Update(diff);


			if (me->HasUnitState(UNIT_STAT_CASTING))

				return;


			if (phase == PHASE_1)

			{

				while (uint32 eventId = events.ExecuteEvent())

				{

					switch(eventId)

					{

						case EVENT_COLD_SLAP:

							if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0, 5.0f, true))

								DoCast(pTarget, SPELL_COLD_SLAP);

							events.ScheduleEvent(EVENT_COLD_SLAP, 500, 0, PHASE_1);

							break;

							/*			//not yet implemented

						case EVENT_ICE_SPEAR:

							if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80, true))

								DoCast(pTarget, SPELL_ICE_SPEAR);

							events.ScheduleEvent(EVENT_ICE_SPEAR, 6000, 0, PHASE_1);

							break;

							*/

						case EVENT_SUMM_ADDS:

							me->SummonCreature(NPC_AHUNITE_FROSTWIND, Pos[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);

							me->SummonCreature(NPC_AHUNTIE_COLD_WAVE, Pos[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);

							events.ScheduleEvent(EVENT_SUMM_ADDS, 5000, 0, PHASE_1);

							break;


						case EVENT_SUMM_MINION:

							me->SummonCreature(NPC_AHUNITE_HAILSTONE, Pos[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);

							events.ScheduleEvent(EVENT_SUMM_MINION, 20000, 0, PHASE_1);

							break;

						case EVENT_SUBMERGE:

							//set p2

							phase = PHASE_2;

							DoCast(me,SPELL_BONFIRE,true);


							//set ahune untouchable

							me->AttackStop();

							me->SetVisible(false);

							me->SetReactState(REACT_PASSIVE);

							me->InterruptNonMeleeSpells(false);

							me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);

							me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);

							me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);


							events.ScheduleEvent(EVENT_SUBMERGE, 90000, 0, PHASE_1);

							break;


					}

				}

			}

			else

			{

				while (uint32 eventId = events.ExecuteEvent())

				{

					switch(eventId)

					{

						case EVENT_MERGE:

							//set p1

							phase = PHASE_1;

							events.SetPhase(PHASE_1);


							//set ahune touchable again

							me->SetReactState(REACT_AGGRESSIVE);

							me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);

							me->SetVisible(true);

							me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);

							me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);


							events.ScheduleEvent(EVENT_MERGE, 25000, 0, PHASE_2);

							break;

					}

				}

			}


			DoMeleeAttackIfReady();


		}


	};


    CreatureAI* GetAI(Creature* pCreature) const

    {

        return new boss_ahuneAI(pCreature);

    }

};

class npc_frozen_core : public CreatureScript

{

public:

	npc_frozen_core() : CreatureScript("npc_frozen_core") { }


	struct npc_frozen_coreAI : public BossAI

	{

		npc_frozen_coreAI(Creature* pCreature) : BossAI(pCreature, BOSS_AHUNE)

        {

			me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);

			me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_GRIP, true);

        };


		Phases phase;



		void Reset()

		{

			_Reset();

			phase = PHASE_1;


			me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);

		};


		void JustDied(Unit * /*victim*/) 

		{

			_JustDied();

			me->DespawnOrUnsummon();

		};


		void EnterCombat(Unit* /*pWho*/)

		{

			_EnterCombat();

			phase = PHASE_1;

			events.SetPhase(PHASE_1);


			me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);

			me->SetVisible(false);


			events.ScheduleEvent(EVENT_SUBMERGE, 90000, 0, PHASE_1);

		};

		/*

		void DamageTaken(Unit *pDone, uint32 &damage)

		{

			if (Unit *pAhune = me->ToTempSummon()->GetSummoner())

				{

					if (damage > me->GetHealth())

						damage = me->GetHealth();


					if (pDone)

						pDone->DealDamage(pAhune, damage);

				}


			DoCast(me,SPELL_AHUNE_GHOST);

		};

		*/

		void UpdateAI(const uint32 diff)

		{

			if (!UpdateVictim())

				return;


			events.Update(diff);


			if (me->HasUnitState(UNIT_STAT_CASTING))

				return;


			if (phase == PHASE_1)

			{

				while (uint32 eventId = events.ExecuteEvent())

				{

					switch(eventId)

					{

						case EVENT_SUBMERGE:

							//set p2

							phase = PHASE_2;


							//set frozen core touchable

							me->SetVisible(true);

							me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);


							events.ScheduleEvent(EVENT_SUBMERGE, 90000, 0, PHASE_1);

							break;


					}

				}

			}

			else

			{

				while (uint32 eventId = events.ExecuteEvent())

				{

					switch(eventId)

					{

						case EVENT_MERGE:

							//set p1

							phase = PHASE_1;

							events.SetPhase(PHASE_1);


							//set frozen core untouchable again

							me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);

							me->SetVisible(false);


							events.ScheduleEvent(EVENT_MERGE, 25000, 0, PHASE_2);

							break;

					}

				}

			}


		};


	};


    CreatureAI* GetAI(Creature* pCreature) const

    {

        return new npc_frozen_coreAI(pCreature);

    }

};

void AddSC_boss_ahune()

{

new boss_ahune();

new npc_frozen_core();

}[/CODE]

I wonder why it would ever become untouchable. According to videos and wowwiki I can’t find anything related to that.

theres a video,i used this as a reference.

according this, in phase2 ahune become invisible, so we need to set ahune not just invisible, but untouchable too, cause of any aoe dmg.

lol… slave penis

No, he doesn’t become invisible or untouchable. In fact, even in this video he casts some spell that changes his model id so now and then. Why would he become invisible when he doesn’t even summon ads? =/

Haha, oops. /emoticons/default_biggrin.png

No, its not the boss who appear in that time, its a spell cast by the frozen core, there is in the code anyway.

Make Ahune’s Ghost Burst

but why are we discussing such a petty problem, when the script still not working… /emoticons/default_biggrin.png

Correct spell for COLD SLAP is 46145