Ir para conteúdo
  • 0

[Resolvido] NPC Item For Teleport


Step Records

Pergunta

7 respostass a esta questão

Posts Recomendados

  • 0
3 horas atrás, Step Records disse:
Versão do Servidor: TFS - 0.3.4
Tipo de Script: npc

Olá, eu precisaria de um script NPC que possa nos teletransportar para um determinado local para a posição. No entanto, tente ou certifique-se de ter um teleport

 

Let me see if I understand, you want a script that the player is teleported to an X position?

Link para o comentário
Compartilhar em outros sites

  • 0
9 horas atrás, Step Records disse:
Versão do Servidor: TFS - 0.3.4
Tipo de Script: npc

Hello, I would need a NPC script that can teleport us to a given place for the position. However, try or make sure you have a teleport

Good friend, I do not quite understand what you're looking for.
But I'll try to help you by what I understood in the title of the topic.

Go into data/ npc / scripts and create an itemtravel.lua file and dump it in:

Spoiler

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

local pos = {x=152,y=58,z=7} -------------- position where the player will be taken
local itemid = 2468 ----------------- Id of the item to be removed from the player

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

   if msgcontains(msg, "offer") or msgcontains(msg, "help") then
       selfSay("Can I take you to this place for a "..getItemNameById(itemid).." item, speak {travel} if you want to travel", cid)
       talkState[cid] = 0
   elseif msgcontains(msg, 'travel') then
      if doPlayerRemoveItem(cid, itemid, 1) then
       selfSay("Good trip.", cid)
    doTeleportThing(cid, pos)
    else
    selfSay("You do not have the required item.", cid)
    end
    end
    return TRUE   
    end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Then go back and create a NOMEDONPC.xml file and put it in:

Spoiler

<npc name="NOMEDONPC" script="data/npc/scripts/itemtravel.lua" walkinterval="2000" floorchange="0">
   <health now="100" max="100"/>
   <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>
       <parameters>
               <parameter key="message_greet" value="Hi. For more information on my services, speak {offer}." />
               <parameter key="message_farewell" value="Bye." />
               <parameter key="message_walkaway" value="Bye." />
       </parameters>
</npc>

 

 

DO NOT FORGET TO CONFIGURE PLAYER DESTINY AND ITEMID ON SCRIPT ....


This script is set to remove the item from the player when it is teleported, but if you want the player to keep the item, let me know.
I hope this helps. ^^

Link para o comentário
Compartilhar em outros sites

  • 0
23 horas atrás, Sepulturaa disse:

Good friend, I do not quite understand what you're looking for.
But I'll try to help you by what I understood in the title of the topic.

Go into data/ npc / scripts and create an itemtravel.lua file and dump it in:

  Mostrar conteúdo oculto


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

local pos = {x=152,y=58,z=7} -------------- position where the player will be taken
local itemid = 2468 ----------------- Id of the item to be removed from the player

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

   if msgcontains(msg, "offer") or msgcontains(msg, "help") then
       selfSay("Can I take you to this place for a "..getItemNameById(itemid).." item, speak {travel} if you want to travel", cid)
       talkState[cid] = 0
   elseif msgcontains(msg, 'travel') then
      if doPlayerRemoveItem(cid, itemid, 1) then
       selfSay("Good trip.", cid)
    doTeleportThing(cid, pos)
    else
    selfSay("You do not have the required item.", cid)
    end
    end
    return TRUE   
    end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Then go back and create a NOMEDONPC.xml file and put it in:

  Mostrar conteúdo oculto


<npc name="NOMEDONPC" script="data/npc/scripts/itemtravel.lua" walkinterval="2000" floorchange="0">
   <health now="100" max="100"/>
   <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>
       <parameters>
               <parameter key="message_greet" value="Hi. For more information on my services, speak {offer}." />
               <parameter key="message_farewell" value="Bye." />
               <parameter key="message_walkaway" value="Bye." />
       </parameters>
</npc>

 

 

DO NOT FORGET TO CONFIGURE PLAYER DESTINY AND ITEMID ON SCRIPT ....


This script is set to remove the item from the player when it is teleported, but if you want the player to keep the item, let me know.
I hope this helps. ^^

[04/11/2018 22:18:42] [Error - LuaScriptInterface::loadFile] data/npc/scripts/shiny.lua:5: unexpected symbol near 'ď'
[04/11/2018 22:18:42] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/shiny.lua
[04/11/2018 22:18:42] data/npc/scripts/shiny.lua:5: unexpected symbol near 'ď'

Link para o comentário
Compartilhar em outros sites

  • 0
1 hora atrás, Step Records disse:

[04/11/2018 22:18:42] [Error - LuaScriptInterface::loadFile] data/npc/scripts/shiny.lua:5: unexpected symbol near 'ď'
[04/11/2018 22:18:42] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/shiny.lua
[04/11/2018 22:18:42] data/npc/scripts/shiny.lua:5: unexpected symbol near 'ď'

Use this one, I've tested it now and it's 100%

 

travel.lua

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...