Page 1 of 1

Adding buffs to yourself/others

Posted: Fri Jul 18, 2014 8:46 pm
by juniorff808
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.

Re: Adding buffs to yourself/others

Posted: Fri Jul 18, 2014 10:33 pm
by Signature
look at @addeffect
then look at status.lua

Re: Adding buffs to yourself/others

Posted: Fri Jul 18, 2014 11:11 pm
by juniorff808
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)

Re: Adding buffs to yourself/others

Posted: Sat Jul 19, 2014 10:23 pm
by atom0s
@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.

Re: Adding buffs to yourself/others

Posted: Sat Jul 19, 2014 10:35 pm
by Signature
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.

Re: Adding buffs to yourself/others

Posted: Sun Jul 20, 2014 11:38 am
by juniorff808
My apologies, I am definitely new to this but I am slowly coming along, thank you for your help.