[Lua] Reference Creation Failed! (Non Valid Lua-Function?) menu

User Tag List

Results 1 to 9 of 9
  1. #1
    Pawaox-Z's Avatar Member
    Reputation
    57
    Join Date
    Dec 2007
    Posts
    176
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua] Reference Creation Failed! (Non Valid Lua-Function?)

    Hey there!

    I have the same problem as "Below post"

    http://www.mmowned.com/forums/emulat...eleporter.html

    When my server attempts to boot the Lua scripts, i get an error
    (At the first "RegisterUnitEvent" ... If i delete that line, it just picks the next -.-)

    So the problem has something to do with that

    v
    http://img248.imageshack.us/img248/5540/pronrl.png

    ^The exact errors in the "Arcemu-World"

    Is there a way to fix it?

    Thanks in advance
    Pawaox

    [Lua] Reference Creation Failed! (Non Valid Lua-Function?)
  2. #2
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,504
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please tag your threads in the future properly, also can you show us your lua script?

    It seems you're trying to call a function without registering it.

  3. #3
    Pawaox-Z's Avatar Member
    Reputation
    57
    Join Date
    Dec 2007
    Posts
    176
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, long time since i last used those forums - will do
    Just began on the emulation again

    This is the short script of the two, The other one have hundreds of lines

    Code:
    RegisterUnitEvent(70001, 1, "AlDriTag_Combat")
    RegisterUnitEvent(70001, 2, "AlDriTag_LeaveCombat")
    RegisterUnitEvent(70001, 3, "DUDE_ONKILL")
    RegisterUnitEvent(70001, 4, "AlDriTag_Death")
    RegisterUnitEvent(70002, 1, "AlDriTagADD_Combat")
    RegisterUnitEvent(70002, 2, "AlDriTagADD_LeaveCombat")
    RegisterUnitEvent(70002, 3, "DUDE_ONKILL")
    RegisterUnitEvent(70002, 4, "AlDriTagADD_Death")
    
    function DUDE_ONKILL(Unit)
            Unit:CastSpell(59663)
    end
    
    function AlDriTagADD_Spells(pUnit)
    local selection = math.random(1, 2)
        if selection == 1 then
           pUnit:FullCastSpellOnTarget(70759, pUnit:GetRandomPlayer(0))
    end
        if selection == 2 then 
           pUnit:FullCastSpellOnTarget(70184, pUnit:GetRandomPlayer(0))
    end
    end
    
    function AlDriTagADD_Combat(Unit)
            Unit:RegisterEvent("AlDriTagADD_Spells", 2000, 0)
    end
    
    function AlDriTagADD_LeaveCombat(Unit)
            Unit:Despawn();
    end
    
    function AlDriTagADD_Death(Unit)
            Unit:Despawn();
    end
    
    function AlDriTag_Combat(Unit)
            Unit:RegisterEvent("AlDriTag_Strike", 1500, 0)
            Unit:RegisterEvent("AlDriTag_Shout", 6000, 0)
            Unit:RegisterEvent("AlDriTag_Charge", 30000, 0)
         if Unit:GetHealthPct() < 20 then
            Unit:RegisterEvent("AlDriTag_Additional",1000, 1)
            end
    end
    
    function AlDriTag_LeaveCombat(Unit)
            Unit:SendChatMessage(12, 0, "Total... Devastation")
    end
    
    function AlDriTag_Death(Unit)
            Unit:SendChatMessage(12, 0, "Your Death... Awaits...")
    end
    
    function AlDriTag_Strike(pUnit)
           pUnit:FullCastSpellOnTarget(70211, pUnit:GetMainTank())
    end
    
    function AlDriTag_Shout(pUnit)
           pUnit:CastSpellOnTarget(55543, pUnit:GetMainTank())
    end
    
    function AlDriTag_Charge(pUnit)
           pUnit:FullCastSpellOnTarget(56107, pUnit:GetRandomPlayer(0))
           pUnit:RegisterEvent("AlDriTag_WhirlWind", 1, 1)
    end
    
    function AlDriTag_WhirlWind(pUnit)
           pUnit:CastSpellOnTarget(50228, pUnit:GetMainTank())
           pUnit:CastSpellOnTarget(55543, pUnit:GetMainTank())
    end
    
    function AlDriTag_Additional(pUnit)
            pUnit:CastSpellOnTarget(52080, pUnit:GetMainTank())
            pUnit:RegisterEvent("AlDriTag_BoneCrack", 60000, 0)
    end
    
    function AlDriTag_BoneCrack(pUnit)
           pUnit:CastSpellOnTarget(52080, pUnit:GetMainTank())
    end

    EDIT:

    I'm actually writing those scripts to have fun with some friends, for then to release it on MMOwned. Back the days (TBC, Early Wrath) i never had this issue :/
    Last edited by Pawaox-Z; 03-28-2010 at 04:24 PM.

  4. #4
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function DUDE_ONKILL(pUnit)
            pUnit:CastSpell(59663)
    end
    
    function AlDriTagADD_Spells(pUnit)
    local selection = math.random(1, 2)
        if selection == 1 then
    local plr = pUnit:GetRandomPlayer(0)
    if plr ~= nil then
           pUnit:FullCastSpellOnTarget(70759, plr)
    end
    end
        if selection == 2 then 
    local plr = pUnit:GetRandomPlayer(0)
     if plr ~= nil then
           pUnit:FullCastSpellOnTarget(70184, plr)
    end
    end
    end
    
    function AlDriTagADD_Combat(pUnit)
            pUnit:RegisterEvent("AlDriTagADD_Spells", 2000, 0)
    end
    
    function AlDriTagADD_LeaveCombat(pUnit)
            pUnit:Despawn(1,0)
    end
    
    function AlDriTagADD_Death(pUnit)
            pUnit:Despawn(1,0)
    end
    
    function AlDriTag_Combat(pUnit)
            pUnit:RegisterEvent("AlDriTag_Strike", 1500, 0)
            pUnit:RegisterEvent("AlDriTag_Shout", 6000, 0)
            pUnit:RegisterEvent("AlDriTag_Charge", 30000, 0)
         if pUnit:GetHealthPct() < 20 then
            pUnit:RegisterEvent("AlDriTag_Additional",1000, 1)
            end
    end
    
    function AlDriTag_LeaveCombat(pUnit)
            pUnit:SendChatMessage(12, 0, "Total... Devastation")
    end
    
    function AlDriTag_Death(pUnit)
            pUnit:SendChatMessage(12, 0, "Your Death... Awaits...")
    end
    
    function AlDriTag_Strike(pUnit)
    local plr = pUnit:GetMainTank()
    if plr ~= nil then
           pUnit:FullCastSpellOnTarget(70211, plr)
    end
    end
    
    function AlDriTag_Shout(pUnit)
    local plr = pUnit:GetMainTank()
    if plr ~= nil then
           pUnit:CastSpellOnTarget(55543, plr)
    end
    end
    
    function AlDriTag_Charge(pUnit)
           pUnit:FullCastSpellOnTarget(56107, pUnit:GetRandomPlayer(0))
           pUnit:RegisterEvent("AlDriTag_WhirlWind", 1, 1)
    end
    
    function AlDriTag_WhirlWind(pUnit)
    local plr = pUnit:GetMainTank()
    if plr ~= nil then
           pUnit:CastSpellOnTarget(50228, plr)
           pUnit:CastSpellOnTarget(55543, plr)
    end
    end
    
    function AlDriTag_Additional(pUnit)
    local plr = pUnit:GetMainTank()
    if plr ~= nil then
            pUnit:CastSpellOnTarget(52080, plr)
    end
            pUnit:RegisterEvent("AlDriTag_BoneCrack", 60000, 0)
    end
    
    function AlDriTag_BoneCrack(pUnit)
    local plr = pUnit:GetMainTank()
    if plr ~= nil then
           pUnit:CastSpellOnTarget(52080, plr)
    end
    end
    
    RegisterUnitEvent(70001, 1, "AlDriTag_Combat")
    RegisterUnitEvent(70001, 2, "AlDriTag_LeaveCombat")
    RegisterUnitEvent(70001, 3, "DUDE_ONKILL")
    RegisterUnitEvent(70001, 4, "AlDriTag_Death")
    RegisterUnitEvent(70002, 1, "AlDriTagADD_Combat")
    RegisterUnitEvent(70002, 2, "AlDriTagADD_LeaveCombat")
    RegisterUnitEvent(70002, 3, "DUDE_ONKILL")
    RegisterUnitEvent(70002, 4, "AlDriTagADD_Death")

  5. #5
    Pawaox-Z's Avatar Member
    Reputation
    57
    Join Date
    Dec 2007
    Posts
    176
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Figured it out

    But then i Began working on my other script, and RIGHT when i'm about to finish it.. Ofcourse i get the same error (Recieved it several times, but this time i don't know how to fix it )

    Any new help would be appreciated :'(



  6. #6
    Hellgawd's Avatar Member
    Reputation
    710
    Join Date
    Jun 2007
    Posts
    2,480
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take a look at the key things Harry changed in your above script, compare them with your original script and your new one. It's pretty obvious

  7. #7
    Pawaox-Z's Avatar Member
    Reputation
    57
    Join Date
    Dec 2007
    Posts
    176
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried earlier, and I just tried again. I seriously can't see how it fixes it

    I might be seriously stupid, I don't know :S

    Could you point out the differences? Then I check it out

    EDIT:

    "What people often consider as obvious is ONLY because they already know it, and it seems obvious to them & their brain. It doesn't mean that everyone else sees it as obvious"
    Last edited by Pawaox-Z; 03-29-2010 at 07:35 PM.

  8. #8
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The register must come AFTER the event.
    e.g:
    Instead of
    register unit event
    function
    end

    it must be

    function
    end
    register unit event...

    Also X = Unit is defining a variable, but you havn't said what this variable is. It will still work but not as you planned always, to fix this simple add at the top of the script local X = nil or just local X.

  9. #9
    Pawaox-Z's Avatar Member
    Reputation
    57
    Join Date
    Dec 2007
    Posts
    176
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alot for all of your help!
    I really appreciate it, and will ofc +rep everyone who helped me

Similar Threads

  1. reference creation failed
    By Xmaily in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 06-16-2013, 12:33 PM
  2. [Lua Script] Not a Valid LUA function
    By mantor4 in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 07-08-2011, 07:48 AM
  3. [Guide] How to use local LUA function!
    By Dartignan in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 08-05-2008, 09:28 PM
  4. Replies: 22
    Last Post: 05-29-2008, 03:52 PM
  5. [Question] Lua functions
    By Lich King in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 04-10-2008, 07:39 PM
All times are GMT -5. The time now is 05:23 AM. 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