Verrine
Member
- Joined
- Mar 2, 2016
- Messages
- 117
- Reaction score
- 7
Hi!
I found here verry nice script for tfs 1.1 but it dont work on 1.2
Here is the script : https://otland.net/threads/tfs-1-1-items-upgrading-by-jewels.228712/
I've copied to global.lua everything and did item but when i try to use it i get this error in console:
i think there is a problem in global.lua in here:
but i rly dont know whats going wrong here. If here is someone who know whats happen please let me know how to fix it. Im new in lua and tfs so many maybe simple errors giving me a lot of troubles ;/ Thanks.
EDIT:
Okay i changed getitemattribute to Item(item.uid) and there is another error:
upgrading lua:
just let me know how can i get Weapon Type in new tfs 1.2 couse from 1.0 to 1.1 it was GetWeaponType() and now... ?
I found here verry nice script for tfs 1.1 but it dont work on 1.2
Here is the script : https://otland.net/threads/tfs-1-1-items-upgrading-by-jewels.228712/
I've copied to global.lua everything and did item but when i try to use it i get this error in console:
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/upgrading.lua:onUse
data/global.lua:123: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/global.lua:123: in function 'getItemAttribute'
data/actions/scripts/upgrading.lua:52: in function <data/actions/scripts/upgrading.lua:50>
i think there is a problem in global.lua in here:
Code:
function getItemAttribute(uid, key)
local i = ItemType(Item(uid):getId())
local string_attributes = {
[ITEM_ATTRIBUTE_NAME] = i:getName(),
[ITEM_ATTRIBUTE_ARTICLE] = i:getArticle(),
[ITEM_ATTRIBUTE_PLURALNAME] = i:getPluralName(),
["name"] = i:getName(),
["article"] = i:getArticle(),
["pluralname"] = i:getPluralName()
}
but i rly dont know whats going wrong here. If here is someone who know whats happen please let me know how to fix it. Im new in lua and tfs so many maybe simple errors giving me a lot of troubles ;/ Thanks.
EDIT:
Okay i changed getitemattribute to Item(item.uid) and there is another error:
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/upgrading.lua:onUse
data/actions/scripts/upgrading.lua:52: attempt to call method 'getWeaponType' (a nil value)
stack traceback:
[C]: in function 'getWeaponType'
data/actions/scripts/upgrading.lua:52: in function <data/actions/scripts/upgrading.lua:50>
Code:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
local it = Item(item.uid)
if((it:getWeaponType(item.uid) > 0 or getItemAttribute(itemEx.uid, ITEM_ATTRIBUTE_ARMOR) > 0) and not isItemStackable(itemEx.itemid))then
local level = upgrading.getLevel(itemEx.uid)
if(level < #conf["level"])then
local nLevel = (conf["level"][(level+1)].successPercent >= math.random(1,100)) and (level+1) or conf["level"][level].downgradeLevel
if(nLevel > level)then
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Upgrade to level " .. nLevel .. " successful!")
else
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Upgrade failed. Your " .. it:getName() .. " is now on level " .. nLevel .. "")
end
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_NAME, it:getName()..((nLevel>0) and "+"..nLevel or ""))
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_ATTACK, upgrading.upValue(it:getAttack(), nLevel, conf["upgrade"].attack))
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_DEFENSE, upgrading.upValue(it:getDefense(), nLevel, conf["upgrade"].defense))
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_EXTRADEFENSE, upgrading.upValue(it:getExtraDefense(), nLevel, conf["upgrade"].extraDefense))
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_ARMOR, upgrading.upValue(it:getArmor(), nLevel, conf["upgrade"].armor))
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_HITCHANCE, upgrading.upValue(it:getHitChance(), nLevel, conf["upgrade"].hitChance))
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your " .. it:getName() .. " is on max level alredy.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot upgrade this item.")
end
end
just let me know how can i get Weapon Type in new tfs 1.2 couse from 1.0 to 1.1 it was GetWeaponType() and now... ?
Last edited: