• 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!

Solved [Help please] NPC Riddler teleport broken.

Wuthow

New Member
Joined
Jul 22, 2015
Messages
38
Reaction score
2
Hello!

I'm rather new when it comes to OT's and scripting but I'm learning quickly and doing my best!

I'm currently using the Emporia NPC files and trying to get the Paradox Tower quest to work on my OT. The NPC Oldrak was broken but I've managed to fix him and get things working (with storage ID's and movement + action scripts) all the way until the Riddler inside the Paradox tower. Is there anyone who possibly could take a look at this? I've studied this code for hours now and I don't know what's malfunctioning.

I'm using [8.60] The Forgotten Server 0.3.6 (Crying Damson) V8 and running my server on Win 8.1, while playing the game on another computer which runs windows 7.

I have also already seen this:
https://otland.net/threads/paradox-tower-npc.110086/#post1095997
but Cykotitan's script broke the NPC completely for me and I've tried re-writing that code etc but I didn't manage to get anything to work.

What I can tell you is that everything's working fine when I talk to him (except that his replies are outside of the "NPC-window" but that isn't a big issue to me...). He gives the replies he's supposed to all the way until he asks what 1+1 is. When I answer that, he's supposed to teleport me to hellgate but that doesn't happen (he never teleports me... and actually, nothing happens at all!). (He's also supposed to teleport you if you answer wrongly, which he also doesn't do).

If I've understood the code correctly, the statement " elseif msgcontains(msg, keyword11) == nil and talkState == 10 then" basically says that in talkstate 10, if I say anything other than the reply which is stored in keyword11, he'll reply with the WRONG! and teleport me.

I think I've also managed to find the different sections in the code;
i) First part after the config is the code segment for when you return to him after you've spoken to a prisoner. (Which I haven't managed to test out yet but it looks like it'd function properly)
ii) Then comes the part with the wrong answers and when you're supposed to get teleported if you answer incorrectly (this is for the second time you talk to him, so I haven't tested it out)
iii) After that comes the part where you have your first discussion with him and you answer the questions for the test. (Works correctly until his last question and he's supposed to say you answered wrong and send you to hellgate)
iv) After that, we have the part with the wrong answers for the first time you talk to him. If you answer incorrectly, he's supposed to send you to hellgate (which doesn't work)

I have checked the coordinates for the posFail and posPass and they're both correct.
The storage value of storage 6667 is equal to one for my character.
The storage value of storage 6668 is nonexistant at the moment and as I see it, I'll update that in the "A Prisoner"-NPC when I talk to him after having been sent to hellgate (which later on will let me access the remaining part of the dialogue with the Riddler (i and ii)

Lastly, if someone has a LUA file for the last NPC in the quest (A Prisoner) with working storages etc, I'd be glad if they could provide me with it (else I feel confident that I can make it by myself but it'll take some time)


I really wish someone could help me out with this, it'd help me a lot and I'd probbably improve a lot with my scripting if somebody does! Please help me, I've done all I can by myself :(

