Can someone please help me with my lua script. menu

User Tag List

Results 1 to 3 of 3
  1. #1
    ConnorJ's Avatar Corporal
    Reputation
    10
    Join Date
    Aug 2013
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can someone please help me with my lua script.

    Hello, I'm trying to make a small questing hub for my girlfriend when she goes on my private server and I wanted some npc's to automatically say stuff when you go within range of them, kind of like the begger in stormwind. I looked at a guide on internet on how to do such a script and what I came up with is

    function FarmerGriffith_OnCombat(Unit, Event)
    Unit:SendChatMessage(12, 0, "Hey, Can you please help me?")
    end

    function FarmerGriffith_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    end

    function FarmerGriffith_OnKilledTarget(Unit, Event)
    end

    function FarmerGriffith_OnDied(Unit, Event)
    Unit:RemoveEvents()
    end

    RegisterUnitEvent(20123, 1, "FarmerGriffith_OnCombat")
    RegisterUnitEvent(20123, 2, "FarmerGriffith_OnLeaveCombat")
    RegisterUnitEvent(20123, 3, "FarmerGriffith_OnKilledTarget")
    RegisterUnitEvent(20123, 4, "FarmerGriffith_OnDied")

    I don't know if it will work, can any good lua scripters tell me if this will do what I want it to, and how I can add it into my server, I have MySQL and I'm using ArcEmu.

    Thanks in advance.
    Last edited by ConnorJ; 08-19-2013 at 06:16 PM.

    Can someone please help me with my lua script.
  2. #2
    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)
    Something like this:

    Code:
    function FarmerGriffith_Events(Unit, Event)
    	if Event == 18 then -- if spawned
    		Unit:RegisterEvent("SendChatMessage_NearbyPlayers", 1000, 0)
    	else -- if died
    		Unit:RemoveEvents()
    	end
    end
    
    function ResetEvent(Unit)
    	Unit:RegisterEvent("SendChatMessage_NearbyPlayers", 1000, 0)
    end
    
    function SendChatMessage_NearbyPlayers(Unit)
    	local found = false
    	for _,v in pairs(Unit:GetInRangePlayers()) do -- for each nearby player, as the variable: v
    		if Unit:GetDistanceYards(v) < 40 and v:IsAlive() then -- if within 40 yards of unit and alive then
    			found = true -- say we found a nearby player
    			break -- we don't need to find another player so stop looping through all nearby players
    		end
    	end
    	if found then -- we found a player
    		Unit:SendChatMessage(12, 0, "Hey, Can you please help me?")
    		Unit:RemoveEvents() -- stop this being sent every second
    		Unit:RegisterEvent("ResetEvent", 60000, 1) -- start checking every second again in 1 minute
    	end
    end
    
    RegisterUnitEvent(20123, 4, "FarmerGriffith_Events") -- on dead
    RegisterUnitEvent(20123, 18, "FarmerGriffith_Events") -- on spawn

  3. #3
    ConnorJ's Avatar Corporal
    Reputation
    10
    Join Date
    Aug 2013
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again man

Similar Threads

  1. [Bot] Can someone Please help me with this bot error i keep getting
    By koolsaf in forum Pokemon GO Hacks|Cheats
    Replies: 3
    Last Post: 08-03-2016, 05:30 PM
  2. Can someone please help me find a good gear swapper?
    By tombox in forum Diablo 3 Bots Questions & Requests
    Replies: 0
    Last Post: 12-28-2012, 08:59 AM
  3. Can someone please help me with this little thing (orc female > tauren male)
    By nizarinho in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 10-05-2010, 02:21 PM
  4. Can someone please help me
    By KRSjr in forum WoW Scams Help
    Replies: 5
    Last Post: 09-24-2008, 06:16 PM
  5. Can someone please help me
    By Kababoba in forum WoW Scam Prevention
    Replies: 6
    Last Post: 05-27-2008, 05:46 PM
All times are GMT -5. The time now is 01:04 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