Dug up an old Set Bonus script and tried to make it work on a the TFS 1.0 (For client 10.21)
But getting some errors.
Here's the error
And here is the script
But getting some errors.
Here's the error
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/set system.lua:onEquip
data/movements/scripts/set system.lua:78: attempt to call global 'setCreatureMax
Health' (a nil value)
stack traceback:
[C]: in function 'setCreatureMaxHealth'
data/movements/scripts/set system.lua:78: in function <data/movements/sc
ripts/set system.lua:71>
And here is the script
Code:
--Set System by Strack
local sets = {
--descripcion, helmet, body, legs, boots
[1] = {'Lava Set', 7900, 7899, 7894, 7891},
[2] = {'Ice Set', 7902, 7897, 7896, 7892},
[3] = {'Energy Set', 7901, 7898, 7895, 7893},
[4] = {'Tera Set', 7903, 7884, 7885, 7886}
}
local speed1 = createConditionObject(CONDITION_HASTE)
setConditionParam(speed1, CONDITION_PARAM_TICKS, -1)
setConditionParam(speed1, CONDITION_PARAM_SPEED, 10)
local speed2 = createConditionObject(CONDITION_HASTE)
setConditionParam(speed1, CONDITION_PARAM_TICKS, -1)
setConditionParam(speed1, CONDITION_PARAM_SPEED, 20)
local shield1 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(shield1, CONDITION_PARAM_TICKS, -1)
setConditionParam(shield1, CONDITION_PARAM_SKILL_SHIELD, 2)
local shield2 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(shield2, CONDITION_PARAM_TICKS, -1)
setConditionParam(shield2, CONDITION_PARAM_SKILL_SHIELD, 5)
--getPlayerSlotItem(cid, 1) --helmet
--getPlayerSlotItem(cid, 4) --armor
--getPlayerSlotItem(cid, 7) --legs
--getPlayerSlotItem(cid, 8) --boots
setBonus = { --- [] = {condition = , maxHealth = , maxMana = }
[1] = {maxHealth = 200, maxMana = 200, condition = speed1, typ = CONDITION_HASTE}, --Lava Set
[2] = {maxMana = 350, maxHealth = 100, condition = shield1}, --Ice Set
[3] = {maxMana = 200, maxHealth = 100, condition = speed2, typ = CONDITION_HASTE}, --Energy Set
[4] = {maxHealth = 300, condition = shield2} --Terra Set
}
local storage = 17181
function onDeEquip(cid, item, slot)
for i=1, #sets do
if getPlayerStorageValue(cid, storage) > 0 then
if (slot == 1 and getPlayerSlotItem(cid, 4).itemid == sets[3] and getPlayerSlotItem(cid, 7).itemid == sets[4] and getPlayerSlotItem(cid, 8).itemid == sets[5])
or (slot == 4 and getPlayerSlotItem(cid, 1).itemid == sets[2] and getPlayerSlotItem(cid, 7).itemid == sets[4] and getPlayerSlotItem(cid, 8).itemid == sets[5])
or (slot == 7 and getPlayerSlotItem(cid, 1).itemid == sets[2] and getPlayerSlotItem(cid, 4).itemid == sets[3] and getPlayerSlotItem(cid, 8).itemid == sets[5])
or (slot == 8 and getPlayerSlotItem(cid, 1).itemid == sets[2] and getPlayerSlotItem(cid, 4).itemid == sets[3] and getPlayerSlotItem(cid, 7).itemid == sets[4]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, sets[1].." effects off.")
if (setBonus).maxHealth ~= nil then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) -(setBonus).maxHealth)
doCreatureAddHealth(cid, -(setBonus).maxHealth)
doRemoveCondition(cid, CONDITION_INFIGHT)
end
if (setBonus).maxMana ~= nil then
setCreatureMaxMana(cid, getCreatureMaxMana(cid) -(setBonus).maxMana)
doCreatureAddMana(cid, -(setBonus).maxMana)
doRemoveCondition(cid, CONDITION_INFIGHT)
end
if (setBonus).condition ~= nil then
doRemoveCondition(cid, (setBonus[i]).condition)
end
setPlayerStorageValue(cid,storage,0)
end
end
end
return true
end
function onEquip(cid, item, slot)
for i=1, #sets do
if getPlayerStorageValue(cid, storage) < 1 then
if getPlayerSlotItem(cid, 1).itemid == sets[i][2] and getPlayerSlotItem(cid, 4).itemid == sets[i][3] and getPlayerSlotItem(cid, 7).itemid == sets[i][4] and getPlayerSlotItem(cid, 8).itemid == sets[i][5] then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, sets[i][1].." effects on.")
if (setBonus[i]).maxHealth ~= nil then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) +(setBonus[i]).maxHealth)
doCreatureAddHealth(cid, (setBonus[i]).maxHealth)
end
if (setBonus[i]).maxMana ~= nil then
setCreatureMaxMana(cid, getCreatureMaxMana(cid) +(setBonus[i]).maxMana)
doCreatureAddMana(cid, (setBonus[i]).maxMana)
end
if (setBonus[i]).condition ~= nil then
doAddCondition(cid, (setBonus[i]).condition)
end
setPlayerStorageValue(cid,storage,1)
end
end
end
return true
end