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

RevScripts Addon Bonuses Conditions

nefinoo

Carnage.flv
Joined
Sep 11, 2010
Messages
549
Solutions
1
Reaction score
58
Location
Lo Mochis, Sinaloa
I have had this script for a long time and before I used it in tfs 1.3, but now I want to use it in canary repos and I got error, could you help me?

Code:
[error] Lua script error:
scriptInterface: [Scripts Interface]
scriptId: [C:\Users\Nefi\OneDrive\Escritorio\canary-main\data\scripts\CUSTOMS NEFI\LOGIN_ADDON_MONTURAS_ATRIBUTOS.lua:callback]
timerEvent: []
 callbackId:[]
function: []
error [...\scripts\CUSTOMS NEFI\LOGIN_ADDON_MONTURAS_ATRIBUTOS.lua:51: attempt to call method 'setParameter' (a nil value)
stack traceback:
        [C]: in function 'setParameter'
        ...\scripts\CUSTOMS NEFI\LOGIN_ADDON_MONTURAS_ATRIBUTOS.lua:51: in function <...\scripts\CUSTOMS NEFI\LOGIN_ADDON_MONTURAS_ATRIBUTOS.lua:9>]

Lua:
local BONUSES = CreatureEvent("BONUSADDONS")
male = {128,129,130,131,132,133,134,143,144,145,146,151,152,153,154,251,268,273,278,289,325,328,335,367,430,432,463,465,472,512,516,541,574,577,610,619,633,634,637,665,667,684,695,697,699,725,733,746,750,760,846,853,873,884,899,908,931,955,957,962,964,966,968,970,972,974,1021,1023,1042,1051,1056,1069,1094,1102,1127,1146,1161,1173,1186,1202,1204,1210,1245,1243,1251,1270,1279,1282,1288,1292,1322,1331,1338,1371,1382,1384,1415,1386,1415,1436,1444, 1449, 1457, 1460, 1489, 1500}
female = {136,137,138,139,140,141,142,147,148,149,150,156,157,158,252,269,270,279,288,324,329,336,366,431,433,464,466,471,513,514,542,575,578,618,620,632,635,636,664,666,683,694,696,698,724,732,745,749,845,852,874,885,900,909,929,956,958,963,965,967,969,971,973,975,1020,1024,1043,1050,1057,1070,1095,1103,1128,1147,1162,1174,1187,1203,1205,1207,1211,1246,1244,1252,1271,1280,1283,1289,1293,1323,1332,1339,1372,1383,1385,1387,1416,1437,1445, 1450, 1456, 1461, 1490, 1501}

local buffs = {
    [5]  = {critical = 1, lifeleech = 1, manaleech = 1, health = 1, mana = 1, expbonus = 1, lootbonus = 1}
}

function BONUSES.onLogin(player)
    local Outfits = 0
    local sex = player:getSex()
   
        if sex == 0 then
            for i, looktype in pairs(female) do
                if player:hasOutfit(looktype, 3) then
                    Outfits = Outfits + 1
                end
            end
        else
            for i, looktype in pairs(male) do
                if player:hasOutfit(looktype, 3) then
                    Outfits = Outfits + 1
                end
            end
        end
       
    local Monturas = 0
    local i = 0
        for i = i+1, 197  do
            if player:hasMount(i) then
            Monturas = Monturas + 1
            end
        end
       
    Total = Outfits + Monturas

    local storageAmount = 5 * math.floor(Total / 5)
    storageAmount = storageAmount > 285 and 285 or storageAmount
    cantidad = math.floor(Total / 5)
    tabla = storageAmount/cantidad
    local i = 0
    local x = player:getStorageValue(11111)
    local buff = buffs[tabla]
   
    local hp = 0
    local mp = 0
   
        if buff then
            if buff.critical then
                crit = buff.critical * cantidad
                player:setParameter(CONDITION_PARAM_SKILL_CRITICAL_HIT_DAMAGE, crit)
            end
            if buff.lifeleech then
                life = buff.lifeleech * cantidad
                player:setParameter(CONDITION_PARAM_SKILL_LIFE_LEECH_AMOUNT, life)
            end
            if buff.manaleech then
                manas = buff.manaleech * cantidad
                player:setParameter(CONDITION_PARAM_SKILL_MANA_LEECH_AMOUNT, manas)
            end
            if buff.lootbonus then
                player:setStorageValue(21111,(buff.lootbonus * cantidad) * 1.75)
            end
            if buff.expbonus then
                player:setStorageValue(21112,(buff.expbonus * cantidad) * 1.75)
            end
            if buff.health then
                hp = buff.health * cantidad
                hp = cantidad / player:getMaxHealth()
                hp = 1 + hp
                hp = player:getMaxHealth() * hp
            end
            if buff.mana then
                mp = buff.mana * cantidad
                mp = cantidad / player:getMaxMana()
                mp = 1 + mp
                mp = player:getMaxMana() * mp
            end
            if mp > 0 or hp > 0 then
                local maxHpmaxMp = Condition(CONDITION_ATTRIBUTES,900)
                maxHpmaxMp:setParameter(CONDITION_PARAM_TICKS, -1)
                if mp > 0 then
                    maxHpmaxMp:setParameter(CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT,mp)
                end
                if hp > 0 then
                    maxHpmaxMp:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT,hp)
                end
                player:addCondition(maxHpmaxMp)
            end
        end  
    return true
