Blizzlike fixes to quest menu

User Tag List

Results 1 to 1 of 1
  1. #1
    marcelo_20xx's Avatar Active Member
    Reputation
    25
    Join Date
    Sep 2008
    Posts
    165
    Thanks G/R
    2/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well instead of making a guide I decided to post a blizzlike fix I made for a quest:

    - OK first you need to run Visual Studio and compile this somewhere in one of your scripts projects.

    Code:
    //Whitebark's Memory Quest 10166
    bool Whitebark_Memory(uint32 i, Spell* pSpell) 
    {
      Player *pPlayer = (Player*)pSpell->u_caster;
      if(!pPlayer)
          return true;
      if(!pSpell->u_caster->IsPlayer())
        return true;
     
      QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(10166);
      Creature * Whitebark = NULL;
      Whitebark = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(8187.786f, -6337.986f, 64.51f, 19456);
      if(qle == NULL)
        return true;
        pPlayer->GetMapMgr()->GetInterface()->SpawnCreature(19456, 8187.786, -6337.986, 64.51, 3.369, true, false, 0,0)->Despawn(180000, 0);
        Creature * pCreature = NULL;
        pCreature = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(8187.786f, -6337.986f, 64.51f, 19456);
        pCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0);
        pCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, 91);
        return true;
    };
    void SetupQuestScripts(ScriptMgr * mgr) // change this to whatever  name the functions are registered
    {
        mgr->register_dummy_spell(33980, &Whitebark_Memory);
    }
    Compile and put the file in your script_bin folder

    - Next come a little lua scripting for the second part (sorry I couldnt make it through C++, guess I need to learn more)

    Code:
    -- Quest 10166 Whitebark Memory
     
    function Whitebark_onDefeat(Unit, event, miscunit, misc)
        if Unit:GetHealthPct() < 30 then
        Unit:RemoveEvents()
        Unit:SendChatMessage(12, 0, "Very well...I admit defeat")
        Unit:SetNPCFlags(2)
        Unit:SetFaction(35) 
        Unit:SetCombatCapable(1)
        Unit:Despawn(30000, 0)
        else
        end
    end
     
    function Whitebark_OnEnterCombat(Unit, event, miscunit, misc)
        Unit:SendChatMessage(12, 0, "Haven't you done enough?")
        Unit:RegisterEvent("Whitebark_onDefeat", 1000, 0)
    end
     
    function Whitebark_OnLeaveCombat(Unit, event, miscunit, misc)
        Unit:RemoveEvents()
    end
     
    RegisterUnitEvent(19456, 1,"Whitebark_OnEnterCombat")
    RegisterUnitEvent(19456, 2,"Whitebark_OnLeaveCombat")
    Save the following in a .lua file and put in your scripts folder.

    Tested and working with ascent based emus and 2.4.3 patch

    Basically if you can understand the code you can easily fix tons of other quest that have the same mechanism, well any comment or code optimization is welcome.

    Another fix for the Quest 437 The Dead Fields

    Code:
    //The Dead Fields Quest 437 Rote Hide
    class Nightslash_Spawned_A : public CreatureAIScript
    {
    public:
        ADD_CREATURE_FACTORY_FUNCTION(Nightslash_Spawned_A);
        Nightslash_Spawned_A(Creature* pCreature) : CreatureAIScript(pCreature) {}
        void OnDied(Unit *mKiller)
        {
            if(!mKiller->IsPlayer())
            return;
            Player *plr = (Player*)mKiller;
            QuestLogEntry *qle = plr->GetQuestLogForEntry(437);
                if(qle == NULL)
                return;
            uint8 chance = (uint8)RandomUInt(5);
            uint32 spawn = 0;
            switch(chance)
            {
            case 3:
                spawn = 1983;
            }
            Creature *creat = sEAS.SpawnCreature(plr, spawn, 1077.445f, 1542.687f, 28.858f, 1*60*1000);
                if(spawn != 1983)
                return;
            creat->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Who dares to kill my minions?");
        }
    };
    //The Dead Fields Quest 437 Rote Hide Mystic
    class Nightslash_Spawned_B : public CreatureAIScript
    {
    public:
        ADD_CREATURE_FACTORY_FUNCTION(Nightslash_Spawned_B);
        Nightslash_Spawned_B(Creature* pCreature) : CreatureAIScript(pCreature) {}
        void OnDied(Unit *mKiller)
        {
            if(!mKiller->IsPlayer())
            return;
            Player *plr = (Player*)mKiller;
            QuestLogEntry *qle = plr->GetQuestLogForEntry(437);
                if(qle == NULL)
                return;
            uint8 chance = (uint8)RandomUInt(5);
            uint32 spawn = 0;
            switch(chance)
            {
            case 5:
                spawn = 1983;
            }
            Creature *creat = sEAS.SpawnCreature(plr, spawn, 1077.445f, 1542.687f, 28.858f, 1*60*1000);
                if(spawn != 1983)
                return;
            creat->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You will pay for what you did!");
        }
    };
    And put these these two lines to register the functions

    Code:
        mgr->register_creature_script(1772, &Nightslash_Spawned_A::Create);
        mgr->register_creature_script(1773, &Nightslash_Spawned_B::Create);
    Last edited by Gastricpenguin; 12-03-2008 at 09:46 AM. Reason: Double posting

    Blizzlike fixes to quest

Similar Threads

  1. how do i fix a quest?
    By SnowX51 in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 08-03-2009, 10:55 PM
  2. Fixing Broken Quests
    By apokolypse in forum WoW EMU Questions & Requests
    Replies: 5
    Last Post: 02-20-2009, 11:14 AM
  3. Fixing Mage Quest
    By aliceamphetamine in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 09-03-2008, 05:41 PM
  4. [GUIDE] Fix on Quest bug [If sql updates didnt work]!
    By Laniax in forum WoW EMU Guides & Tutorials
    Replies: 1
    Last Post: 03-22-2008, 04:20 PM
  5. FIX for Quest Log's Disappearing Act
    By Freyetta in forum WoW EMU Guides & Tutorials
    Replies: 1
    Last Post: 02-07-2008, 11:16 PM
All times are GMT -5. The time now is 02:51 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search