Seção incorreta, movido~
Mais atenção da próxima vez.
Por roriscrave, 26 de jul. de 2012 em Scripts
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

Seção incorreta, movido~
Mais atenção da próxima vez.
info
Grupo: Visconde
Registrado: 19/07/12
Posts: 395
Reputação: +36
Char no Tibia: Billy Poul

[Data/spells/scripts/attack]
Copie e cole qualquer arquivo .lua e renomeie-o para lover.
Abra-o, apague tudo que tem lá e cole isso:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1498)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -9.9, -99, -9.9, 6)
local arr = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Agora salve e feche, e em spells.xml cole isto:
<instant name="Lover" words="loving" lvl="0" mana="0" direction="1" exhaustion="1200" needlearn="0" script="attack/lover.lua"> <vocation name="Knight" /> <vocation name="Elite Knight" /> </instant>
tentai
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

Deu não cara, a magia não está com delay de 15sec.
info
Grupo: Conde
Registrado: 30/06/11
Posts: 631
Reputação: +371
Char no Tibia: Warrior of Mort

-- Trap
local config = {
exhaustionSeconds = 15, -- exausted em segundos
storageUse = 34538 -- storage usado.
}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 10)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 2711)
local arr = {
{ 0, 0, 0, 0, 0, 0, },
{ 0, 0, 0, 0, 0, 0, },
{ 0, 0, 1, 1, 1, 0, },
{ 0, 0, 1, 2, 1, 0, },
{ 0, 0, 1, 1, 1, 0, },
{ 0, 0, 0, 0, 0, 0, },
{ 0, 0, 0, 0, 0, 0, },
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
function onCastSpell(cid, var)
if(exhaustion.check(cid, config.storageUse) == TRUE) then
if (exhaustion.get(cid, config.storageUse) >= 60) then
doPlayerSendCancel(cid, "Voçê só pode usar após [" .. math.floor(exhaustion.get(cid, config.storageUse) / 60 + 1) .."] minutos.")
end
if (exhaustion.get(cid, config.storageUse) <= 60) then
doPlayerSendCancel(cid, "Voçê só pode usar após [" .. exhaustion.get(cid, config.storageUse).."] segundos.")
end
return false
end
doCombat(cid, combat, var)
exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
return true
end
-- Paralyze
local config = {
exhaustionSeconds = 20, -- exausted em segundos
storageUse = 34539 -- storage usado.
}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000) -- aqui vai o tempo de paralyze, 1000 = 1 segundo
setConditionParam(condition, CONDITION_PARAM_SPEED, -400) -- velocidade que o player irá perder
setConditionFormula(condition, 0, 0, 0, 0)
setCombatCondition(combat, condition)
function onCastSpell(cid, var)
if(exhaustion.check(cid, config.storageUse) == TRUE) then
if (exhaustion.get(cid, config.storageUse) >= 60) then
doPlayerSendCancel(cid, "Voçê só pode usar após [" .. math.floor(exhaustion.get(cid, config.storageUse) / 60 + 1) .."] minutos.")
end
if (exhaustion.get(cid, config.storageUse) <= 60) then
doPlayerSendCancel(cid, "Voçê só pode usar após [" .. exhaustion.get(cid, config.storageUse).."] segundos.")
end
return false
end
local target = getCreatureTarget(cid)
if target > 0 then
doAddCondition(target, condition)
exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
return true
end
return false
end
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

Vlw ae Jhon992, funcionou certinho,irei dar rep pra vc e para o Tchubacka que tentou ajudar.
Obrigado.
_______________________________
EDIT: Só uma dúvida que ficou.
Na magia de trap para o item sumir eu teria que modificar la no items.xml, e colocar ele tipo o magic wall.
Queria saber se é possivel modificar essa spell para que não precise mudar o item la no item.xml, já que vou criar varios tipos de trap.
Editado Julho 29 por roriscrave
info
Grupo: Conde
Registrado: 30/06/11
Posts: 631
Reputação: +371
Char no Tibia: Warrior of Mort

