Postado Junho 7, 2014 11 anos Olá TK Friends! Galera, estou precisando de um script de um NPC, ele fará o seguinte: O NPC irá falar "Ola (nome do player), deseja sair deste lugar?", o player irá dizer "sim", o NPC irá teleportar ele para uma position (32097, 32297, 7), mas só se o player for level maior que 50, se o player não for maior que 50 o NPC dirá "Desculpe, voce nao tem level 50 ou maior para sair da Destiny Island, continue upando." Se alguém tiver o script e me ajudar, reputarei o mesmo. Grato Oi
Postado Junho 9, 2014 11 anos Solução Crie um arquivo chamado James.lua na pasta data/npc/scripts e cole isso 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 local cfg = { toPos = {x=32097, y=32297, z=7}, -- Posição que o jogador sera teleportado level = 50, -- Level necessário para ser teleportado price = 0 -- Dinheiro a ser cobrado para ser teleportado } 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, 'sim') then selfSay(' Ola , voce deseja mesmo sair deste lugar ?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then if getPlayerLevel(cid) >= cfg.level then if doPlayerRemoveMoney(cid, cfg.price) then doTeleportThing(cid, cfg.toPos) talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Crie um arquivo chamado Kiru.xml na pasta data/npc e cole isso <?xml version="1.0" encoding="UTF-8"?><npc name="James" script="data/npc/scripts/James.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="128" head="114" body="12" legs="57" feet="114" addons="0" /> <parameters> <parameter key="message_greet" value="Ola, |PLAYERNAME|! voce deseja mesmo sair deste lugar ?"/> <parameter key="message_walkaway" value="Hey Hey, where you go ?"/> <parameter key="message_farewell" value="Bye bye!"/> </parameters></npc>
Postado Junho 11, 2014 11 anos Autor Crie um arquivo chamado James.lua na pasta data/npc/scripts e cole isso 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 local cfg = { toPos = {x=32097, y=32297, z=7}, -- Posição que o jogador sera teleportado level = 50, -- Level necessário para ser teleportado price = 0 -- Dinheiro a ser cobrado para ser teleportado } 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, 'sim') then selfSay(' Ola , voce deseja mesmo sair deste lugar ?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then if getPlayerLevel(cid) >= cfg.level then if doPlayerRemoveMoney(cid, cfg.price) then doTeleportThing(cid, cfg.toPos) talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Crie um arquivo chamado Kiru.xml na pasta data/npc e cole isso <?xml version="1.0" encoding="UTF-8"?> <npc name="James" script="data/npc/scripts/James.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="128" head="114" body="12" legs="57" feet="114" addons="0" /> <parameters> <parameter key="message_greet" value="Ola, |PLAYERNAME|! voce deseja mesmo sair deste lugar ?"/> <parameter key="message_walkaway" value="Hey Hey, where you go ?"/> <parameter key="message_farewell" value="Bye bye!"/> </parameters> </npc> Obrigado meu amigo! Oi
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.