Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 5 of 5
  1. #1
    Beginner
    anasterion's Avatar
    Join Date
    Feb 2010
    Posts
    2
    Post Thanks / Like
    Rep Power
    15
    Reputation
    1

    Problem with a Lua Script


    Register to remove this ad
    Hey guys!
    made my first lua script today, iam not able to find errors in it but i cant get the phases working :/ could someone take a look at the script and tell me whats wrong? the npc casts the spells like i wanted, but the phases wont be registered

    Code:
    function Saurfang_OnCombat(Unit, Event)
    Unit:SendChatMessage(14, 0, "YOU CANNOT ESCAPE MY ANGER!!!")
    Unit:RegisterEvent("Saurfang_Berserk", 1, 1)
    Unit:RegisterEvent("Saurfang_Boilingblood", 60000, 20)
    Unit:RegisterEvent("Saurfang_Bloodlink", 60000, 10)
    Unit:RegisterEvent("Saurfang_Phase1", 5000, 1)
    Unit:RegisterEvent("Saurfang_Phase2", 5000, 1)
    end
    
    function Saurfang_Phase1(Unit, Event)
    if Unit:GetHealthPct() <= 75 then
    Unit:SendChatMessage(14, 0, "You are stronger than i thought you are!")
    Unit:CastSpell(72173)
    Unit:CastSpell(15578)
    end
    end
    
    function Saurfang_Phase2(Unit, Event)
    if Unit:GetHealthPct() <= 33 then
    Unit:SendChatMessage(14, 0, "That was nothing, take this!!!")
    Unit:CastSpell(46008)
    Unit:CastSpell(41185)
    Unit:SetScale(2)
    end
    end
    
    function Saurfang_Berserk(Unit, Event)
    Unit:CastSpell(26662)
    Unit:SendChatMessage(14, 0, "Feel the pain!!")
    end
    
    
    function Saurfang_Boilingblood(Unit, Event)
    Unit:FullCastSpellOnTarget(72178, Unit:GetClosestPlayer())
    end
    
    function Saurfang_Bloodlink(Unit, Event)
    Unit:CastSpell(72371)
    Unit:SendChatMessage(14, 0, "Your Hate makes me even STRONGER!!")
    end
    
    function Saurfang_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents() 
    end
    
    function Saurfang_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(14, 0, "Who expected this? hahaha!")
    Unit:CastSpell(72356)
    end
    
    function Saurfang_OnDied(Unit, Event)
    Unit:SendChatMessage(14, 0, "You...cannot...win against...the...Lich...King!")
    Unit:RemoveEvents()
    end
    
    RegisterUnitEvent(37813, 1, "Saurfang_OnCombat")
    RegisterUnitEvent(37813, 2, "Saurfang_OnLeaveCombat")
    RegisterUnitEvent(37813, 3, "Saurfang_OnKilledTarget")
    RegisterUnitEvent(37813, 4, "Saurfang_OnDied")





    › See More: Problem with a Lua Script



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Sergeant

    Join Date
    Sep 2009
    Posts
    71
    Post Thanks / Like
    Rep Power
    16
    Reputation
    5
    Code:
    function Saurfang_Phase1(Unit, Event)
    if Unit:GetHealthPct() <= 75 then
    Unit:SendChatMessage(14, 0, "You are stronger than i thought you are!")
    Unit:CastSpell(72173)
    Unit:CastSpell(15578)
    end
    end
    
    function Saurfang_Phase2(Unit, Event)
    if Unit:GetHealthPct() <= 33 then
    Unit:SendChatMessage(14, 0, "That was nothing, take this!!!")
    Unit:CastSpell(46008)
    Unit:CastSpell(41185)
    Unit:SetScale(2)
    end
    end
    u shall only use 1 end

  4. #3
    Beginner
    anasterion's Avatar
    Join Date
    Feb 2010
    Posts
    2
    Post Thanks / Like
    Rep Power
    15
    Reputation
    1
    Quote Originally Posted by mag1212 View Post
    Code:
    function Saurfang_Phase1(Unit, Event)
    if Unit:GetHealthPct() <= 75 then
    Unit:SendChatMessage(14, 0, "You are stronger than i thought you are!")
    Unit:CastSpell(72173)
    Unit:CastSpell(15578)
    end
    end
    
    function Saurfang_Phase2(Unit, Event)
    if Unit:GetHealthPct() <= 33 then
    Unit:SendChatMessage(14, 0, "That was nothing, take this!!!")
    Unit:CastSpell(46008)
    Unit:CastSpell(41185)
    Unit:SetScale(2)
    end
    end
    u shall only use 1 end
    thought i have to end the if to, saw it in a tutorial, k i will try that ty

  5. #4
    Sergeant

    Join Date
    Sep 2009
    Posts
    71
    Post Thanks / Like
    Rep Power
    16
    Reputation
    5
    nope its 1 function so u only need 1 end

  6. #5
    Contributor
    Bing's Avatar
    Join Date
    Jul 2010
    Posts
    103
    Post Thanks / Like
    Rep Power
    16
    Reputation
    103

    Register to remove this ad
    Mag is right, the reduction of those two ends should make the phases register!

 

 

Visitors found this page by searching for:

castspell lua

SEO Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 07:01 AM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org