Não tenho a mínima ideia de como fazer :s
- Fórum
- OTServ
- Pedidos
- Resolvidos
- [Resolvido] Effect após morrer.
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

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

9 minutos atrás, Thalles Vitor disse:Só ir no script de death do player e colar lá
Posso deixar aqui ?
Citarlocal config = {
deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
doSendMagicEffect(getThingPos(cid), 530)
if(config.deathListEnabled ~= TRUE) then
return
endlocal hitKillerName = "field item"
local damageKillerName = ""
if(lastHitKiller ~= FALSE) then
if(isPlayer(lastHitKiller) == TRUE) then
hitKillerName = getPlayerGUID(lastHitKiller)
else
hitKillerName = getCreatureName(lastHitKiller)
endif(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
if(isPlayer(mostDamageKiller) == TRUE) then
damageKillerName = getPlayerGUID(mostDamageKiller)
else
damageKillerName = getCreatureName(mostDamageKiller)
end
end
enddb.query("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
if(rows:getID() ~= -1) then
local amount = rows:getRows(true) - config.maxDeathRecords
if(amount > 0) then
if(config.sqlType == DATABASE_ENGINE_SQLITE) then
for i = 1, amount do
db.query("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
end
else
db.query("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
end
end
end
end
Alí não aconteceu nada
Editado Março 8 por diarmaint
info
Grupo: Diretor
Registrado: 12/05/12
Posts: 818
Reputação: +578
Gênero: Masculino
Char no Tibia: [ADM] Night

Me explique direito como quer que faço para você sem gambiarras. Ao morrer ele recebe um effect por X tempo? o efeito vai ficar nele ou acima da cabeça dele? quer para todos a mesma coisa ou cada um com um efeito?
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

Agora, Yan Liima disse:Me explique direito como quer que faço para você sem gambiarras. Ao morrer ele recebe um effect por X tempo? o efeito vai ficar nele ou acima da cabeça dele? quer para todos a mesma coisa ou cada um com um efeito?
Isso, após morrer aparece o efeito por 1 minuto., seria um effect para cada classe.
queria editar o xyz pq algumas classes tem sprites maiores.
info
Grupo: Diretor
Registrado: 12/05/12
Posts: 818
Reputação: +578
Gênero: Masculino
Char no Tibia: [ADM] Night

@diarmaint boom, tente assim. Crie um arquivo em creaturescripts chamado deatheffect.lua e cole isso:
local repetir = 2 -- Tempo para repetir o efeito local tempo = 1 * 60 -- Tempo em minutos que ficará com o efeito local str = 037668 -- storage, não mexa! local config = { [1] = 10, -- [Vocation] = 10(effect) [2] = 20, [3] = 30 } function onDeath(cid, corpse, deathList) setPlayerStorageValue(cid, str, os.time() + tempo) return true end function onLogin(cid) registerCreatureEvent(cid, "deathEffect") if getPlayerStorageValue(cid, str) > os.time() then effects(cid, getPlayerStorageValue(cid, str) - os.time()) end return true end function effects(cid, tempo) if (config[getPlayerVocation(cid)]) and isPlayer(cid) then if tempo > 0 then doSendMagicEffect(getPlayerPosition(cid), config[getPlayerVocation(cid)]) -- or getThingPos(cid) addEvent(effects, repetir * 1000, cid, tempo-repetir) else setPlayerStorageValue(cid, str, 0) return true end end end -- Créditos: Yan Liima(Xtibia)
XML:
<event type="login" name="loginEffect" event="script" value="deatheffect.lua"/> <event type="death" name="deathEffect" event="script" value="deatheffect.lua"/>
Tome cuidado com caractere invalido ao copiar. xD
Editado Março 8 por nedroesdoksdja
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

15 horas atrás, Yan Liima disse:local config = { [1] = 10, -- [Vocation] = 10(effect) [2] = 20, [3] = 30 }
Funcionou perfeitamente mas tem como editar o xyz? pois algumas vocações tem sprites maiores.
Aonde mudo pra deixar o mesmo effect para todas as classes? preciso do mesmo para outro servidor.
Editado Março 9 por diarmaint
info
Grupo: Diretor
Registrado: 12/05/12
Posts: 818
Reputação: +578
Gênero: Masculino
Char no Tibia: [ADM] Night

57 minutos atrás, diarmaint disse:Funcionou perfeitamente mas tem como editar o xyz? pois algumas vocações tem sprites maiores.
Aonde mudo pra deixar o mesmo effect para todas as classes? preciso do mesmo para outro servidor.
Pra tu ajeitar a posição você poderia por isso:
local pos = getPlayerPosition(cid) local position = {x = pos.x, y = pos.y - 1, z = pos.z}
Só por o valor -1 ou +1 ... Dai o doSendMagicEffect tu poderia deixar assim:
doSendMagicEffect(position, config[getPlayerVocation(cid)])
Ou você poderia ajusta isso na sprite mesmo, deixar ela de acordo com o personagem...
E para funcionar o mesmo efeito em todos deixe o script assim:
local repetir = 2 -- Tempo para repetir o efeito local tempo = 1 * 60 -- Tempo em minutos que ficará com o efeito local str = 037668 -- storage, não mexa! local effect = 29 -- Efeito function onDeath(cid, corpse, deathList) setPlayerStorageValue(cid, str, os.time() + tempo) return true end function onLogin(cid) registerCreatureEvent(cid, "deathEffect") if getPlayerStorageValue(cid, str) > os.time() then effects(cid, getPlayerStorageValue(cid, str) - os.time()) end return true end function effects(cid, tempo) if isPlayer(cid) then if tempo > 0 then doSendMagicEffect(getPlayerPosition(cid), effect) -- or getThingPos(cid) addEvent(effects, repetir * 1000, cid, tempo-repetir) else setPlayerStorageValue(cid, str, 0) return true end end end -- Créditos: Yan Liima(Xtibia)
Editado Março 9 por nedroesdoksdja
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

36 minutos atrás, Yan Liima disse:local pos = getPlayerPosition(cid) local position = {x = pos.x, y = pos.y - 1, z = pos.z}
Me auxilia aonde inserir essas linhas no script, tentei nas primeiras junto com os outros "local" e deu erro.
Citar[16:24:37.470] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/diarmaint/efeitomorte.lua:4: unexpected symbol near '´'
[16:24:37.471] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/diarmaint/efeitomorte.lua)
[16:24:37.471] data/creaturescripts/scripts/diarmaint/efeitomorte.lua:4: unexpected symbol near '´'
[16:24:37.472] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/diarmaint/efeitomorte.lua:4: unexpected symbol near '´'
[16:24:37.472] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/diarmaint/efeitomorte.lua)
[16:24:37.473] data/creaturescripts/scripts/diarmaint/efeitomorte.lua:4: unexpected symbol near '´'
local repetir = 1 -- Tempo para repetir o efeito
local tempo = 1 * 60 -- Tempo em minutos que ficará com o efeito
local str = 037668 -- storage, não mexa!
local pos = getPlayerPosition(cid)
local position = {x = pos.x, y = pos.y - 1, z = pos.z}
local config = {
[1] = 530, -- [Vocation] = 10(effect)
[2] = 530,
[3] = 530,
[4] = 530,
[5] = 530,
[6] = 530,
[7] = 530,
[8] = 530,
[9] = 530,
[10] = 530,
[11] = 530,
[12] = 530,
[13] = 530,
[14] = 530,
[15] = 530,
[16] = 530,
[473] = 530,
[909] = 530
}
function onDeath(cid, corpse, deathList)
setPlayerStorageValue(cid, str, os.time() + tempo)
return true
end
function onLogin(cid)
registerCreatureEvent(cid, "deathEffect")
if getPlayerStorageValue(cid, str) > os.time() then
effects(cid, getPlayerStorageValue(cid, str) - os.time())
end
return true
end
function effects(cid, tempo)
if (config[getPlayerVocation(cid)]) and isPlayer(cid) then
if tempo > 0 then
doSendMagicEffect(position, config[getPlayerVocation(cid)]) -- or getThingPos(cid)
addEvent(effects, repetir * 1000, cid, tempo-repetir)
else
setPlayerStorageValue(cid, str, 0)
return true
end
end
end
Editado Março 9 por diarmaint
info
Grupo: Diretor
Registrado: 12/05/12
Posts: 818
Reputação: +578
Gênero: Masculino
Char no Tibia: [ADM] Night

4 minutos atrás, diarmaint disse:
Tenta assim:
local repetir = 1 -- Tempo para repetir o efeito local tempo = 1 * 60 -- Tempo em minutos que ficará com o efeito local str = 037668 -- storage, não mexa! local config = { [1] = 530, -- [Vocation] = 10(effect) [2] = 530, [3] = 530, [4] = 530, [5] = 530, [6] = 530, [7] = 530, [8] = 530, [9] = 530, [10] = 530, [11] = 530, [12] = 530, [13] = 530, [14] = 530, [15] = 530, [16] = 530, [473] = 530, [909] = 530 } function onDeath(cid, corpse, deathList) setPlayerStorageValue(cid, str, os.time() + tempo) return true end function onLogin(cid) registerCreatureEvent(cid, "deathEffect") if getPlayerStorageValue(cid, str) > os.time() then effects(cid, getPlayerStorageValue(cid, str) - os.time()) end return true end function effects(cid, tempo) local pos = getPlayerPosition(cid) local position = {x = pos.x, y = pos.y - 1, z = pos.z} if (config[getPlayerVocation(cid)]) and isPlayer(cid) then if tempo > 0 then doSendMagicEffect(position, config[getPlayerVocation(cid)]) -- or getThingPos(cid) addEvent(effects, repetir * 1000, cid, tempo-repetir) else setPlayerStorageValue(cid, str, 0) return true end end end
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

Obrigado!
info
Grupo: Diretor
Registrado: 12/05/12
Posts: 818
Reputação: +578
Gênero: Masculino
Char no Tibia: [ADM] Night



info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho
Ao morrer o player fique com um effect.
preciso editar o tempo de duração, posição xyz, effect diferente por classe e o tempo entre os effects.
TFS 0.4
Editado Março 8 por diarmaint