Antes de ler, verifique se você está no XTibia!
Introdução:
Esse script, foi feito especialmente para o Script Delivery.
Aqui, o player (com soul) configura o Recharger com o volante do navio, após isso, ele (com uma manapotion vazia na mão) usa o recharger e PUFF! Mana potion recuperada.. Legal né ?
Screenshot:
Tutorial
☻Como mostra na imagem, faça um mapa como aquele no map editor;
☻Pode usar qualquer item como "volante", porém esse item PRECISA ter UniqueID 2211
☻ Construa o Recharger, com os ID's 7913 e 7914
☻ Após construir tudo, salve o mapa, vá na pasta data/actions/scripts e crie um arquivo chamado recharger.lua e coloque o seguinte dentro:
function onUse(cid, item, frompos, item2, topos)
--Nao Mecha--
local nome = getPlayerName(cid)
local greatManaPot = 7590
local strongManaPot = 7589
local manaPot = 7620
local soul = getPlayerSoul(cid)
local config = getPlayerStorageValue(cid, 2211)
local playerpos = getPlayerPosition(cid)
----
--Normal Mana Potion
if config == 0 then
if soul >= 3 then
if doPlayerRemoveItem(cid,7636,1) == 1 then
doPlayerSendTextMessage(cid,22,"Você recarregou sua empty potion")
doSendMagicEffect(playerpos, 3)
potadd = doPlayerAddItem(cid,7620,1)
doSetItemSpecialDescription(potadd,"Recarregada por ".. nome .. ".")
doPlayerAddSoul(cid,-3)
else
doPlayerSendTextMessage(cid,4,"Você precisa de uma empty potion!")
doSendMagicEffect(playerpos, 2)
end
else
doPlayerSendTextMessage(cid,4,"Você não tem soul!")
doSendMagicEffect(playerpos, 2)
end
end
--Strong Mana Potion
if config == 1 then
if soul >= 5 then
if doPlayerRemoveItem(cid,7634,1) == 1 then
doPlayerSendTextMessage(cid,22,"Você recarregou sua empty potion")
doSendMagicEffect(playerpos, 3)
potadd = doPlayerAddItem(cid,7589,1)
doSetItemSpecialDescription(potadd,"Recarregada por ".. nome .. ".")
doPlayerAddSoul(cid,-5)
else
doPlayerSendTextMessage(cid,4,"Você precisa de uma empty strong potion!")
doSendMagicEffect(playerpos, 2)
end
else
doPlayerSendTextMessage(cid,4,"Você não tem soul!")
doSendMagicEffect(playerpos, 2)
end
end
--Great Mana Potion
if config == 2 then
if soul >= 8 then
if doPlayerRemoveItem(cid,7635,1) == 1 then
doPlayerSendTextMessage(cid,22,"Você recarregou sua empty potion")
doSendMagicEffect(playerpos, 3)
potadd = doPlayerAddItem(cid,7590,1)
doSetItemSpecialDescription(potadd,"Recarregada por ".. nome .. ".")
doPlayerAddSoul(cid,-8)
else
doPlayerSendTextMessage(cid,4,"Você precisa de uma empty great potion!")
doSendMagicEffect(playerpos, 2)
end
else
doPlayerSendTextMessage(cid,4,"Você não tem soul!")
doSendMagicEffect(playerpos, 2)
end
end
--NoConfig
if config == -1 then
doPlayerSendTextMessage(cid,4,"Configure o Recharger !!!")
doSendMagicEffect(playerpos, 2)
end
return 0
end
☻ Depois, na [u]mesma pasta[/u] crie outro arquivo chamado [u]configrecharger.lua[/u] e insira o seguinte dentro:
[codebox]
--function onUse(cid, item, frompos, item2, topos)
config = getPlayerStorageValue(cid,2211)
if config == -1 then
doPlayerSendTextMessage(cid,22,"Configurado para Mana Potion.")
setPlayerStorageValue(cid,2211,0)
else
if config == 0 then
doPlayerSendTextMessage(cid,22,"Configurado para Strong Mana Potion.")
setPlayerStorageValue(cid,2211,1)
else
if config == 1 then
doPlayerSendTextMessage(cid,22,"Configurado para Great Mana Potion.")
setPlayerStorageValue(cid,2211,2)
else
if config == 2 then
doPlayerSendTextMessage(cid,22,"Configurado para Mana Potion.")
setPlayerStorageValue(cid,2211,0)
end
end
return 0
end
end
return 1
end
☻ Conseguiu!, mas antes, vá na pasta anterior [u](data/actions) [/u], abra o arquivo [u] actions.xml[/u] e insira essas linhas:
<!--Recharger by Chain--><action itemid="7913" script="recharger.lua" />
<action itemid="7914" script="recharger.lua" />
<action uniqueid="2211" script="configrecharger.lua" />
☻Agora, vá no arquivo [u]data/items/items.xml[/u], abra, procure pelas seguintes linhas:
<item id="7913" name="item of type"></item>
<item id="7914" name="item of type">
</item>
e substitua por:
<item id="7913" name="Potion Recharger"></item>
<item id="7914" name="Potion Recharger">
</item>
[b]PRONTO!![/b]
//Chain~
[size=4][b]Dúvidas, Críticas, Sugestões \/[/b][/size]
Caso goste, [color=#FF0000]USE MINHA FANBAR!!![/color]