Postado Setembro 1, 2017 7 anos Editou as posições, os corpos? Colocou corretamente no spells.xml? Testei aqui agora e tá correto. Editado Setembro 1, 2017 7 anos por Dwarfer (veja o histórico de edições) Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Setembro 1, 2017 7 anos Autor Spoiler local t = { hp_pc = 15, -- % de hp para usar timetoback = {3, "sec"}, -- tempo para voltar cooldown_used = {5, "sec"}, -- cooldown ao usar o item cooldown_maxused = {3, "hour"}, -- quando usar max_coracoes vezes o cooldown aumenta para esse timetocooldown_maxused = {1, "day"}, -- tempo que ficará o cooldown aumentado max_coracoes = 6, new_pos = {x=1008,y=910,z=6}, -- posição para onde será teleportado corpses = { [1] = 1111, -- id do corpo [2] = 2222, [3] = 3333, [4] = 4444} } -- só modifique se necessário local stors = {hearts = 16772, cooldown = 16773, daily_cooldown = 16774} function onUse(cid, item, fromPosition, itemEx, toPosition) local p, v = getPlayerPosition(cid), t.corpses[getPlayerVocation(cid)] local current_hp, max = getCreatureHealth(cid), getCreatureMaxHealth(cid) if not v then return true end if getPlayerStorageValue(cid, stors.cooldown) - os.time() > 0 then daily = getPlayerStorageValue(cid, stors.daily_cooldown) - os.time() rest_time = getPlayerStorageValue(cid, stors.cooldown) - os.time() cooldown = daily > 0 and math.ceil(rest_time/3600) .. " hours" or rest_time .. " seconds" doPlayerSendCancel(cid, "You must wait " .. cooldown .. " to use again.") doSendMagicEffect(p, CONST_ME_POFF) return true end if current_hp >= (t.hp_pc/100)*max then doPlayerSendCancel(cid, "Your health must be " .. t.hp_pc .. "% or less to use.") doSendMagicEffect(p, CONST_ME_POFF) return true end if getPlayerStorageValue(cid, stors.hearts) == -1 then setPlayerStorageValue(cid, stors.hearts, 6) end local current_hearts = getPlayerStorageValue(cid, stors.hearts) setPlayerStorageValue(cid, stors.hearts, current_hearts - 1) current_hearts = getPlayerStorageValue(cid, stors.hearts) local type = (current_hearts > 0.5*(t.max_coracoes) and MESSAGE_INFO_DESCR or MESSAGE_STATUS_WARNING) doPlayerSendTextMessage(cid, type, "Corações: [" ..current_hearts .. "/" .. t.max_coracoes .. "]") doTeleportThing(cid, t.new_pos) doSendMagicEffect(t.new_pos, CONST_ME_TELEPORT) if current_hearts == 0 then setPlayerStorageValue(cid, stors.daily_cooldown, mathtime(t.timetocooldown_maxused) + os.time()) setPlayerStorageValue(cid, stors.cooldown, mathtime(t.cooldown_maxused) + os.time()) setPlayerStorageValue(cid, stors.hearts, 6) else setPlayerStorageValue(cid, stors.cooldown, mathtime(t.cooldown_used) + os.time()) if getPlayerStorageValue(cid, stors.daily_cooldown) ~= -1 then setPlayerStorageValue(cid, stors.daily_cooldown, -1) end end doCreateItem(v, 1, t.new_pos) addEvent(function() if isPlayer(cid) then doCleanTile(t.new_pos) doCreatureAddHealth(cid, max-current_hp) doTeleportThing(cid, p) doSendMagicEffect(p, CONST_ME_TELEPORT) end end, mathtime(t.timetoback)*1000) return true end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == "day" and 2 or i-1))*(v == "day" and 24 or 1) end end return "Error: Bad declaration in mathtime function." end Spoiler local t = { hp_pc = 15, -- % de hp para usar timetoback = {3, "sec"}, -- tempo para voltar cooldown_used = {5, "sec"}, -- cooldown ao usar o item cooldown_maxused = {3, "hour"}, -- quando usar max_coracoes vezes o cooldown aumenta para esse timetocooldown_maxused = {1, "day"}, -- tempo que ficará o cooldown aumentado max_coracoes = 6, new_pos = {x=1008,y=910,z=6}, -- posição para onde será teleportado corpses = { [1] = 1111, -- id do corpo [2] = 2222, [3] = 3333, [4] = 4444} } -- só modifique se necessário local stors = {hearts = 16772, cooldown = 16773, daily_cooldown = 16774} function onCastSpell(cid, var) local p, v = getPlayerPosition(cid), t.corpses[getPlayerVocation(cid)] local current_hp, max = getCreatureHealth(cid), getCreatureMaxHealth(cid) if not v then return true end if getPlayerStorageValue(cid, stors.cooldown) - os.time() > 0 then daily = getPlayerStorageValue(cid, stors.daily_cooldown) - os.time() rest_time = getPlayerStorageValue(cid, stors.cooldown) - os.time() cooldown = daily > 0 and math.ceil(rest_time/3600) .. " hours" or rest_time .. " seconds" doPlayerSendCancel(cid, "You must wait " .. cooldown .. " to use again.") doSendMagicEffect(p, CONST_ME_POFF) return true end if current_hp >= (t.hp_pc/100)*max then doPlayerSendCancel(cid, "Your health must be " .. t.hp_pc .. "% or less to use.") doSendMagicEffect(p, CONST_ME_POFF) return true end if getPlayerStorageValue(cid, stors.hearts) == -1 then setPlayerStorageValue(cid, stors.hearts, 6) end local current_hearts = getPlayerStorageValue(cid, stors.hearts) setPlayerStorageValue(cid, stors.hearts, current_hearts - 1) current_hearts = getPlayerStorageValue(cid, stors.hearts) local type = (current_hearts > 0.5*(t.max_coracoes) and MESSAGE_INFO_DESCR or MESSAGE_STATUS_WARNING) doPlayerSendTextMessage(cid, type, "Corações: [" ..current_hearts .. "/" .. t.max_coracoes .. "]") doTeleportThing(cid, t.new_pos) doSendMagicEffect(t.new_pos, CONST_ME_TELEPORT) if current_hearts == 0 then setPlayerStorageValue(cid, stors.daily_cooldown, mathtime(t.timetocooldown_maxused) + os.time()) setPlayerStorageValue(cid, stors.cooldown, mathtime(t.cooldown_maxused) + os.time()) setPlayerStorageValue(cid, stors.hearts, 6) else setPlayerStorageValue(cid, stors.cooldown, mathtime(t.cooldown_used) + os.time()) if getPlayerStorageValue(cid, stors.daily_cooldown) ~= -1 then setPlayerStorageValue(cid, stors.daily_cooldown, -1) end end doCreateItem(v, 1, t.new_pos) addEvent(function() if isPlayer(cid) then doCleanTile(t.new_pos) doCreatureAddHealth(cid, max-current_hp) doTeleportThing(cid, p) doSendMagicEffect(p, CONST_ME_TELEPORT) end end, mathtime(t.timetoback)*1000) return true end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == "day" and 2 or i-1))*(v == "day" and 24 or 1) end end return "Error: Bad declaration in mathtime function." end 1 ta no action 2 no spells Tag <instant name="bacu dois" words="bacu dois" lvl="75" mana="3900" aggressive="1" range="5" blockwalls="1" selftarget="1" exhaustion="800" needlearn="0" event="script" value="coraco.lua"> <vocation id="1-15"/> </instant> Tag <action itemid="5943" script="coracotp.lua" /> O rei de seu proprio destino é aquele que luta pela gloria do amanhã! Discord : ZoR#9373
Postado Setembro 1, 2017 7 anos Solução Se configurou os nomes dos arquivos corretamente, vai funcionar. Edite os corpses também, ali eu escrevi qualquer coisa. Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Setembro 1, 2017 7 anos Autor 47 minutos atrás, Dwarfer disse: Editou as posições, os corpos? Colocou corretamente no spells.xml? Testei aqui agora e tá correto. o corpse esta aparecendo em outro lugar O rei de seu proprio destino é aquele que luta pela gloria do amanhã! Discord : ZoR#9373
Postado Setembro 1, 2017 7 anos Como assim, amigo? O corpo vai aparecer nessa posição: new_pos = {x=1008,y=910,z=6} Contato: Email: [email protected] Discord: Dwarfer#2715
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.