CA
pedido

Epic Promotion Some Quando O Char Desloga...

Por calemai, 20 de ago. de 2012 em Scripts

32
10.7k
21 de agosto de 2012 às 20:00

O erro é no NPCSYSTEM, na Lib, mas não tenho a tag aqui agora. Vou tentar procurar e posto aqui pra você.

calemaiC
21 de agosto de 2012 às 20:09

e nao vai nem assim, assim ele liga eu falo com o npc ele responde mas quando falo yes pra comprar da erro...

 

semttuloxmg.jpg

NewtonnotwenN
21 de agosto de 2012 às 20:21

Volta seu vocation.xml ao normal e adiciona no script.lua:

 

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

 

if(msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then

selfSay('Diga newvoc.', cid)

talkState[talkUser] = 1

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

if doPlayerRemoveMoney(cid, 1000000) then

voc = getPlayerVocation(cid)

doPlayerSetVocation(cid, 10)

selfSay('Agora você possui a nova vocação!', cid)

else

selfSay('Você não tem dinheiro!', cid)

end

talkState[talkUser] = 0

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Script by LuckOake.

Editado Agosto 21 por Newtonnotwen

calemaiC
21 de agosto de 2012 às 20:56

vou testar um momento...

 

Finalmente deu certoooo brigadao ganhou rep+

 

agora poderia me ajudar a aparecer no gesior a vocaçao nova???

 

no gesior continua a vocaçao normal nao a epic

NewtonnotwenN
21 de agosto de 2012 às 21:02

Gesior?

calemaiC
21 de agosto de 2012 às 21:27

sim

 

no site gesior

 

no site

 

amigo eu testei aki e nao deu tanto certo assim, todos os chars independente da vocaçao estao virando epic elder druid.... elite knight vira epic elder druid, e nao epic elite knight... =/

 

 

me ajude a resolver???

NewtonnotwenN
21 de agosto de 2012 às 21:35

Aqui o script, eu copiei de outro tópico meu:

 

Em data/npc crie um arquivo.xml nomeie para newvoc e adicione:

 

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

<npc name="Newvoc" script="data/npc/scripts/newvoc.lua" walkinterval="1000" floorchange="1">

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

<look type="302" head="114" body="114" legs="200" feet="114" addons="3"/>

<parameters>

<parameter key="message_greet" value="Deseja virar nova prof? "/>

</parameters>

</npc>

Em data/npc/scripts crie um arquivo.lua nomeie para newvoc e adicione:

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

 

if(msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then

selfSay('Diga newvoc.', cid)

talkState[talkUser] = 1

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

if(getPlayerItemCount(cid, 2160) >= 100) then

doPlayerRemoveItem(cid, 2160, 100)

doPlayerSetVocation(cid, 10)

selfSay('Agora você possui a nova vocação!', cid)

else

selfSay('Você não tem dinheiro!', cid)

end

talkState[talkUser] = 0

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Editando:

 

-Roxo: Looktype

-Verde escuro: Mensagem após falar hi

-Dourado: Mensagem que o player precisara dizer para o npc continuar

​-Vermelho: Próxima mensagem do npc

​-Verde claro: Próxima mensagem do player

-Marrom: Id do item a ser removido

-Violeta: Quantidade do item a ser removido

-Cinza: Id da vocação

-Azul Turco: Mensagem de confirmação

-Teal: Mensagem de cancelamento

 

arrow.gifObs: Autor desconhecido (pelo menos por mim)

 

​Créditos:

 

Autor desconhecido ----- Pelo script

Newtonnotwen ----- Pela edição e pelo tutorial button_ok.png

 

Imagens:

51351616.png

35220542.png

-------------------Ouça uma musica enquanto instala o npc music.gif

calemaiC
21 de agosto de 2012 às 21:42

ok, so que esse script o char mesmo sendo kina vira epic elder druid devido a esta linha

 

doPlayerSetVocation(cid, 10)

 

esta mandando o char virar epic elder druid

NewtonnotwenN
22 de agosto de 2012 às 10:41

Esse deve funcionar:

 

Renomeie o arquivo.lua para promnpc em npc/scripts.

 

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

if(msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then

selfSay('Diga {Supreme Sorcerer}.', cid)

talkState[talkUser] = 1

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

if(getPlayerItemCount(cid, 2160) >= 100) then

doPlayerRemoveItem(cid, 2160, 100)

doPlayerSetVocation(cid,9)

selfSay('Agora você é um Supreme Sorcerer.', cid)

else

selfSay('Você não tem Dinheiro Suficiente.', cid)

end

talkState[talkUser] = 0

end

return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

agora em npc.xml renomeie um arquivo para Supreme Sorcerer.

 

 

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

 

<npc name="NOME DO NPC" script="data/npc/scripts/promnpc.lua" walkinterval="0" floorchange="0">

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

<look type="302" head="114" body="114" legs="200" feet="114" addons="3"/>

<parameters>

<parameter key="message_greet" value="Deseja virar um Supreme Sorcerer? "/>

</parameters>

</npc>

 

Se não souber editar, fala que eu explico.

leo420L
22 de agosto de 2012 às 10:46

calemai, você pode me passar teu msn ou algo para contato ?

calemaiC
22 de agosto de 2012 às 17:50

Newtonnotwen

 

 

 

voce esta me passando um npc q vende somente uma vocaçao

 

 

eu quero um que para cada vocaçao ele da uma promotion diferente

 

Elite Knight >>> Epic Elite Knight

Master sorcerer >>> Epic ​Master sorcerer

Elder Druid >>> Epic Elder Druid

Royal paladin >>> Epic Royal Paladin

 

Entendeu???

 

leo420

 

 

te passei o msn por pm, me passe o seu...

NewtonnotwenN
22 de agosto de 2012 às 17:52

Script by Vodkart:

 

Obs: apaga os outros, esse aqui um só faz a função dos 4. (como esperado do Vodkart)

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

msg = string.lower(msg)

local price = 1

local vocations = {5,6,7,8}

local level = 100

if isInArray({"promote","second promote","promover"}, msg) then

selfSay('Você quer ser promovido por '..price..' gps? {yes} ', cid)

talkState[talkUser] = 1

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

if isInArray(vocations, getPlayerVocation(cid)) then

if getPlayerLevel(cid) >= level then

if doPlayerRemoveMoney(cid,price) == TRUE then

local new = (getPlayerVocation(cid)+4)

doPlayerSetVocation(cid, new)

setPlayerStorageValue(cid, 878975, new)

selfSay('Parabens! Voce tem sua segunda promocao. ', cid)

talkState[talkUser] = 0

else

selfSay('Você não tem ' .. price .. ' gps para ser promovido', cid)

talkState[talkUser] = 0

end

else

selfSay('Desculpe, você precisa ter level '.. level .. ' ou mais para se promover!', cid)

talkState[talkUser] = 0

end

else

selfSay('Desculpe, mais você não possui a primeira promotion.', cid)

talkState[talkUser] = 0

end

elseif msg == "no" and talkState[talkUser] >= 1 then

selfSay("Then not", cid)

talkState[talkUser] = 0

npcHandler:releaseFocus(cid)

end

return TRUE

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Em data/creaturescript/script/login.lua adc isso antes do último return true

if getPlayerStorageValue(cid, 878975) ~= -1 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 878975))

end

Editado Agosto 22 por Newtonnotwen

calemaiC
22 de agosto de 2012 às 20:53

Continua sumindo a promotion quando o char desloga e volta....

NewtonnotwenN
22 de agosto de 2012 às 21:02

Você adicionou isso?

 

if getPlayerStorageValue(cid, 878975) ~= -1 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 878975))

end

calemaiC
23 de agosto de 2012 às 05:52

sim adicionei...