Hi.
I’m working on TrinityCore 3.3.5a.
I want to create a new boss script.
What i do :
mysql -u root -p world < npc.sql
npc.sql :
INSERT INTO creature_template
VALUES (90000, 0, 0, 0, 0, 0, 145, 0, 0, 0, ‘Furbolg’, ‘’, NULL, 0, 1, 2, 0, 14, 0, 1.2, 1.14286, 1, 0, 0, 2000, 2000, 1, 1, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ‘’, 0, 3, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, ‘MyPrettyFurbolg’, 12340);
cd TrinityCore/src/server/script/Custom
i create exemple.cpp
enum eSpells
{
SPELL_LIGHTBOLT = 403,
};
class MyPrettyFurbolg : public CreatureScript
{
public:
MyPrettyFurbolg() : CreatureScript(“MyPrettyFurbolg”) { }
struct MyPrettyFurbolgAI : public ScriptedAI
{
MyPrettyFurbolgAI(Creature* creature) : ScriptedAI(creature) { }
uint32 m_uiLightBoltTimer;
void Reset() override
{
m_uiLightBoltTimer = urand(4 * IN_MILLISECONDS, 8 * IN_MILLISECONDS);
}
void UpdateAI(uint32 uiDiff) override
{
if (!UpdateVictim())
return;
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
if (m_uiLightBoltTimer <= uiDiff)
{
DoCast(SPELL_LIGHTBOLT);
m_uiLightBoltTimer = urand(4 * IN_MILLISECONDS, 8 * IN_MILLISECONDS);
}
else m_uiLightBoltTimer -= uiDiff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new MyPrettyFurbolgAI(creature);
}
};
void AddSC_AI_Furbolg()
{
new MyPrettyFurbolg();
}
I modify CMakeList.txt :
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
Custom/exemple.cpp)
message (" → Prepared: Custom")
cd TrinityCore/src/server/game/Script
i modify ScriptLoader.cpp :
#ifdef SCRIPTS
/* This is where custom scripts’ loading functions should be declared. */
void AddSC_boss_exemple();
#endif
void AddCustomScripts()
{
#ifdef SCRIPTS
/* This is where custom scripts should be added. */
AddSC_boss_exemple();
#endif
}
cd TrinityCore/buil
cmake …/
make
sudo make install
Then i restart worldserver.
But my npc just AA and i don’t know why …