Não tem como testar mas se funcionar é top esse script, teria como mudar a forma de cobrança para diamond?
- Forums
- OTServ
- Tutoriais
- Tutoriais de Scripting
- Npc que pinta pokebola
info
Group: Visconde
Joined: 16/08/13
Posts: 286
Reputation: +30
Gender: Masculino

info
Group: Conde
Joined: 21/04/16
Posts: 831
Reputation: +271
Gender: Masculino

15 minutos atrás, Duhisback disse:Não tem como testar mas se funcionar é top esse script, teria como mudar a forma de cobrança para diamond?
--[[
::: Script refeita por marshmello :::
::: Não remova os creditos Plase :::
]]
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function playerHaveItems(cid, itemid)
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
if getPlayerItemCount(cid, items) <= 0 then
return false
end
end
return true
end
function doPlayerRemoveItems(cid, itemid, count)
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
doPlayerRemoveItem(cid, items, count ~= nil and count or 1)
end
return nil
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if(msgcontains(msg, 'paint')) then
selfSay('Você quer pintar a sua ball?', cid)
return true
end
if(msgcontains(msg, 'quero')) then
selfSay('Olá, você pode escolher: Pokeball, Greatball, Superball, Ultraball.', cid)
return true
end
local diamond = 2145 --- Id dos Diamonds
if((msgcontains(msg, 'Pokeball') or msgcontains(msg, 'Poke ball') or msgcontains(msg, 'pokeball') or msgcontains(msg, 'poke ball'))) then
if getPlayerItemCount(cid,diamond) >= 15 true then
doPlayerRemoveItems(cid, diamond,15)
selfSay('Boa escolha, a partir de agora um, ele vai olhar como uma Pokeball! Há qualquer outra coisa que eu possa ajudá-lo?', cid)
doTransformItem(getPlayerSlotItem(cid, 8).uid, 11826)
else
selfSay('Sorry '.. getCreatureName(cid) ..', mas você não tem dinheiro suficiente.', cid)
end
end
if((msgcontains(msg, 'Greatball') or msgcontains(msg, 'Great ball') or msgcontains(msg, 'greatball') or msgcontains(msg, 'great ball'))) then
selfSay('Boa escolha, a partir de agora um, ele vai olhar como uma Greatball! Há qualquer outra coisa que eu possa ajudá-lo?', cid)
if getPlayerItemCount(cid,diamond) >= 15 true then
doPlayerRemoveItems(cid, diamond,15)
doTransformItem(getPlayerSlotItem(cid, 8).uid, 11832)
else
selfSay('Sorry '.. getCreatureName(cid) ..', mas você não tem dinheiro suficiente.', cid)
end
end
if((msgcontains(msg, 'Superball') or msgcontains(msg, 'Super ball') or msgcontains(msg, 'super ball') or msgcontains(msg, 'superball'))) then
if getPlayerItemCount(cid,diamond) >= 15 true then
doPlayerRemoveItems(cid, diamond,15)
selfSay('Boa escolha, a partir de agora um, ele vai olhar como uma Superball! Há qualquer outra coisa que eu possa ajudá-lo?', cid)
doTransformItem(getPlayerSlotItem(cid, 8).uid, 11835)
else
selfSay('Sorry '.. getCreatureName(cid) ..', mas você não tem dinheiro suficiente.', cid)
end
end
if((msgcontains(msg, 'Ultra ball') or msgcontains(msg, 'Ultraball') or msgcontains(msg, 'ultra ball') or msgcontains(msg, 'ultraball'))) then
selfSay('Boa escolha, a partir de agora um, ele vai olhar como uma Ultraball! Há qualquer outra coisa que eu possa ajudá-lo?', cid)
if getPlayerItemCount(cid,diamond) >= 15 true then
doPlayerRemoveItems(cid, diamond,15)
doTransformItem(getPlayerSlotItem(cid, 8).uid, 11829)
else
selfSay('Sorry '.. getCreatureName(cid) ..', mas você não tem dinheiro suficiente.', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
info
Group: Visconde
Joined: 16/08/13
Posts: 286
Reputation: +30
Gender: Masculino

Boa dei REP +
info
Group: Conde
Joined: 21/04/16
Posts: 831
Reputation: +271
Gender: Masculino

3 horas atrás, Duhisback disse:Boa dei REP +
Tmj men
Opa brendo blz, como faco para nao dar para pintar a ball com o pokemon para fora, so dentro do slot?
info
Group: Conde
Joined: 21/04/16
Posts: 831
Reputation: +271
Gender: Masculino

if getCreatureSummons(cid) == 1 then
selfsay('retorne seu pokemon')
return true
end
Coloque isso no codigo@XkillerW
Nao funfou mano, quando escolhe o type da ball com o pokemon pra fora, a type muda no slot fechada, porem o meta q tava pra fora fica ainda pra fora, e quando clico na ball do slot o meta duplica.
info
Group: Conde
Joined: 21/04/16
Posts: 831
Reputation: +271
Gender: Masculino

Vou refazer o codigo , e atualizo o topico
Quando refazer avisa pf
info
Group: Conde
Joined: 21/04/16
Posts: 831
Reputation: +271
Gender: Masculino

@XkillerW Código atualizado




info
Group: Conde
Joined: 21/04/16
Posts: 831
Reputation: +271
Gender: Masculino
Salve gaz, já vi esse tipo de script em alguns foruns , porem não tão funcional, então decidir refazer , e acabou funfando. então vou compartilhar com vocês
Primeiro vai em Npc crie um arquivo xml e cole isso dentro
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Diana" script="ball.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="1030" head="116" body="54" legs="114" feet="0" addons="2"/>
<parameters>
<parameter key="message_greet" value="Bem-vindo à minha loja de pintura |PLAYERNAME| Se quizer pintar sua ball fale {paint}!"/>
</parameters>
</npc>
Depois vai em npc/scripts e cria um arquivo .lua chamado ball.lua e cole isso dentro
Obrigada a @DarkWore Por identar o codigo pois n lembrava o site
Gostou ? deixe seu Rep+
Edited Julho 28 by Marshmello