• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Teleport/msg bug with dederin

Lopaskurwa

Well-Known Member
Joined
Oct 6, 2017
Messages
936
Solutions
2
Reaction score
57
Hi
so i have problem with dederin he dont want to teleport me because of some kind of ticked, but idk which line ask me for ticked so i have no idea which line should i delete
(Dederin code in npc/scripts)
[Pawn] local STORAGE = 4150 -- Storage necessária para viajar local smallcity = {x=10 - Pastebin.com
(Dederin code in npc)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Dederin" script="dederin.lua" walkinterval="0">
    <health now="100" max="100"/>
    <look type="459"/>
    <parameters>
        <parameter key="module_shop" value="1"/>
        <parameter key="message_greet" value="I can take you to {Small City}, {Namek Island}, {Big City}, {Ice City}, {Frozen City}, {West Island}, {East Island}, {Broken City}, {Assassin Tower} (100 zeni everywhere)"/>
    </parameters>
</npc>
And other problem is that my msg is duplicated he send in NPC and in DEFAULT chat i want to make it send only in NPC. Idk where is problem
 
I think you can use this, with all these values removed, try it and tell me if it works:

LUA:
local smallcity = {x=107, y=200, z=7}
local namekisland = {x=461, y=447, z=5}
local bigcity = {x=117, y=102, z=7}
local icecity = {x=315, y=179, z=7}
local frozencity = {x=477, y=643, z=7}
local westisland = {x=83, y=39, z=7}
local eastisland = {x=111, y=39, z=7}
local brokencity = {x=99, y=343, z=7}
local assassintower = {x=254, y=393, z=7}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid)         npcHandler:onCreatureAppear(cid)         end
function onCreatureDisappear(cid)      npcHandler:onCreatureDisappear(cid)         end
function onCreatureSay(cid, type, msg)   npcHandler:onCreatureSay(cid, type, msg:lower())   end
function onThink()                  npcHandler:onThink()                  end
local talkState = {}
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, "travel") then
        selfSay("Eu posso te levar para {Small City}, {Namek Island}, {Big City}, {Ice City}, {Frozen City}, {West Island}, {East Island}, {Broken City}, {Assassin Tower} e {Castle War}.", cid)
    end
    if msgcontains(msg, "small city") then
        if not isPlayerPzLocked(cid) then
            doSendMagicEffect(getThingPos(cid), 10)
            npcHandler:releaseFocus(cid)
            doTeleportThing(cid, smallcity)
            doSendMagicEffect(smallcity, 10)
        else
            selfSay("Voce deve estar sem pz locked!", cid)
        end
    talkState[talkUser] = 0
    end
   
    if msgcontains(msg, "namek island") then
        if not isPlayerPzLocked(cid) then
            doSendMagicEffect(getThingPos(cid), 10)
            npcHandler:releaseFocus(cid)
            doTeleportThing(cid, namekisland)
            doSendMagicEffect(namekisland, 10)
        else
            selfSay("Voce deve estar sem pz locked!", cid)
        end
    talkState[talkUser] = 0
    end
    if msgcontains(msg, "big city") then
        if not isPlayerPzLocked(cid) then
            doSendMagicEffect(getThingPos(cid), 10)
            npcHandler:releaseFocus(cid)
            doTeleportThing(cid, bigcity)
            doSendMagicEffect(bigcity, 10)
        else
            selfSay("Voce deve estar sem pz locked!", cid)
        end
    talkState[talkUser] = 0
    end
   
    if msgcontains(msg, "ice city") then
        if not isPlayerPzLocked(cid) then
            doSendMagicEffect(getThingPos(cid), 10)
            npcHandler:releaseFocus(cid)
            doTeleportThing(cid, icecity)
            doSendMagicEffect(icecity, 10)
        else
            selfSay("Voce deve estar sem pz locked!", cid)
        end
    talkState[talkUser] = 0
    end
   
    if msgcontains(msg, "frozen city") then
        if not isPlayerPzLocked(cid) then
            doSendMagicEffect(getThingPos(cid), 10)
            npcHandler:releaseFocus(cid)
            doTeleportThing(cid, frozencity)
            doSendMagicEffect(frozencity, 10)
        else
            selfSay("Voce deve estar sem pz locked!", cid)
        end
    talkState[talkUser] = 0
    end
   
    if msgcontains(msg, "west island") then
        if not isPlayerPzLocked(cid) then
            doSendMagicEffect(getThingPos(cid), 10)
            npcHandler:releaseFocus(cid)
            doTeleportThing(cid, westisland)
            doSendMagicEffect(westisland, 10)
        else
            selfSay("Voce deve estar sem pz locked!", cid)
        end
    talkState[talkUser] = 0
    end
   
    if msgcontains(msg, "east island") then
        if not isPlayerPzLocked(cid) then
            doSendMagicEffect(getThingPos(cid), 10)
            npcHandler:releaseFocus(cid)
            doTeleportThing(cid, eastisland)
            doSendMagicEffect(eastisland, 10)
        else
            selfSay("Voce deve estar sem pz locked!", cid)
        end
    talkState[talkUser] = 0
    end
   
    if msgcontains(msg, "broken city") then
        if not isPlayerPzLocked(cid) then
            doSendMagicEffect(getThingPos(cid), 10)
            npcHandler:releaseFocus(cid)
            doTeleportThing(cid, brokencity)
            doSendMagicEffect(brokencity, 10)
        else
            selfSay("Voce deve estar sem pz locked!", cid)
        end
    talkState[talkUser] = 0
    end
   
    if msgcontains(msg, "assassin tower") then
        if not isPlayerPzLocked(cid) then
            doSendMagicEffect(getThingPos(cid), 10)
            npcHandler:releaseFocus(cid)
            doTeleportThing(cid, assassintower)
            doSendMagicEffect(assassintower, 10)
        else
            selfSay("Voce deve estar sem pz locked!", cid)
        end
    talkState[talkUser] = 0
    end
   
   return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
