MaNGOSR2

MangosR2 is a free, open source MMORPG framework, derived from MaNGOS project


You are not connected. Please login or register

Fix quest 2118

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Fix quest 2118 on Sat Jan 05 2013, 10:26

Hi

I try to create a Blizzlike server, debugged and translated in french... This is a script inspirated of ScriptDev0 from MaNGOS to fix the quest 2218 : http://www.wowhead.com/quest=2118/
Please I'm a noobie in C++ dev..

In scriptdev2/scripts/kalimdor/Darkshore.cpp
Add the script :
Code:

/*######
## npc_rabid_bear
######*/

enum
{
    QUEST_PLAGUED_LANDS = 2118,
    NPC_RABID_BEAR = 2164,
    NPC_RABID_BEAR_CAPTURED = 11836,
    GO_BEAR_TRAP = 111148,
};

struct MANGOS_DLL_DECL npc_rabid_bearAI : public ScriptedAI
{
    npc_rabid_bearAI(Creature* pCreature) : ScriptedAI(pCreature)
    {
        Reset();
    }

    Player* pPlayer;

    void Reset()
    {
        pPlayer = NULL;
    }

    void MoveInLineOfSight(Unit* pWho)
    {
        if (pWho->GetTypeId() != TYPEID_PLAYER)
            return;

        pPlayer = (Player*)pWho;
        if (pPlayer->GetQuestStatus(QUEST_PLAGUED_LANDS) == QUEST_STATUS_INCOMPLETE)
        {
            if (GetClosestGameObjectWithEntry(m_creature, GO_BEAR_TRAP, 0.5f))
            {
                pPlayer->CastedCreatureOrGO(NPC_RABID_BEAR_CAPTURED, m_creature->GetObjectGuid(), 9437, true);
                m_creature->setFaction(35);
                m_creature->addUnitState(UNIT_STAT_STUNNED);
                m_creature->DeleteThreatList();
                m_creature->ForcedDespawn(5000);
            }
        }
    }
};

CreatureAI* GetAI_npc_rabid_bear(Creature* pCreature)
{
    return new npc_rabid_bearAI(pCreature);
}

And this at the end of file:
Code:

    pNewScript = new Script;
    pNewScript->Name = "npc_rabid_bear";
    pNewScript->GetAI = &GetAI_npc_rabid_bear;
    pNewScript->RegisterSelf();


Please don't forget to set scriptname='npc_rabid_bear' where entry='2164' in creature_template !

Probably in mangos_scriptname_full
Code:

UPDATE creature_template SET ScriptName='npc_rabid_bear' WHERE entry=2164;

Done :)

View user profile

2 Re: Fix quest 2118 on Sun Jan 06 2013, 04:24

rsa

avatar
Admin
Good work for beginning. But this quest must be maked by another way - see item 7586 and spells 9455, 9478, 9437 - this seems as small hack. Also more simple be maked over EventAI (not need make code like this in SD2 always, need make all as possible in EAI).

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum