Postado Maio 14, 2013 12 anos Olá a todos bom se puderem por favor fazer um script de um npc que teleporta para tau lugar mas o player tem que ter level +170 para ele teleportar.Ex: HiOlá, você quer ir para a rocket quest? fale rocketrocketTem certeza que quer mesmo ir? você não poderá voltaryesAqui o local: {x=359,y=1667,z=7} Base: Pokemon Centurion 4.0
Postado Maio 14, 2013 12 anos Este é um post popular. Olá a todos bom se puderem por favor fazer um script de um npc que teleporta para tau lugar mas o player tem que ter level +170 para ele teleportar. Ex: Hi Olá, você quer ir para a rocket quest? fale rocket rocket Tem certeza que quer mesmo ir? você não poderá voltar yes Aqui o local: {x=359,y=1667,z=7} Base: Pokemon Centurion 4.0 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=359, y=1667, z=7}, -- Posição que o jogador sera teleportado level = 170, -- Level necessário para ser teleportado price = 50 -- 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, 'rocket') then selfSay('You are sure you want to go? You can not return.', 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()) Configurando local cfg = { toPos = {x=359, y=1667, z=7}, -- Posição que o jogador sera teleportado level = 170 -- Level necessário para ser teleportado price = 50 -- Dinheiro a ser cobrado para ser teleportado } Está tudo comentado então não há necessidade de explicar 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="Hello, |PLAYERNAME|! Would like to travel to {rocket} quest?"/> <parameter key="message_walkaway" value="Hey Hey, where you go ?"/> <parameter key="message_farewell" value="Bye bye!"/> </parameters> </npc> Não testado. Dúvidas? Me avise. Att. Giovani Rodrigo Editado Maio 15, 2013 12 anos por GiovaniRodrigo (veja o histórico de edições) Spoiler local config = { delrey = getPlayerCarValue(cid, DELREY), cigarro = getPlayerCancer(cid, DERBY), prostituta = getPlayerAIDS(cid, cracuda), tresOitao = getPlayerRevorvi(cid, 38) } if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS") end
Postado Maio 14, 2013 12 anos Autor Crie um arquivo chamado Kiru.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=359, y=1667, z=7}, -- Posição que o jogador sera teleportado level = 170 -- Level necessário para ser teleportado price = 50 -- 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, 'rocket') then selfSay('You are sure you want to go? You can not return.', 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 '.. 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()) Configurando local cfg = { toPos = {x=359, y=1667, z=7}, -- Posição que o jogador sera teleportado level = 170 -- Level necessário para ser teleportado price = 50 -- Dinheiro a ser cobrado para ser teleportado } Está tudo comentado então não há necessidade de explicar Crie um arquivo chamado Kiru.xml na pasta data/npc e cole isso ?xml version="1.0" encoding="UTF-8"?> <npc name="Kiru" script="data/npc/scripts/Kiru.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="Hello, |PLAYERNAME|! Would like to travel to {rocket} quest?"/> <parameter key="message_walkaway" value="Hey Hey, where you go ?"/> <parameter key="message_farewell" value="Bye bye!"/> </parameters> </npc> Não testado. Dúvidas? Me avise. Att. Giovani Rodrigo Amigo na hora de colocar o respown do npc no mapa deu esse erro Eu coloquei o nome dele como james ?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="1758" head="114" body="12" legs="57" feet="114" addons="0" /> <parameters> <parameter key="message_greet" value="Hello, |PLAYERNAME|! Would like to travel to {rocket} quest?"/> <parameter key="message_walkaway" value="Hey Hey, where you go ?"/> <parameter key="message_farewell" value="Bye bye!"/> </parameters> </npc> 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=359, y=1667, z=7}, -- Posição que o jogador sera teleportado level = 170 -- Level necessário para ser teleportado price = 50 -- 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, 'rocket') then selfSay('You are sure you want to go? You can not return.', 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 '.. 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())
Postado Maio 14, 2013 12 anos Amigo na hora de colocar o respown do npc no mapa deu esse erro Eu coloquei o nome dele como james ?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="1758" head="114" body="12" legs="57" feet="114" addons="0" /> <parameters> <parameter key="message_greet" value="Hello, |PLAYERNAME|! Would like to travel to {rocket} quest?"/> <parameter key="message_walkaway" value="Hey Hey, where you go ?"/> <parameter key="message_farewell" value="Bye bye!"/> </parameters> </npc> 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=359, y=1667, z=7}, -- Posição que o jogador sera teleportado level = 170 -- Level necessário para ser teleportado price = 50 -- 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, 'rocket') then selfSay('You are sure you want to go? You can not return.', 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 '.. 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()) Pronto arrumei, refaça o NPC. Spoiler local config = { delrey = getPlayerCarValue(cid, DELREY), cigarro = getPlayerCancer(cid, DERBY), prostituta = getPlayerAIDS(cid, cracuda), tresOitao = getPlayerRevorvi(cid, 38) } if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS") end
Postado Maio 14, 2013 12 anos Autor Pronto arrumei, refaça o NPC. Bom na hora de importar deu certo so que quando vou deixar o jogo online aparece em erro e quando entro no jogo o npc não esta la [14/05/2013 11:32:44] [Error - LuaScriptInterface::loadFile] data/npc/scripts/James.lua:17: '}' expected (to close '{' at line 11) near 'price' [14/05/2013 11:32:44] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/James.lua [14/05/2013 11:32:44] data/npc/scripts/James.lua:17: '}' expected (to close '{' at line 11) near 'price' E agora? Editado Maio 14, 2013 12 anos por abmauromacedo (veja o histórico de edições)
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.