exanime
I´m learning Lua
I did this code, nevertheless this mistake gives me, not that parameter to put in the line 13 or in the function slott:getActionId ()???
It helps please
my script TFS 1.3
I get this error
It helps please
my script TFS 1.3
Lua:
local ids = {
{thing = "Legendary", chance = 2, itemID = 2475, actionID = 45115, armor = 3, speed = 10, extradefense = 3}, --2%
{thing = "Bound", chance = 15, itemID = 2475, actionID = 45114, armor = 3, speed = 10, extradefense = 3}, --13%
{thing = "Normal", chance = 100, itemID = 2475, actionID = 45113, armor = 3, speed = 10, extradefense = 3} --85%
}
--player:getSlotItem(CONST_SLOT_HEAD)
--item:getActionId()
---------------------------------------------------------------------------
---------------------------------------------------------------------------
function onEquip(player, item, slot)
for _, t in ipairs(ids) do
local slott = player:getSlotItem(CONST_SLOT_HEAD)
local slot_actionid = slott:getActionId()
if t.actionID == slot_actionid then --compare actionID with actionID on head slot
item:setAttribute(ITEM_ATTRIBUTE_EXTRADEFENSE, t.extradefense)
item:setAttribute(ITEM_ATTRIBUTE_ARMOR, t.armor)
local speedCondition = player:setParameter(CONDITION_PARAM_SPEED, t.speed)
player:addCondition(speedCondition)
item:setAttribute("description", "+ ".. t.armor .." Armor")
item:setAttribute("description", "+ ".. t.speed .." Speed")
item:setAttribute("description", "+ ".. t.extradefense .." Extradefense")
end --end if
end --end for
return true --return value
end -- end function
---------------------------------------------------------------------------
--///////////////////////////////////////////////////////////////////////--
---------------------------------------------------------------------------
function onDeEquip(player, item, slot)
for _, t in ipairs(ids) do
local slott = player:getSlotItem(CONST_SLOT_HEAD)
local slot_actionid = slott:getActionId()
if t.actionID == slot_actionid then
item:setAttribute(ITEM_ATTRIBUTE_EXTRADEFENSE, t.extradefense * 0)
item:setAttribute(ITEM_ATTRIBUTE_ARMOR, t.armor * 0)
local speedCondition = player:setParameter(CONDITION_PARAM_SPEED, t.speed * 0)
player:addCondition(speedCondition)
item:removeAttribute("description", "+ ".. t.armor .." Armor")
item:removeAttribute("description", "+ ".. t.speed .." Speed")
item:removeAttribute("description", "+ ".. t.extradefense .." Extradefense")
end --end if
end --end for
return true --return value
end--end function
---------------------------------------------------------------------------
---------------------------------------------------------------------------
I get this error
Last edited by a moderator: