Question about LUA?! menu

User Tag List

Results 1 to 3 of 3
  1. #1
    weezyC's Avatar Sergeant Major
    Reputation
    33
    Join Date
    Mar 2010
    Posts
    154
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question about LUA?!

    Does anyone know if its possible to change npc factions after the death of another npc in lua?

    Say you kill Thrall, then the guards around him change factions to be friendly with alliance.

    Is that possible in lua?

    ---------- Post added at 09:31 PM ---------- Previous post was at 07:45 PM ----------

    Anyone?!?!?!

    Question about LUA?!
  2. #2
    Rock Lee's Avatar Banned
    Reputation
    41
    Join Date
    Jul 2010
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by weezyC View Post
    Does anyone know if its possible to change npc factions after the death of another npc in lua?

    Say you kill Thrall, then the guards around him change factions to be friendly with alliance.

    Is that possible in lua?

    ---------- Post added at 09:31 PM ---------- Previous post was at 07:45 PM ----------

    Anyone?!?!?!
    Code:
    local THRALLID = IDHERE
    local GUARDID = IDHERE
    local Guard = nil
    
    function Thrall_OnSpawn(pUnit, event)
    	pUnit = Thrall
    end
    
    function Guard_OnSpawn(pUnit, event)
    	pUnit = Guard
    	Guard:RegisterEvent("DeathCheck", 1000, 0)
    end
    
    function DeathCheck(pUnit, event)
    	if Thrall:IsAlive()==false then
    		Guard:SetFaction(FACTIONIDHERE)
    	end
    	Guard:RegisterEvent("DeathCheck", 1000, 0)
    end
    
    RegisterUnitEvent(GUARDID, 18, "Guard_OnSpawn")
    RegisterUnitEvent(THRALLID, 18, "Thrall_OnSpawn")
    Not tested.

  3. #3
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    No P1raten, that wouldn't work. That would change the faction of fixed guards, not nearby guards.

    This would be a more effective method:

    Code:
    function Thrall_On_Death(pUnit, Event)
        for a, units in pairs(pUnit:GetInRangeFriends()) do -- Assuming this command returns units and not players
        units:SetFaction(35)
        units:WipeTargetList() -- resets aggro
        end
    end

Similar Threads

  1. A question about Lua
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 07-10-2008, 12:02 AM
  2. [Question] About Lua
    By Nilrac in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 06-21-2008, 07:27 PM
  3. Question about Lua scripting
    By bill45 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 05-13-2008, 02:49 AM
  4. [Question] About lua files...
    By Ellenor in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 02-15-2008, 06:26 PM
  5. A simple question about Lua Scripts
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 12-28-2007, 01:57 AM
All times are GMT -5. The time now is 03:52 PM. 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