• 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.1] Outfit Bonuses

I made something similar, it builds a condition based on the attributes on the list, that's why it only says "distance" or "sword", the first value is the skill % and the second is the subid :p
 
c904905454.png

It looks way too messy :(

I like messy if it works
 
Yeah of course it works, is only missing the speed/light/regen attributes and the supress thing which I think it can't be done in a "good" way.
Honestly I don't think I should update it lol. Maybe I'll do it one day, sorry :oops:
 
Yeah of course it works, is only missing the speed/light/regen attributes and the supress thing which I think it can't be done in a "good" way.
Honestly I don't think I should update it lol. Maybe I'll do it one day, sorry :oops:

Aew :c
 
I tried to implement this into my TFS 1.1 server and I get this error when a character logs in...

Code:
 Lua Script Error: [Event Interface] 
data/events/scripts/creature.lua:Creature@onChangeOutfit
data/events/scripts/creature.lua:24: attempt to index global 'oldOutfit' (a nil value)
stack traceback:
[C]: in function '__index'
data/events/scirpts/creature.lua:24: in function <data/events/scripts/creature.lua:23>
[C]: in function 'setOutfit'
data/creaturescripts/scripts/others/login.lua:91: in function <data/creaturescripts/scripts/others/login.lua:48>
 
Creature: onChangeOutfit executes when a creature's outfit changes.
Therefore, you'd have to change your outfit to receive the bonus.

Executing player:setOutfit(player:getOutfit()) as they login executes Creature: onChangeOutfit. This sets the outfit bonus when they login.

Red

But it's not a hack, it's how it's supposed to be.

You should get the bonuses when loggin in (if you logged out with an outfit that receive bonuses)
 
But it's not a hack, it's how it's supposed to be.

You should get the bonuses when loggin in (if you logged out with an outfit that receive bonuses)

Yeah, but the hack is setting the player's outfit to their existing outfit to trigger the function. The hack is the method of achieving that bonus on login, not the fact that they get the bonus when logging in
 
@Colors how can i change/ add the bonuses to this system i added it and it gave no erroe but it's not giving any bonuses either
i would be very greatful for any help
 
@Colors how can i change/ add the bonuses to this system i added it and it gave no erroe but it's not giving any bonuses either
i would be very greatful for any help

Make sure you registered the events in login.lua and if you added the system while the server is online and used /reload, you have to make sure you log out then back in to register the event. If you're still having issues, post your script here
 
Make sure you registered the events in login.lua and if you added the system while the server is online and used /reload, you have to make sure you log out then back in to register the event. If you're still having issues, post your script here
did all that here is the script i just dont know how to add the bonuses to the outfits
Code:
local hp = Condition(CONDITION_ATTRIBUTES)
hp:setParameter(CONDITION_PARAM_TICKS, -1)
hp:setParameter(CONDITION_PARAM_SUBID, 100)
hp:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTS, 300)

local distance = Condition(CONDITION_ATTRIBUTES)
distance:setParameter(CONDITION_PARAM_TICKS, -1)
distance:setParameter(CONDITION_PARAM_SUBID, 101)
distance:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150)

local sword = Condition(CONDITION_ATTRIBUTES)
sword:setParameter(CONDITION_PARAM_TICKS, -1)
sword:setParameter(CONDITION_PARAM_SUBID, 102)
sword:setParameter(CONDITION_PARAM_SKILL_SWORDPERCENT, 150)

oldOutfit = {}

outfitBonuses = {
    [128] = {[1] = {condition = distance}, [2] = {condition = sword}, [3] = {condition = hp}},
    [129] = {[3] = {condition = hp}},
    [130] = {[3] = {condition = {distance, sword, hp}}}
}