@lokolokio YES! you was right if i delete all values everything work. So now left last problem with duplicate msg in default and npc chat how to make it send only in npc chat?
 
I think you can use this:
LUA:
npcHandler:say('Voce deve estar sem pz locked!', cid)
Instead:
LUA:
selfSay("Voce deve estar sem pz locked!", cid)
Try it.
 
I think you can use this:
LUA:
npcHandler:say('Voce deve estar sem pz locked!', cid)
Instead:
LUA:
selfSay("Voce deve estar sem pz locked!", cid)
Try it.
What about this part?
Code:
    <parameters>
        <parameter key="module_shop" value="1"/>
        <parameter key="message_greet" value="I can take you to {Small City}, {Namek Island}, {Big City}, {Ice City}, {Frozen City}, {West Island}, {East Island}, {Broken City}, {Assassin Tower} (100 zeni everywhere)"/>
    </parameters>
</npc>
?
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Dederin" script="default.lua" walkinterval="0" floorchange="0">
    <health now="150" max="150"/>
    <look type="459"/>
    <parameters>
        <parameter key="module_travel" value="1"/>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. If you don't know where to flow, say {travel}."/>
        <parameter key="travel_destinations" value="
        smallcity, 107, 200, 7, 0;
        namekisland, 461, 447, 5, 0;
        bigcity, 117, 102, 7, 0;
        icecity, 315, 179, 7, 0;
        frozencity, 477, 643, 7, 0;
        westisland, 83, 39, 7, 0;
        eastisland, 111, 39, 7, 0;
        brokencity, 99, 343, 7, 0;
        assassintower, 254, 393, 7, 0;
        "/>
    </parameters>
</npc>
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Dederin" script="default.lua" walkinterval="0" floorchange="0">
    <health now="150" max="150"/>
    <look type="459"/>
    <parameters>
        <parameter key="module_travel" value="1"/>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. If you don't know where to flow, say {travel}."/>
        <parameter key="travel_destinations" value="
        smallcity, 107, 200, 7, 0;
        namekisland, 461, 447, 5, 0;
        bigcity, 117, 102, 7, 0;
        icecity, 315, 179, 7, 0;
        frozencity, 477, 643, 7, 0;
        westisland, 83, 39, 7, 0;
        eastisland, 111, 39, 7, 0;
        brokencity, 99, 343, 7, 0;
        assassintower, 254, 393, 7, 0;
        "/>
    </parameters>
</npc>
This is not a solution if i re make all codes it will take a lot of time of checking did i make it right so that's why better to try remove npc msg to default chat. I know that i need to use selfSay but i have no idea how should i rewrite this code part
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <npc name="Dederin" script="dederin.lua" walkinterval="0">
  3. <health now="100" max="100"/>
  4. <look type="459"/>
  5. <parameters>
  6. <parameter key="module_shop" value="1"/>
  7. <parameter key="message_greet" value="I can take you to {Small City}, {Namek Island}, {Big City}, {Ice City}, {Frozen City}, {West Island}, {East Island}, {Broken City}, {Assassin Tower} (100 zeni everywhere)"/>
  8. </parameters>
  9. </npc>
 
You do not need to remake it, just copy/paste code, it wont need to modify anything than just the price
City, 123, 456, 7, price;
Nothing, nothing just price part, and not need to worry for file.lua, all servers include default.lua.
 
You do not need to remake it, just copy/paste code, it wont need to modify anything than just the price
City, 123, 456, 7, price;
Nothing, nothing just price part, and not need to worry for file.lua, all servers include default.lua.
But how this will fix msg in default?

bump
 
Last edited by a moderator:
Back
Top