• 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!

TFS 1.X+ Outfit Bonus

abdala ragab

Veteran OT User
Joined
Aug 18, 2018
Messages
461
Solutions
11
Reaction score
340
Location
gamelaot.sytes.net
How do I change this text?
I tried a lot to change it to provide the value of mana /health +5 mlvl +5 skill sword/distance/clup/axe

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 = {
    [{127, 126}] = createBonusCondition(1, {
            {param = CONDITION_PARAM_STAT_MAGICPOINTS, value = 10},
            {param = CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, value = 110}
        }
    ),
    [{127, 126}] = createBonusCondition(2, {
            {param = CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, value = 110}
        }
    )
}

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

function Creature:onChangeOutfit(outfit)
    if not self:isPlayer() then
        return true
    end
    local previousBonusCondition = getBonusCondition(self:getOutfit().lookType)
    local newBonusCondition = getBonusCondition(outfit.lookType)
    if previousBonusCondition then
        self:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, previousBonusCondition:getSubId())
    end
    if newBonusCondition then
        self:addCondition(newBonusCondition)
    end
    return true
end
Can someone help me
Code:
CONDITION_PARAM_OWNER
CONDITION_PARAM_TICKS
CONDITION_PARAM_HEALTHGAIN
CONDITION_PARAM_HEALTHTICKS
CONDITION_PARAM_MANAGAIN
CONDITION_PARAM_MANATICKS
CONDITION_PARAM_DELAYED
CONDITION_PARAM_SPEED
CONDITION_PARAM_LIGHT_LEVEL
CONDITION_PARAM_LIGHT_COLOR
CONDITION_PARAM_SOULGAIN
CONDITION_PARAM_SOULTICKS
CONDITION_PARAM_MINVALUE
CONDITION_PARAM_MAXVALUE
CONDITION_PARAM_STARTVALUE
CONDITION_PARAM_TICKINTERVAL
CONDITION_PARAM_FORCEUPDATE
CONDITION_PARAM_SKILL_MELEE
CONDITION_PARAM_SKILL_FIST
CONDITION_PARAM_SKILL_CLUB
CONDITION_PARAM_SKILL_SWORD
CONDITION_PARAM_SKILL_AXE
CONDITION_PARAM_SKILL_DISTANCE
CONDITION_PARAM_SKILL_SHIELD
CONDITION_PARAM_SKILL_FISHING
CONDITION_PARAM_STAT_MAXHITPOINTS
CONDITION_PARAM_STAT_MAXMANAPOINTS
CONDITION_PARAM_STAT_SOULPOINTS
CONDITION_PARAM_STAT_MAGICPOINTS
CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT
CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT
CONDITION_PARAM_STAT_SOULPOINTSPERCENT
CONDITION_PARAM_STAT_MAGICPOINTSPERCENT
CONDITION_PARAM_PERIODICDAMAGE
CONDITION_PARAM_SKILL_MELEEPERCENT
CONDITION_PARAM_SKILL_FISTPERCENT
CONDITION_PARAM_SKILL_CLUBPERCENT
CONDITION_PARAM_SKILL_SWORDPERCENT
CONDITION_PARAM_SKILL_AXEPERCENT
CONDITION_PARAM_SKILL_DISTANCEPERCENT
CONDITION_PARAM_SKILL_SHIELDPERCENT
CONDITION_PARAM_SKILL_FISHINGPERCENT
CONDITION_PARAM_BUFF_SPELL
CONDITION_PARAM_SUBID
CONDITION_PARAM_FIELD
I use this
@Infernum
Help me with your text and thanks in advance
 
Solution
Change your data/events/scripts/creature.lua to this one and retry
Lua:
CREATURE_REGISTER_EVENTS = {}

function Creature.getRegisteredEvent(cid, name)
    if not CREATURE_REGISTER_EVENTS[cid] then
        CREATURE_REGISTER_EVENTS[cid] = {}
    end
    return CREATURE_REGISTER_EVENTS[cid][name]
end


function Creature.setRegisteredEvent(cid, name)
    CREATURE_REGISTER_EVENTS[cid][name] = true
end

function Creature:onChangeOutfit(outfit)
    return true
end

function Creature:onAreaCombat(tile, isAggressive)
    return RETURNVALUE_NOERROR
end

function Creature:onTargetCombat(target)
    if isMonster(target) then
        local targetID = target:getId()
        if not Creature.getRegisteredEvent(targetID, "damageBoostHP") then...
Lua:
            {param = CONDITION_PARAM_STAT_MAGICPOINTS, value = 5},
            {param = CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, value = 110}
            {param = CONDITION_PARAM_SKILL_FIST, value = 5},
            {param = CONDITION_PARAM_SKILL_CLUB, value = 5},
            {param = CONDITION_PARAM_SKILL_SWORD, value = 5},
            {param = CONDITION_PARAM_SKILL_AXE, value = 5},
            {param = CONDITION_PARAM_SKILL_DISTANCE, value = 5},
            {param = CONDITION_PARAM_SKILL_SHIELD, value = 5},
 