local config = {
exhaustionSeconds = 15, -- exausted em segundos
trapId = 3456, -- id do item do trap
timeRemove = 30, -- segundos para remover o trap
storageUse = 34538 -- storage usado.
}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 10)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 2711)
local arr = {
{ 0, 0, 0, 0, 0, 0, },
{ 0, 0, 0, 0, 0, 0, },
{ 0, 0, 1, 1, 1, 0, },
{ 0, 0, 1, 2, 1, 0, },
{ 0, 0, 1, 1, 1, 0, },
{ 0, 0, 0, 0, 0, 0, },
{ 0, 0, 0, 0, 0, 0, },
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
function onCastSpell(cid, var)
if(exhaustion.check(cid, config.storageUse) == TRUE) then
if (exhaustion.get(cid, config.storageUse) >= 60) then
doPlayerSendCancel(cid, "Voçê só pode usar após [" .. math.floor(exhaustion.get(cid, config.storageUse) / 60 + 1) .."] minutos.")
end
if (exhaustion.get(cid, config.storageUse) <= 60) then
doPlayerSendCancel(cid, "Voçê só pode usar após [" .. exhaustion.get(cid, config.storageUse).."] segundos.")
end
return false
end
doCombat(cid, combat, var)
local pos = getCreaturePosition(cid)
posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1}
posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1}
posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1}
posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1}
posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1}
posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1}
posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1}
posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1}
posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8}
exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
addEvent(removeTrap, config.timeRemove*1000, posAll)
return true
end
function removeTrap(posAll)
for i=1, #posAll do
for j=0, 255 do
pos_stack = {x=posAll[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j}
removeTile = getThingfromPos(pos_stack)
if removeTile.itemid == config.trapId then
doRemoveItem(removeTile.uid)
end
end
end
end
Editado Julho 29 por Jhon992
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

Deu esse erro aqui cara, você sabe remover?
[Error - Spell Interface] data/spells/scripts/test.lua:onCastSpell Description: data/spells/scripts/test.lua:49: attempt to perform arithmetic on global 'timeRemove' (a nil value) stack traceback: data/spells/scripts/test.lua:49: in function <data/spells/scripts/test.lua:27>
info
Grupo: Conde
Registrado: 30/06/11
Posts: 631
Reputação: +371
Char no Tibia: Warrior of Mort

Editei la em cima, testa novamente.
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

O erro que estava dando saiu, mas agora não está removendo os items.
info
Grupo: Conde
Registrado: 30/06/11
Posts: 631
Reputação: +371
Char no Tibia: Warrior of Mort

Essa magia cria os items em volta do jogador que soltou ou do target?
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

Eu coloquei para soltar os items no target.
(Mas só mexi no spell.xml)
info
Grupo: Conde
Registrado: 30/06/11
Posts: 631
Reputação: +371
Char no Tibia: Warrior of Mort

Se eh no target fica assim:
local config = {
exhaustionSeconds = 15, -- exausted em segundos
trapId = 3456, -- id do item do trap
timeRemove = 30, -- segundos para remover o trap
storageUse = 34538 -- storage usado.
}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 10)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 2711)
local arr = {
{ 0, 0, 0, 0, 0, 0, },
{ 0, 0, 0, 0, 0, 0, },
{ 0, 0, 1, 1, 1, 0, },
{ 0, 0, 1, 2, 1, 0, },
{ 0, 0, 1, 1, 1, 0, },
{ 0, 0, 0, 0, 0, 0, },
{ 0, 0, 0, 0, 0, 0, },
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
function onCastSpell(cid, var)
if(exhaustion.check(cid, config.storageUse) == TRUE) then
if (exhaustion.get(cid, config.storageUse) >= 60) then
doPlayerSendCancel(cid, "Voçê só pode usar após [" .. math.floor(exhaustion.get(cid, config.storageUse) / 60 + 1) .."] minutos.")
end
if (exhaustion.get(cid, config.storageUse) <= 60) then
doPlayerSendCancel(cid, "Voçê só pode usar após [" .. exhaustion.get(cid, config.storageUse).."] segundos.")
end
return false
end
doCombat(cid, combat, var)
local pos = getCreaturePosition(getCreatureTarget(cid))
posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1}
posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1}
posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1}
posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1}
posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1}
posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1}
posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1}
posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1}
posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8}
exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
addEvent(removeTrap, config.timeRemove*1000, posAll)
return true
end
function removeTrap(posAll)
for i=1, #posAll do
for j=0, 255 do
pos_stack = {x=posAll[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j}
removeTile = getThingfromPos(pos_stack)
if removeTile.itemid == config.trapId then
doRemoveItem(removeTile.uid)
end
end
end
end
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

Pô cara, com esse ai os items não estão sumindo
info
Grupo: Conde
Registrado: 30/06/11
Posts: 631
Reputação: +371
Char no Tibia: Warrior of Mort

Acabei de testar cara e ta funcionando perfeitamente, você só precisa configurar a variável "trapId = 3456" para o id do item que é criado no trap, ou seja, "trapId = 2711".
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei
O titulo fala tudo, queria fazer o pedido de 2 spells para t.f.s 0.3.6 (8.54).
1- Ao usar no player ele é paralyzado, e quem usou fica com delay de 10 segundis.
2- Tenho essa spell que eu mesmo fiz, que ao usar no target ele é trapado. Porém queria adicionar um deley de 15 segundos nela:
local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, 10) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 2711) local arr = { { 0, 0, 0, 0, 0, 0, }, { 0, 0, 0, 0, 0, 0, }, { 0, 0, 1, 1, 1, 0, }, { 0, 0, 1, 2, 1, 0, }, { 0, 0, 1, 1, 1, 0, }, { 0, 0, 0, 0, 0, 0, }, { 0, 0, 0, 0, 0, 0, }, } local area = createCombatArea(arr) setCombatArea(combat, area) function onCastSpell(cid, var) return doCombat(cid, combat, var) endDarei rep+