DE

Duelo De Summons

Por Demonbholder, 06 de mai. de 2011 em Mods, funções e outros

otserv
tibia
script
31
8.2k
21 de maio de 2011 às 23:16

Quem tiver o mesmo problema que ele, usa esse script:

 

function onSay(cid, words, param)

if param == "" or not(isPlayer(getPlayerByName(param))) then
return doPlayerSendCancel(cid, "Parâmetro incorreto.")
end

return setPlayerStorageValue(getPlayerByName(param), 34570, -1), TRUE
end

 

Coloca em data/talkactions/scripts. A tag deve ser essa:

 

<talkaction words="!reset" script="NomeDoArquivo.lua" />

 

Troquem o NomeDoArquivo pelo nome do arquivo .lua que vocês usaram para colocar o script acima.

 

Ai, no jogo, falem !reset NomeDoJogador

 

---

 

Script editado, agora esse erro não vai mais acontecer. Lembrando que o monstro a ser sumonado dever poder ser convencido, e o dragon não é, então mude isso no seu OT Server.

Editado Maio 22 por Demonbholder

joao33J
22 de maio de 2011 às 10:19

Para quem não sabe como faz para summonar o dragon faça issu va em seu ot/data/monster/script/dragon.xml

 

 

 

e siga o tutorial

 

<?xml version="1.0" encoding="UTF-8"?>

<monster name="Rabbit" nameDescription="a rabbit" race="blood" experience="0" speed="380" manacost="220">

<health now="15" max="15"/>

<look type="74" corpse="6017"/>

<targetchange interval="5000" chance="20"/>

<strategy attack="100" defense="0"/>

<flags>

<flag summonable="1"/>

<flag attackable="1"/>

<flag hostile="0"/>

<flag illusionable="1"/>

<flag convinceable="1"/>

<flag pushable="1"/>

<flag canpushitems="0"/>

<flag canpushcreatures="0"/>

<flag targetdistance="1"/>

<flag staticattack="90"/>

<flag runonhealth="15"/>

</flags>

<defenses armor="2" defense="3"/>

<loot>

<item id="2684" countmax="4" chance="70000"/><!-- carrot -->

<item id="2666" countmax="2" chance="20000"/><!-- meat -->

</loot>

</monster>

 

 

 

Onde está em negrito e em itálico é onde vc tem que editar...

a parte:

manacost, é o valor de mana que vc gastará para invocar e convencer o monstro...

e a parte:

<flag summonable="1"/>, é se o bixo pode ser sumonado ou não...

 

Também pode ser util para você as tags:

<flag illusionable="1"/>

<flag convinceable="1"/>

 

Illusionable é se vai poder dar Utevo res ina ou não... e Convinceable é se vai poder convencer ou não. (com a runa Convince Creature)

 

Lembrando que '1' = 'sim' e '0' = 'não', então se NAO quiser que um bixo seja sumonado, coloque no <flag summonable> o valor '0' deixando-o assim: <flag summonable="0">

 

 

 

COMO ARRUMO O PREMIO?

Editado Maio 22 por TrojanBr

22 de maio de 2011 às 14:30

Nessa tabela:

 

monsters = {
["rat"] = {sto = -1, awa = 300},
["skeleton"] = {sto = 3, awa = 500},
["orc"] = {sto = 5, awa = 700},
["rotworm"] = {sto = 7, awa = 900},
["dwarf"] = {sto = 7, awa = 900},
["minotaur"] = {sto = 8, awa = 1000},
["dwarf soldier"] = {sto = 10, awa = 1200},
["minotaur archer"] = {sto = 10, awa = 1200},
["carrion worm"] = {sto = 10, awa = 1200},
["slime"] = {sto = 15, awa = 1700},
["cyclops drone"] = {sto = 18, awa = 2000},
["minotaur guard"] = {sto = 18, awa = 2000},
["minotaur mage"] = {sto = 23, awa = 2500},
["dwarf guard"] = {sto = 26, awa = 2800},
["demon skeleton"] = {sto = 30, awa = 3200},
["dragon hatchling"] = {sto = 35, awa = 3700},
["dragon"] = {sto = 45, awa = 5000},
}

 

o sto é o número de vitórias necessárias (monstros iniciais é -1) e awa é o quanto que o oponente vai ganhar, em gps, por matar esse monstro.

joao33J
22 de maio de 2011 às 14:50

Alguem pode me ajudar como faço para quando o player perder ele ser teletransportado pro templo automaticamente me ajudem rep+

22 de maio de 2011 às 14:57

Então, testa ai

 

 

<?xml version="1.0" encoding="UTF-8"?>
<mod name="SummonDuel" enabled="yes" author="Demonbholder" forum="XTibia.com">

