Hello to all! I’m new in core development! I’m scripting a boss (Ook-Ook) that summons a barrell. And here i scripted all ok i think…
this barrell have to move forward using the orientation (for example in game i’m the npc, i will press W to move) and on hit with something (player, the npc that summoned that or a wall) it will cast a spell (it will explode)
how can i do that?
Thank you!
#include “ScriptMgr.h”
#include “ScriptedCreature.h”
#include “ScriptedGossip.h”
#include “Player.h”
enum Yells
{
};
enum Spells
{
SPELL_PESTATERRA = 106807,
SPELL_INSCIMMIATO = 106651,
SPELL_ESPLOSIONE_BARILI = 107351
};
class boss_uggaugga : public CreatureScript
{
public :
boss_uggaugga() :CreatureScript(“boss_uggaugga”) {}
struct boss_uggauggaAI : public ScriptedAI
{
boss_uggauggaAI(Creature* creature) : ScriptedAI(creature) { } //chiamato solo una volta
//qua i timer
uint32 timer_inscimmiato = 0;
uint32 timer_pestaterra = 0;
uint32 timer_barili = 0;
//qua i timer
void Reset() OVERRIDE
{
timer_pestaterra = 10000;
}
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()) {} //fuori combat
if (!UpdateVictim())
return;
//ora il codice del fight
if (me->GetHealth() / me->GetMaxHealth() == 90 || me->GetHealth() / me->GetMaxHealth() == 60 || me->GetHealth() / me->GetMaxHealth() == 30)
{
DoCast(me, SPELL_INSCIMMIATO);
//dopo la spell il boss summona barili.. creare la classe del barile per comandarlo
Creature* barile = DoSpawnCreature(56682, 0, 0, 0, me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0);
}
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”) {}
struct barileAI : public ScriptedAI
{
barileAI(Creature* creature) : ScriptedAI(creature) { }
// qua i timer
void Reset() OVERRIDE
{
}
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()) {} //fuori combat
if (!UpdateVictim())
return;
}
};
};
void AddSC_boss_uggaugga()
{
new boss_uggaugga();
new barile();
}
sorry for the non-english comment, i’m scripting for my locale (itIT)