• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Lottery Ticket NPC

Majeski20

New Member
Joined
Apr 21, 2008
Messages
602
Reaction score
4
Location
Sweden
Hello guys.

I need an npc that change etc Spider Silks against lottery tickets.
Can somone make one for me please?
 
Npc
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="A Neard" script="data/npc/scripts/neard.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="22" head="0" body="0" legs="0" feet="0"/>
	<parameters>
		<parameter key="message_greet" value="Hum Humm! Welcume |PLAYERNAME|." />
		<parameter key="message_decline" value="Alright then. Come back when you got the neccessary items." />		
		<parameter key="message_walkaway" value="Farewell, human." />
		<parameter key="module_keywords" value="1" />
		<parameter key="keywords" value="job" />
		<parameter key="keyword_reply1" value="I'm an forger." />
	</parameters>
</npc>

neard.lua
LUA:
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,5879) >= 1 then
        if doPlayerRemoveItem(cid,5879,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5957,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 need spider silks!!"})

local node1 = keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Hum Humm! Welcume lil. I can do unbroken but Big Ben want spider silks. 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})


npcHandler:addModule(FocusModule:new())
Untested :p post if it dont work :P
 
Last edited:
Npc
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="A Neard" script="data/npc/scripts/neard.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="22" head="0" body="0" legs="0" feet="0"/>
	<parameters>
		<parameter key="message_greet" value="Hum Humm! Welcume |PLAYERNAME|." />
		<parameter key="message_decline" value="Alright then. Come back when you got the neccessary items." />		
		<parameter key="message_walkaway" value="Farewell, human." />
		<parameter key="module_keywords" value="1" />
		<parameter key="keywords" value="job" />
		<parameter key="keyword_reply1" value="I'm an forger." />
	</parameters>
</npc>

neard.lua
LUA:
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,5879) >= 1 then
        if doPlayerRemoveItem(cid,5879,1) then
            npcHandler:say('Here is your item!', cid)
            doPlayerAddItem(cid,5957,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 need spider silks!!"})

local node1 = keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Hum Humm! Welcume lil. I can do unbroken but Big Ben want spider silks. 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})


npcHandler:addModule(FocusModule:new())
Untested :p post if it dont work :P

He doesnt answer me ..
 
Back
Top