<config name="SumLib"><![CDATA[

pla1 = getThingFromPos({x=151, y=39, z=7, stackpos=253}).uid
pla2 = getThingFromPos({x=152, y=39, z=7, stackpos=253}).uid
pos = {x=152, y=43, z=7}
monsters = {
["rat"] = {sto = -1, awa = 300},
["skeleton"] = {sto = 3, awa = 500},
["orc"] = {sto = 5, awa = 700},
["rotworm"] = {sto = 7, awa = 900},
["dwarf"] = {sto = 7, awa = 900},
["minotaur"] = {sto = 8, awa = 1000},
["dwarf soldier"] = {sto = 10, awa = 1200},
["minotaur archer"] = {sto = 10, awa = 1200},
["carrion worm"] = {sto = 10, awa = 1200},
["slime"] = {sto = 15, awa = 1700},
["cyclops drone"] = {sto = 18, awa = 2000},
["minotaur guard"] = {sto = 18, awa = 2000},
["minotaur mage"] = {sto = 23, awa = 2500},
["dwarf guard"] = {sto = 26, awa = 2800},
["demon skeleton"] = {sto = 30, awa = 3200},
["dragon hatchling"] = {sto = 35, awa = 3700},
["dragon"] = {sto = 45, awa = 5000},
}
temple = {x=160, y=51, z=7}

]]></config>

<creaturescript type="login" name="SummonL" event="script"><![CDATA[

registerCreatureEvent(cid, "SummonC")

return TRUE

]]></creaturescript>

<creaturescript type="combat" name="SummonC" event="script"><![CDATA[

if getPlayerStorageValue(cid, 34570) ~= -1 and isPlayer(target) then
return FALSE, doPlayerSendCancel(cid, "Voce nao pode atacar enquanto esta no jogo.")
elseif getPlayerStorageValue(target, 34570) ~= -1 then
return FALSE
end

return TRUE

]]></creaturescript>

<creaturescript type="statschange" name="SummonS" event="script"><![CDATA[

if type == STATSCHANGE_HEALTHLOSS then
if isPlayer(attacker) and isPlayer(getCreatureMaster(cid)) then
if getPlayerStorageValue(getCreatureMaster(cid), 34570) ~= -1 then
return FALSE
end
end
end

return TRUE

]]></creaturescript>

<creaturescript type="kill" name="SummonK" event="script"><![CDATA[
domodlib('SumLib')

setPlayerStorageValue(pla1, 34570, -1)
setPlayerStorageValue(pla2, 34570, -1)
setPlayerStorageValue(getCreatureMaster(cid), 34571, getPlayerStorageValue(getCreatureMaster(cid), 34571) +1)
doCreatureSetNoMove(pla1, FALSE)
doCreatureSetNoMove(pla2, FALSE)
doPlayerAddMoney(getCreatureMaster(cid), monsters[string.lower(getCreatureName(target))].awa)
doSendMagicEffect(getCreaturePosition(getCreatureMaster(cid)), 49)
doTeleportThing(getCreatureMaster(target), temple)
doRemoveCreature(cid)

return TRUE

]]></creaturescript>

<talkaction words="!start;!summon" event="script"><![CDATA[
domodlib('SumLib')

if cid ~= pla1 and cid ~= pla2 then
return doPlayerSendCancel(cid, "Voce precisa ser um dos jogadores."), doSendMagicEffect(getCreaturePosition(cid), 2)
elseif isPlayer(pla1) == FALSE or isPlayer(pla2) == FALSE then
return doPlayerSendCancel(cid, "Voce precisa de dois jogadores."), doSendMagicEffect(getCreaturePosition(cid), 2)
end

if words == "!start" then
if getPlayerStorageValue(pla1, 34570) == -1 and getPlayerStorageValue(pla2, 34570) == -1 then
setPlayerStorageValue(pla1, 34570, 1)
setPlayerStorageValue(pla2, 34570, 1)
doPlayerSendTextMessage(pla1, 4, "Partida comecada.")
doPlayerSendTextMessage(pla2, 4, "Partida comecada.")
doSendMagicEffect(getCreaturePosition(pla1), 10)
doSendMagicEffect(getCreaturePosition(pla2), 10)
doCreatureSetNoMove(pla1, TRUE)
doCreatureSetNoMove(pla2, TRUE)
else
doPlayerSendCancel(cid, "A partida ja iniciou.")
doSendMagicEffect(getCreaturePosition(cid), 2)
end

elseif words == "!summon" then
if param ~= "" then
if getPlayerStorageValue(cid, 34570) == 1 then
if monsters[string.lower(param)] then
if getPlayerStorageValue(cid, 34571) >= monsters[string.lower(param)].sto then
local mom = doCreateMonster(string.lower(param), pos)
doConvinceCreature(cid, mom)
setPlayerStorageValue(cid, 34570, 2)
registerCreatureEvent(mom, "SummonC")
registerCreatureEvent(mom, "SummonS")
registerCreatureEvent(mom, "SummonK")
else
doPlayerSendCancel(cid, "Voce nao pode sumonar este monstro.")
doSendMagicEffect(getCreaturePosition(cid), 2)
end
else
doPlayerSendCancel(cid, "Este monstro nao pode ser sumonado.")
doSendMagicEffect(getCreaturePosition(cid), 2)
end
else
doPlayerSendCancel(cid, "A partida nao esta nesta parte.")
doSendMagicEffect(getCreaturePosition(cid), 2)
end
else
doPlayerSendCancel(cid, "Diga o nome do monstro a ser sumonado.")
doSendMagicEffect(getCreaturePosition(cid), 2)
end

end

return TRUE

]]></talkaction>

