• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Lua [Help] cap on outfit bonus.

tony11

New Member
Joined
Sep 2, 2010
Messages
1
Reaction score
0
Hello, i'm using the script for outfit bonus and it work's perfectly with all attributes execpt for capacity.

That's my creature.lua on events. i checked on server src and the condition CONDITION_PARAM_STAT_CAPACITYPERCENT exists but it don't work. may someone please help me to figure out a way to increase capacity with outfit bonus?
Lua:
function createBonusCondition(id, params)
    local condition = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT)
    condition:setParameter(CONDITION_PARAM_TICKS, -1)
    condition:setParameter(CONDITION_PARAM_SUBID, id)
    for i = 1, #params do
        local param = params[i].param
        local value = params[i].value
        condition:setParameter(param, value)
    end
    return condition
end

outfitBonuses = {
    [{128, 136}] = createBonusCondition(1, {
            {param = CONDITION_PARAM_STAT_MAGICPOINTS, value = 10},
            {param = CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, value = 110}
        }
    ),
    [{129, 137}] = createBonusCondition(2, {
            {param = CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, value = 200}
        }
    ),
    [{426}] = createBonusCondition(3, {
            {param = CONDITION_PARAM_SKILL_DISTANCEPERCENT , value = 110},
            {param = CONDITION_PARAM_STAT_CAPACITYPERCENT , value = 500}
        }
    )
}


function getBonusCondition(outfit)
    for outfits, bonus in pairs(outfitBonuses) do
        if table.contains(outfits, outfit) then
            return bonus
        end
    end
    return nil
end



-- Functions from The Forgotten Server
function Creature:onChangeOutfit(outfit)
    if self:isPlayer() then
        local playerCap = self:getCapacity()
        local familiarLookType = self:getFamiliarLooktype()
        --outfit bonus
        local previousBonusCondition = getBonusCondition(self:getOutfit().lookType)
        local newBonusCondition = getBonusCondition(outfit.lookType)
        local newBonusConditionMount = addBonusCap(outfit.lookMount,self)
        if previousBonusCondition then
        self:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, previousBonusCondition:getSubId())
        end
        if newBonusCondition then
        self:addCondition(newBonusCondition)
        removeBonusCap(self)
        end
        --outfit bonus
        if familiarLookType ~= 0 then
            for _, summon in pairs(self:getSummons()) do
                if summon:getType():familiar() then
                        if summon:getOutfit().lookType ~= familiarLookType then
                            summon:setOutfit({lookType = familiarLookType})
                        end
                    break
                end
            end
        end
    end
    return true
end
 
Top