[Guide] How to use local LUA function! menu

User Tag List

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

    [Guide] How to use local LUA function!

    Ok guys well this is my first guide ive made so don;t Flame to hard on it.

    I wrote the whole guide in LUA so if anything copy and past it into either BLUA or a notepad....I wrote it in BLUA but ther's the guide hope you like it.

    Code:
    -- Ok in this guide im gonig to demonstrate 2 things.
    -- 1 Im Going to show how to use to Define a couple of things 
    -- that i use myself to help make Phases in LUA Scripting
    -- they don't always work but that's just because well its LUA
    -- OK well let's get started.
    
    -- Let's Start by showing you how to use the math.random function
    -- i think my brother mager already made a math.random guide
    -- but it doesn't hurt to have another one so let's get started on it
    
    -- Ok math.random is used in a local formation. So you would do
    -- local <name> = math.random(1,<amount you want to random between>)
    -- So Let's demonstrate this in a CastSpell Function
    function Guide_Random(pUnit)
    	local guide = math.random(1,2)
    	if(guide == 1) then
    		pUnit:CastSpellOnTarget(5)
    	end
    -- Notice how you have to end each if function you create
    	if(guide == 2) then
    		pUnit:CastSpellOnTarget(10)
    	end
    end
    -- After ending the if function be sure to end the entire function as well
    -- i always forget that part lol.
    -- well thats math.random. Easy huh
    
    -- ok now i will show you how to Make phases using Health Pct
    -- this is just like math.random well kinda lol
    -- well the format for this would be
    -- local <name> = pUnit:GetHealthPct()
    -- then the if function following it would be
    -- if(<name> <= 90) then
    -- the <= part mean Less than or equal to 90 pct
    -- Now let's put this in a function
    function Guide_Pct(pUnit)
    	local hp = pUnit:GetHealthPct()
    	if(hp <= 90) then
    		pUnit:CastSpellOnTarget(5)
    	end
    	-- Notice once again end the if function first
    end
    
    -- Now im going to show you a way thats more accurate for the
    -- mob to use a spell on a target instead of skipping it 
    -- because it didnt select a target. Well here's how you would use
    -- this function
    -- ok once again it's a local function and you GetClosestPlayer
    -- so the function would be local <name> = pUnit:GetClosestPlayer()
    -- this one doesnt have an if function for it. I will show you
    -- how to use this one in the function its self.
    -- Also before we go on I will also like to show you how to get a
    -- Random player instead of Closest Player
    -- Lets start the function
    function Guide_Closest(pUnit)
    	local plr = pUnit:GetClosestPlayer()
    	pUnit:CastSpellOnTarget(5, plr)
    end
    -- Notice i put the function name plr after the spell id.
    -- That's how you tell it to use that local function in the cast
    
    -- Now lets demonstrate Random one
    function Guide_Random(pUnit)
    	local plr = pUnit:GetRandomPlayer(0)
    -- Notice how you put a 0 in the () on this one
    	pUnit:CastSpellOnTarget(5, plr)
    end
    -- Same as Closest you put the Local name after the spell id
    
    
    -- *******************************************************
    -- *  Now I will put the whole script together for you   *
    -- *               to refer to if you need               *
    -- *******************************************************
    
    function Dartignan_Spell(pUnit)
    	local hp = pUnit:GetHealthPct()
    	local plr = pUnit:GetClosestPlayer()
    	local spell = math.random(1,2)
    	if(hp <= 90) then
    		if(spell == 1) then
    			pUnit:CastSpellOnTarget(5, plr)
    		end
    		if(spell == 2) then
    			pUnit:CastSpellOnTarget(10, plr)
    		end
    	end
    end
    
    function Dartignan_OnCombat(pUnit)
    	pUnit:RegisterEvent("Dartignan_Spell", 10000, 0)
    end
    -- This function im using to register a function in a function
    -- i do this to put time between each time it cast the spell
    -- now when you RegisterUnitEvent you only register the
    -- Dartignan_ OnCombat so just likee this
    
    RegisterUnitEvent(55555, 1, "Dartignan_OnCombat")

    [Guide] How to use local LUA function!

Similar Threads

  1. [Lua] how to use the mysql functions
    By trujillo in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 04-22-2010, 12:54 PM
  2. [Guide] How to: Use the WoWModelViewer Greenscreen
    By Cursed in forum Art & Graphic Design
    Replies: 5
    Last Post: 11-15-2007, 03:57 PM
  3. [Guide] How to use PayPal
    By gogobananas in forum World of Warcraft Guides
    Replies: 3
    Last Post: 10-30-2007, 09:12 AM
  4. [Guide] How to use Cheat Engine!, Picture guide
    By Creeps in forum World of Warcraft Bots and Programs
    Replies: 15
    Last Post: 06-26-2007, 03:33 PM
  5. GUIDE: HOW TO USE TORRENTS (Look inside)
    By Hounro in forum Community Chat
    Replies: 14
    Last Post: 01-22-2007, 09:04 PM
All times are GMT -5. The time now is 11:27 AM. 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