Lua script problem menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    robinelitenn's Avatar Member
    Reputation
    2
    Join Date
    Aug 2008
    Posts
    139
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lua script problem

    Hello i have created an lua script but got an error :/..... [updated)

    function GodOfWar_OnCombat(Unit, Event)
    Unit:SendChatMessage(12, 0, "i will crush everybody in my way! you are finished!")
    Unit:RegisterEvent(150002, "GodOfWar_Stomp", 50000, 3)
    Unit:RegisterEvent(150002, "GodOfWar_Earthquake", 120000, 5)
    Unit:RegisterEvent(150002, "GodOfWar_Crushing Leap", 90000, 6)
    Unit:RegisterEvent(150002, "GodOfWar_SummonPlayer", 60000, 2)
    end

    function GodOfWar_OnLeaveCombat(Unit, Event)
    Unit:SendChatMessage(12, 0, "Run like chickens! like i always say, you are no match for me! and my power!")
    Unit:RemoveEvents()
    end

    function GodOfWar_OnDied(Unit, Event)
    Unit:SendChatMessage(12, 0, "NO! this cannot been true? how did i fail?!")
    Unit:RemoveEvents()
    end

    function GodOfWar_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(12, 0, "HaHa! Rest in hell!")
    end

    function GodOfWar_Stomp(Unit, Event)
    Unit:FullCastSpellOnTarget(58663, Unit:GetRandomPlayer(0))
    end

    function GodOfWar_CrushingLeap(Unit, Event)
    Unit:FullCastSpellOnTarget(58963, Unit:GetRandomPlayer(0))
    end

    function GodOfWar_sunbeam(Unit, Event)
    Unit:CastSpell(62872, Unit:GetMainTank())
    end
    Unit:RegisterEvent(150002, "GodOfWar_sunbeam", 50000, 3)

    function GodOfWar_Earthquake(Unit, Event)
    Unit:FullCastSpellOnTarget(19798, Unit:GetRandomPlayer(0))
    end

    function GodOfWar_SummonPlayer(Unit, Event)
    Unit:FullCastSpellOnTarget(20477, Unit:GetRandomPlayer(0))
    end

    RegisterUnitEvent(150002, 3,"GodOfWar_OnKilledTarget")
    RegisterUnitEvent(150002, 4,"GodOfWar_OnDied")
    RegisterUnitEvent(150002, 2,"GodOfWar_OnLeaveCombat")
    RegisterUnitEvent(150002, 1,"GodOfWar_OnCombat")



    on world.exe itsays scripts/xzgodofwar.lua:22: calling 'registerevent'on bad self (unitexpected, got table) ????
    Last edited by robinelitenn; 10-23-2009 at 04:25 PM.

    Lua script problem
  2. #2
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function GodOfWar_OnCombat(Unit, Event) 
    Unit:SendChatMessage(12, 0, "i will crush everybody in my way! you are finished!")
    Unit:RegisterEvent("GodOfWar_Stomp", 50000, 3)
    Unit:RegisterEvent("GodOfWar_sunbeam", 50000, 3)
    Unit:RegisterEvent("GodOfWar_Crushing Leap", 90000, 6)
    Unit:RegisterEvent("GodOfWar_Earthquake", 120000, 5)
    end
     
    function GodOfWar_OnLeaveCombat(Unit, Event) 
    Unit:RemoveEvents() 
    Unit:SendChatMessage(12, 0, "Run like chickens! like i allways say, you are no match for my! and my power!") 
    end
     
    function GodOfWar_OnDied(Unit, Event) 
    Unit:RemoveEvents() 
    Unit:SendChatMessage(12, 0, "NO! this cannot been ture? how did a failed!") 
    end
     
    function GodOfWar_OnKilledTarget(Unit, Event) 
    Unit:SendChatMessage(12, 0, "HaHa! Rest in hell!") 
    end
     
    function GodOfWar_Stomp(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(58663, pUnit:GetRandomPlayer(0)) 
    end
     
    function GodOfWar_CrushingLeap(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(58963, pUnit:GetRandomPlayer(7)) 
    end
     
    function GodOfWar_sunbeam(pUnit, Event) 
    pUnit:CastSpell(62872, pUnit:GetMainTank()) 
    end
     
    function GodOfWar_Earthquake(Unit, Event) 
    Unit:FullCastSpellOnTarget(19798, pUnit:GetRandomPlayer(7)) 
    end
     
    function GodOfWar_Summon Player(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(20477, pUnit:GetRandomPlayer(6)) 
    end
    Unit:RegisterEvent("GodOfWar_Summon Player", 60000, 2)
    Im guessing that is what you was trying to do, you wasn't calling the commands properly therefore leaving them with no trigger, placing them where i did might not make it function as you want, but it might help.

  3. #3
    thebigman's Avatar Contributor Reliable Trader
    CoreCoins Purchaser
    Reputation
    89
    Join Date
    Dec 2008
    Posts
    605
    Thanks G/R
    2/0
    Trade Feedback
    26 (96%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kind of a newb script anyhow.

    wtb phases.

  4. #4
    Vision1000's Avatar Member
    Reputation
    104
    Join Date
    Jun 2008
    Posts
    122
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:

    Code:
    function GodOfWar_OnCombat(Unit, Event)
    Unit:SendChatMessage(12, 0, "i will crush everybody in my way! you are finished!")
    Unit:RegisterEvent("GodOfWar_Stomp", 50000, 3)
    Unit:RegisterEvent("GodOfWar_Earthquake", 120000, 5)
    Unit:RegisterEvent("GodOfWar_Crushing Leap", 90000, 6)
    Unit:RegisterEvent("GodOfWar_Summon Player", 60000, 2)
    end
    
    function GodOfWar_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    Unit:SendChatMessage(12, 0, "Run like chickens! like i allways say, you are no match for my! and my power!")
    end
    
    function GodOfWar_OnDied(Unit, Event)
    Unit:RemoveEvents()
    Unit:SendChatMessage(12, 0, "NO! this cannot been ture? how did a failed!")
    end
    
    function GodOfWar_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(12, 0, "HaHa! Rest in hell!")
    end
    
    function GodOfWar_Stomp(Unit, Event)
    Unit:FullCastSpellOnTarget(58663, Unit:GetRandomPlayer(0))
    end
    
    function GodOfWar_CrushingLeap(Unit, Event)
    Unit:FullCastSpellOnTarget(58963, Unit:GetRandomPlayer(7))
    end
    
    function GodOfWar_sunbeam(Unit, Event)
    Unit:CastSpell(62872, Unit:GetMainTank())
    end
    Unit:RegisterEvent("GodOfWar_sunbeam", 50000, 3)
    
    function GodOfWar_Earthquake(Unit, Event)
    Unit:FullCastSpellOnTarget(19798, Unit:GetRandomPlayer(7))
    end
    
    function GodOfWar_Summon Player(Unit, Event)
    Unit:FullCastSpellOnTarget(20477, Unit:GetRandomPlayer(6))
    end
    
    RegisterUnitEvent(NPCENTRYID, 3,"GodOfWar_OnKilledTarger")
    RegisterUnitEvent(NPCENTRYID, 4,"GodOfWar_OnDied")
    RegisterUnitEvent(NPCENTRYID, 2,"GodOfWar_OnLeaveCombat")
    RegisterUnitEvent(NPCENTRYID, 1,"GodOfWar_OnCombat")
    Replacing NPCENTRYID with your creatues entryid of course.

    I will explain everything tomorrow, I have to go to wake up early so I'm going to go to bed.

    But pretty much you were Registering events outside of functions, and randomly using pUnit and Unit, you can only use one.

    Theres two ways to register events, One is with creature hooks I suppose(correct me if I'm wrong)
    Code:
    RegisterUnitEvent(NPCENTRYID, FLAG, "Function name you want to be triggered when this event happens")
    You put this code at the bottom of your script, It will trigger the selected function name when the triggering event happens(This is determined by the FLAG), from there you can register new events from inside functions with Unit:RegisterEvent().

    Code:
    	CREATURE_EVENT_ON_ENTER_COMBAT		= 1,
    	CREATURE_EVENT_ON_LEAVE_COMBAT		= 2,
    	CREATURE_EVENT_ON_TARGET_DIED		= 3,
    	CREATURE_EVENT_ON_DIED		= 4,
    	CREATURE_EVENT_ON_TARGET_PARRIED		= 5,
    	CREATURE_EVENT_ON_TARGET_DODGED		= 6,
    	CREATURE_EVENT_ON_TARGET_BLOCKED		= 7,
    	CREATURE_EVENT_ON_TARGET_CRIT_HIT		= 8,
    	CREATURE_EVENT_ON_PARRY		= 9,
    	CREATURE_EVENT_ON_DODGED		= 10,
    	CREATURE_EVENT_ON_BLOCKED		= 11,
    	CREATURE_EVENT_ON_CRIT_HIT		= 12,
    	CREATURE_EVENT_ON_HIT		= 13,
    	CREATURE_EVENT_ON_ASSIST_TARGET_DIED		= 14,
    	CREATURE_EVENT_ON_FEAR		= 15,
    	CREATURE_EVENT_ON_FLEE		= 16,
    	CREATURE_EVENT_ON_CALL_FOR_HELP		= 17,
    	CREATURE_EVENT_ON_LOAD		= 18,
    	CREATURE_EVENT_ON_REACH_WP		= 19,
    	CREATURE_EVENT_ON_LOOT_TAKEN		= 20,
    	CREATURE_EVENT_ON_AIUPDATE		= 21,
    	CREATURE_EVENT_ON_EMOTE		= 22,
    Those are creature flags for RegisterUnitEvent(NPCID, FLAG, "FunctionName").

    I'll explain more tommorow.
    Last edited by Vision1000; 10-22-2009 at 11:37 PM.

Similar Threads

  1. LUA script problem, teleporter.
    By Romis in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 12-02-2008, 04:32 PM
  2. LUA script problem
    By uberhak3r in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 07-09-2008, 06:32 PM
  3. [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
  4. LUA Scripting Problem
    By Knife in forum World of Warcraft Emulator Servers
    Replies: 18
    Last Post: 03-10-2008, 02:00 PM
  5. Lua scripts problem
    By Mr.Ice.Cold in forum World of Warcraft Emulator Servers
    Replies: 12
    Last Post: 02-02-2008, 11:44 AM
All times are GMT -5. The time now is 07:40 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