</mod>

 

 

Acha isso no script:

 

temple = {x=160, y=51, z=7}

 

Esta é a posição do templo.

joao33J
22 de maio de 2011 às 22:06

Funcionou s vlw rep + lek msm sendo moderador se me mando 5 mensagens e me ajudo + 1 rep + ao total 2:D poe la a parada que eu fiz pra o pessoal poder add novos monstros tipow demon e tlaz tem qfazer o tutorial que te mandei >D

 

Por favor faz 1 comando que as pessoas tenham como ver quantos bixus ja mataram ajudaram muito

29 de maio de 2011 às 18:17

Consegui fazer um rank aqui, vamos ver se funciona, lá vai:

 

Vai em data/talkactions/scripts, cria um arquivo .lua e cola isso:

 

function onSay(cid, words, param)

local tab = getDbSto()
local n = {}
local t = {}
local m = {}
local l = {}
local str = nil

for i = 1, #tab do
if tonumber(db.getResult("SELECT `online` FROM `players` WHERE `id` = "..tab[i]..";"):getDataString("online")) == 0 then
table.insert(n, tonumber(db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = "..tab[i].." AND `key` = 34571;"):getDataString("value")))
table.insert(t, tonumber(db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = "..tab[i].." AND `key` = 34571;"):getDataString("value")))
table.insert(m, db.getResult("SELECT `name` FROM `players` WHERE `id` = "..tab[i]..";"):getDataString("name"))
else
for _, pid in pairs(getPlayersOnline()) do
if getPlayerGUID(pid) == tab[i] then
table.insert(n, getPlayerStorageValue(pid, 34571))
table.insert(t, getPlayerStorageValue(pid, 34571))
table.insert(m, getCreatureName(pid))
end
end
end
end

local f = doOrderTab(n, 0)

for r = 1, #f do
local pos = table.find(t, f[r])
table.insert(l, m[pos])
table.remove(m, pos)
table.remove(t, pos)
end

for h, g in pairs(f) do
str = str and str .. "\n" .. l[h] .. " : " .. g or l[h] .. " : " .. g
end


return TRUE, doShowTextDialog(cid, 2160, str)
end

function getDbSto()

local data = tonumber(db.getResult("SELECT `id` FROM `players` ORDER BY `id` DESC;"):getDataString("id"))
c = {}

for i = 1, data do
w = 0
local t = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = "..i.." AND `key` = 34571;") 
for d, s in pairs(t) do
w = w + 1
if w == 2 then
table.insert(c, i)
end
end
end

return c
end

function doOrderTab(tabela, value)

max = {}

for i = 1, table.maxn(tabela) do
valor = value
for a, b in ipairs(tabela) do
if b > valor then
valor = b
end
end
table.remove(tabela, table.find(tabela, valor))
if valor ~= value then
table.insert(max, valor)
end
end
return max
end

 

Depois vai em data/talkactions, abre o arquivo talkactions.xml e cola essa tag:

 

<talkaction words="!duelrank" script="NomeDoArquivo.lua" />

 

Edita o NomeDoArquivo e as words se quiser.

 

Da uma testada e avisa se funcionou.

Editado Maio 29 por Demonbholder

joao33J
29 de maio de 2011 às 18:29

vlw vo testar oks se der certo eu posto aki dps

 

obs:recuperei meus rep+ :D

1 mês depois...
ScizorgameS
06 de junho de 2011 às 15:59

pow sera que e muito dificil ageitar esse script para pokemon battle ? '_'

GMRaphaelG
09 de junho de 2011 às 21:10

Po Valeu Demonbholder Você é O Melhor Cara Pô Sabe de Tudo Mesmo.

 

 

Otímo Tópico.

1 mês depois...
27 de julho de 2011 às 17:39

Demonbholder, tem como fazer para o duelo ser entre duplas?

Adorei muito o sistema, ta bem legal.

Parabéns!

 

Abraços.

27 de julho de 2011 às 19:26

Acredito que com algumas alterações seja possível sim.

 

Obrigado pelo elogio, até.

28 de julho de 2011 às 02:05

Teria como você fazer?

 

Obrigado, abraços.

1 mês depois...
eduardo190696E
04 de agosto de 2011 às 19:20

axo que vc n se importa deu criar um duel system para poketibia né ?

04 de agosto de 2011 às 19:54

não, vai fundo.