--------
Code in next reply, I wasn't able to post it in this one because the message was too long.
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
if (not npcHandler:isFocused(cid)) then
        return false
    end

   

    -- start config
    local queststate1 = getPlayerStorageValue(cid,6667)
    local queststate2 = getPlayerStorageValue(cid,6668)
    local response01 = "Death awaits those who fail the test of the three seals! Do you really want me to test you?"
    local response02 = "FOOL! Now you're doomed! But well ... So be it! Let's start out with the Seal of Knowledge and the first question: What name did the necromant king choose for himself?"
    local response03 = "HOHO! You have learned your lesson well. Question number two then: Who or what is the feared Hugo?"
    local response04 = "HOHO! Right again. All right. The final question of the first seal: Who was the first warrior to follow the path of the Mooh'Tah?"
    local response05 = "HOHO! Lucky you. You have passed the first seal! So ... would you like to continue with the Seal of the Mind?"
    local response06 = "As you wish, foolish one! Here is my first question: Its lighter then a feather but no living creature can hold it for ten minutes?"
    local response07 = "That was an easy one. Let's try the second: If you name it, you break it."
    local response08 = "Hm. I bet you think you're smart. All right. How about this: What does everybody want to become but nobody to be?"
    local response09 = "ARGH! You did it again! Well all right. Do you wish to break the Seal of Madness?"
    local response10 = "GOOD! So I will get you at last. Answer this: What is my favourite colour?"
    local response11 = "UHM UH OH ... How could you guess that? Are you mad??? All right. Question number two: What is the opposite?"
    local response12 = "NO! NO! NO! That can't be true. You're not only mad, you are a complete idiot! Ah well. Here is the last question: What is 1 plus 1?"
    local response13 = "WRONG!"
    local response14 = "RIGHT!"

    local wrong = "NO! HAHA! YOU FAILED!"
    local keywordAbadon = "no"
    local abadon = "Better for you..."

    -- all keywords MUST be lower-case
    local keyword01 = "test"
    local keyword02 = "yes"
    local keyword03 = "goshnar"
    local keyword04 = "demonbunny"
    local keyword05 = "tha'kull"
    local keyword06 = "yes"
    local keyword07 = "breath"
    local keyword08 = "silence"
    local keyword09 = "old"
    local keyword10 = "yes"
    local keyword11 = "green"
    local keyword12 = "none"
    local keyword13 = "1132asas"
    local keyword14 = "2"
   
    local posPass = {x=32478, y=31905, z=1, stackpos=0}
    local posFail = {x=32725, y=31589, z=12, stackpos=0}

    -- end config
    if msgcontains(msg, keyword01) and queststate2 == 1 then
    npcHandler:say('response01', cid)
        talkState = 13
    elseif msgcontains(msg, keyword02) and talkState == 13 then
        selfSay(response02)
        talkState = 14
    elseif msgcontains(msg, keywordAbadon) and talkState == 13 then
        selfSay(abadon)
        talkState = 0
    -- let's start the right answers
    elseif msgcontains(msg, keyword03) and talkState == 14 then
        selfSay(response03)
        talkState = 15
    elseif msgcontains(msg, keyword04) and talkState == 15 then
        selfSay(response04)
        talkState = 16
    elseif msgcontains(msg, keyword05) and talkState == 16 then
        selfSay(response05)
        talkState = 17
    elseif msgcontains(msg, keyword06) and talkState == 17 then
        selfSay(response06)
        talkState = 18
    elseif msgcontains(msg, keyword07) and talkState == 18 then
        selfSay(response07)
        talkState = 19
    elseif msgcontains(msg, keyword08) and talkState == 19 then
        selfSay(response08)
        talkState = 20
    elseif msgcontains(msg, keyword09) and talkState == 20 then
        selfSay(response09)
        talkState = 21
    elseif msgcontains(msg, keyword10) and talkState == 21 then
        selfSay(response10)
        talkState = 22
    elseif msgcontains(msg, keyword11) and talkState == 22 then
        selfSay(response11)
        talkState = 23
    elseif msgcontains(msg, keyword12) and talkState == 23 then
        selfSay(response12)
        talkState = 24
    elseif msgcontains(msg, keyword14) and talkState == 24 then
        doTeleportThing(cid,posPass)
        selfSay(response14)
    -- let's start the wrong answers annd the "death" teleport :D
    elseif msgcontains(msg, keyword03) == nil and talkState == 13 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword04) == nil and talkState == 14 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword05) == nil and talkState == 15 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword06) == nil and talkState == 16 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword07) == nil and talkState == 17 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword08) == nil and talkState == 18 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword09) == nil and talkState == 19 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword10) == nil and talkState == 20 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword11) == nil and talkState == 21 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword12) == nil and talkState == 22 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword13) == nil and talkState == 23 then
        selfSay(wrong)
        talkState = 0
 
I had to cut the code in two pieces because it had 10170ish signs and max was 10k ^^;
Here's the rest:
Code:
    --1st--
    elseif msgcontains(msg, keyword01) and queststate1 == 1 then
        selfSay(response01)
        talkState = 1
    elseif msgcontains(msg, keyword02) and talkState == 1 then
        selfSay(response02)
        talkState = 2
    elseif msgcontains(msg, keywordAbadon) and talkState == 1 then
        selfSay(abadon)
        talkState = 0
    -- let's start the right answers
    elseif msgcontains(msg, keyword03) and talkState == 2 then
        selfSay(response03)
        talkState = 3
    elseif msgcontains(msg, keyword04) and talkState == 3 then
        selfSay(response04)
        talkState = 4
    elseif msgcontains(msg, keyword05) and talkState == 4 then
        selfSay(response05)
        talkState = 5
    elseif msgcontains(msg, keyword06) and talkState == 5 then
        selfSay(response06)
        talkState = 6
    elseif msgcontains(msg, keyword07) and talkState == 6 then
        selfSay(response07)
        talkState = 7
    elseif msgcontains(msg, keyword08) and talkState == 7 then
        selfSay(response08)
        talkState = 8
    elseif msgcontains(msg, keyword09) and talkState == 8 then
        selfSay(response09)
        talkState = 9
    elseif msgcontains(msg, keyword10) and talkState == 9 then
        selfSay(response10)
        talkState = 10
    elseif msgcontains(msg, keyword11) and talkState == 10 then
        selfSay(response11)
        talkState = 11
    elseif msgcontains(msg, keyword12) and talkState == 11 then
        selfSay(response12)
        talkState = 12
    elseif msgcontains(msg, keyword13) == nil and talkState == 12 then
        selfSay(response13)
        doTeleportThing(cid,posFail)
    -- let's start the wrong answers annd the "death" teleport :D
    elseif msgcontains(msg, keyword03) == nil and talkState == 2 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword04) == nil and talkState == 3 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)

    elseif msgcontains(msg, keyword05) == nil and talkState == 4 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword06) == nil and talkState == 5 then
        selfSay(wrong)
        talkState = 0


        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword07) == nil and talkState == 6 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword08) == nil and talkState == 7 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword09) == nil and talkState == 8 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword10) == nil and talkState == 9 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword11) == nil and talkState == 10 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword12) == nil and talkState == 11 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
    elseif msgcontains(msg, keyword13) == nil and talkState == 12 then
        selfSay(wrong)
        talkState = 0
        doTeleportThing(cid,posFail)
       


    end
    return true
end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Got some help from @ZooTeam
It showed that changing the words of nil to false made the script work! That leaves this as solved. Hope it helps someone in the future.
 
Back
Top