[CREATURESCRIPT] Buy Summon Scroll
Fala galera do TibiaKing, eu vim postar pra vocês um script que eu fiz muito rapidinho aqui, só pra passar o tempo enquanto eu compilava umas sourcers :x
Esse script é o seguinte, você tem um scroll e dentro dele você escreve o nome da criatura que você quer sumonar, porém para cada criatura você precisa de uma certa quantia de gold coins e level. Para saber o nome das criaturas disponíveis você digita "monsters" ou "monster".
Testado: 0.3.6pl1 [8.54]
Instalação
Data/Creaturescript/Scripts/ScrollMonsters.lua
--- Créditos: Tony Araújo (OrochiElf) ----
local monsters = {
["orc berserker"] = {price = 1000, lv = 40, exhaustSto = 99900, exhaustTime = 120},
["dragon"] = {price = 10000, lv = 80, exhaustSto = 99901, exhaustTime = 300},
-- [nome do monstro] {price = preço(gold coins), lv = level necessário, exhaustSto = storage para salvar o exhaust, exhaustTime = quantos segundos de exhaust},
}
local removeOnUse = true -- Remover ao usar? true / false
function onTextEdit(cid, item, newText)
local i = monsters[newText:lower()]
local str = "~~ Scroll Monsters ~~"
if isInArray({"monsters", "monster"}, newText:lower()) then
for monsterName, monsterInfo in ipairs(monsters) do
str = str "\n" .. monsterName .." [lv: "..monsterInfo.lv.." GP$: ".. monsterInfo.price
end
doShowTextDialog(cid, item.itemid, str)
return true
end
if i then
if getPlayerLevel(cid) >= i.lv then
if doPlayerRemoveMoney(cid, i.price) then
if not exhaustion.get(cid, i.exhaustSto) then
if removeOnUse then
doRemoveItem(cid, item.uid, 1)
end
doSummonCreature(cid, newText:lower())
exhaustion.set(cid, i.exhaustSto, i.exhaustTime)
return true
else
doPlayerSendCancel(cid, "Voce precisa esperar "..exhaustion.get(cid, i.exhaustSto).." segundos.")
return true
end
else
doPlayerSendCancel(cid, "Voce precisa de "..i.price.." gold coins.")
return true
end
else
doPlayerSendCancel(cid, "Voce precisa do level "..i.lv)
return true
end
else
doPlayerSendCancel(cid, "Esta criatura não existe.")
return true
end
end
Data/Creaturescript/Creaturescript.xml
<event type="textedit" name="Scroll Monsters" event="script" value="ScrollMonsters.lua"/>
Data/Creaturescript/Scripts/Login.lua
registerCreatureEvent(cid, "Scroll Monsters")
Créditos
Tony Araújo (OrochiElf) 100%