Jump to content

Simple .buff command


Marko

Recommended Posts

Posted
function buff(event, player, message, Type, lang)
if(message:lower() == "buff")then
player:AddAura(48074, player)
player:AddAura(35912, player)
player:AddAura(38734, player)
player:AddAura(65075, player)
player:AddAura(65077, player)
player:AddAura(43223, player)
player:AddAura(15366, player)
player:AddAura(36880, player)
player:AddAura(36880, player)
player:AddAura(16609, player)
player:AddAura(48073, player)
player:AddAura(48469, player)
player:AddAura(26035, player)
player:SendBroadcastMessage("You have been Buffed!")
end
end

RegisterPlayerEvent(42, buff)

You can use this simple script and add any spells as buffs you want. Can also change here whatever broadcast message you want when player gets buffed, and can even change the default .buff command to something else. 

Enjoy :)  

The original code i have found long time ago somewhere on Emudevs forums which are lost now. Ofc i edited the code slightly and you can too, to fit your needs. 

Posted

Feel free to post any examples and edits you make :)  I'm sure peeps will like and use it. 

I'm not so expert with eluna as to make any advanced edits here, just basic stuff anyone can do :)

Posted

nice job newbie ;) 

now lets see you learn how to take it from another newbie buff script and make it an advanced dynamic buff script. B|

oooh like make it so it will buff each class with a group of different buffs or every 10 levels a player gains access to more buff id's... 

Arrays/Tables are frak'n sooo easy in Lua once you understand how to store data and access the stored data when needed.  3d tables will be just an everyday thing :) 

check out my buff command in my VIP System. its setup to issue players buff's depending on VIP level, guild member or if they have an item in inventory.

 

When you stop learning you stop living ;)

Posted

ok i made you an example using a simple 2D table to store the buff id's.

 

local command = "buff"; -- here we define "command" as local variable with a string value of "buff". I defined it as a `local` outside any functions so it is localized to this Lua file only.
local buff = {}; -- here i define the variable `buff` as an empty table (Without data).again i have defined it as a local outside any functions so it is localized to this Lua file only.

buff = {48074,35912,38734,65075,65077,43223,15366,36880,36880,16609,48073,48469,26035}; -- Here I will now store data in the table named `buff`. each id separated by a comma. each spot will be a unique address piece(1,2,3,4,5,6.....) accessed by using the full adress. so to puff a player with buff id '43223' i will use the command `player:AddAura(buff[6], player)` and the player will get buffed with 43223.

	
function buff(event, player, message, Type, lang)

	if(message:lower() == command)then -- here we chech every chat message (converting it to `lower`case) to see if it matches absolute(==) the string stored in the variable `command`.
		
		local entry_id; -- here i am defining a variable i will use ONLY inside this function so when its local inside a function it will be localized to only that function and you can make a new variable inside another function using the same name but different stored data.
		
			for entry_id = 1, #buff do -- here i am starting a loop. telling it that entry_id will be from 1 to the max size of the `buff` table (#buff).

				player:AddAura(buff[entry_id], player); -- now using the full address to pinpoint a location of stored data we will apply the data as a buff to the player.
			end -- end for when our current loop is complete and increase entry_id +1 or if entry_id value is the max size for the loop then end and exit the loop.
	
		player:SendBroadcastMessage("You have been Buffed!")
	end -- end for the end of our if statement.
end -- end of function end.

RegisterPlayerEvent(42, buff)

 

  • 2 weeks later...
Posted

local BuffS = {}; --Spell Id's

function Buff(event, player, message, Type, lang)
    if(message:lower() == "Buff")then    
        for _, v in ipairs(buffS)do
            player:AddAura(v, player)
            end
        player:SendBroadcastMessage("You Are Buffed !")
            end
        end
end


RegisterPlayerEvent(42, Buff)

  • 3 years later...
Posted

---------------------------
--  SIMPLE BUFF COMMAND ---
---------------------------
-- copy to your lua scripts folder and reload eluna/server

local auras = {48074,35912,38734,65075,65077,43223,15366,36880,36880,16609,48073,48469,26035,70233,70234,70235,70244,70242,70243};

--  you can add or remove spells ^
--  you will be buffed if no target selected

function buff(event, player, message, Type, lang)
    if (message:lower() == "buff") then

    gmRank =player:GetGMRank()
    if (gmRank >= 3) then  -- change number (0-3) 0 - to all  1,2,3 GM with rank  
        selectTarget = player:GetSelection()

        if (not selectTarget) then  
            selectTarget = player
        end

        for _, i in ipairs(auras) do
            selectTarget:AddAura(i, selectTarget)
        end
        selectTarget:SetHealth( selectTarget:GetMaxHealth() )
        player:SendBroadcastMessage("|cff5af304Buffed !|r")
    end
    end
end
RegisterPlayerEvent(42, buff)

-- checked on TrinityCore rev. 27fffd302563+ 2020-05-31 23:31:01 + Eluna + NPCbots
-- original idea Marko, released dopiks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use