[LUA HELP] Boss spawning npc when he dies menu

Shout-Out

User Tag List

Results 1 to 13 of 13
  1. #1
    Moaradin's Avatar Contributor
    Reputation
    163
    Join Date
    Feb 2008
    Posts
    439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [LUA HELP] Boss spawning npc when he dies

    Got a couple questions I need answered =)

    Got me a boss going. I need to know how to make a npc spawn when he dies.
    Then get the npc to say a couple things and not repeat himself. Anyway to do this?

    Thanks

    +rep people who help you

    [LUA HELP] Boss spawning npc when he dies
  2. #2
    y2kss66's Avatar Member
    Reputation
    104
    Join Date
    Jan 2008
    Posts
    778
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function Test_OnDied(pUnit, Event) 
       pUnit:RemoveEvents() 
       pUnit:SpawnCreature(entryID, x, y, z, o, faction, duration) -- spawns the npc on death
      pUnit:SendChatMessage(14, 0, "What_HE_SAYS_HERE")
    end
    is this what you are looking for?

  3. #3
    Moaradin's Avatar Contributor
    Reputation
    163
    Join Date
    Feb 2008
    Posts
    439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sort of.. I kinda know how to do this.. What I need is to make a npc say 1 or 2 things only once when he spawns and not repeat himself. Anyone know how to do this?

    +rep people who help you

  4. #4
    Moaradin's Avatar Contributor
    Reputation
    163
    Join Date
    Feb 2008
    Posts
    439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anybody?
    ?

    +rep people who help you

  5. #5
    y2kss66's Avatar Member
    Reputation
    104
    Join Date
    Jan 2008
    Posts
    778
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is this for a boss script? because there is no lua command to make an npc say something whenever they are spawned. however you could make him say something whenever he enters combat after being spawned. but this is the closest you will get with lua I believe.

    you might be able to do what your asking with c++ though. I do not know enough c++ right now to help you though. sorry!

    example in lua:
    like this:

    Code:
    function NPCNAME_OnEnterCombat(pUnit, Event)
    pUnit:SendChatMessage(14, 0, "Dialogue here")
    pUnit:RegisterEvent("NPCNAME_1", 1000, 0)
    end
    
    RegisterUnitEvent(13371337, 2, "NPCNAME_OnEnterCombat")
    or like this:

    Code:
    function NPCNAME_OnCombat(pUnit, Event)
    pUnit:SendChatMessage(14, 0, "Dialogue here")
    pUnit:RegisterEvent("NPCNAME_1", 1000, 0)
    end
    
    RegisterUnitEvent(13371337, 2, "NPCNAME_OnCombat")
    cannot remember if it is OnEnterCombat or OnCombat.

    I believe it is OnCombat though!
    Last edited by y2kss66; 04-17-2009 at 07:11 AM.

  6. #6
    Moaradin's Avatar Contributor
    Reputation
    163
    Join Date
    Feb 2008
    Posts
    439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there is a Lua command to make a boss say something whenever they are spawned.. its

    Code:
    function Boss_OnSpawn(Unit,Event)
    Unit:RegisterEvent("Talk", 30000, 0) -- 30000 = 30 seconds
    
    function Talk(Unit,Event)
    local choice = math.random(1,5)
      if (choice == 1) then
          Unit:SendChatMessage(14, 0, "Text goes here")

    What I need is how to make a boss spawn a npc ONCE when the boss dies. Then make the spawned npc say multiple things and not to repeat himself. I'm sure there is a way to do this.. I just don't know how. Anybody?

    +rep people who help you

  7. #7
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function SpawnedNPC_OnSpawn(Unit,Event)
     Unit:RegisterEvent("NPCTalk1",2000, 1)
     Unit:RegisterEvent("NPCTalk2",5000, 1)
     Unit:RegisterEvent("NPCTalk3",8000, 1)
     Unit:RegisterEvent("NPCTalk4",11000, 1)
     Unit:RegisterEvent("NPCTalk5",14000, 1)
     Unit:RegisterEvent("NPCTalk6",17000, 1)
    end
    
    function NPCTalk1(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 1")
    end
    
    function NPCTalk2(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 2")
    end
    
    function NPCTalk3(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 3")
    end
    
    function NPCTalk4(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 4")
    end
    
    function NPCTalk5(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 5")
    end
    
    function NPCTalk6(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 6")
    end
    
    RegisterUnitEvent(YOUR SPAWNED NPCID, 18, "SpawnedNPC_OnSpawn")
    Try this.


    Edit: did you managed it that the Boss spawns the npc when the Boss die?

    Edit2: Maybe you can post your complete script, then we can add things like this^^
    Last edited by Kaidos; 04-17-2009 at 06:21 PM.

  8. #8
    Moaradin's Avatar Contributor
    Reputation
    163
    Join Date
    Feb 2008
    Posts
    439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function Malygos_OnSpawn(Unit,Event)
    Unit:RegisterEvent("Talk", 30000, 0) -- 30000 = 30 seconds
    end
    
    function Malygos_OnCombat(pUnit, Event)
    pUnit:RegisterEvent("Malygos_Phase1", 100, 0)
    end
    
    function Malygos_OnLeaveCombat(pUnit, Event)
    pUnit:RemoveEvents()
    end
    
    function Malygos_OnKillTarget(pUnit, Event)
    pUnit:PlaySoundToSet(14521)
    pUnit:SendChatMessage(14, 0, "Heheheheh.. How very.. naive..")
    end
    
    function Malygos_OnDeath(pUnit, Event)
    pUnit:PlaySoundToSet(14540)
    pUnit:SendChatMessage(14, 0, "Unthinkable! The mortals will destroy.. e-everything.. my sister.. what have you..")
    pUnit:RemoveEvents()
    end
    
    RegisterUnitEvent(28859, 18, "Malygos_OnSpawn")
    RegisterUnitEvent(28859, 1, "Malygos_OnCombat")
    RegisterUnitEvent(28859, 2, "Malygos_OnLeaveCombat")
    RegisterUnitEvent(28859, 3, "Malygos_OnKillTarget")
    RegisterUnitEvent(28859, 4, "Malygos_OnDeath")
    
    
    function Talk(Unit,Event)
    local choice = math.random(1,5)
      if (choice == 1) then
          Unit:PlaySoundToSet(14512)
          Unit:SendChatMessage(14, 0, "Lesser beings, intruding here! A shame that your excess courage does not compensate for your stupidity!")
    elseif (choice == 2) then
          Unit:PlaySoundToSet(14513)
          Unit:SendChatMessage(14, 0, "None but the blue dragonflight are welcome here! Perhaps this is the work of Alexstrasza? Well then, she has sent you to your deaths.")
    elseif (choice == 3) then
           Unit:PlaySoundToSet(14514)
           Unit:SendChatMessage(14, 0, "What could you hope to accomplish, to storm brassily into my domain? To employ MAGIC? Against ME?")
    elseif (choice == 4) then
           Unit:PlaySoundToSet(14515)
           Unit:SendChatMessage(14, 0, "I am without limits here...the rules of your cherished reality do not apply...In this realm, I am in control...")
    elseif (choice == 5) then
           pUnit:PlaySoundToSet(14516);
           Unit:SendChatMessage(14, 0, "I give you one chance. Pledge loyalty to me, and perhaps I won't slaughter you for your insolence!")
    end
    end
    
    
    function Malygos_Surge_Of_Power(pUnit, Event)
    pUnit:FullCastSpell(56505)
    pUnit:PlaySoundToSet(14524);
    pUnit:SendChatMessage(14, 0, "I will teach you ignorant children just how little you know about magic!")
    end
    
    function Malygos_Arcane_Storm(pUnit, Event)
    pUnit:FullCastSpell(57459)
    end
    
    function Malygos_Arcane_Breath(pUnit, Event)
    pUnit:FullCastSpell(56272)
    pUnit:PlaySoundToSet(14518);
    pUnit:SendChatMessage(14, 0, "You will not succeed while I draw breath!")
    end
    
    function Malygos_Frenzy(pUnit, Event)
    pUnit:CastSpell(28131)
    pUnit:PlaySoundToSet(14533);
    pUnit:SendChatMessage(14, 0, "I am UNSTOPPABLE!")
    end
    
    function Malygos_Phase1(pUnit, Event)
    if pUnit:GetHealthPct() <= 100 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Arcane_Breath", 6000, 0)
    pUnit:RegisterEvent("Malygos_Phase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "My patience has reached its limit, I WILL BE RID OF YOU! ")
    pUnit:PlaySoundToSet(14517);
    end
    end
    
    function Malygos_Phase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 50 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Surge_Of_Power", 15000, 0)
    pUnit:RegisterEvent("Malygos_Arcane_Storm", 12000, 0)
    pUnit:RegisterEvent("Malygos_Phase3", 100, 0)
    pUnit:SendChatMessage(14, 0, "Few have experienced the pain I will now inflict on you! ")
    pUnit:PlaySoundToSet(14523);
    end
    end
    
    function Malygos_Phase3(pUnit, Event)
    if pUnit:GetHealthPct() <= 30 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Frenzy", 120000, 0)
    pUnit:RegisterEvent("Malygos_EndPhase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "Now your benefactors make their appearance...But they are too late. The powers contained here are powerful enough to destroy the world ten times over! What do you think they will do to you?")
    pUnit:PlaySoundToSet(14530);
    end
    end
    
    function Malygos_EndPhase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 31 then
    pUnit:RemoveEvents()
    pUnit:SendChatMessage(14, 0, "ENOUGH! If you intend to reclaim Azeroth's magic, then you shall have it...")
    pUnit:PlaySoundToSet(14529);
    end
    end
    Its a Malygos script. Its Moffman's script. Everything in red is what I added.

    Im thinking about redoing the whole thing though..
    but.. anyways.. im sure you need to make a separate script for the spawned npc which shouldn't be hard.. but what i need is how to make that spawned npc say a few things when Malygos dies then doesn't repeat himself. I Didn't try the script you gave me yet but..

    I still need help on spawning the npc after the boss dies.. maybe add a 10 second timer.. right when the boss dies it triggers. anyone know what to do?
    Last edited by Moaradin; 04-18-2009 at 05:31 AM.

    +rep people who help you

  9. #9
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok i see...

    Code:
    -----------------[[ Malygos ]]-----------------
    
    
    function Malygos_OnSpawn(Unit,Event)
    Unit:RegisterEvent("Talk", 30000, 0) -- 30000 = 30 seconds
    end
    
    function Malygos_OnCombat(pUnit, Event)
    pUnit:RegisterEvent("Malygos_Phase1", 100, 0)
    end
    
    function Malygos_OnLeaveCombat(pUnit, Event)
    pUnit:RemoveEvents()
    end
    
    function Malygos_OnKillTarget(pUnit, Event)
    pUnit:PlaySoundToSet(14521)
    pUnit:SendChatMessage(14, 0, "Heheheheh.. How very.. naive..")
    end
    
    function Malygos_OnDeath(pUnit, Event)
    pUnit:RegisterEvent("Malygos_Spawning", 5000, 1) -- added
    pUnit:PlaySoundToSet(14540)
    pUnit:SendChatMessage(14, 0, "Unthinkable! The mortals will destroy.. e-everything.. my sister.. what have you..")
    pUnit:RemoveEvents()
    end
    
    function Malygos_Spawning(pUnit, Event) -- function added
    pUnit:SpawnCreature(Your spawned npcID, x, y, z, o, faction, Duration)
    end
    
    --[ Duration means the npc will despawn after a time, set to " 0 " then the npc stays there forever ]--
    
    RegisterUnitEvent(28859, 18, "Malygos_OnSpawn")
    RegisterUnitEvent(28859, 1, "Malygos_OnCombat")
    RegisterUnitEvent(28859, 2, "Malygos_OnLeaveCombat")
    RegisterUnitEvent(28859, 3, "Malygos_OnKillTarget")
    RegisterUnitEvent(28859, 4, "Malygos_OnDeath")
    
    
    function Talk(Unit,Event)
    local choice = math.random(1,5)
      if (choice == 1) then
          Unit:PlaySoundToSet(14512)
          Unit:SendChatMessage(14, 0, "Lesser beings, intruding here! A shame that your excess courage does not compensate for your stupidity!")
    elseif (choice == 2) then
          Unit:PlaySoundToSet(14513)
          Unit:SendChatMessage(14, 0, "None but the blue dragonflight are welcome here! Perhaps this is the work of Alexstrasza? Well then, she has sent you to your deaths.")
    elseif (choice == 3) then
           Unit:PlaySoundToSet(14514)
           Unit:SendChatMessage(14, 0, "What could you hope to accomplish, to storm brassily into my domain? To employ MAGIC? Against ME?")
    elseif (choice == 4) then
           Unit:PlaySoundToSet(14515)
           Unit:SendChatMessage(14, 0, "I am without limits here...the rules of your cherished reality do not apply...In this realm, I am in control...")
    elseif (choice == 5) then
           pUnit:PlaySoundToSet(14516);
           Unit:SendChatMessage(14, 0, "I give you one chance. Pledge loyalty to me, and perhaps I won't slaughter you for your insolence!")
    end
    end
    
    
    function Malygos_Surge_Of_Power(pUnit, Event)
    pUnit:FullCastSpell(56505)
    pUnit:PlaySoundToSet(14524);
    pUnit:SendChatMessage(14, 0, "I will teach you ignorant children just how little you know about magic!")
    end
    
    function Malygos_Arcane_Storm(pUnit, Event)
    pUnit:FullCastSpell(57459)
    end
    
    function Malygos_Arcane_Breath(pUnit, Event)
    pUnit:FullCastSpell(56272)
    pUnit:PlaySoundToSet(14518);
    pUnit:SendChatMessage(14, 0, "You will not succeed while I draw breath!")
    end
    
    function Malygos_Frenzy(pUnit, Event)
    pUnit:CastSpell(28131)
    pUnit:PlaySoundToSet(14533);
    pUnit:SendChatMessage(14, 0, "I am UNSTOPPABLE!")
    end
    
    function Malygos_Phase1(pUnit, Event)
    if pUnit:GetHealthPct() <= 100 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Arcane_Breath", 6000, 0)
    pUnit:RegisterEvent("Malygos_Phase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "My patience has reached its limit, I WILL BE RID OF YOU! ")
    pUnit:PlaySoundToSet(14517);
    end
    end
    
    function Malygos_Phase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 50 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Surge_Of_Power", 15000, 0)
    pUnit:RegisterEvent("Malygos_Arcane_Storm", 12000, 0)
    pUnit:RegisterEvent("Malygos_Phase3", 100, 0)
    pUnit:SendChatMessage(14, 0, "Few have experienced the pain I will now inflict on you! ")
    pUnit:PlaySoundToSet(14523);
    end
    end
    
    function Malygos_Phase3(pUnit, Event)
    if pUnit:GetHealthPct() <= 30 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Frenzy", 120000, 0)
    pUnit:RegisterEvent("Malygos_EndPhase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "Now your benefactors make their appearance...But they are too late. The powers contained here are powerful enough to destroy the world ten times over! What do you think they will do to you?")
    pUnit:PlaySoundToSet(14530);
    end
    end
    
    function Malygos_EndPhase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 31 then
    pUnit:RemoveEvents()
    pUnit:SendChatMessage(14, 0, "ENOUGH! If you intend to reclaim Azeroth's magic, then you shall have it...")
    pUnit:PlaySoundToSet(14529);
    end
    end
    
    
    -----------------[[ Spawned Npc ]]-----------------
    
    --[[ This is the script for your Spawned npc ]]--
    
    
    function SpawnedNPC_OnSpawn(Unit,Event)
     Unit:RegisterEvent("NPCTalk1",2000, 1)
     Unit:RegisterEvent("NPCTalk2",5000, 1)
     Unit:RegisterEvent("NPCTalk3",8000, 1)
     Unit:RegisterEvent("NPCTalk4",11000, 1)
     Unit:RegisterEvent("NPCTalk5",14000, 1)
     Unit:RegisterEvent("NPCTalk6",17000, 1)
    end
    
    function NPCTalk1(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 1")
    end
    
    function NPCTalk2(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 2")
    end
    
    function NPCTalk3(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 3")
    end
    
    function NPCTalk4(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 4")
    end
    
    function NPCTalk5(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 5")
    end
    
    function NPCTalk6(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 6")
    end
    
    RegisterUnitEvent(Your spawned npcID, 18, "SpawnedNPC_OnSpawn")



    I marked the things i added...

    You could try this script.
    This include the scripts for Malygos and the Npc you want to spawn.

    Now edit these things:

    Code:
    function Malygos_Spawning(pUnit, Event) -- function added
    pUnit:SpawnCreature(Your spawned npcID, x, y, z, o, faction, Duration)
    end
    You must add the coordinates and the npc ID from your npc you will spawn after the death of Malygos.


    Add your Spawned npc ID here too.

    Code:
    RegisterUnitEvent(Your spawned npcID, 18, "SpawnedNPC_OnSpawn")

    You can add the Texts for your spawned npc yourself here:

    Code:
    function NPCTalk1(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 1")
    end
    
    function NPCTalk2(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 2")
    end
    
    function NPCTalk3(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 3")
    end
    
    function NPCTalk4(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 4")
    end
    
    function NPCTalk5(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 5")
    end
    
    function NPCTalk6(Unit, Event)
     Unit:SendChatMessage(12, 0, "Your Text here 6")
    end
    Just include your Text in the " ".


    On Spawn he talk every 3 seconds a different text.

  10. #10
    Moaradin's Avatar Contributor
    Reputation
    163
    Join Date
    Feb 2008
    Posts
    439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks.. but all this really helps is makes my Malygos script and Alexstrasza into one script.. but.. the npc is not spawning 10 seconds after the boss dies (how I have it set up)
    when I manually spawn the npc.. the script works.. but when Malygos dies.. the npc does not spawn. Here is the full script
    Code:
    -----------------[[ Malygos ]]-----------------
    
    
    function Malygos_OnSpawn(Unit,Event)
    Unit:RegisterEvent("Talk", 30000, 0) -- 30000 = 30 seconds
    end
    
    function Malygos_OnCombat(pUnit, Event)
    pUnit:RegisterEvent("Malygos_Phase1", 100, 0)
    end
    
    function Malygos_OnLeaveCombat(pUnit, Event)
    pUnit:RemoveEvents()
    end
    
    function Malygos_OnKillTarget(pUnit, Event)
    pUnit:PlaySoundToSet(14521)
    pUnit:SendChatMessage(14, 0, "Heheheheh.. How very.. naive..")
    end
    
    function Malygos_OnDeath(pUnit, Event)
    pUnit:RegisterEvent("Malygos_Spawning", 10000, 1) -- added
    pUnit:PlaySoundToSet(14540)
    pUnit:SendChatMessage(14, 0, "Unthinkable! The mortals will destroy.. e-everything.. my sister.. what have you..")
    end
    
    function Malygos_Spawning(pUnit, Event) -- function added
    pUnit:SpawnCreature(32295, x, y, z, o, 35, 100000)
    end
    
    --[ Duration means the npc will despawn after a time, set to " 0 " then the npc stays there forever ]--
    
    RegisterUnitEvent(28859, 18, "Malygos_OnSpawn")
    RegisterUnitEvent(28859, 1, "Malygos_OnCombat")
    RegisterUnitEvent(28859, 2, "Malygos_OnLeaveCombat")
    RegisterUnitEvent(28859, 3, "Malygos_OnKillTarget")
    RegisterUnitEvent(28859, 4, "Malygos_OnDeath")
    
    
    function Talk(Unit,Event)
    local choice = math.random(1,5)
      if (choice == 1) then
          Unit:PlaySoundToSet(14512)
          Unit:SendChatMessage(14, 0, "Lesser beings, intruding here! A shame that your excess courage does not compensate for your stupidity!")
    elseif (choice == 2) then
          Unit:PlaySoundToSet(14513)
          Unit:SendChatMessage(14, 0, "None but the blue dragonflight are welcome here! Perhaps this is the work of Alexstrasza? Well then, she has sent you to your deaths.")
    elseif (choice == 3) then
           Unit:PlaySoundToSet(14514)
           Unit:SendChatMessage(14, 0, "What could you hope to accomplish, to storm brassily into my domain? To employ MAGIC? Against ME?")
    elseif (choice == 4) then
           Unit:PlaySoundToSet(14515)
           Unit:SendChatMessage(14, 0, "I am without limits here...the rules of your cherished reality do not apply...In this realm, I am in control...")
    elseif (choice == 5) then
           pUnit:PlaySoundToSet(14516);
           Unit:SendChatMessage(14, 0, "I give you one chance. Pledge loyalty to me, and perhaps I won't slaughter you for your insolence!")
    end
    end
    
    
    function Malygos_Surge_Of_Power(pUnit, Event)
    pUnit:FullCastSpell(56505)
    pUnit:PlaySoundToSet(14524);
    pUnit:SendChatMessage(14, 0, "I will teach you ignorant children just how little you know about magic!")
    end
    
    function Malygos_Arcane_Storm(pUnit, Event)
    pUnit:FullCastSpell(57459)
    end
    
    function Malygos_Arcane_Breath(pUnit, Event)
    pUnit:FullCastSpell(56272)
    pUnit:PlaySoundToSet(14518);
    pUnit:SendChatMessage(14, 0, "You will not succeed while I draw breath!")
    end
    
    function Malygos_Frenzy(pUnit, Event)
    pUnit:CastSpell(28131)
    pUnit:PlaySoundToSet(14533);
    pUnit:SendChatMessage(14, 0, "I am UNSTOPPABLE!")
    end
    
    function Malygos_Phase1(pUnit, Event)
    if pUnit:GetHealthPct() <= 100 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Arcane_Breath", 6000, 0)
    pUnit:RegisterEvent("Malygos_Phase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "My patience has reached its limit, I WILL BE RID OF YOU! ")
    pUnit:PlaySoundToSet(14517);
    end
    end
    
    function Malygos_Phase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 50 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Surge_Of_Power", 15000, 0)
    pUnit:RegisterEvent("Malygos_Arcane_Storm", 12000, 0)
    pUnit:RegisterEvent("Malygos_Phase3", 100, 0)
    pUnit:SendChatMessage(14, 0, "Few have experienced the pain I will now inflict on you! ")
    pUnit:PlaySoundToSet(14523);
    end
    end
    
    function Malygos_Phase3(pUnit, Event)
    if pUnit:GetHealthPct() <= 30 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Frenzy", 120000, 0)
    pUnit:RegisterEvent("Malygos_EndPhase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "Now your benefactors make their appearance...But they are too late. The powers contained here are powerful enough to destroy the world ten times over! What do you think they will do to you?")
    pUnit:PlaySoundToSet(14530);
    end
    end
    
    function Malygos_EndPhase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 31 then
    pUnit:RemoveEvents()
    pUnit:SendChatMessage(14, 0, "ENOUGH! If you intend to reclaim Azeroth's magic, then you shall have it...")
    pUnit:PlaySoundToSet(14529);
    end
    end
    
    
    -----------------[[ Spawned Npc ]]-----------------
    
    --[[ This is the script for your Spawned npc ]]--
    
    
    function SpawnedNPC_OnSpawn(Unit,Event)
     Unit:RegisterEvent("NPCTalk1",7000, 1)
     Unit:RegisterEvent("NPCTalk2",12000, 1)
     Unit:RegisterEvent("NPCTalk3",25000, 1)
     Unit:RegisterEvent("NPCTalk4",50000, 1)
    end
    
    function NPCTalk1(Unit, Event)
    Unit:PlaySoundToSet(14406);
    Unit:SendChatMessage(12, 0, "I did what I had to, brother.. You gave me no alternative.")
    end
    
    function NPCTalk2(Unit, Event)
    Unit:PlaySoundToSet(14407);
    Unit:SendChatMessage(12, 0, "And so ends the Nexus War.")
    end
    
    function NPCTalk3(Unit, Event)
    Unit:PlaySoundToSet(14408);
    Unit:SendChatMessage(12, 0, "This resolution pains me deeply, but the destruction, the monumental loss of life had to end. Regardless of Malygos' recent transgressions, I will mourn his loss. He was once a guardian, a protector. This day, one of the world's mightiest has fallen.")
    end
    
    function NPCTalk4(Unit, Event)
    Unit:PlaySoundToSet(14409);
    Unit:SendChatMessage(12, 0, "The red dragonflight will take on the burden of mending the devastation wrought on Azeroth. Return home to your people and rest. Tomorrow will bring you new challenges, and you must be ready to face them. Life.. goes on.")
    end
    
    RegisterUnitEvent(32295, 18, "SpawnedNPC_OnSpawn")
    Any more suggestions?

    +rep people who help you

  11. #11
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by treston323 View Post

    [...] when I manually spawn the npc.. the script works [...]
    This is good

    btw.:

    did you change this? i mean the x,y,z,o coordinate of Alexstrasza's position?

    Code:
    pUnit:SpawnCreature(32295, x, y, z, o, 35, 100000)


    If you do that and it didnt work, we can try to do 2 things:

    1. Instant Spawn Alexstrasza after Malygos died.

    2. If 1. not work, Instant Spawn Alexstrasza, when Malygos is under 2% or 1%... at the moment i cant find a 3.1 arcEmu server, so you must test it^^

    This is the script to Instant spawn Alexstrasza after Death of Malygos:

    Code:
    -----------------[[ Malygos ]]-----------------
    
    
    function Malygos_OnSpawn(Unit,Event)
    Unit:RegisterEvent("Talk", 30000, 0) -- 30000 = 30 seconds
    end
    
    function Malygos_OnCombat(pUnit, Event)
    pUnit:RegisterEvent("Malygos_Phase1", 100, 0)
    end
    
    function Malygos_OnLeaveCombat(pUnit, Event)
    pUnit:RemoveEvents()
    end
    
    function Malygos_OnKillTarget(pUnit, Event)
    pUnit:PlaySoundToSet(14521)
    pUnit:SendChatMessage(14, 0, "Heheheheh.. How very.. naive..")
    end
    
    function Malygos_OnDeath(pUnit, Event)
    pUnit:SpawnCreature(32295, x, y, z, o, 35, 100000) --Instantspawn at death
    pUnit:PlaySoundToSet(14540)
    pUnit:SendChatMessage(14, 0, "Unthinkable! The mortals will destroy.. e-everything.. my sister.. what have you..")
    --pUnit:RegisterEvent("Malygos_Spawning", 10000, 1)
    end
    
    --function Malygos_Spawning(pUnit, Event) -- function added
    --pUnit:SpawnCreature(32295, x, y, z, o, 35, 100000)
    --end
    
    --[ Duration means the npc will despawn after a time, set to " 0 " then the npc stays there forever ]--
    
    RegisterUnitEvent(28859, 18, "Malygos_OnSpawn")
    RegisterUnitEvent(28859, 1, "Malygos_OnCombat")
    RegisterUnitEvent(28859, 2, "Malygos_OnLeaveCombat")
    RegisterUnitEvent(28859, 3, "Malygos_OnKillTarget")
    RegisterUnitEvent(28859, 4, "Malygos_OnDeath")
    
    
    function Talk(Unit,Event)
    local choice = math.random(1,5)
      if (choice == 1) then
          Unit:PlaySoundToSet(14512)
          Unit:SendChatMessage(14, 0, "Lesser beings, intruding here! A shame that your excess courage does not compensate for your stupidity!")
    elseif (choice == 2) then
          Unit:PlaySoundToSet(14513)
          Unit:SendChatMessage(14, 0, "None but the blue dragonflight are welcome here! Perhaps this is the work of Alexstrasza? Well then, she has sent you to your deaths.")
    elseif (choice == 3) then
           Unit:PlaySoundToSet(14514)
           Unit:SendChatMessage(14, 0, "What could you hope to accomplish, to storm brassily into my domain? To employ MAGIC? Against ME?")
    elseif (choice == 4) then
           Unit:PlaySoundToSet(14515)
           Unit:SendChatMessage(14, 0, "I am without limits here...the rules of your cherished reality do not apply...In this realm, I am in control...")
    elseif (choice == 5) then
           pUnit:PlaySoundToSet(14516);
           Unit:SendChatMessage(14, 0, "I give you one chance. Pledge loyalty to me, and perhaps I won't slaughter you for your insolence!")
    end
    end
    
    
    function Malygos_Surge_Of_Power(pUnit, Event)
    pUnit:FullCastSpell(56505)
    pUnit:PlaySoundToSet(14524);
    pUnit:SendChatMessage(14, 0, "I will teach you ignorant children just how little you know about magic!")
    end
    
    function Malygos_Arcane_Storm(pUnit, Event)
    pUnit:FullCastSpell(57459)
    end
    
    function Malygos_Arcane_Breath(pUnit, Event)
    pUnit:FullCastSpell(56272)
    pUnit:PlaySoundToSet(14518);
    pUnit:SendChatMessage(14, 0, "You will not succeed while I draw breath!")
    end
    
    function Malygos_Frenzy(pUnit, Event)
    pUnit:CastSpell(28131)
    pUnit:PlaySoundToSet(14533);
    pUnit:SendChatMessage(14, 0, "I am UNSTOPPABLE!")
    end
    
    function Malygos_Phase1(pUnit, Event)
    if pUnit:GetHealthPct() <= 100 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Arcane_Breath", 6000, 0)
    pUnit:RegisterEvent("Malygos_Phase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "My patience has reached its limit, I WILL BE RID OF YOU! ")
    pUnit:PlaySoundToSet(14517);
    end
    end
    
    function Malygos_Phase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 50 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Surge_Of_Power", 15000, 0)
    pUnit:RegisterEvent("Malygos_Arcane_Storm", 12000, 0)
    pUnit:RegisterEvent("Malygos_Phase3", 100, 0)
    pUnit:SendChatMessage(14, 0, "Few have experienced the pain I will now inflict on you! ")
    pUnit:PlaySoundToSet(14523);
    end
    end
    
    function Malygos_Phase3(pUnit, Event)
    if pUnit:GetHealthPct() <= 30 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Frenzy", 120000, 0)
    pUnit:RegisterEvent("Malygos_EndPhase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "Now your benefactors make their appearance...But they are too late. The powers contained here are powerful enough to destroy the world ten times over! What do you think they will do to you?")
    pUnit:PlaySoundToSet(14530);
    end
    end
    
    function Malygos_EndPhase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 31 then
    pUnit:RemoveEvents()
    pUnit:SendChatMessage(14, 0, "ENOUGH! If you intend to reclaim Azeroth's magic, then you shall have it...")
    pUnit:PlaySoundToSet(14529);
    end
    end
    
    
    -----------------[[ Spawned Npc ]]-----------------
    
    --[[ This is the script for your Spawned npc ]]--
    
    
    function SpawnedNPC_OnSpawn(Unit,Event)
     Unit:RegisterEvent("NPCTalk1",7000, 1)
     Unit:RegisterEvent("NPCTalk2",12000, 1)
     Unit:RegisterEvent("NPCTalk3",25000, 1)
     Unit:RegisterEvent("NPCTalk4",50000, 1)
    end
    
    function NPCTalk1(Unit, Event)
    Unit:PlaySoundToSet(14406);
    Unit:SendChatMessage(12, 0, "I did what I had to, brother.. You gave me no alternative.")
    end
    
    function NPCTalk2(Unit, Event)
    Unit:PlaySoundToSet(14407);
    Unit:SendChatMessage(12, 0, "And so ends the Nexus War.")
    end
    
    function NPCTalk3(Unit, Event)
    Unit:PlaySoundToSet(14408);
    Unit:SendChatMessage(12, 0, "This resolution pains me deeply, but the destruction, the monumental loss of life had to end. Regardless of Malygos' recent transgressions, I will mourn his loss. He was once a guardian, a protector. This day, one of the world's mightiest has fallen.")
    end
    
    function NPCTalk4(Unit, Event)
    Unit:PlaySoundToSet(14409);
    Unit:SendChatMessage(12, 0, "The red dragonflight will take on the burden of mending the devastation wrought on Azeroth. Return home to your people and rest. Tomorrow will bring you new challenges, and you must be ready to face them. Life.. goes on.")
    end
    
    RegisterUnitEvent(32295, 18, "SpawnedNPC_OnSpawn")


    This is the script for spawning Alexstrasza when Malygos get under 1%:

    (If this didnt work, change the if pUnit:GetHealth() <= 1 to if pUnit:GetHealth() <= 2)

    Code:
    -----------------[[ Malygos ]]-----------------
    
    
    function Malygos_OnSpawn(Unit,Event)
    Unit:RegisterEvent("Talk", 30000, 0) -- 30000 = 30 seconds
    end
    
    function Malygos_OnCombat(pUnit, Event)
    pUnit:RegisterEvent("Malygos_Phase1", 100, 0)
    end
    
    function Malygos_OnLeaveCombat(pUnit, Event)
    pUnit:RemoveEvents()
    end
    
    function Malygos_OnKillTarget(pUnit, Event)
    pUnit:PlaySoundToSet(14521)
    pUnit:SendChatMessage(14, 0, "Heheheheh.. How very.. naive..")
    end
    
    function Malygos_OnDeath(pUnit, Event)
    pUnit:PlaySoundToSet(14540)
    pUnit:SendChatMessage(14, 0, "Unthinkable! The mortals will destroy.. e-everything.. my sister.. what have you..")
    end
    
    --[ Duration means the npc will despawn after a time, set to " 0 " then the npc stays there forever ]--
    
    RegisterUnitEvent(28859, 18, "Malygos_OnSpawn")
    RegisterUnitEvent(28859, 1, "Malygos_OnCombat")
    RegisterUnitEvent(28859, 2, "Malygos_OnLeaveCombat")
    RegisterUnitEvent(28859, 3, "Malygos_OnKillTarget")
    RegisterUnitEvent(28859, 4, "Malygos_OnDeath")
    
    
    function Talk(Unit,Event)
    local choice = math.random(1,5)
      if (choice == 1) then
          Unit:PlaySoundToSet(14512)
          Unit:SendChatMessage(14, 0, "Lesser beings, intruding here! A shame that your excess courage does not compensate for your stupidity!")
    elseif (choice == 2) then
          Unit:PlaySoundToSet(14513)
          Unit:SendChatMessage(14, 0, "None but the blue dragonflight are welcome here! Perhaps this is the work of Alexstrasza? Well then, she has sent you to your deaths.")
    elseif (choice == 3) then
           Unit:PlaySoundToSet(14514)
           Unit:SendChatMessage(14, 0, "What could you hope to accomplish, to storm brassily into my domain? To employ MAGIC? Against ME?")
    elseif (choice == 4) then
           Unit:PlaySoundToSet(14515)
           Unit:SendChatMessage(14, 0, "I am without limits here...the rules of your cherished reality do not apply...In this realm, I am in control...")
    elseif (choice == 5) then
           pUnit:PlaySoundToSet(14516);
           Unit:SendChatMessage(14, 0, "I give you one chance. Pledge loyalty to me, and perhaps I won't slaughter you for your insolence!")
    end
    end
    
    
    function Malygos_Surge_Of_Power(pUnit, Event)
    pUnit:FullCastSpell(56505)
    pUnit:PlaySoundToSet(14524);
    pUnit:SendChatMessage(14, 0, "I will teach you ignorant children just how little you know about magic!")
    end
    
    function Malygos_Arcane_Storm(pUnit, Event)
    pUnit:FullCastSpell(57459)
    end
    
    function Malygos_Arcane_Breath(pUnit, Event)
    pUnit:FullCastSpell(56272)
    pUnit:PlaySoundToSet(14518);
    pUnit:SendChatMessage(14, 0, "You will not succeed while I draw breath!")
    end
    
    function Malygos_Frenzy(pUnit, Event)
    pUnit:CastSpell(28131)
    pUnit:PlaySoundToSet(14533);
    pUnit:SendChatMessage(14, 0, "I am UNSTOPPABLE!")
    end
    
    function Malygos_Phase1(pUnit, Event)
    if pUnit:GetHealthPct() <= 100 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Arcane_Breath", 6000, 0)
    pUnit:RegisterEvent("Malygos_Phase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "My patience has reached its limit, I WILL BE RID OF YOU! ")
    pUnit:PlaySoundToSet(14517);
    end
    end
    
    function Malygos_Phase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 50 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Surge_Of_Power", 15000, 0)
    pUnit:RegisterEvent("Malygos_Arcane_Storm", 12000, 0)
    pUnit:RegisterEvent("Malygos_Phase3", 100, 0)
    pUnit:SendChatMessage(14, 0, "Few have experienced the pain I will now inflict on you! ")
    pUnit:PlaySoundToSet(14523);
    end
    end
    
    function Malygos_Phase3(pUnit, Event)
    if pUnit:GetHealthPct() <= 30 then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Malygos_Frenzy", 120000, 0)
    pUnit:RegisterEvent("Malygos_EndPhase2", 100, 0)
    pUnit:SendChatMessage(14, 0, "Now your benefactors make their appearance...But they are too late. The powers contained here are powerful enough to destroy the world ten times over! What do you think they will do to you?")
    pUnit:PlaySoundToSet(14530);
    end
    end
    
    function Malygos_EndPhase2(pUnit, Event)
    if pUnit:GetHealthPct() <= 31 then
    pUnit:RemoveEvents()
    pUnit:SendChatMessage(14, 0, "ENOUGH! If you intend to reclaim Azeroth's magic, then you shall have it...")
    pUnit:PlaySoundToSet(14529);
    pUnit:RegisterEvent("Malygos_Alexstrasza", 100, 0)
    end
    end
    
    function Malygos_Alexstrasza(pUnit, Event)
    if pUnit:GetHealthPct() <= 1 then
    pUnit:RemoveEvents()
    pUnit:SpawnCreature(32295, x, y, z, o, 35, 100000) --add coordinates! :D
    end
    end
    
    
    -----------------[[ Spawned Npc ]]-----------------
    
    --[[ This is the script for your Spawned npc ]]--
    
    
    function SpawnedNPC_OnSpawn(Unit,Event)
     Unit:RegisterEvent("NPCTalk1",7000, 1)
     Unit:RegisterEvent("NPCTalk2",12000, 1)
     Unit:RegisterEvent("NPCTalk3",25000, 1)
     Unit:RegisterEvent("NPCTalk4",50000, 1)
    end
    
    function NPCTalk1(Unit, Event)
    Unit:PlaySoundToSet(14406);
    Unit:SendChatMessage(12, 0, "I did what I had to, brother.. You gave me no alternative.")
    end
    
    function NPCTalk2(Unit, Event)
    Unit:PlaySoundToSet(14407);
    Unit:SendChatMessage(12, 0, "And so ends the Nexus War.")
    end
    
    function NPCTalk3(Unit, Event)
    Unit:PlaySoundToSet(14408);
    Unit:SendChatMessage(12, 0, "This resolution pains me deeply, but the destruction, the monumental loss of life had to end. Regardless of Malygos' recent transgressions, I will mourn his loss. He was once a guardian, a protector. This day, one of the world's mightiest has fallen.")
    end
    
    function NPCTalk4(Unit, Event)
    Unit:PlaySoundToSet(14409);
    Unit:SendChatMessage(12, 0, "The red dragonflight will take on the burden of mending the devastation wrought on Azeroth. Return home to your people and rest. Tomorrow will bring you new challenges, and you must be ready to face them. Life.. goes on.")
    end
    
    RegisterUnitEvent(32295, 18, "SpawnedNPC_OnSpawn")

  12. #12
    Moaradin's Avatar Contributor
    Reputation
    163
    Join Date
    Feb 2008
    Posts
    439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a bunch man! Im using the first one =)
    +Repx2

    got one more problem which is probably a DB problem..

    Alexstrasza looks like shes just standing in the air with no fl ying emotion! :O

    +rep people who help you

  13. #13
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by treston323 View Post
    Thanks a bunch man! Im using the first one =)
    +Repx2

    got one more problem which is probably a DB problem..

    Alexstrasza looks like shes just standing in the air with no fl ying emotion! :O
    No problem!

Similar Threads

  1. [Trinity] Making npcs spawn at the same time every time even when they die at different time
    By Badcobra10 in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 06-03-2011, 12:15 PM
  2. I Need some help will spawning a NPC Spirit Healer...
    By PRIMO12 in forum World of Warcraft Emulator Servers
    Replies: 11
    Last Post: 12-06-2007, 07:33 PM
  3. I Need some help will spawning a NPC Spirit Healer...
    By PRIMO12 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 12-05-2007, 05:08 PM
  4. Help needed - I cannot talk to spawned NPCs
    By ADAMZY in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 11-23-2007, 08:02 AM
  5. custom/spawned npc wont save when i spawned them
    By bjorn11 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 11-19-2007, 10:04 AM
All times are GMT -5. The time now is 12:11 PM. 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