A estátua será um monstro ou item?
info
Grupo: Cavaleiro
Registrado: 14/04/15
Posts: 191
Reputação: +2

Um item. Esse item ficará como o efeito. Quando a magia acaba some.
Spell:
local config = {
time = 10, --Tempo de stun.
statue = xxx, --ID da estátua.
storage = 9181
}
function onCastSpell(cid)
local target = getCreatureTarget(cid)
if not isCreature(target) then
return doPlayerSendCancel(cid, "You do not have a target.")
end
doCreatureSetNoMove(target, true)
doCreateItem(config.statue, 1, getThingPos(target))
setPlayerStorageValue(target, config.storage, 1)
local guid, toPos = getPlayerGUID(target), getThingPos(target)
addEvent(function()
local item = getTileItemById(toPos, config.statue).uid
if item > 0 then
doRemoveItem(item)
end
local pid = isCreature(target) and target or getPlayerByName(getPlayerNameByGUID(guid))
if isCreature(pid) then
setPlayerStorageValue(pid, config.storage, -1)
doCreatureSetNoMove(pid, false)
else
db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storage.." AND player_id = "..guid)
end
end, config.time * 1000)
return true
end
local storage = 9181
function onTarget(cid, target)
return getPlayerStorageValue(target, storage) < 1
end
function onStatsChange(cid, attacker, type, combat, value)
return getPlayerStorageValue(cid, storage) < 1
end
function onLogin(cid)
registerCreatureEvent(cid, "stunStatsChange")
registerCreatureEvent(cid, "stunTarget")
return true
end<event type="login" name="stunLogin" event="script" value="nome_do_arquivo.lua"/> <event type="statschange" name="stunStatsChange" event="script" value="nome_do_arquivo.lua"/> <event type="target" name="stunTarget" event="script" value="nome_do_arquivo.lua"/>
Editado Agosto 8 por zipter98
info
Grupo: Cavaleiro
Registrado: 14/04/15
Posts: 191
Reputação: +2

Poderia fazer uma pra min somente o stun. Mas os player poderá atacar e n aparecerá o item.
Tipo se eu estiver correndo atrás do player eu uso a magia ele para na hora por 5 segundos.
local time = 5 --Tempo de stun.
function onCastSpell(cid)
local target = getCreatureTarget(cid)
if not isCreature(target) then
return doPlayerSendCancel(cid, "You do not have a target.")
end
doCreatureSetNoMove(target, true)
addEvent(function()
if not isCreature(target) then return true end
doCreatureSetNoMove(target, false)
end, time * 1000)
return true
end
info
Grupo: Cavaleiro
Registrado: 14/04/15
Posts: 191
Reputação: +2

Obrigado Amigo!
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

Em 08/08/2015 em 01:28, zipter98 disse:Spell:
local config = { time = 10, --Tempo de stun. statue = xxx, --ID da estátua. storage = 9181 } function onCastSpell(cid) local target = getCreatureTarget(cid) if not isCreature(target) then return doPlayerSendCancel(cid, "You do not have a target.") end doCreatureSetNoMove(target, true) doCreateItem(config.statue, 1, getThingPos(target)) setPlayerStorageValue(target, config.storage, 1) local guid, toPos = getPlayerGUID(target), getThingPos(target) addEvent(function() local item = getTileItemById(toPos, config.statue).uid if item > 0 then doRemoveItem(item) end local pid = isCreature(target) and target or getPlayerByName(getPlayerNameByGUID(guid)) if isCreature(pid) then setPlayerStorageValue(pid, config.storage, -1) doCreatureSetNoMove(pid, false) else db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storage.." AND player_id = "..guid) end end, config.time * 1000) return true enddata/creaturescripts/scripts:local storage = 9181 function onTarget(cid, target) return getPlayerStorageValue(target, storage) < 1 end function onStatsChange(cid, attacker, type, combat, value) return getPlayerStorageValue(cid, storage) < 1 end function onLogin(cid) registerCreatureEvent(cid, "stunStatsChange") registerCreatureEvent(cid, "stunTarget") return true endTags:<event type="login" name="stunLogin" event="script" value="nome_do_arquivo.lua"/> <event type="statschange" name="stunStatsChange" event="script" value="nome_do_arquivo.lua"/> <event type="target" name="stunTarget" event="script" value="nome_do_arquivo.lua"/>
Desculpe reviver mas preciso muito.
usando tfs 1.3 e dá esse erro.
[Error - CreatureEvent::configureEvent] Invalid type for creature event: stunTarget
[Warning - BaseEvents::loadFromXml] Failed to configure event
[Error - CreatureEvent::configureEvent] Invalid type for creature event: SpellBuff
[Warning - BaseEvents::loadFromXml] Failed to configure event




info
Grupo: Cavaleiro
Registrado: 14/04/15
Posts: 191
Reputação: +2
Queria uma spell que deixa o target parado.
Explicaõ: eu atacou um target o ficara parado por 10 segundos n poderá se move, mas ninguém poderá o ataca. E fica uma statua em cima do target que foi ativado a spell, a statua ficará por 10 segundos depois some.
Up