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.