Jump to content

Recommended Posts

Posted

How do I can hook up the item to the NPC. I mean Urn to summon Shade, This is last thing i miss in my Nightbane code and i totaly have no idea how to do it :-?

Posted

more SD2 related;

commit a1bc738437050c2fff9bbdeb6668330156a27c82
Author: Schmoozerd <[email protected]>
Date:   Sat Dec 11 12:19:32 2010 +0100

   Karazhan - Quick, Dirty Nightbane summoning

diff --git a/scripts/eastern_kingdoms/karazhan/instance_karazhan.cpp b/scripts/eastern_kingdoms/karazhan/instance_karazhan.cpp
index 1fa083d..611f104 100644
--- a/scripts/eastern_kingdoms/karazhan/instance_karazhan.cpp
+++ b/scripts/eastern_kingdoms/karazhan/instance_karazhan.cpp
@@ -297,6 +297,42 @@ InstanceData* GetInstanceData_instance_karazhan(Map* pMap)
    return new instance_karazhan(pMap);
}

+bool ProcessEventId_event_karazhan(uint32 uiEventId, Object* pSource, Object* pTarget, bool bIsStart)
+{
+    if (!bIsStart || pSource->GetTypeId() != TYPEID_PLAYER)
+        return false;
+
+    if (uiEventId == 10591)
+    {
+        if (ScriptedInstance* pInstance = (ScriptedInstance*)((Player*)pSource)->GetInstanceData())
+        {
+            if (pInstance->GetData(TYPE_NIGHTBANE) == NOT_STARTED || pInstance->GetData(TYPE_NIGHTBANE) == FAIL)
+            {
+                Creature* pNightbane = pInstance->instance->GetCreature(pInstance->GetData64(NPC_NIGHTBANE));
+                if (pNightbane && pNightbane->isAlive())
+                {
+                    pInstance->SetData(TYPE_NIGHTBANE, IN_PROGRESS);
+                    ((Player*)pSource)->MonsterSay("debug_ surpise on the way..",0,0);
+
+                    // Sort of a hack, it is unclear how this really work but the values appear to be valid (see Onyxia, too)
+                    pNightbane->SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_UNK_2);
+                    pNightbane->AddSplineFlag(SPLINEFLAG_FLYING);
+
+                    // Remove old idle movement and switch to waypoint movement
+                    pNightbane->SetSpeedRate(MOVE_WALK, 3.0f);
+                    pNightbane->GetMotionMaster()->Clear(false, true);
+                    pNightbane->GetMotionMaster()->MoveWaypoint();
+                }
+                else
+                    ((Player*)pSource)->MonsterSay("debug_ nothing on the way..",0,0);
+            }
+        }
+        return true;                                        // No further handling of these events
+    }
+
+    return false;
+}
+
void AddSC_instance_karazhan()
{
    Script* pNewScript;
@@ -305,4 +341,9 @@ void AddSC_instance_karazhan()
    pNewScript->Name = "instance_karazhan";
    pNewScript->GetInstanceData = &GetInstanceData_instance_karazhan;
    pNewScript->RegisterSelf();
+
+    pNewScript = new Script;
+    pNewScript->Name = "event_karazhan";
+    pNewScript->pProcessEventId = &ProcessEventId_event_karazhan;
+    pNewScript->RegisterSelf();
}

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use