LUA Locals Problem menu

Shout-Out

User Tag List

Results 1 to 6 of 6
  1. #1
    Bloodsin's Avatar Member
    Reputation
    13
    Join Date
    Jun 2007
    Posts
    165
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA Locals Problem

    Code:
    local = 600502
    local = 600501
    
    function Gruntworker_OnDied(Unit, Event)
            Unit:RegisterEvent("getcords", 15000, 0)
    	Unit:SpawnCreature(600502,x,y,z,1,600000)
    	Unit:SendChatMessage(14, 0, "The Ally have taken a unit!")
            Unit:RemoveEvents()
    end
    
    function Gruntworker_OnDied(Unit, Event)
            Unit:RegisterEvent("getcords", 15000, 0)
    	Unit:SpawnCreature(600501,x,y,z,2,600000)
    	Unit:SendChatMessage(14, 0, "The Horde have taken a unit!")
            Unit:RemoveEvents()
    end
    
    function Gruntworker_LeaveCombat (Unit, Event)
             Unit:RemoveEvents()
    end
    
    function getcords (Unit, Event)
            x = Unit:GetSpawnX();
            y = Unit:GetSpawnY();
            z = Unit:GetSpawnZ();
            o = Unit:GetSpawnO();
    end
    
    --Hordeids
    RegisterUnitEvent(600501, 4, "Gruntworker_OnDied")
    RegisterUnitEvent(600501, 2, "Gruntworker_LeaveCombat")
    --Allyids
    RegisterUnitEvent(600502, 4, "Gruntworker_OnDied")
    RegisterUnitEvent(600502, 2, "Gruntworker_LeaveCombat")
    Helpzorz
    will +rep

    Its not working at all, can some pick out the problems please, im just learning about locals.
    still not clear on what they are PLEASE HELP!!

    LUA Locals Problem
  2. #2
    Bloodsin's Avatar Member
    Reputation
    13
    Join Date
    Jun 2007
    Posts
    165
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bump <(0.0<)

  3. #3
    Bloodsin's Avatar Member
    Reputation
    13
    Join Date
    Jun 2007
    Posts
    165
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I really need this working will rep x3

  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)
    You don't need to bump it constantly, people have different time zones for example yesterday when I went to bed I didn't see this post, now in the morning I see it and you've already bumped it twice.
    When you use a local variable you are defining that for example a word is something else, for example local npcid = 50002, you can't have local = 5 as that makes no sense

    Fixed up your script and added a couple of comments:

    Code:
    function Gruntworker_OnDied(Unit, Event)
        x = Unit:GetX()
        y = Unit:GetY()
        z = Unit:GetZ()
        o = Unit:GetO()
        Unit:SpawnCreature(600502,x,y,z,1,600000) -- faction 1 for 600 seconds, change to 0 to spawn forever
        Unit:SendChatMessage(14, 0, "The Ally have taken a unit!") -- Change to type 42 for a raid message, shout works as well though
    end
    
    function Gruntworker_Two_OnDied(Unit, Event)
        x = Unit:GetX()
        y = Unit:GetY()
        z = Unit:GetZ()
        o = Unit:GetO()
        Unit:SpawnCreature(600501,x,y,z,2,600000) -- for 600 seconds, change to 0 to spawn forever
        Unit:SendChatMessage(14, 0, "The Horde have taken a unit!") -- 14 works but 42 may look better for what we are trying to do
    end
    
    --Hordeids
    RegisterUnitEvent(600501, 4, "Gruntworker_OnDied")
    --Allyids
    RegisterUnitEvent(600502, 4, "Gruntworker_Two_OnDied") -- Can't have the same name

  5. #5
    Bloodsin's Avatar Member
    Reputation
    13
    Join Date
    Jun 2007
    Posts
    165
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still same error :\ come on msn :P

  6. #6
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    x = Unit:GetSpawnX();
    y = Unit:GetSpawnY();
    z = Unit:GetSpawnZ();
    o = Unit:GetSpawnO();

    Lua isn't C++, you don't need the ';' its probably whats causing the error
    Lunar Gaming - Reaching For The Stars

Similar Threads

  1. LUA script problem
    By uberhak3r in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 07-09-2008, 06:32 PM
  2. [Help] Fairly large Lua script problem
    By Muruk in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 03-16-2008, 09:03 PM
  3. LUA Scripting Problem
    By Knife in forum World of Warcraft Emulator Servers
    Replies: 18
    Last Post: 03-10-2008, 02:00 PM
  4. Lua scripts problem
    By Mr.Ice.Cold in forum World of Warcraft Emulator Servers
    Replies: 12
    Last Post: 02-02-2008, 11:44 AM
  5. .Lua portal problem
    By Kiev in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 01-12-2008, 10:49 AM
All times are GMT -5. The time now is 11:58 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