Ir para conteúdo
  • 0

PEDIDO : NPC PROMOTION


sergionilo

Pergunta

bom até pouco tempo eu estive usando um script de promotion criado pelo Roksas, muito bom alias, mas eu tava pensando em criar uma vip só para promotions dai eu presisaria de 2 npcs para q o da vip seja em uma quest e o outro deja de graça :

ot tem 2 promotion a primeira é para quem não é vip por exemplo um elite knight vira member knight, e a segunda é só pra quem é vip, então eu estava querendo um script de npc.lua para estas funções :

 

vender promotion só se tiver a 1ª promotion

vender só se tiver level

vender só se tiver money para comprar

 

 

falas :

 

 

player : hi

npc: Welcome, Usuario! I have been expecting you!

player : promotion / vip promotion

npc :

 

You want to be promoted vip for 80000000 gold coins?

 

ou

 

You are already promoted, good bye... (npc sai da conversa)

 

player : yes

npc :

 

you don't have 80000000 gold coins to be promoted vip, good bye... (npc sai da conversa)

 

ou

 

Sorry, you need to have the first promotion to be promoted vip, good bye... (npc sai da conversa)

 

ou

 

Congratulations! You were promoted vip! good bye! (npc sai da conversa)

 

 

+++REP pra quem ajudar ai galera ! valeu !

Editado por sergionilo
Link para o comentário
Compartilhar em outros sites

  • Respostas 39
  • Created
  • Última resposta

Top Posters For This Question

Posts Recomendados

  • 0

Bom, vamos lá. Vá em data/npc/scripts, crie um arquivo chamado promo2.lua e adicione isso dentro:

 

 

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 creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

local price = 80000000

 

if(msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion')) then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if(getPlayerLevel(cid) >= 50 and getPlayerPromotionLevel(cid) < 2) then

if(doPlayerRemoveMoney(cid, price) == TRUE) then

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!.', cid)

else

selfSay('You do not have 80000000 gold coins to be promoted vip, good bye.', cid)

end

else

selfSay('You are already promoted, or not have level and promotion needed.', cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Para configurar, aonde eu selecionei de vermelho são: preço e lvl necessário!

Agora em data/npc, crie um arquivo chamado Promo Sell.xml e adicione isso dentro:

 

 

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

<npc name="Promo Seller" script="promo2.lua" walkinterval="2000" floorchange="0">

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

<look type="133" head="20" body="39" legs="45" feet="7" addons="0"/>

</npc>

 

 

Espero que funcione ^^

Link para o comentário
Compartilhar em outros sites

  • 0

ow valeu ! funfo tudo certinho REP +, só que como fasso pra promotion vip (segunda promotion) só ser adiquirida se eu tiver a member promotion (primeira promotion) ?

dou + outro REP + amanhã se ajudar ai vlw :D

Link para o comentário
Compartilhar em outros sites

  • 0

Só substituir :))

 

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 creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

local price = 80000000

 

