Mateus Robeerto
Excellent OT User
I would like to know if it is possible to implement the functionality of gaining attributes when using specific items and having them disappear when unequipped. I am unsure if I need to use onMoveItem. I have some doubts about how to do this. Thank you very much for your attention.
I took Levi's script and adapted it to show the appearance of the item and keep the description permanent...
The Oen upgrade system for TFS 1.3/1.4 is really pleasing me. However, his script is quite extensive. I can't remove some parts I don't want. I would like to have separate scripts for each specific item, including common, rare, epic and legendary.
See the image, that's why I'm doing specific upgrades for common and rare items, epics, etc., separating the stones, etc. It's just that, something simple... Can anyone help me?
I took Levi's script and adapted it to show the appearance of the item and keep the description permanent...
Lua:
local config = {
itemUse = 8301,
itemTarget = 2400,
effect = CONST_ME_MAGIC_RED,
removeItem = false,
}
local action = Action()
function action.onUse(player, item, fromPos, target, toPos, isHotkey)
if target.itemid == config.itemTarget then
if config.removeItem then
item:remove()
end
local skillType
local skillAmount
local skillDescription
local randomNumber = math.random(0, 100)
if randomNumber <= 10 then
skillAmount = math.random(0, 10)
elseif randomNumber <= 40 then
skillAmount = math.random(11, 40)
elseif randomNumber <= 70 then
skillAmount = math.random(41, 70)
else
skillAmount = math.random(71, 100)
end
local randomSkill = math.random(1, 4)
if randomSkill == 1 then
skillType = CONDITION_PARAM_SKILL_SWORD
skillDescription = "Sword"
elseif randomSkill == 2 then
skillType = CONDITION_PARAM_SKILL_AXE
skillDescription = "Axe"
elseif randomSkill == 3 then
skillType = CONDITION_PARAM_SKILL_CLUB
skillDescription = "Club"
else
skillType = CONDITION_PARAM_SKILL_FIST
skillDescription = "Fist"
end
local description = skillDescription .. " +" .. skillAmount .. " Skill."
target:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, description)
player:sendTextMessage(MESSAGE_INFO_DESCR, description)
local skill = Condition(CONDITION_ATTRIBUTES)
skill:setParameter(skillType, skillAmount)
player:addCondition(skill)
player:getPosition():sendMagicEffect(config.effect)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Buff activated.')
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You can only use this on a specific weapon.')
end
return true
end
action:id(config.itemUse)
action:register()
The Oen upgrade system for TFS 1.3/1.4 is really pleasing me. However, his script is quite extensive. I can't remove some parts I don't want. I would like to have separate scripts for each specific item, including common, rare, epic and legendary.
See the image, that's why I'm doing specific upgrades for common and rare items, epics, etc., separating the stones, etc. It's just that, something simple... Can anyone help me?
Last edited: