[ArcEmu][Lua] Select players within x amount of yards? menu

User Tag List

Results 1 to 6 of 6
  1. #1
    Pretzal's Avatar Member
    Reputation
    8
    Join Date
    Aug 2008
    Posts
    57
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [ArcEmu][Lua] Select players within x amount of yards?

    This time ill post it in the right forum >,>

    Core: ArcEmu R 3236
    Lua Engine: LuaHypArc

    My code almost works, except for the fact that when you stand near one of the npc's, then go ~ 300 yards or so away and stand next to the other one, the core console goes berserk spamming Out of Memory. Im guessing its because I have a bad range checker, and is there a more efficient way i could do it? lua pref... i know abit of C++ but when i try read whats in the core - my head spins xD

    Anyways heres the code that works, but sends the core crazy -

    Code:
    function Peacekeeper_On(Unit, Event)
    	local plrs = Unit:GetInRangePlayers()
    	for k, v in pairs(plrs) do
    		if Unit:GetDistanceYards(v) < 10 then
    			v:FlagFFA(false) 
    		end
    	end
    	RegisterTimedEvent("Peacekeeper_On", 1000, 0, Unit)
    end
    
    RegisterUnitEvent(59951, 18, "Peacekeeper_On")
    
    
    function Warbringer_On(Unit, Event)
    	local plrs = Unit:GetInRangePlayers()
    	for k, v in pairs(plrs) do
    		if Unit:GetDistanceYards(v) < 10 then
    			v:FlagFFA(true) 
    		end
    	end
    	RegisterTimedEvent("Warbringer_On", 1000, 0, Unit)
    end
    
    RegisterUnitEvent(59952, 18, "Warbringer_On")
    Heres what i mean by "Sends the core crazy":
    http://www.netherfoam.envisageart.co...h%20memory.png

    Cant just ignore it - Not when you cant read anything the core is outputting & it sends a few of my cores through the roof (an I7, so i have plenty of processor but why waste it?)
    Last edited by Pretzal; 04-02-2010 at 10:15 PM.

    [ArcEmu][Lua] Select players within x amount of yards?
  2. #2
    RyeRye's Avatar Contributor
    Reputation
    240
    Join Date
    Aug 2008
    Posts
    996
    Thanks G/R
    0/1
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there an error on the ArcEmu World thing?



  3. #3
    Pretzal's Avatar Member
    Reputation
    8
    Join Date
    Aug 2008
    Posts
    57
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah. But not your normal lua error. my script, works perfectly EXCEPT when you go from the peacekeeper's InRange area, to the warbringers InRange error (Or visa versa). When that occurs, the console repeats Out of memory over and over, until it eventually crashes xD (Out of memory error is spammed over 50x every second)

    EDIT: Btw i have 12gb RAM & an I7 (And watching my cpu/ram as the error occurs) and i am definatenyl NOT out of memory/processor, but some of my cores are spiked heavily)

  4. #4
    P1raten's Avatar Banned
    Reputation
    500
    Join Date
    Mar 2008
    Posts
    1,323
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont really understand what you want help with..

  5. #5
    Pretzal's Avatar Member
    Reputation
    8
    Join Date
    Aug 2008
    Posts
    57
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function Peacekeeper_On(Unit, Event)
    	local plrs = Unit:GetInRangePlayers() <-- Range checker #1 - Is there a better way to do this?
    	for k, v in pairs(plrs) do 
    		if Unit:GetDistanceYards(v) < 10 then <-- Range checker #2
    			v:FlagFFA(false) 
    		end
    	end
    	RegisterTimedEvent("Peacekeeper_On", 1000, 0, Unit)
    end

    Okay my goal of this script:
    Flag/ unflag people for free for all PvP within the radius of this NPC

    I am (guessing) that my method for getting the players -
    Code:
    	local plrs = Unit:GetInRangePlayers()
    	for k, v in pairs(plrs) do
    		if Unit:GetDistanceYards(v) < 10 then
    is bad.

    Because, whenever the character stands next to one npc, it deflags him properly. But when he then moves to the other NPC to flag him (After, and only after standing next to the original deflagging npc) the server sends that spaz of an error message. (And eventually the server crashes when i try the reloadscripts command, and most other commands for that fact)

    The script has no syntax errors, only some kind of logic error that is screwing the server up.

    So I am asking - Why is my server telling me that i am out of memory, whenever someone walks within 10 yards of one npc, and then within 10 yards of the other npc, (The npcs are roughly 50-70 yards apart)?

  6. #6
    P1raten's Avatar Banned
    Reputation
    500
    Join Date
    Mar 2008
    Posts
    1,323
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this.
    function Peacekeeper_On(Unit, Event)
    local plrs = Unit:GetInRangePlayers()
    for k, v in pairs(plrs) do
    if Unit:GetDistanceYards(v) < 10 then
    v:FlagFFA(false)
    end
    end
    RegisterTimedEvent("Peacekeeper_On", 1000, 0, Unit)
    Unit:RemoveEvents()
    end

    RegisterUnitEvent(59951, 18, "Peacekeeper_On")


    function Warbringer_On(Unit, Event)
    local plrs = Unit:GetInRangePlayers()
    for k, v in pairs(plrs) do
    if Unit:GetDistanceYards(v) < 10 then
    v:FlagFFA(true)
    end
    end
    RegisterTimedEvent("Warbringer_On", 1000, 0, Unit)
    Unit:RemoveEvents()
    end

    RegisterUnitEvent(59952, 18, "Warbringer_On")

Similar Threads

  1. ArcEmu Lua Library
    By TheZaronz in forum World of Warcraft Emulator Servers
    Replies: 8
    Last Post: 05-29-2009, 09:02 AM
  2. Hirering a (professional) arcemu/lua scripter/debugger
    By theory18 in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 05-11-2009, 05:48 AM
  3. [BIG BUG] ArcEmu Revision 2196 - Players Fall Under Stormwind
    By viKKmaN in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 02-21-2009, 02:17 PM
  4. {ArcEmu} LUA help!
    By ariax1 in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 12-29-2008, 03:44 PM
  5. lua get player level
    By KaMakaZe in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 11-19-2008, 11:51 AM
All times are GMT -5. The time now is 07:03 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