function Creature:onChangeOutfit(outfit)
    if self:isPlayer() then
        local getOutfit = self:getOutfit()
        oldOutfit[self:getId()] = { --Colors (Head, Body, Legs, Feet) and lookTypeEx are unused, but I still keep them here because I'm stupid.
            lookHead = getOutfit.lookHead;
            lookBody = getOutfit.lookBody;
            lookLegs = getOutfit.lookLegs;
            lookFeet = getOutfit.lookFeet;
            lookType = getOutfit.lookType;
            lookTypeEx = getOutfit.lookTypeEx;
            lookAddons = getOutfit.lookAddons;
            lookMount = getOutfit.lookMount;
        }

        local old = oldOutfit[self:getId()]
        local oldOutfit_t = outfitBonuses[old.lookType]
        if oldOutfit_t and oldOutfit_t[old.lookAddons] then
            local oldCondition = oldOutfit_t[old.lookAddons].condition
            if type(oldCondition) == "table" then
                for _, condition in pairs(oldCondition) do
                    self:removeCondition(condition:getType(), condition:getId(), condition:getSubId())
                end
            else
                self:removeCondition(oldCondition:getType(), oldCondition:getId(), oldCondition:getSubId())
            end
        end

        local currentOutfit = outfitBonuses[outfit.lookType]
        if currentOutfit and currentOutfit[outfit.lookAddons] then
            local newCondition = currentOutfit[outfit.lookAddons].condition
            if type(newCondition) == "table" then
                for _, condition in pairs(newCondition) do
                    self:addCondition(condition)
                end
            else
                self:addCondition(newCondition)
            end
        end
    end
    return true
end

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

local function removeCombatProtection(cid)
    local player = Player(cid)
    if not player then
        return true
    end

    local time = 0
    if player:isMage() then
        time = 10
    elseif player:isPaladin() then
        time = 20
    else
        time = 30
    end

    player:setStorageValue(Storage.combatProtectionStorage, 2)
    addEvent(function(cid)
        local player = Player(cid)
        if not player then
            return
        end

        player:setStorageValue(Storage.combatProtectionStorage, 0)
        player:remove()
    end, time * 1000, cid)
end

function Creature:onTargetCombat(target)
    if not self then
        return true
    end

    if target:isPlayer() then
        if self:isMonster() then
            local protectionStorage = target:getStorageValue(Storage.combatProtectionStorage)

            if target:getIp() == 0 then -- If player is disconnected, monster shall ignore to attack the player
                if protectionStorage <= 0 then
                    addEvent(removeCombatProtection, 30 * 1000, target.uid)
                    target:setStorageValue(Storage.combatProtectionStorage, 1)
                elseif protectionStorage == 1 then
                    self:searchTarget()
                    return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
                end

                return true
            end

            if protectionStorage >= os.time() then
                return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
            end
        end
    end

    return true
end
 
alright, first of all, which outfit are you switching to? the effects are based on which addon you have on as well as the outfit, so if you switch to citizen male (128) and have only addon 1, you'll get distance skill, if only addon 2, sword skill, if both addons, health, if no addons, no bonus. 129 and 130 (hunter and mage) will only work if you have both addons on
Nothing it's like it's not even added
 
alright, first of all, which outfit are you switching to? the effects are based on which addon you have on as well as the outfit, so if you switch to citizen male (128) and have only addon 1, you'll get distance skill, if only addon 2, sword skill, if both addons, health, if no addons, no bonus. 129 and 130 (hunter and mage) will only work if you have both addons on
i used citizens and mage outfit and neither had any effect on my stats or displayed any notification i have all addons i have tried with each addon seperate
 
i used citizens and mage outfit and neither had any effect on my stats or displayed any notification i have all addons i have tried with each addon seperate

This is a tough one to troubleshoot, do you have teamviewer? If so, pm me with partner id and password and I'll get you up and running.
 
it's software for remote desktop control, allows me to control your mouse, etc. and manually do things for you. Much easier than trying to identify a problem when there's no errors in the console :p www.teamviewer.com if you'd like to give it a try
 
it's software for remote desktop control, allows me to control your mouse, etc. and manually do things for you. Much easier than trying to identify a problem when there's no errors in the console :p www.teamviewer.com if you'd like to give it a try
ahh no thanks i better not i dont understand the program enough to use it it would be as much trouble to fix the script as to learn to set up another program lol
 
okay, no problem. :p Not sure what else to suggest at this point, if there's no errors in the console, it most likely means something isn't set up properly. try going through the first post again and make sure all the scripts exist and the names are correct and all the changes like login.lua are all set up properly, and make sure you reload events and creaturescripts once everything is set up
 
So I managed to figure out my previous errors, however I've run into another problem... :(
I've been using this template to create bonuses:
Code:
local hp = Condition(CONDITION_ATTRIBUTES)
hp:setParameter(CONDITION_PARAM_TICKS, -1)
hp:setParameter(CONDITION_PARAM_SUBID, 100)
hp:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTS, 300)

I have figured out most bonuses +melee skills, +regeneration, +magic level.... But I can't figure out how to make a bonus for element resist. For example: +10% Fire Resist. Does anyone know how to do this?
 
Back
Top