Lua Attempt (Help) menu

User Tag List

Results 1 to 8 of 8
  1. #1
    Warriar's Avatar Active Member
    Reputation
    31
    Join Date
    May 2009
    Posts
    149
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lua Attempt (Help)

    Well It didn't work ... Anyone know why?

    Code:
    function Announcer_OnSpawned(Punit, event, player)
    pUnit:RegisterEvent("Announcer_Say", 30000, 0)
    end
    
    function Announcer_Died(pUnit, event, player)
    pUnit:RemoveEvents()
    end
    
    function Announcer_Say(pUnit, event, player)
    local chance = math.random(1, 2)
    if(chance == 1) then
    pUnit:SendChatMessage(12, 0, "I am too eager, I will kill you!")
    end
    if(chance == 2) then
    pUnit:SendChatMessage (14, 0, "My powers .. Are yet to be tested")
    end
    end
    RegisterUnitEvent(77744, 18, "Announcer_OnSpawned")
    RegisterUnitEvent(77744, 4, "Announcer_Died")
    none of my lua scripts have worked

    Lua Attempt (Help)
  2. #2
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    get any errors?
    post em if so

  3. #3
    alj03's Avatar Contributor
    Reputation
    91
    Join Date
    Feb 2008
    Posts
    1,103
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LUA enabled?
    Death to all but Metal.

  4. #4
    ~Keric Vi Britannia~'s Avatar Member
    Reputation
    13
    Join Date
    Oct 2007
    Posts
    91
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now, I'm not exactly a pro, but I think I see some errors in there. *I am completely empty to Lua. :P* Now, I think I notice something. You have the functions OnSpawned, Died, and Say. I think you have to register the event for say, as well, instead of just having something check for it. Not sure... But that's what I'm thinking. Hope I could be of some help!
    Caeli Absolutio.
    Picking back up C++, learning Lua later.

  5. #5
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Keric is a little wrong. For one check that lua is enabled. Also what core are you using?

  6. #6
    Linkn's Avatar Contributor
    Reputation
    90
    Join Date
    Mar 2009
    Posts
    296
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function Announcer_OnSpawned(pUnit, event, player)
    pUnit:RegisterEvent("Announcer_Say", 30000, 0)
    end
    
    function Announcer_Died(pUnit, event, player)
    pUnit:RemoveEvents()
    end
    
    function Announcer_Say(pUnit, event, player)
    local chance = math.random(1, 2)
    if(chance == 1) then
    pUnit:SendChatMessage(12, 0, "I am too eager, I will kill you!")
    end
    if(chance == 2) then
    pUnit:SendChatMessage (14, 0, "My powers .. Are yet to be tested")
    end
    end
    RegisterUnitEvent(77744, 18, "Announcer_OnSpawned")
    RegisterUnitEvent(77744, 4, "Announcer_Died")
    In bold, you had Punit i believe. Try that and see if it works.

  7. #7
    Warriar's Avatar Active Member
    Reputation
    31
    Join Date
    May 2009
    Posts
    149
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lol, Punit changed to pUnit, It worked + rep for ju

  8. #8
    Linkn's Avatar Contributor
    Reputation
    90
    Join Date
    Mar 2009
    Posts
    296
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hah, usually is just something simple Glad to help.

Similar Threads

  1. LuA Scripting Help
    By Jlp in forum World of Warcraft Emulator Servers
    Replies: 15
    Last Post: 06-27-2008, 03:33 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. Lua script help and general questions from beginner
    By WinKIller0 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 02-23-2008, 04:38 AM
  4. Need LUA Scripting Help ?
    By Snailz in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 02-04-2008, 12:36 PM
  5. help .lua portal help
    By Tom_2001 in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 01-24-2008, 03:21 PM
All times are GMT -5. The time now is 06:10 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