end
BONUSES:register()
 
player:setParameter -> player:addCondition
+some more fix

Lua:
local BONUSES = CreatureEvent("BONUSADDONS")
local maleOutfits = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325, 328, 335, 367, 430, 432, 463, 465, 472, 512, 516, 541, 574, 577, 610, 619, 633, 634, 637, 665, 667, 684, 695, 697, 699, 725, 733, 746, 750, 760, 846, 853, 873, 884, 899, 908, 931, 955, 957, 962, 964, 966, 968, 970, 972, 974, 1021, 1023, 1042, 1051, 1056, 1069, 1094, 1102, 1127, 1146, 1161, 1173, 1186, 1202, 1204, 1210, 1245, 1243, 1251, 1270, 1279, 1282, 1288, 1292, 1322, 1331, 1338, 1371, 1382, 1384, 1415, 1386, 1415, 1436, 1444, 1449, 1457, 1460, 1489, 1500}
local femaleOutfits = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 156, 157, 158, 252, 269, 270, 279, 288, 324, 329, 336, 366, 431, 433, 464, 466, 471, 513, 514, 542, 575, 578, 618, 620, 632, 635, 636, 664, 666, 683, 694, 696, 698, 724, 732, 745, 749, 845, 852, 874, 885, 900, 909, 929, 956, 958, 963, 965, 967, 969, 971, 973, 975, 1020, 1024, 1043, 1050, 1057, 1070, 1095, 1103, 1128, 1147, 1162, 1174, 1187, 1203, 1205, 1207, 1211, 1246, 1244, 1252, 1271, 1280, 1283, 1289, 1293, 1323, 1332, 1339, 1372, 1383, 1385, 1387, 1416, 1437, 1445, 1450, 1456, 1461, 1490, 1501}

local buffs = {
    [5] = { critical = 1, lifeleech = 1, manaleech = 1, health = 1, mana = 1, expbonus = 1, lootbonus = 1 }
}

function BONUSES.onLogin(player)
    local Outfits = 0
    local sex = player:getSex()

    if sex == 0 then
        for _, looktype in pairs(femaleOutfits) do
            if player:hasOutfit(looktype, 3) then
                Outfits = Outfits + 1
            end
        end
    else
        for _, looktype in pairs(maleOutfits) do
            if player:hasOutfit(looktype, 3) then
                Outfits = Outfits + 1
            end
        end
    end

    local Monturas = 0
    for i = 1, 197 do
        if player:hasMount(i) then
            Monturas = Monturas + 1
        end
    end

    local Total = Outfits + Monturas

    local storageAmount = 5 * math.floor(Total / 5)
    storageAmount = storageAmount > 285 and 285 or storageAmount
    local cantidad = math.floor(Total / 5)
    local tabla = storageAmount / cantidad
    local i = 0
    local x = player:getStorageValue(11111)
    local buff = buffs[tabla]

    local hp = 0
    local mp = 0

    if buff then
        if buff.critical then
            local crit = buff.critical * cantidad
            player:addCondition(CONDITION_PARAM_SKILL_CRITICAL_HIT_DAMAGE, crit)
        end
        if buff.lifeleech then
            local life = buff.lifeleech * cantidad
            player:addCondition(CONDITION_PARAM_SKILL_LIFE_LEECH_AMOUNT, life)
        end
        if buff.manaleech then
            local manas = buff.manaleech * cantidad
            player:addCondition(CONDITION_PARAM_SKILL_MANA_LEECH_AMOUNT, manas)
        end
        if buff.lootbonus then
            player:setStorageValue(21111, (buff.lootbonus * cantidad) * 1.75)
        end
        if buff.expbonus then
            player:setStorageValue(21112, (buff.expbonus * cantidad) * 1.75)
        end
        if buff.health then
            local hpPercent = buff.health * cantidad
            hpPercent = cantidad / player:getMaxHealth()
            hpPercent = 1 + hpPercent
            hp = player:getMaxHealth() * hpPercent
        end
        if buff.mana then
            local mpPercent = buff.mana * cantidad
            mpPercent = cantidad / player:getMaxMana()
            mpPercent = 1 + mpPercent
            mp = player:getMaxMana() * mpPercent
        end
        if mp > 0 or hp > 0 then
            local maxHpMaxMp = Condition(CONDITION_ATTRIBUTES)
            maxHpMaxMp:setParameter(CONDITION_PARAM_TICKS, -1)
            if mp > 0 then
                maxHpMaxMp:setParameter(CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, mp)
            end
            if hp > 0 then
                maxHpMaxMp:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, hp)
            end
            player:addCondition(maxHpMaxMp)
        end
    end
    return true
end

BONUSES:register()
 
Back
Top