• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Small 'Talking' Cinematic

Tommy

Founder
Hey guys, I just made this script because I wanted to.

Features:


  • [*=1]Two Npcs that talk with each other

Screenshots:
P1hiBbv.jpg

aXExBN4.jpg


What to note:


  • [*=1]Note that the spawn position Z is set to work for the terrain the Gnull is in. Might need to change it where you place the Defias Commander NPC.
    [*=1]Note that the Defias Commander spawns the other NPC.

Download:
SQL Queries:

Source


EmuDevs:

Code:
/*
 *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗ 
 *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
 *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
 *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
 *            www.emudevs.com
*/
enum NpcIds
{
    NPC_DEFIAS_COMMANDER = 80000,
    NPC_DEFIAS_VICTIM = 80001
};

enum EventIds
{
    EVENT_NONE,
    EVENT_START_CINEMATIC,
    EVENT_CINEMATIC_TALK,
    EVENT_CINEMATIC_TALK2,
    EVENT_CINEMATIC_TALK3,
    EVENT_CINEMATIC_TALK4
};

class defias_cinematic : public CreatureScript
{
public:
    defias_cinematic() : CreatureScript("defias_cinematic") { }

    bool OnGossipHello(Player* player, Creature* creature)
    {
        if (defias_cinematicAI* defiasAI = CAST_AI(defias_cinematicAI, creature->GetAI()))
        {
            if (!defiasAI->start)
                defiasAI->start = true;
            else
                player->GetSession()->SendNotification("Event already started!");
        }
        return true;
    }

    struct defias_cinematicAI : public ScriptedAI
    {
        defias_cinematicAI(Creature* creature) : ScriptedAI(creature) { }

        bool start;
        bool canContinue;

        void Reset()
        {
            start = false;
            canContinue = true;
            if (!me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
                me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
            events.Reset();
        }

        void UpdateAI(uint32 diff)
        {
            events.Update(diff);

            if (start && canContinue)
            {
                events.ScheduleEvent(EVENT_START_CINEMATIC, 1000);
                me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
                canContinue = false;
            }

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_START_CINEMATIC:
                        defiasVictim = me->SummonCreature(NPC_DEFIAS_VICTIM, me->GetPositionX() - 2, me->GetPositionY(), me->GetPositionZ() + 1, me->GetOrientation() + me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0);
                        me->MonsterSay("Welcome scum!", LANG_UNIVERSAL, 0);
                        me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
                        events.ScheduleEvent(EVENT_CINEMATIC_TALK, 2500);
                        break;

                    case EVENT_CINEMATIC_TALK:
                        defiasVictim->MonsterSay("Please.. what have I done to you?", LANG_UNIVERSAL, 0);
                        events.ScheduleEvent(EVENT_CINEMATIC_TALK2, 4000);
                        break;

                    case EVENT_CINEMATIC_TALK2:
                        me->MonsterSay("SILENCE! It is not what you've done, it is what your buddy, Hogger, has done..", LANG_UNIVERSAL, 0);
                        me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
                        events.ScheduleEvent(EVENT_CINEMATIC_TALK3, 4500);
                        break;

                    case EVENT_CINEMATIC_TALK3:
                        defiasVictim->MonsterYell("So be it! I'd rather die than see your ugly face!", LANG_UNIVERSAL, 0);
                        events.ScheduleEvent(EVENT_CINEMATIC_TALK4, 3500);
                        break;

                    case EVENT_CINEMATIC_TALK4:
                        me->MonsterYell("Be gone!", LANG_UNIVERSAL, 0);
                        defiasVictim->DespawnOrUnsummon(1000);
                        me->DespawnOrUnsummon(1000);
                        break;
                }
            }
        }

    private:
        EventMap events;
        Creature* defiasVictim;
    };

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

void AddSC_cinematic()
{
    new defias_cinematic();
}


ENJOY!

 
Top