Add Custom boss_script

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 …

— Canned message start —

This thread is not related to the official Trinity codebase and was moved to the Custom Code section.

Please read the stickies next time.

— Canned message end —

up

Your code seems fine… what happens when you use .npc info on the npc?

In your script you declare

[COLOR=rgb(0,0,136)]void [COLOR=rgb(102,0,102)]AddSC_AI_FurbolgCOLOR=rgb(102,102,0)
[COLOR=rgb(102,102,0)]{
[COLOR=rgb(0,0,136)]new [COLOR=rgb(102,0,102)]MyPrettyFurbolgCOLOR=rgb(102,102,0);
[COLOR=rgb(102,102,0)]}

[COLOR=rgb(102,102,0)]but in your scriptloader you declare and call

[COLOR=rgb(102,0,102)]AddSC_boss_exemple

[COLOR=rgb(102,0,102)]Just replace [COLOR=rgb(102,0,102)]AddSC_boss_exemple in your scriptloader to [COLOR=rgb(102,0,102)]AddSC_AI_Furbolg or change [COLOR=rgb(102,0,102)]AddSC_AI_Furbolg in your script to [COLOR=rgb(102,0,102)]AddSC_boss_exemple