[Lua] Spell Guide menu

Shout-Out

User Tag List

Results 1 to 14 of 14
  1. #1
    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)

    [Lua] Spell Guide

    Introduction
    Some people might be unaware of that your able to script Spells in Lua, like it or not this is the case.

    Doing this isnt very hard. All you need is the right resources.

    Example of a Spell Script:
    Code:
    local Caster = nil
    
    RegisterDummySpell(686, "ShadowBoltOne_Cast")
    RegisterDummySpell(695, "ShadowBoltTwo_Cast")
    RegisterDummySpell(705, "ShadowBoltThree_Cast")
    RegisterDummySpell(1088, "ShadowBoltFour_Cast")
    RegisterDummySpell(1106, "ShadowBoltFive_Cast")
    RegisterDummySpell(7641, "ShadowBoltSix_Cast")
    RegisterDummySpell(11659, "ShadowBoltSeven_Cast")
    RegisterDummySpell(11660, "ShadowBoltEight_Cast")
    RegisterDummySpell(11661, "ShadowBoltNine_Cast")
    RegisterDummySpell(25307, "ShadowBoltTen_Cast")
    RegisterDummySpell(27209, "ShadowBoltEleven_Cast")
    RegisterDummySpell(47808, "ShadowBoltTwelve_Cast")
    RegisterDummySpell(47809, "ShadowBoltThirteen_Cast")
    
    
    function ShadowBolt_CastOne(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 9%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastTwo(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 11%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastThree(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 15%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastFour(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastFive(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	f (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastSix(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastSeven(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastEight(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastNine(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastTen(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastEleven(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastTwelve(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    
    function ShadowBolt_CastThirteen(effectIndex, Spell)
    	local Caster = Spell:GetCaster() 
    	if (Spell:GetSpellState() == 0) then
    		if (Caster:GetManaPct() => 16%) then
    		Spell:Cast()
    		else
    		end
    	else
    	end
    end
    This script is a fix for a old ArcEmu ticket which i dont know if its fixed or not.

    Description:

    Character: Warlock lvl 1
    Casting: Shadowbolt cost: 37 mana
    Once i'm below 37 mana my cast icon grays out. Once i have 37 mana my cast icon lites back up. but when i try to cast it says i don't have enough mana. It's not till i have 48 mana before i can cast Shadow bolt again.
    Since shadow bolt now takes % instead of (x)amount of mana i decided to fix it with Lua.

    The Guide

    This script is very plain.

    Code:
    local Caster = Spell:GetCaster()
    Caster is the same as Spell:GetCaster()

    For those of you who don't know; local means that the variable only can be used for its purpose within the current file.

    Code:
    RegisterDummySpell(686, "ShadowBoltOne_Cast")
    This trigger may be new to some people and old to others.

    RegisterDummySpell(entry, funcName)

    Put your spell EntryID where entry is and Function Name where it says funcName.

    Code:
    function ShadowBolt_CastOne(effectIndex, Spell)
    Make sure the parameters are correct.

    effectIndex and Spell must be included in the parameters.

    Code:
    if (Spell:GetSpellState() == 0) then
    If the Spell isnt being casted right now then..

    :GetSpellState FLAGS:
    SPELL_STATE_NULL = 0,
    SPELL_STATE_PREPARING = 1,
    SPELL_STATE_CASTING = 2,
    SPELL_STATE_FINISHED = 3,
    SPELL_STATE_IDLE = 4
    Code:
    if (Caster:GetManaPct() => 9%) then
    If the casters Mana Procent is above 9% then..

    Code:
    Spell:Cast(true)
    The player is allowed to cast the spell.

    If you set Cast to false then you force the player to cast the spell.

    End

    That's all for this guide, folks. Hope it helped.

    Last edited by P1raten; 03-01-2010 at 08:47 AM.

    [Lua] Spell Guide
  2. #2
    Daimyo2704's Avatar Member
    Reputation
    37
    Join Date
    Jan 2009
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks great, thanks for the tut. +rep.

    thanks to P1raten

  3. #3
    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)
    Thanks.

  4. #4
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,503
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Whats with all the extra else's before the ends?

    Otherwise nice guide.

  5. #5
    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)
    Originally Posted by Ground Zero View Post
    Whats with all the extra else's before the ends?

    Otherwise nice guide.
    Bad Habit.

  6. #6
    Daimyo2704's Avatar Member
    Reputation
    37
    Join Date
    Jan 2009
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    -- Heroic Fury [Warrior]
    
    local Caster = Spell:GetCaster()   
    
    RegisterDummySpell(60970, "HeroicFury_Spell")
    
    function HeroicFury_Spell(effectIndex, Spell)
            if(Spell:GetSpellState() == 2) then
              local caster = Spell:GetCaster()
              for _,v in pairs(caster) do
              local Mechanic = {7922, 60995, 19675, 45334, 408, 8643}
                 if(v:HasAuraWithMechanic(Mechanic) == true) then
                   v:RemoveAura(Mechanic)
              end
         end
    end
    Is this right?
    And do you got any idea how I reset the cooldown of Intercept =D?
    Last edited by Daimyo2704; 02-28-2010 at 02:47 PM.

    thanks to P1raten

  7. #7
    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)
    Originally Posted by Daimyo2704 View Post
    Is this right?
    And do you got any idea how I reset the cooldown of Intercept =D?
    Code:
    local Caster = nil
    
    RegisterDummySpell(60970, "HeroicFury_Spell")
    
    function HeroicFury_Spell(effectIndex, Spell)
    	Caster = Spell:GetCaster()
            if(Spell:GetSpellState() == 2) then
              local caster = Spell:GetCaster()
              for _,v in pairs(caster) do
              local Mechanic = {7922, 60995, 19675, 45334, 408, 8643}
                 if(v:HasAuraWithMechanic(Mechanic) == true) then
                   v:RemoveAura(Mechanic)
    			end
    		end
    	end
    end
    Fixed some errors.

  8. #8
    Daimyo2704's Avatar Member
    Reputation
    37
    Join Date
    Jan 2009
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, +rep.

    Edit: Must spread : /

    thanks to P1raten

  9. #9
    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)
    Originally Posted by Daimyo2704 View Post
    Thanks, +rep.

    Edit: Must spread : /
    np

    fillerz


  10. #10
    mag1212's Avatar Active Member
    Reputation
    55
    Join Date
    Aug 2009
    Posts
    352
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice guide +Rep

  11. #11
    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)
    Thank you.

  12. #12
    pantryboy's Avatar Member
    Reputation
    44
    Join Date
    Sep 2008
    Posts
    99
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by -Jebus Fist- View Post

    Code:
    local Caster = nil
    
    RegisterDummySpell(60970, "HeroicFury_Spell")
    
    function HeroicFury_Spell(effectIndex, Spell)
    	Caster = Spell:GetCaster()
            if(Spell:GetSpellState() == 2) then
              local caster = Spell:GetCaster()
              for _,v in pairs(caster) do
              local Mechanic = {7922, 60995, 19675, 45334, 408, 8643}
                 if(v:HasAuraWithMechanic(Mechanic) == true) then
                   v:RemoveAura(Mechanic)
    			end
    		end
    	end
    end
    Fixed some errors.
    Not to bump an old thread, but that still won't work. You see, you're trying to use :HasAuraWithMechanic(), which requires a spell ID (a number), but you're using Mechanic, a table. A table is it's own seperate identity, so it won't automatically take the values from within the table, Lua will complain that it got a table instead of a number. Also, you're trying to loop 'caster' (Spell:GetCaster()) through a loop, which also won't work, since 'caster' is a unit / object / item depending on what casted it.

    Here's your fixed code:

    Code:
    function HeroicFury_Spell(effectIndex, Spell)
    	if (Spell:GetSpellState() == 2) then
    		local Caster = Spell:GetCaster();
    		local Mechanic = {7922, 60995, 19675, 45334, 408, 8643};
    		for _, v in pairs(Mechanic) do
    			if(Caster:HasAuraWithMechanic(v) == true) then
    				Caster:RemoveAura(v);
    			end
    		end
    	end
    end

  13. #13
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very good guide. I don't know how you make so many Jebus... +Rep for this

  14. #14
    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)
    Thank you. Im gonna make some more soon.

Similar Threads

  1. NPC lua spell commands [GUIDE]
    By thebigman in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 08-12-2009, 06:11 PM
  2. [Guide] Lua Scripting Guide is here [Updating]
    By Illidan1 in forum WoW EMU Guides & Tutorials
    Replies: 93
    Last Post: 11-04-2008, 06:56 PM
  3. Lua Scripting Guide
    By [Shon3m] in forum WoW EMU Guides & Tutorials
    Replies: 6
    Last Post: 06-16-2008, 02:03 PM
  4. [Guide] Another LUA Scripting Guide
    By Bapes in forum WoW EMU Guides & Tutorials
    Replies: 13
    Last Post: 05-08-2008, 05:01 PM
  5. LuA SCRIPTING (guide)
    By Dee2001 in forum WoW EMU Guides & Tutorials
    Replies: 5
    Last Post: 03-05-2008, 11:43 AM
All times are GMT -5. The time now is 10:35 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