Postado Maio 7, 2015 10 anos Autor erro meu... não é =< é <= local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid 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 greetCallback(cid) talkState[talkUser] = 0 return true end function creatureSayCallback(cid, type, msg) local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if(not npcHandler:isFocused(cid)) then return false end local vocationsNameId = { {name = "Lutador", id = 4}, -- nome da vocação, id {name = "Defensor", id = 8} } local startstorageid = 30031 local msg = string.lower(msg) if getPlayerStorageValue(cid, startstorageid) == 1 then selfSay("You has changed your vocation!", cid) npcHandler:onCreatureDisappear(cid) end if getPlayerVocationId(cid, 12) == false then elseif getPlayerLevel(cid) <= 49 then selfSay("You dont change your vocation and You need level 50 to change vocation.", cid) npcHandler:onCreatureDisappear(cid) end if msgcontains(msg, 'yes') and talkState[talkUser] == nil or talkState[talkUser] == 0 then selfSay("You want to change your vocation?", cid) talkState[talkUser] = 2 elseif msgcontains(msg, 'no') and talkState[talkUser] == nil or talkState[talkUser] == 0 then talkState[talkUser] = 0 npcHandler:onCreatureDisappear(cid) elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then selfSay("Ok, you change to {"..(vocationsNameId[1].name).."} or {"..(vocationsNameId[2].name).."}?", cid) talkState[talkUser] = 3 elseif msgcontains(msg, 'no') and talkState[talkUser] == 2 then talkState[talkUser] = 0 npcHandler:onCreatureDisappear(cid) elseif msgcontains(msg, string.lower(vocationsNameId[1].name)) and talkState[talkUser] == 3 then selfSay("You want to change your vocation to {"..(vocationsNameId[1].name).."}?", cid) setPlayerStorageValue(cid, startstorageid, 1) talkState[talkUser] = 4 elseif msgcontains(msg, string.lower(vocationsNameId[2].name)) and talkState[talkUser] == 3 then selfSay("You want to change your vocation to {"..(vocationsNameId[2].name).."}?", cid) setPlayerStorageValue(cid, startstorageid, 1) talkState[talkUser] = 4 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 4 then doPlayerSetVocation(cid, vocationsNameId[getPlayerStorageValue(cid, startstorageid)].id) doSendMagicEffect(getCreaturePosition(cid), 29) setPlayerStorageValue(cid, startstorageid, 1) selfSay("Ok, you have changed this vocation to vocation {"..(vocationsNameId[getPlayerStorageValue(cid, startstorageid)].name).."}.", cid) talkState[talkUser] = 0 npcHandler:onCreatureDisappear(cid) elseif msgcontains(msg, 'no') and talkState[talkUser] == 4 then talkState[talkUser] = 0 npcHandler:onCreatureDisappear(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) não prestei atenção nas aulas de LP Também não funcionou. ele fica parado na primeira frase. " 20:40 Promoter Lutador: Hello Mr Tank. Hello I can change your vocation, are you sure ? 20:40 Mr Tank [115]: yes 20:40 Mr Tank [115]: change 20:40 Mr Tank [115]: vocation 20:41 Mr Tank [115]: defensor 20:41 Mr Tank [115]: guerreiro" consegui fazer um aqui, ta trocando a vocação o unico problema é que não salva, quando o char reloga ele ta na vocação inicial vou passar ele aqui <npc name="Oracle Lutador Promoter" floorchange="0" walkinterval="0" access="5"> <health now="150" max="150"/> <look typeex="1448"/> <interaction range="3" idletime="30"> <interact keywords="hi" focus="1"> <!--These are the keywords will trigger this interaction--> <keywords>hello</keywords> <keywords>greet</keywords> <response> <action name="script"> <![CDATA[ if(getPlayerLevel(cid)) >= 50 then selfSay(getCreatureName(cid) .. ", ARE YOU PREPARED O FACE YOUR DESTINY?") _state.b1 = (isPremium(cid) == TRUE) _state.topic = 1 else selfSay("CHILD! COME BACK WHEN YOU HAVE GROWN UP!") _state.isidle = true end ]]> </action> </response> </interact> <interact keywords="yes" topic="1"> <response text=" WHAT PROFESSION HAVE YOU CHOSEN: Defensor or Guerreiro?"> <!--n1: 1 = prudence, 2 = edron, 3 = thais, 4 = venore--> <action name="script"> <![CDATA[ _state.topic = 2 ]]> </action> </response> </interact> <interact keywords="defensor" topic="2"> <response text="Um Defensor, grande defesa e vida sem limites, pronto para proteger seus amigos em dungeons e contra monstros que sem voce seria hitkill em todo o grupo. Voce sera imortal!! Esta pronto para este destino ?"> <!--n2: 8 = defensor, 12 = guerreiro--> <action name="script"> <![CDATA[ _state.n2 = 8 _state.topic = 4 ]]> </action> </response> </interact> <interact keywords="guerreiro" topic="2"> <response text="Um Guerreiro! Um combatente de forças inimaginaveis capaz de causar danos estrondosos aos inimigos com seus machados de duas mãos. São capazes de matar inimigos com um unico golpe! Tem certeza deste destino?"> <!--n2: 8 = defensor, 12 = guerreiro--> <action name="script"> <![CDATA[ _state.n2 = 12 _state.topic = 4 ]]> </action> </response> </interact> <!--If the player does not say any profession, repeat our question--> <interact keywords="|*|" topic="3"> <response text="Guerreiro ou Defensor?"/> </interact> <interact keywords="yes" topic="4"> <response> <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore--> <!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid--> <action name="script"> <![CDATA[ selfSay("SO BE IT!") doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) doPlayerSetVocation(cid, _state.n2) return true ]]> </action> <action name="idle" value="1"/> </response> </interact> <interact keywords="bye" focus="0"> <keywords>farewell</keywords> <response text="Good bye. Recommend us, if you were satisfied with our service."/> </interact> <!--This event triggers if the player goes to far away from the npc/logout/idle timeout--> <interact event="onPlayerLeave" focus="0"> <response text="How Rude!"/> </interact> </interaction> </npc> Editado Maio 8, 2015 10 anos por paulovbonfim (veja o histórico de edições)
Postado Maio 8, 2015 10 anos <npc name="Oracle Lutador Promoter" floorchange="0" walkinterval="0" access="5"> <health now="150" max="150"/> <look typeex="1448"/> <interaction range="3" idletime="30"> <interact keywords="hi" focus="1"> <!--These are the keywords will trigger this interaction--> <keywords>hello</keywords> <keywords>greet</keywords> <response> <action name="script"> <![CDATA[ if(getPlayerLevel(cid)) >= 50 then selfSay(getCreatureName(cid) .. ", ARE YOU PREPARED O FACE YOUR DESTINY?") _state.b1 = (isPremium(cid) == TRUE) _state.topic = 1 else selfSay("CHILD! COME BACK WHEN YOU HAVE GROWN UP!") _state.isidle = true end ]]> </action> </response> </interact> <interact keywords="yes" topic="1"> <response text=" WHAT PROFESSION HAVE YOU CHOSEN: Defensor or Guerreiro?"> <!--n1: 1 = prudence, 2 = edron, 3 = thais, 4 = venore--> <action name="script"> <![CDATA[ _state.topic = 2 ]]> </action> </response> </interact> <interact keywords="defensor" topic="2"> <response text="Um Defensor, grande defesa e vida sem limites, pronto para proteger seus amigos em dungeons e contra monstros que sem voce seria hitkill em todo o grupo. Voce sera imortal!! Esta pronto para este destino ?"> <!--n2: 8 = defensor, 12 = guerreiro--> <action name="script"> <![CDATA[ _state.n2 = 8 _state.topic = 4 ]]> </action> </response> </interact> <interact keywords="guerreiro" topic="2"> <response text="Um Guerreiro! Um combatente de forças inimaginaveis capaz de causar danos estrondosos aos inimigos com seus machados de duas mãos. São capazes de matar inimigos com um unico golpe! Tem certeza deste destino?"> <!--n2: 8 = defensor, 12 = guerreiro--> <action name="script"> <![CDATA[ _state.n2 = 12 _state.topic = 4 ]]> </action> </response> </interact> <!--If the player does not say any profession, repeat our question--> <interact keywords="|*|" topic="3"> <response text="Guerreiro ou Defensor?"/> </interact> <interact keywords="yes" topic="4"> <response> <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore--> <!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid--> <action name="script"> <![CDATA[ selfSay("SO BE IT!") doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) doPlayerSetVocation(cid, _state.n2) doRemoveCreature(cid) return true ]]> </action> <action name="idle" value="1"/> </response> </interact> <interact keywords="bye" focus="0"> <keywords>farewell</keywords> <response text="Good bye. Recommend us, if you were satisfied with our service."/> </interact> <!--This event triggers if the player goes to far away from the npc/logout/idle timeout--> <interact event="onPlayerLeave" focus="0"> <response text="How Rude!"/> </interact> </interaction> </npc> Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais... ________________________________________________________________________________ Minhas Sprites: Mega Metagross Mega Abomasnow Pack de Shinys [Posso atualizá-lo com novos shinys a qualquer momento] Tutoriais: [Completo] Criando e adicionando um novo Pokémon [Actions] Criando quest no RME Editores Lua/Xml/Sync Entre outros: Editores Win/Mac/Linux
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.