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

Problem Sweaty Cyclops

Michaeel

New Member
Joined
Mar 6, 2009
Messages
272
Reaction score
1
Hey I have problem with sweety cyclops, he says that i don't have required items but i have items! :(

Code:
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)    end
function onThink()                npcHandler:onThink()                end


function obsidian(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2516) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
        if doPlayerRemoveItem(cid,2516,1) and doPlayerRemoveItem(cid,2425,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5908,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
    end
end	

function crude(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2393) >= 1 then
        if doPlayerRemoveItem(cid,2393,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5892,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
    end
end

function draconian(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2516) >= 1 then
        if doPlayerRemoveItem(cid,2516,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5889,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
   end   
end

function hell(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2462) >= 1 then
        if doPlayerRemoveItem(cid,2462,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5888,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
   end   
end

function royal(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2487) >= 1 then
        if doPlayerRemoveItem(cid,2487,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5887,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
   end   
end

function infernal(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,5944) >= 1 then
        if doPlayerRemoveItem(cid,5944,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,6529,4)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
   end   
end


keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can forge {Obsidian Knife}, {Infernal Bolt}, {Huge Chunk of Crude Iron}, {Piece of Hell Steel}, {Piece of Royal Steel} and {Piece of Draconian Steel}!"})

local node1 = keywordHandler:addKeyword({'obsidian'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield and an Obsidian Lance for a Obsidian Knife?'})
    node1:addChildKeyword({'yes'}, obsidian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

local node2 = keywordHandler:addKeyword({'crude'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Good iron is. Me friends use it much for fight. Me can make from weapon. Lil\' one want to trade?'})
    node2:addChildKeyword({'yes'}, crude, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
	
local node3 = keywordHandler:addKeyword({'draconian'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Firy steel it is. Need green ones\' breath to melt. Or red even better. Me can make from shield. Lil\' one want to trade?'})
    node3:addChildKeyword({'yes'}, draconian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
	
local node4 = keywordHandler:addKeyword({'hell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Hellsteel is. Cursed and evil. Dangerous to work with. Me can make from evil helmet. Lil\' one want to trade?'})
    node4:addChildKeyword({'yes'}, draconian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
	
local node5 = keywordHandler:addKeyword({'royal'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Very noble. Shiny. Me like. But breaks so fast. Me can make from shiny armour. Lil\' one want to trade?'})
    node5:addChildKeyword({'yes'}, draconian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
	
local node6 = keywordHandler:addKeyword({'infernal'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Uh. Me can make some nasty lil\' bolt from soul orbs. Lil\' one want to trade all?'})
    node6:addChildKeyword({'yes'}, draconian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

npcHandler:addModule(FocusModule:new())

works: obsidian, crude, draconian
doesn't work: hell, royal, infernal
I haven't idea whats wrong :(
Can someone check it?
 
Try this:

HTML:
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)    end
function onThink()                npcHandler:onThink()                end

-- XVX FORGER START --

function amulet(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,8262) >= 1 and getPlayerItemCount(cid,8263) >= 1 and getPlayerItemCount(cid,8264) >= 1 and  getPlayerItemCount(cid,8265) >= 1 then
        if doPlayerRemoveItem(cid,8262,1) and doPlayerRemoveItem(cid,8263,1) and doPlayerRemoveItem(cid,8264,1) and  doPlayerRemoveItem(cid,8265,1) and (doPlayerRemoveMoney(cid, 5000) == TRUE) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,8266,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
    end
end

function obsidian(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2516) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
        if doPlayerRemoveItem(cid,2516,1) and doPlayerRemoveItem(cid,2425,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5908,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
    end
end	

function crude(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,5879) >= 1 then
        if doPlayerRemoveItem(cid,5879,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5892,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
    end
end

function draconian(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2516) >= 1 then
        if doPlayerRemoveItem(cid,2516,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5889,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
   end   
end

function royal(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2487) >= 1 then
        if doPlayerRemoveItem(cid,2487,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5887,1)
        end
        else
            npcHandler:say('You don\'t have these items!', cid)
   end   
end

-- XVX FORGER END --

keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can forge Amulet, Obsidian Knife, Huge Chunk of Crude Iron, Piece of Royal Steel, and Piece of Draconian Steel!"})

local node1 = keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Hum Humm! Welcume lil. Me can do unbroken but Big Ben want gold 5000 and Big Ben need a lil time to make it unbroken. Yes or no??'})
    node1:addChildKeyword({'yes'}, amulet, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

local node2 = keywordHandler:addKeyword({'obsidian'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield and an Obsidian Lance for a Obsidian Knife?'})
    node2:addChildKeyword({'yes'}, obsidian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

local node3 = keywordHandler:addKeyword({'crude'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Giant Spider Silk for a Huge Chunk of Crude Iron?'})
    node3:addChildKeyword({'yes'}, crude, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
	
local node4 = keywordHandler:addKeyword({'draconian'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield for a Piece of Draconian Steel?'})
    node4:addChildKeyword({'yes'}, draconian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
	
local node5 = keywordHandler:addKeyword({'royal'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Crown Armor for a Piece of Royal Steel?'})
    node5:addChildKeyword({'yes'}, royal, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})	

npcHandler:addModule(FocusModule:new())

Add infernal bolts if you feel like you need it.
 
try this:
this is full Sweaty Cyc working
A Sweaty Cyclops.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="A Sweaty Cyclops" script="data/npc/scripts/Sweaty Cyclops.lua" walkinterval="2000" floorchange="0" access="5" >
    <health now="150" max="150"/>
    <look type="22" corpse="2212"/>
   
    <parameters>
        <parameter key="message_greet" value="Hum Humm! Welcume lil' Player.."/>
        <parameter key="message_farewell" value="Good bye lil' one."/>
    </parameters>
</npc>


Script:
Sweaty Cyclops.lua
Code:
  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

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

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
        local cycmsg = 'Cling Clang!'
        local noimsg = 'Lil\' one no have that thing!'
        local deny      =       'Lil\' one is no sure? Okay'
        local infbolt = 4 -- change this to adjust the number of infernal bolts you want to give to the players for 1 soul orb.


--------------------MESSAGES------------------------------------------------------------------------------
    if msgcontains(msg, 'help') or msgcontains(msg, 'trade') then
                selfSay('Me can make {royal steel}, {draconian steel}, {hell steel} and {crude iron}. Me also make lil\' {infernal bolt}.', cid)
       
        elseif msgcontains(msg, 'royal steel') then
        selfSay('Very noble. Shiny. Me like. But breaks so fast. Me can make from shiny armour. Lil\' one want to trade?', cid)
        talkState[talkUser] = 1
   
    elseif msgcontains(msg, 'draconian steel') then
        selfSay('Firy steel it is. Need green ones\' breath to melt. Or red even better. Me can make from shield. Lil\' one want to trade?', cid)
                talkState[talkUser] = 2

    elseif msgcontains(msg, 'hell steel') then
        selfSay('Hellsteel is. Cursed and evil. Dangerous to work with. Me can make from evil helmet. Lil\' one want to trade?', cid)
                talkState[talkUser] = 3
               
    elseif msgcontains(msg, 'crude iron') then
        selfSay('Good iron is. Me friends use it much for fight. Me can make from weapon. Lil\' one want to trade?', cid)
                talkState[talkUser] = 4
       
        elseif msgcontains(msg, 'infernal bolt') then
                selfSay('Uh. Me can make some nasty lil\' bolt from soul orbs. Lil\' one want to trade all?', cid)
                talkState[talkUser] = 5
               
-------------GETTING METALS FROM HIM-------------------
       
        -- Royal Steel
        elseif talkState[talkUser] == 1 then
                if msgcontains(msg, 'yes') then
                        if doPlayerTakeItem(cid, 2487, 1) == true then
                                doPlayerAddItem(cid, 5887, 1)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                        end
                else
                        selfSay(deny, cid)
                end
                talkState[talkUser] = 0
        -- Draconian Steel
        elseif talkState[talkUser] == 2 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 2516, 1) == true then
                                doPlayerAddItem(cid, 5889, 1)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                        end
                else
                        selfSay(deny, cid)
                end
                talkState[talkUser] = 0
        -- Hell Steel
        elseif talkState[talkUser] == 3 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 2462, 1) == true then
                                doPlayerAddItem(cid, 5888, 1)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                        end
                else
                        selfSay(deny, cid)
                end
                talkState[talkUser] = 0
        -- Crude Iron
        elseif talkState[talkUser] == 4 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 2393, 1) == true then
                                doPlayerAddItem(cid, 5892, 1)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                        end
                else
                        selfSay(deny, cid)
                end
                talkState[talkUser] = 0
        elseif talkState[talkUser] == 5 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 5944, 1) == true then
                                doPlayerAddItem(cid, 6529, infbolt)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                        end
                else
                        selfSay(deny, cid)
                end
                talkState[talkUser] = 0
        end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

REP+ if i helped u
 
Back
Top