[C++] Grizzly Hills quest  'Mr.Floppy's Perilous Adventure' question. menu

Shout-Out

User Tag List

Results 1 to 3 of 3
  1. #1
    newtech's Avatar Active Member
    Reputation
    57
    Join Date
    Aug 2008
    Posts
    308
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] Grizzly Hills quest 'Mr.Floppy's Perilous Adventure' question.

    Hey there fellows


    Alright, so I'm working on learning C++ (expanding from Lua, to C++, mainly cause I'm working for CoA, a Trinity core server), and I've learned the basics of Gossip, however... Now, I'm going to try and make an escort quest, and the actual making of the quest is no problem, its more the scripting of the path, and what to happen on the quest.
    So I found that there was already a script in the source code for the quest Mr. Floppy's Perilous Adventure
    So, here's the part of the code from the 'grizzly_hills.cpp' script, that I assume is needed to tell me how everything works:
    Code:
    /*######
    ## Quest 12027: Mr. Floppy's Perilous Adventure
    ######*/
    
    enum eFloppy
    {
        NPC_MRFLOPPY                = 26589,
        NPC_HUNGRY_WORG             = 26586,
        NPC_RAVENOUS_WORG           = 26590,   //RWORG
        NPC_EMILY                   = 26588,
    
        QUEST_PERILOUS_ADVENTURE    = 12027,
    
        SPELL_MRFLOPPY              = 47184,    //vehicle aura
    
        SAY_WORGHAGGRO1             = -1800001, //Um... I think one of those wolves is back...
        SAY_WORGHAGGRO2             = -1800002, //He's going for Mr. Floppy!
        SAY_WORGRAGGRO3             = -1800003, //Oh, no! Look, it's another wolf, and it's a biiiiiig one!
        SAY_WORGRAGGRO4             = -1800004, //He's gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!
        SAY_RANDOMAGGRO             = -1800005, //There's a big meanie attacking Mr. Floppy! Help!
        SAY_VICTORY1                = -1800006, //Let's get out of here before more wolves find us!
        SAY_VICTORY2                = -1800007, //Don't go toward the light, Mr. Floppy!
        SAY_VICTORY3                = -1800008, //Mr. Floppy, you're ok! Thank you so much for saving Mr. Floppy!
        SAY_VICTORY4                = -1800009, //I think I see the camp! We're almost home, Mr. Floppy! Let's go!
        TEXT_EMOTE_WP1              = -1800010, //Mr. Floppy revives
        TEXT_EMOTE_AGGRO            = -1800011, //The Ravenous Worg chomps down on Mr. Floppy
        SAY_QUEST_ACCEPT            = -1800012, //Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!
        SAY_QUEST_COMPLETE          = -1800013  //Thank you for helping me get back to the camp. Go tell Walter that I'm safe now!
    };
    
    //emily
    class npc_emily : public CreatureScript
    {
    public:
        npc_emily() : CreatureScript("npc_emily") { }
    
        struct npc_emilyAI : public npc_escortAI
        {
            npc_emilyAI(Creature* pCreature) : npc_escortAI(pCreature) { }
    
            uint32 m_uiChatTimer;
    
            uint64 RWORGGUID;
            uint64 MrfloppyGUID;
    
            bool Completed;
    
            void JustSummoned(Creature* pSummoned)
            {
                if (Creature* Mrfloppy = GetClosestCreatureWithEntry(me, NPC_MRFLOPPY, 50.0f))
                    pSummoned->AI()->AttackStart(Mrfloppy);
                else
                    pSummoned->AI()->AttackStart(me->getVictim());
            }
    
            void WaypointReached(uint32 i)
            {
                Player* pPlayer = GetPlayerForEscort();
                if (!pPlayer)
                    return;
                switch (i)
                {
                    case 9:
                        if (Creature *Mrfloppy = GetClosestCreatureWithEntry(me, NPC_MRFLOPPY, 100.0f))
                            MrfloppyGUID = Mrfloppy->GetGUID();
                        break;
                    case 10:
                        if (Unit::GetCreature(*me, MrfloppyGUID))
                        {
                            DoScriptText(SAY_WORGHAGGRO1, me);
                            me->SummonCreature(NPC_HUNGRY_WORG,me->GetPositionX()+5,me->GetPositionY()+2,me->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000);
                        }
                        break;
                    case 11:
                        if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
                            Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
                        break;
                    case 17:
                        if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
                            Mrfloppy->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
                        DoScriptText(SAY_WORGRAGGRO3, me);
                        if (Creature *RWORG = me->SummonCreature(NPC_RAVENOUS_WORG,me->GetPositionX()+10,me->GetPositionY()+8,me->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000))
                        {
                            RWORG->setFaction(35);
                            RWORGGUID = RWORG->GetGUID();
                        }
                        break;
                    case 18:
                        if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
                        {
                            if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID))
                                RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
                            DoCast(Mrfloppy,SPELL_MRFLOPPY);
                        }
                        break;
                    case 19:
                        if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
                        {
                            if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0))
                            {
                                if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID))
                                    Mrfloppy->EnterVehicle(RWORG);
                            }
                        }
                        break;
                    case 20:
                        if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID))
                            RWORG->HandleEmoteCommand(34);
                        break;
                    case 21:
                        if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
                        {
                            if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID))
                            {
                                RWORG->Kill(Mrfloppy);
                                Mrfloppy->ExitVehicle();
                                RWORG->setFaction(14);
                                RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ());
                                DoScriptText(SAY_VICTORY2, me);
                            }
                        }
                        break;
                    case 22:
                        if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
                        {
                            if (Mrfloppy->isDead())
                            {
                                if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID))
                                    RWORG->DisappearAndDie();
                                me->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
                                Mrfloppy->setDeathState(ALIVE);
                                Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
                                DoScriptText(SAY_VICTORY3, me);
                            }
                        }
                        break;
                    case 24:
                        if (pPlayer)
                        {
                            Completed = true;
                            pPlayer->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, me);
                            DoScriptText(SAY_QUEST_COMPLETE, me, pPlayer);
                        }
                        me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
                        break;
                    case 25:
                        DoScriptText(SAY_VICTORY4, me);
                        break;
                    case 27:
                        me->DisappearAndDie();
                        if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
                            Mrfloppy->DisappearAndDie();
                        break;
                }
            }
    
            void EnterCombat(Unit* /*Who*/)
            {
                DoScriptText(SAY_RANDOMAGGRO, me);
            }
    
            void Reset()
            {
                m_uiChatTimer = 4000;
                MrfloppyGUID = 0;
                RWORGGUID = 0;
            }
    
            void UpdateAI(const uint32 uiDiff)
            {
                npc_escortAI::UpdateAI(uiDiff);
    
                if (HasEscortState(STATE_ESCORT_ESCORTING))
                {
                    if (m_uiChatTimer <= uiDiff)
                    {
                        m_uiChatTimer = 12000;
                    }
                    else
                        m_uiChatTimer -= uiDiff;
                }
            }
        };
    
        bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest)
        {
            if (quest->GetQuestId() == QUEST_PERILOUS_ADVENTURE)
            {
                DoScriptText(SAY_QUEST_ACCEPT, pCreature);
                if (Creature* Mrfloppy = GetClosestCreatureWithEntry(pCreature, NPC_MRFLOPPY, 180.0f))
                {
                    Mrfloppy->GetMotionMaster()->MoveFollow(pCreature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
                }
    
                if (npc_escortAI* pEscortAI = CAST_AI(npc_emily::npc_emilyAI, (pCreature->AI())))
                    pEscortAI->Start(true, false, pPlayer->GetGUID());
            }
            return true;
        }
    
        CreatureAI *GetAI(Creature *creature) const
        {
            return new npc_emilyAI(creature);
        }
    };
    
    //mrfloppy
    class npc_mrfloppy : public CreatureScript
    {
    public:
        npc_mrfloppy() : CreatureScript("npc_mrfloppy") { }
    
        struct npc_mrfloppyAI : public ScriptedAI
        {
            npc_mrfloppyAI(Creature *c) : ScriptedAI(c) {}
    
            uint64 EmilyGUID;
            uint64 RWORGGUID;
            uint64 HWORGGUID;
    
            void Reset() {}
    
            void EnterCombat(Unit* Who)
            {
                if (Creature* Emily = GetClosestCreatureWithEntry(me, NPC_EMILY, 50.0f))
                {
                    switch(Who->GetEntry())
                    {
                        case NPC_HUNGRY_WORG:
                            DoScriptText(SAY_WORGHAGGRO2, Emily);
                            break;
                        case NPC_RAVENOUS_WORG:
                            DoScriptText(SAY_WORGRAGGRO4, Emily);
                            break;
                        default:
                            DoScriptText(SAY_RANDOMAGGRO, Emily);
                    }
                }
            }
    
            void EnterEvadeMode() {}
    
            void MoveInLineOfSight(Unit * /*who*/) {}
    
            void UpdateAI(const uint32 /*diff*/)
            {
                if (!UpdateVictim())
                    return;
            }
        };
    
        CreatureAI *GetAI(Creature *creature) const
        {
            return new npc_mrfloppyAI(creature);
        }
    };
    Well, basically I just don't understand where in that script, that it tells where to walk and stuff? Like, in Lua it'd be something like... "On time'd event, walk to X, Y and Z coords, spawn evil stuff, wait till evil stuff is dead, continue, etc." Only thing is, I see nowhere in the script where it says anything like 'Go to...' in that C++ script. Now, I've been told that Trinity C++ scripting also has a lot to do with the DB, so maybe it is something in there? Well, I've tried following the most obvious connections from the script into the DB, but I couldn't find anything :S So... Could anyone enlighten me please? :>


    Thanks
    Newtech


    Note: I take no credit WHATSOEVER for the quest script I provided above. That was an extract from the Trinity source. I merely use it as an example so I can see how it can be done, and so I can expand my knowledge about C++ scripting
    LuaHypArc Lua scripter - 3.3.5a World Builder.

    [C++] Grizzly Hills quest  'Mr.Floppy's Perilous Adventure' question.
  2. #2
    SpellEffects's Avatar Sergeant
    Reputation
    64
    Join Date
    Apr 2011
    Posts
    69
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    Mrfloppy->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
    Replace me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() with X, Y and Z values of where you want Mrfloppy to go.

  3. #3
    newtech's Avatar Active Member
    Reputation
    57
    Join Date
    Aug 2008
    Posts
    308
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oi! Thanks! =D Ill see if it works now :>
    LuaHypArc Lua scripter - 3.3.5a World Builder.

Similar Threads

  1. Grizzly hills quest gives tons of xp
    By gouland in forum World of Warcraft Guides
    Replies: 6
    Last Post: 11-22-2009, 03:45 PM
  2. Grizzly Hills Electo-Dwarf Easy quests
    By Schiffer4 in forum World of Warcraft Exploits
    Replies: 4
    Last Post: 12-01-2008, 03:19 PM
  3. Grizzly Hills quest uncomplete 33k HP
    By No0se in forum World of Warcraft Exploits
    Replies: 7
    Last Post: 11-22-2008, 03:47 PM
  4. WotLK Site new feature added: Grizzly Hills Overview
    By amd in forum World of Warcraft Exploration
    Replies: 5
    Last Post: 02-14-2008, 07:57 PM
All times are GMT -5. The time now is 07:14 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search