potinho
Advanced OT User
I would like a script (action) that, when I use the item, the skill rate (skills axe, sword, club, distance, shield, fist and magic level) would be "x" times faster for "x" time. can you help me?
local config = {
removeOnUse = true,
time = 1, -- minutes
storage = 26
}
config.boostItem = {
[itemID] = {
[SKILL__LEVEL] = 5,
[SKILL_AXE] = 10,
[SKILL_SWORD] = 50
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local val = config.boostItem[item.itemid]
if not val then return true end
if getCreatureStorage(cid, config.storage) - os.time() >= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You must wait for using this item.")
return true
end
if config.removeOnUse then
doRemoveItem(item.uid, 1)
end
for key, value in pairs(val) do
doPlayerSetRate(cid, key, value)
end
addEvent(function()
if isPlayer(cid) then
for key, value in pairs(val) do
doPlayerSetRate(cid, key, 1) -- set rates x1
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your boost time has over.")
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
end
end, config.time * 60 * 1000)
doCreatureSetStorage(cid, config.storage, os.time() + (config.time * 60))
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You\'ve been boosted.")
doCreatureSay(cid, "BOOST!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getThingPosition(cid), CONST_ME_STUN)
return true
end
if getCreatureStorage(cid, STORAGE) - os.time() >= 0 then
doCreatureSetStorage(cid, STORAGE, -1)
end
Sorry for be a newbie, but how this script works? What i need to change? I guess rates and skills, but i dont know to do it right.Lua:local config = { removeOnUse = true, time = 1, -- minutes storage = 26 } config.boostItem = { [itemID] = { [SKILL__LEVEL] = 5, [SKILL_AXE] = 10, [SKILL_SWORD] = 50 } } function onUse(cid, item, fromPosition, itemEx, toPosition) local val = config.boostItem[item.itemid] if not val then return true end if getCreatureStorage(cid, config.storage) - os.time() >= 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You must wait for using this item.") return true end if config.removeOnUse then doRemoveItem(item.uid, 1) end for key, value in pairs(val) do doPlayerSetRate(cid, key, value) end addEvent(function() if isPlayer(cid) then for key, value in pairs(val) do doPlayerSetRate(cid, key, 1) -- set rates x1 end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your boost time has over.") doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF) end end, config.time * 60 * 1000) doCreatureSetStorage(cid, config.storage, os.time() + (config.time * 60)) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You\'ve been boosted.") doCreatureSay(cid, "BOOST!", TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPosition(cid), CONST_ME_STUN) return true end
login.lua
Lua:if getCreatureStorage(cid, STORAGE) - os.time() >= 0 then doCreatureSetStorage(cid, STORAGE, -1) end
Just set the skill id and a new rate.Sorry for be a newbie, but how this script works? What i need to change? I guess rates and skills, but i dont know to do it right.
config.boostItem = {
[itemID] = {
[SKILL_ID] = newRate,
[SKILL_ID] = newRate
}
}
Its Possible to add hp or mana instead of skills?Just set the skill id and a new rate.
Lua:config.boostItem = { [itemID] = { [SKILL_ID] = newRate, [SKILL_ID] = newRate } }