Lua:
            {param = CONDITION_PARAM_STAT_MAGICPOINTS, value = 5},
            {param = CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, value = 110}
            {param = CONDITION_PARAM_SKILL_FIST, value = 5},
            {param = CONDITION_PARAM_SKILL_CLUB, value = 5},
            {param = CONDITION_PARAM_SKILL_SWORD, value = 5},
            {param = CONDITION_PARAM_SKILL_AXE, value = 5},
            {param = CONDITION_PARAM_SKILL_DISTANCE, value = 5},
            {param = CONDITION_PARAM_SKILL_SHIELD, value = 5},

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/login.lua:eek:nLogin
data/creaturescripts/scripts/login.lua:2: attempt to call global 'getBonusCondition' (a nil value)
stack traceback:
[C]: in function 'getBonusCondition'
data/creaturescripts/scripts/login.lua:2: in function <data/creaturescripts/scripts/login.lua:1>
does not work
 
Show me your
data/events/scripts/creature.lua
and
data/creaturescripts/scripts/login.lua
login.lua
Lua:
function onLogin(player)
    local bonusCondition = getBonusCondition(player:getOutfit().lookType)
    if bonusCondition then
        player:addCondition(bonusCondition)
    end
    local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "! Say !Promotion to buy Promotion"
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. " Please choose your outfit."
        player:sendOutfitWindow()
    else
        if loginStr ~= "" then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format("Your last visit was on %s.", os.date("%a %b %d %X %Y", player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    local playerId = player:getId()
        local time = 10 -- 10 seconds cooldown until they can logout
        setPlayerStorageValue(cid, 3333, os.time()+time)


    -- Stamina
    nextUseStaminaTime[player.uid] = 0


    -- STAMINA DEVIDO A QUEDAS START
  
    --local stamina_full = 42 * 60 -- config. 42 = horas
     -- if player:getStamina() >= stamina_full then
    --  player:sendCancelMessage("Your stamina is already full.")
    -- elseif player:getPremiumDays() < 1 then
    --   player:sendCancelMessage("You must have a premium account.")
    -- else
    --  player:setStamina(stamina_full)
    -- player:sendTextMessage(MESSAGE_INFO_DESCR, "Your stamina has been refilled.")     
    -- end
  
    -- STAMINA DEVIDO A QUEDAS END

    -- Promotion
    local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(STORAGEVALUE_PROMOTION)
        if not promotion and value ~= 1 then
            player:setStorageValue(STORAGEVALUE_PROMOTION, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end
player:registerEvent('KillDeathCount')
player:registerEvent("Task")
player:registerEvent("AutoLoot")
player:registerEvent("GoldOnKillPlayer")
player:registerEvent("damageBoostHP")
player:registerEvent("damageBoostMana")
    -- Outfits
    if not player:isPremium() then
        if player:getSex() == PLAYERSEX_FEMALE then
            local outfit = player:getOutfit()
            if outfit.lookType > 139 then
                player:setOutfit({lookType = 136, lookHead = 78, lookBody = 106, lookLegs = 58, lookFeet = 95})
            end
        else
            local outfit = player:getOutfit()
            if outfit.lookType > 131 then
                player:setOutfit({lookType = 128, lookHead = 78, lookBody = 106, lookLegs = 58, lookFeet = 95})
            end
        end
    if player:getStorageValue(2038) == 1 then -- Task System register if still has task
        player:registerEvent("TaskKill")
    end
    -- tasks:updateTasks(player)
    end

    -- Premium system
    if player:isPremium() then
        player:setStorageValue(43434, 1)
    elseif player:getStorageValue(43434) == 1 then
        player:setStorageValue(43434, 0)
        player:teleportTo({x = 160, y = 54, z = 7})
        player:setTown(Town("Motherland"))
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Your premium time has expired.")
    end

 -- for global with rookgaard
 -- Premium system
 --   local rookTownId = 6
 --   local thaisTownId = 2

 --   if player:isPremium() and player:getStorageValue(43434) ~= 1 then
 --       player:setStorageValue(43434, 1)
 --   elseif not player:isPremium() and player:getStorageValue(43434) == 1 then
 --       if player:getVocation():getId() == 0 then
 --           player:setTown(Town(rookTownId))
 --       else
 --           player:setTown(Town(thaisTownId))
 --       end
 --       player:sendTextMessage(22, "Your premium time has expired.")
 --       player:setStorageValue(43434, -1)       
 --       player:teleportTo(player:getTown():getTemplePosition())
 --   end


-- account manager
local accountManager = player:getAccountManager()
    if(accountManager == MANAGER_NONE) then
        local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!"
        if player:getLastLoginSaved() <= 0 then
            loginStr = loginStr .. " Please choose your outfit."
            player:sendOutfitWindow()
        else
            if loginStr ~= "" then
                player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
            end
            loginStr = string.format("Your last visit was on %s.", os.date("%a %b %d %X %Y", player:getLastLoginSaved()))
        end
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
    elseif(accountManager == MANAGER_NAMELOCK) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")

    elseif(accountManager == MANAGER_ACCOUNT) then
        player:say("account",1)
    elseif(accountManager == MANAGER_NEW) then
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Account Manager: Hey, my name is Account Manager.")
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Account Manager: If you want, I can create a new 'account' for you.")
    end

    -- Events
    player:registerEvent("logoutdelay")
    player:registerEvent(cid, "pvpenfo")
    player:registerEvent("PlayerDeath")
    player:registerEvent("DropLoot")
    player:registerEvent("broadcast_deaths")
    player:registerEvent("loot")
    return true
end
creature.lua
Code:
CREATURE_REGISTER_EVENTS = {}

function Creature.getRegisteredEvent(cid, name)
    if not CREATURE_REGISTER_EVENTS[cid] then
        CREATURE_REGISTER_EVENTS[cid] = {}
    end
    return CREATURE_REGISTER_EVENTS[cid][name]
end


function Creature.setRegisteredEvent(cid, name)
    CREATURE_REGISTER_EVENTS[cid][name] = true
end

function Creature:onChangeOutfit(outfit)
    return true
end

function Creature:onAreaCombat(tile, isAggressive)
    return RETURNVALUE_NOERROR
end

function Creature:onTargetCombat(target)
    if isMonster(target) then
        local targetID = target:getId()
        if not Creature.getRegisteredEvent(targetID, "damageBoostHP") then
            target:registerEvent("damageBoostHP")
            Creature.setRegisteredEvent(targetID, "damageBoostHP")
        end
    end
end

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 = {
    [{127, 126}] = createBonusCondition(1, {
            {param = CONDITION_PARAM_STAT_MAGICPOINTS, value = 10},
            {param = CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, value = 110}
        }
    ),
    [{127, 126}] = createBonusCondition(2, {
            {param = CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, value = 110}
        }
    )
}

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

function Creature:onChangeOutfit(outfit)
    if not self:isPlayer() then
        return true
    end
    local previousBonusCondition = getBonusCondition(self:getOutfit().lookType)
    local newBonusCondition = getBonusCondition(outfit.lookType)
    if previousBonusCondition then
        self:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, previousBonusCondition:getSubId())
    end
    if newBonusCondition then
        self:addCondition(newBonusCondition)
    end
    return true
end
 
Change your data/events/scripts/creature.lua to this one and retry
Lua:
CREATURE_REGISTER_EVENTS = {}

function Creature.getRegisteredEvent(cid, name)
    if not CREATURE_REGISTER_EVENTS[cid] then
        CREATURE_REGISTER_EVENTS[cid] = {}
    end
    return CREATURE_REGISTER_EVENTS[cid][name]
end


function Creature.setRegisteredEvent(cid, name)
    CREATURE_REGISTER_EVENTS[cid][name] = true
end

function Creature:onChangeOutfit(outfit)
    return true
end

function Creature:onAreaCombat(tile, isAggressive)
    return RETURNVALUE_NOERROR
end

function Creature:onTargetCombat(target)
    if isMonster(target) then
        local targetID = target:getId()
        if not Creature.getRegisteredEvent(targetID, "damageBoostHP") then
            target:registerEvent("damageBoostHP")
            Creature.setRegisteredEvent(targetID, "damageBoostHP")
        end
    end
end

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 = {
    [{127, 126}] = createBonusCondition(1, {
            {param = CONDITION_PARAM_STAT_MAGICPOINTS, value = 5},
            {param = CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, value = 110},
            {param = CONDITION_PARAM_SKILL_FIST, value = 5},
            {param = CONDITION_PARAM_SKILL_CLUB, value = 5},
            {param = CONDITION_PARAM_SKILL_SWORD, value = 5},
            {param = CONDITION_PARAM_SKILL_AXE, value = 5},
            {param = CONDITION_PARAM_SKILL_DISTANCE, value = 5},
            {param = CONDITION_PARAM_SKILL_SHIELD, value = 5}
        }
    ),
    [{127, 126}] = createBonusCondition(2, {
            {param = CONDITION_PARAM_STAT_MAGICPOINTS, value = 5},
            {param = CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, value = 110},
            {param = CONDITION_PARAM_SKILL_FIST, value = 5},
            {param = CONDITION_PARAM_SKILL_CLUB, value = 5},
            {param = CONDITION_PARAM_SKILL_SWORD, value = 5},
            {param = CONDITION_PARAM_SKILL_AXE, value = 5},
            {param = CONDITION_PARAM_SKILL_DISTANCE, value = 5},
            {param = CONDITION_PARAM_SKILL_SHIELD, value = 5}
        }
    )
}

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

function Creature:onChangeOutfit(outfit)
    if not self:isPlayer() then
        return true
    end
    local previousBonusCondition = getBonusCondition(self:getOutfit().lookType)
    local newBonusCondition = getBonusCondition(outfit.lookType)
    if previousBonusCondition then
        self:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, previousBonusCondition:getSubId())
    end
    if newBonusCondition then
        self:addCondition(newBonusCondition)
    end
    return true
end
 
Solution
Back
Top