if(msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion')) then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if(getPlayerLevel(cid) >= 50 and getPlayerPromotionLevel(cid) < 2) then

if(doPlayerRemoveMoney(cid, price) == TRUE) and getPlayerPromotionLevel(cid,1) == TRUE then

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!.', cid)

else

selfSay('You do not have 80000000 gold coins to be promoted vip, good bye.', cid)

end

else

selfSay('You are already promoted, or not have level and promotion needed.', cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Dúvida sanada?

Link para o comentário
Compartilhar em outros sites

  • 0

deu esse erro :

 

[27/02/2013 21:27:51] [Error - LuaScriptInterface::loadFile] data/npc/scripts/vip promotion seller.lua:32: ')' expected near 't'

[27/02/2013 21:27:51] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/vip promotion seller.lua

[27/02/2013 21:27:51] data/npc/scripts/vip promotion seller.lua:32: ')' expected near 't'

 

tentei procura o parenteses errado mais n achei todos tavão completos mas talvez algum esteja em um local errado (dai não sei ver) :x

Link para o comentário
Compartilhar em outros sites

  • 0

Ve ai

 

 

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 creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

local price = 80000000

 

if msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if(getPlayerLevel(cid) >= 50 and getPlayerPromotionLevel(cid) < 2) then

if(doPlayerRemoveMoney(cid, price) == TRUE) and getPlayerPromotionLevel(cid,1) == TRUE then

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('You do not have 80000000 gold coins to be promoted vip, good bye', cid)

end

else

selfSay('You are already promoted, or not have level and promotion needed', cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

  • 0

lol mudei o nome do npc tava tudo okey mais tbm não era isso que estranho o.0 vou passar o que eu modifiquei :

 

 

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 creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

local price = 80000000

 

if msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if(getPlayerLevel(cid) >= 750 and getPlayerPromotionLevel(cid) < 2) then

if(doPlayerRemoveMoney(cid, price) == TRUE) and getPlayerPromotionLevel(cid,1) == TRUE then

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('You do not have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay('You are already promoted vip, or not have level 750, or don't have the member promotion, good bye...', cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

e o .xml :

 

 

 

 

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

<npc name="Vip Promotion Seller" script="data/npc/scripts/Vip Promotion Seller.lua" walkinterval="2000" floorchange="0">

<mana now="100" max="100"/>

<health now="99" max="100"/>

<look type="332" head="0" body="0" legs="0" feet="0"/>

</npc>

 

 

Editado por sergionilo
Link para o comentário
Compartilhar em outros sites

  • 0

Ah cara, mals, esqueci de colocar uma coisa, tenta ae:

 

 

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 creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

local price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if(getPlayerLevel(cid) >= 750 and getPlayerPromotionLevel(cid) < 2) then

if(doPlayerRemoveMoney(cid, price) == TRUE) and getPlayerPromotionLevel(cid,1) == TRUE then

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('You do not have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750, or don't have the member promotion, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

Editado por Roksas
Link para o comentário
Compartilhar em outros sites

  • 0

agora o npc ta aparecendo mais quando vc compra a promotion e não tem a primera promotion ele dis q vc n tem 80000000 moedas e dai ele pega tuas moedas :x, mas quando o cara não tem level, ou ja tem a promotion vip ele fala certinho é só quando o cara não tem a primera promotion, tipo ele não ta disendo que o cara não tem a primera promotion ele ja pergunta se tu tem dinhero e tu dis sim e ele pega tens 80kk

Editado por sergionilo
Link para o comentário
Compartilhar em outros sites

  • 0

Experimenta cara:

 

 

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 creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

local price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if (getPlayerPromotionLevel(cid) < 2 and getPlayerLevel(cid)) >= 750 then

if getPlayerPromotionLevel(cid,1) == TRUE then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('You do not have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750, or don't have the member promotion, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

  • 0

agora ele não pega o dinheiro mais ainda fala que não tenho 80000000 moedas em ves de diser :

You are already promoted vip, or not have level 750, or don't have the member promotion, good bye...

no caso ele devia diser a frase acima pois eu n tenho a primeira vocation, mas eu tenho money.

Editado por sergionilo
Link para o comentário
Compartilhar em outros sites

  • 0

Experimenta cara:

 

 

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 creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

local price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if and getPlayerLevel(cid) >= 750 then

if getPlayerPromotionLevel(cid) <= 1 then

if doPlayerRemoveMoney(cid, price) == TRUE then

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('You are already promoted vip, or not have level 750, or don't have the member promotion, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750, or don't have the member promotion, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

  • 0

ow fico assim :

 

 

 

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 creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

local price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if (getPlayerPromotionLevel(cid) < 2 and getPlayerLevel(cid)) >= 750 then

if getPlayerPromotionLevel(cid,1) == TRUE then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('You don't have the member promotion, or you don't have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

mais o npc n aparece denovo quando eu tento summona ele com o god e aparece essa mensagem no exe :

 

 

 

[03/03/2013 20:32:51] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Vip Promotion Seller.lua:32: ')' expected near 't'

[03/03/2013 20:32:51] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Vip Promotion Seller.lua

[03/03/2013 20:32:51] data/npc/scripts/Vip Promotion Seller.lua:32: ')' expected near 't'

Link para o comentário
Compartilhar em outros sites


×
×
  • Criar Novo...