TFS 1.0
Right now I'm trying to edit equipment set 3, as you can see, to set attribute rare1, and I have it calling the setAttributes method(To set rare1's attributes) before it adds the conditions, why doesn't this work? and how could I make it work?
Code:
local shield2 = Condition(CONDITION_ATTRIBUTES)
shield2:setTicks(-1)
shield2:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
shield2:setParameter(CONDITION_PARAM_SUBID, 13)
shield2:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
local rare1 = Condition(CONDITION_ATTRIBUTES)
rare1:setTicks(-1)
rare1:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
rare1:setParameter(CONDITION_PARAM_SUBID, 13)
function setAttributes(cid)
local skill = none
if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 2 then
rare1:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
rare1:setParameter(CONDITION_PARAM_SUBID, 13)
rare1:setParameter(CONDITION_PARAM_SKILL_MAGIC, 5)
elseif getPlayerVocation(cid) == 3 then
rare1:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
rare1:setParameter(CONDITION_PARAM_SUBID, 13)
rare1:setParameter(CONDITION_PARAM_SKILL_CLUB, 5)
elseif getPlayerVocation(cid) == 4 then
rare1:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
rare1:setParameter(CONDITION_PARAM_SUBID, 13)
rare1:setParameter(CONDITION_PARAM_SKILL_AXE, 5)
elseif getPlayerVocation(cid) == 5 then
rare1:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
rare1:setParameter(CONDITION_PARAM_SUBID, 13)
rare1:setParameter(CONDITION_PARAM_SKILL_SWORD, 5)
print("reached")
elseif getPlayerVocation(cid) == 6 then
rare1:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
rare1:setParameter(CONDITION_PARAM_SUBID, 13)
rare1:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
end
return skill
end
local itemsmod = {
---------------
[1] = {
[1] = {}, --- Helmet
[2] = {2136}, --- Amulet
[3] = {}, --- Backpack
[4] = {2476}, --- Armor
[5] = {}, --- Right
[6] = {}, --- Left
[7] = {2477}, --- Legs
[8] = {}, --- Feet
[9] = {}, --- Ring
[10] = {}, --- Ammo
[11] = {16750}, --- Put a unique storage value here
[12] = {
[1] = {text = "Set 2 Equipped"}, --- Equip Text 1
[2] = {}, --- Equip Text 2
[3] = {text = "Item 1 Equipped"} --- Equip Text 3
},
[13] = {
[1] = {enable = true}, --- Enable All items bonus
[2] = {enable = true}, --- Enable All-1 setitems bonus
[3] = {enable = true}}, --- Enable All-2 setitems bonus
[14] = {
[1] = {condition = shield2, typ = CONDITION_ATTRIBUTES, sub = 13},
[2] = {maxHealth = 50, maxMana = 50},
[3] = {itemStorageAddNumber = {45003, 5}}
},
},
[2] = {
[1] = {}, --- Helmet
[2] = {}, --- Amulet
[3] = {}, --- Backpack
[4] = {}, --- Armor
[5] = {2376}, --- Right
[6] = {2525}, --- Left
[7] = {}, --- Legs
[8] = {}, --- Feet
[9] = {}, --- Ring
[10] = {}, --- Ammo
[11] = {16752}, --- Put a unique storage value here
[12] = {
[1] = {text = "Set 2 Equipped"}, --- Equip Text 1
[2] = {}, --- Equip Text 2
[3] = {text = "Item 1 Equipped"} --- Equip Text 3
},
[13] = {
[1] = {enable = true}, --- Enable All items bonus
[2] = {enable = false}, --- Enable All-1 items bonus
[3] = {enable = false}}, --- Enable All-1 items bonus
[14] = {
[1] = {maxHealth = 50, maxMana = 50},
[2] = {},
[3] = {}
},
},
[3] = {
[1] = {}, --- Helmet
[2] = {}, --- Amulet
[3] = {}, --- Backpack
[4] = {}, --- Armor
[5] = {2537}, --- Right
[6] = {}, --- Left
[7] = {}, --- Legs
[8] = {}, --- Feet
[9] = {}, --- Ring
[10] = {}, --- Ammo
[11] = {16753}, --- Put a unique storage value here
[12] = {
[1] = {text = "Rare Shield Equipped"}, --- Equip Text 1
[2] = {}, --- Equip Text 2
[3] = {text = "Item 1 Equipped"} --- Equip Text 3
},
[13] = {
[1] = {enable = true}, --- Enable All items bonus
[2] = {enable = true}, --- Enable All-1 items bonus
[3] = {enable = true}}, --- Enable All-1 items bonus
[14] = {
[1] = {condition = rare1, typ = CONDITION_ATTRIBUTES, sub = 13},
[2] = {maxHealth = 500, maxMana = 0},
[3] = {itemStorageAddNumber = {45002, 6}}
},
}
--------------
}
local shield2 = Condition(CONDITION_ATTRIBUTES)
shield2:setTicks(-1)
shield2:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
shield2:setParameter(CONDITION_PARAM_SUBID, 13)
shield2:setParameter(CONDITION_PARAM_SKILL_SHIELD, 5)
function onEquip(cid, item, slot)
local player = Player(cid)
for i = 1,#itemsmod do
local fullset = {}
local counter = 0
-----------------------------
if getPlayerSlotItem(cid, 5).itemid == itemsmod[i][5][1] or getPlayerSlotItem(cid, 6).itemid == itemsmod[i][5][1] then
counter = counter + 1
end
if getPlayerSlotItem(cid, 5).itemid == itemsmod[i][6][1] or getPlayerSlotItem(cid, 6).itemid == itemsmod[i][6][1] then
counter = counter + 1
end
for var, item in pairs(itemsmod[i]) do
-----------------------------
if var <= 10 then
if item[1] ~= nil then
table.insert(fullset, 1)
if not(getPlayerSlotItem(cid, 5).itemid == item[1] or getPlayerSlotItem(cid, 6).itemid == item[1]) then
if getPlayerSlotItem(cid, var).itemid == item[1] then
counter = counter + 1
end
end
end
end
end
-----------------------------
if itemsmod[i][13][3].enable == true then
if getPlayerStorageValue(cid, itemsmod[i][11][1]) < 1 then
if (counter) >= table.getn(fullset) - 2 then
setPlayerStorageValue(cid, itemsmod[i][11][1], 1)
if (itemsmod[i][14][3]).maxHealth ~= nil then
player:setMaxHealth(player:getMaxHealth() + (itemsmod[i][14][3]).maxHealth)
player:addHealth((itemsmod[i][14][3]).maxHealth)
end
if (itemsmod[i][14][3]).maxMana ~= nil then
player:setMaxMana(player:getMaxMana() + (itemsmod[i][14][3]).maxMana)
player:addMana((itemsmod[i][14][3]).maxMana)
end
if (itemsmod[i][14][3]).condition ~= nil then
setAttributes(cid)
player:addCondition(itemsmod[i][14][3].condition)
end
if (itemsmod[i][14][3]).itemStorageAddNumber ~= nil then
player:setStorageValue(itemsmod[i][14][3].itemStorageAddNumber[1], player:getStorageValue(itemsmod[i][14][3].itemStorageAddNumber[1]) + itemsmod[i][14][3].itemStorageAddNumber[2])
end
if (itemsmod[i][12][3].text) ~= nil then
player:sendTextMessage(MESSAGE_INFO_DESCR, "" ..itemsmod[i][12][3].text.. "")
end
end
end
end
if itemsmod[i][13][2].enable == true then
if getPlayerStorageValue(cid, itemsmod[i][11][1]) < 2 then
if (counter) >= table.getn(fullset) - 1 then
setPlayerStorageValue(cid, itemsmod[i][11][1], 2)
if (itemsmod[i][14][2]).maxHealth ~= nil then
player:setMaxHealth(player:getMaxHealth() + (itemsmod[i][14][2]).maxHealth)
player:addHealth((itemsmod[i][14][2]).maxHealth)
end
if (itemsmod[i][14][2]).maxMana ~= nil then
player:setMaxMana(player:getMaxMana() + (itemsmod[i][14][2]).maxMana)
player:addMana((itemsmod[i][14][2]).maxMana)
end
if (itemsmod[i][14][2]).condition ~= nil then
setAttributes(cid)
player:addCondition(itemsmod[i][14][2].condition)
end
if (itemsmod[i][14][2]).itemStorageAddNumber ~= nil then
player:setStorageValue(itemsmod[i][14][2].itemStorageAddNumber[1], player:getStorageValue(itemsmod[i][14][2].itemStorageAddNumber[1]) + itemsmod[i][14][2].itemStorageAddNumber[2])
end
if (itemsmod[i][12][2].text) ~= nil then
player:sendTextMessage(MESSAGE_INFO_DESCR, "" ..itemsmod[i][12][2].text.. "")
end
end
end
end
if itemsmod[i][13][1].enable == true then
if getPlayerStorageValue(cid, itemsmod[i][11][1]) < 3 then
if (counter) == table.getn(fullset) then
setPlayerStorageValue(cid, itemsmod[i][11][1], 3)
if (itemsmod[i][14][1]).maxHealth ~= nil then
player:setMaxHealth(player:getMaxHealth() + (itemsmod[i][14][1]).maxHealth)
player:addHealth((itemsmod[i][14][1]).maxHealth)
end
if (itemsmod[i][14][1]).maxMana ~= nil then
player:setMaxMana(player:getMaxMana() + (itemsmod[i][14][1]).maxMana)
player:addMana((itemsmod[i][14][1]).maxMana)
end
if (itemsmod[i][14][1]).condition ~= nil then
setAttributes(cid)
player:addCondition(itemsmod[i][14][1].condition)
end
if (itemsmod[i][14][1]).itemStorageAddNumber ~= nil then
player:setStorageValue(itemsmod[i][14][1].itemStorageAddNumber[1], player:getStorageValue(itemsmod[i][14][1].itemStorageAddNumber[1]) + itemsmod[i][14][1].itemStorageAddNumber[2])
end
if (itemsmod[i][12][1].text) ~= nil then
player:sendTextMessage(MESSAGE_INFO_DESCR, "" ..itemsmod[i][12][1].text.. "")
end
end
end
end
counter = 0
end
return true
end
function onDeEquip(cid, item, slot)
REMOVED SO IT CAN FIT
end
Right now I'm trying to edit equipment set 3, as you can see, to set attribute rare1, and I have it calling the setAttributes method(To set rare1's attributes) before it adds the conditions, why doesn't this work? and how could I make it work?
Last edited: