Adding buffs to yourself/others

Post Reply
juniorff808
Posts: 4
Joined: Sun May 26, 2013 10:58 pm

Adding buffs to yourself/others

Post by juniorff808 » Fri Jul 18, 2014 8:46 pm

How do you add buffs to players such as 2h's, regens, other buffs as such? also if you need a buff value where could I find that?

I have been on other private servers and seen GM's just add a buff on the spot to a player.

User avatar
Signature
Posts: 126
Joined: Fri May 02, 2014 3:44 am

Re: Adding buffs to yourself/others

Post by Signature » Fri Jul 18, 2014 10:33 pm

look at @addeffect
then look at status.lua

juniorff808
Posts: 4
Joined: Sun May 26, 2013 10:58 pm

Re: Adding buffs to yourself/others

Post by juniorff808 » Fri Jul 18, 2014 11:11 pm

Can you manipulate the duration and level within the command?

After some playing around I have found they are all like level 1 effect and last roughly 30 secs no matter the spell...

Is there a format to the command such as:

@addeffect <effect id> <level> <duration> <--- don't know if this works, I am asking if there is something like this

ex.
@addeffect 40 5 60 (would give protect 5 for 60 mins IF that were the command)

User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Re: Adding buffs to yourself/others

Post by atom0s » Sat Jul 19, 2014 10:23 pm

@addeffect has subparams that handle the duration and such for the effect you are adding. Check out the source to see how the params are used.

User avatar
Signature
Posts: 126
Joined: Fri May 02, 2014 3:44 am

Re: Adding buffs to yourself/others

Post by Signature » Sat Jul 19, 2014 10:35 pm

I don't understand why it is so hard to Read through the .lua file for the command....

When i had said take a look at @addeffect i meant open Up the addeffect.lua file and look through it...

It clearly states how it works, and what the params are right in the function.

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: addeffect
-- auth: Lautan
-- desc: Adds the given effect to the given player.
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 1,
    parameters = "siii"
};

function onTrigger(player, target, id, power, duration)

    -- Ensure a target is set..
    if (target == nil) then
        player:PrintToPlayer( "Target required; cannot be nil." );
        return;
    end

    local effectTarget = player;
    
    -- check if target name was entered
    local num = tonumber(target)
    if (type(num) == "number") then
        if (power == 0 or power == nil) then
            duration = 60;
        else
            duration = power;
        end

        if (id == 0 or id == nil) then
            power = 1;
        else
            power = id;
        end

        id = num
    else
        local pc = GetPlayerByName(target);
        if (pc ~= nil) then
            effectTarget = pc;
        else
            return;
        end

        if (power == nil) then
            power = 1;
        end

        if (duration == nil) then
            duration = 60;
        end

        if (id == 0 or id == nil) then
            id = 1;
        end
    end

    if (id == nil) then
        player:PrintToPlayer( "Effect id cannot be nil." );
        return;
    end

    if (effectTarget:addStatusEffect(id, power, 3, duration)) then
        effectTarget:messagePublic(280, effectTarget, id, id);
    else
        effectTarget:messagePublic(283, effectTarget, id);
    end
end
Incase you missed it.....

Code: Select all

function onTrigger(player, target, id, power, duration)

So that makes it @addeffect Target SpellID Power Duration

If you do not specify a target it will put the buff on you.

juniorff808
Posts: 4
Joined: Sun May 26, 2013 10:58 pm

Re: Adding buffs to yourself/others

Post by juniorff808 » Sun Jul 20, 2014 11:38 am

My apologies, I am definitely new to this but I am slowly coming along, thank you for your help.

Post Reply