[Help] my first lua need quite bit of help menu

User Tag List

Results 1 to 2 of 2
  1. #1
    jordddm's Avatar Member
    Reputation
    11
    Join Date
    Nov 2007
    Posts
    49
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Help] my first lua need quite bit of help

    need help on my lua script keep gettin error this is not copyed i wrote from scratch with help few lua guides on certain commands

    scripts/zsathra.lua:29 Calling 'GetClosestPlayer' on bad self (unit expected, got table)

    Code:
    ------------------------------
    --Conquerer Usathra
    --GougeWow
    --Made by jordddm
    ------------------------------
    local npcid=99997
     
    function Usathra_OnDeath(Unit, Event)
    Unit:SendChatMessage(14, 0, "You have not seen the last of ME!")
    Unit:RemoveEvents()
    end
     
    function Usathra_OnKillTarget(Unit, Event)
    Unit:SendChatMessage(14, 0, "1 down! only few more to go!")
    end
     
    function Usathra_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    end
     
    RegisterUnitEvent(99997,1,"Usathra_OnCombat")
    RegisterUnitEvent(99997,4,"Usathra_OnDeath")
    RegisterUnitEvent(99997,3,"Usathra_OnKillTarget")
    RegisterUnitEvent(99997,2,"Usathra_OnLeaveCombat")
     
    --    OnCombat     --
    local plr = Unit:GetClosestPlayer()
    local tank = Unit:GetMainTank()
    local plrMana = Unit:GetRandomPlayer(4)
    function Usathra_OnCombat(Unit,Event)
        if plr == nil then
        Unit:SendChatMessage(14, 0, "Lets see how you like my pyro on your ass!")
      else
        Unit:FullCastSpellOnTarget(31263,tank)
        if tank == nil then
        Unit:SendChatMessage(14, 0, "Seeing as your friend is not here lets see what you can do! you worthless Mana users!")
        Unit:FullCastSpellOnTarget(38538,plr)
        Unit:FullCastSpellOnTarget(61591,plrMana)
        if plr == nil then
        if plrMana == nil then
        return
        Unit:RegisterEvent("Usathra_At75", 100, 0)
    end
      end
    end
      end
    end
     
    --      Phase One       --
    function Usathra_At75(Unit,Event)
        if Unit:GetHealthPct() < 75 then
        Unit:SendChatMessage(14, 0, "Hmm youre tougher than i thought no matter you will be disposed of pretty soon!")
       else
        Unit:FullCastSpell(29973,plr)
        if plr == nil then
        Unit:FullCastSpell(31250,plrMana)
        Unit:FullCastSpell(61594,plrMana)
        if plrMana == nil then
        return
        Unit:RegisterEvent("Usathra_Minions1", 100, 0)
    end
      end
    end
      end
     
    --       Minions 1-3       --
    function Usathra_Minions1(Unit,Event)
        if Unit:GetHealthPct() < 35 then
        Unit:SpawnCreature(11121,3708.236572,3573.539795,477.444366,6.093113,14,60000);
        Unit:SpawnCreature(11122,3770.843506,3560.783936,477.441742,2.931886,14,60000);
        Unit:RegisterEvent("Usathra_Minions2", 60000, 1)
    end
      end
     
    function Usathra_Minions2(Unit,Event)
        if Unit:GetHealthPct() < 35 then
        local X = Unit:GetX()
        local Y = Unit:GetY()
        local Z = Unit:GetZ()
        local O = Unit:GetO()
        Unit:SpawnCreature(11121,3757.075430,3563.169434,477.441986,2.957025,14,60000);
        Unit:SpawnCreature(11122,3721.801270,3570.813232,477.441193,6.060132,14,60000);
        Unit:RegisterEvent("Usathra_Minions3", 100, 0)
    end
      end
     
    local X = Unit:GetX()
    local Y = Unit:GetY()
    local Z = Unit:GetZ()
    local O = Unit:GetO()
    local npc1 = Unit:GetCreatureNearestCoords(X,Y,Z,11121)
    local npc2 = Unit:GetCreatureNearestCoords(X,Y,Z,11122)
    function Usathra_Minions3(Unit,Event)
        if npc1:IsDead() == 1 and npc2:IsDead() == 1 then
        Unit:SpawnCreature(28583,X,Y,Z,45,0)
        Unit:SpawnCreature(23870,X,Y,Z,45,0)
    end
      end
     
    ---     Minion 1s spells       --
    function Ashudar_OnDeath(Unit, Event)
    Unit:SendChatMessage(12, 0, "Hmm you were tougher than i thought...")
    Unit:RemoveEvents()
    end
     
    function Ashudar_OnKillTarget(Unit, Event)
    Unit:SendChatMessage(12, 0, "Pathetic!")
    end
     
    function Ashudar_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    end
    RegisterUnitEvent(11121,1,"Ashudar_Spell1OnCombat")
    RegisterUnitEvent(11121,4,"Ashudar_OnDeath")
    RegisterUnitEvent(11121,3,"Ashudar_OnKillTarget")
    RegisterUnitEvent(11121,2,"Ashudar_OnLeaveCombat")
     
    function Ashudar_Spell1OnCombat(Unit,Event)
        Unit:FullCastSpellOnTarget(15708,tank)
        if tank == nil then
        Unit:FullCastSpellOnTarget(54469,plr)
        Unit:FullCastSpellOnTarget(49723,plr)
        Unit:FullCastSpellOnTarget(51429,plr)
        if plr == nil then
        Unit:FullCastSpellOnTarget(29881,plrMana)
        Unit:FullCastSpellOnTarget(25195,plrMana)
        if plrMana == nil then
        return
        Unit:RegisterEvent("Ashudar_Spell2", 1000, 0)
    end
      end
    end
      end
     
    function Ashudar_Spell2(Unit,Event)
        Unit:FullCastSpellOnTarget(15708,tank)
        if tank == nil then
        Unit:FullCastSpellOnTarget(54469,plr)
        Unit:FullCastSpellOnTarget(49723,plr)
        Unit:FullCastSpellOnTarget(51429,plr)
        if plr == nil then
        Unit:FullCastSpellOnTarget(29881,plrMana)
        Unit:FullCastSpellOnTarget(25195,plrMana)
        if plrMana == nil then
        return
    end
      end
    end
      end
     
    ---     Minion 2s Spells     --
    function Eunganda_OnDeath(Unit, Event)
    Unit:SendChatMessage(12, 0, "Sorry master... i have... Failed.....")
    Unit:RemoveEvents()
    end
     
    function Eunganda_OnKillTarget(Unit, Event)
    Unit:SendChatMessage(12, 0, "what a pathetic bunch of rubble you really are!")
    end
    function Eunganda_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    end
    RegisterUnitEvent(11122,1,"Eunganda_Spell1OnCombat")
    RegisterUnitEvent(11122,4,"Eunganda_OnDeath")
    RegisterUnitEvent(11122,3,"Eunganda_OnKillTarget")
    RegisterUnitEvent(11122,2,"Eunganda_OnLeaveCombat")
     
    function Eunganda_Spell1OnCombat(Unit,Event)
        Unit:FullCastSpellOnTarget(15708,tank)
        if tank == nil then
        Unit:FullCastSpellOnTarget(36868,plr)
        Unit:FullCastSpellOnTarget(31345,plr)
        Unit:FullCastSpellOnTarget(58536,plr)
        if plr == nil then
        Unit:FullCastSpellOnTarget(47864,plrMana)
        Unit:FullCastSpellOnTarget(47813,plrMana)
        Unit:FullCastSpellOnTarget(31705,plrMana)
        if plrMana == nil then
        return
        Unit:RegisterEvent("Eunganda_Spell2", 500, 0)
    end
      end
    end
      end
     
    function Eunganda_Spell2(Unit,Event)
        Unit:FullCastSpellOnTarget(15708,tank)
        if tank == nil then
        Unit:FullCastSpellOnTarget(36868,plr)
        Unit:FullCastSpellOnTarget(31345,plr)
        Unit:FullCastSpellOnTarget(58536,plr)
        if plr == nil then
        Unit:FullCastSpellOnTarget(47864,plrMana)
        Unit:FullCastSpellOnTarget(47813,plrMana)
        Unit:FullCastSpellOnTarget(31705,plrMana)
        if plrMana == nil then
        return
    end
      end
    end
      end
    Last edited by jordddm; 03-22-2009 at 09:56 AM.

    [Help] my first lua need quite bit of help
  2. #2
    Confucius's Avatar Moderator The Idiot

    CoreCoins Purchaser Authenticator enabled
    Reputation
    1396
    Join Date
    Oct 2007
    Posts
    2,645
    Thanks G/R
    281/290
    Trade Feedback
    7 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm new to Lua as well but I think your error is here:
    function Eunganda_Spell1OnCombat(Unit,Event)
    Unit:FullCastSpellOnTarget(15708,tank)
    if tank == nil then
    Unit:FullCastSpellOnTarget(36868,plr)
    Unit:FullCastSpellOnTarget(31345,plr)
    Unit:FullCastSpellOnTarget(58536,plr)
    if plr == nil then
    Unit:FullCastSpellOnTarget(47864,plrMana)
    Unit:FullCastSpellOnTarget(47813,plrMana)
    Unit:FullCastSpellOnTarget(31705,plrMana)
    if plrMana == nil then
    return
    Unit:RegisterEvent("Eunganda_Spell2", 500, 0)
    end

    put end for the function then after it do registerevent

    also I don't think you need
    local npcid=99997

Similar Threads

  1. Need A Bit of Lua Help
    By Dr. Livingstone in forum WoW EMU Questions & Requests
    Replies: 6
    Last Post: 04-05-2009, 06:23 AM
  2. [Help] New to LUA, Need help with script.
    By nickelo in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 03-14-2008, 11:23 PM
  3. Need a bit help here please :)
    By Spurven in forum World of Warcraft General
    Replies: 2
    Last Post: 01-28-2008, 04:29 PM
  4. Need a bit of help...
    By Rhynix in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 12-12-2007, 08:54 PM
All times are GMT -5. The time now is 04:49 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