DestinationSer
@echo off
- Joined
- Mar 7, 2009
- Messages
- 2,806
- Solutions
- 1
- Reaction score
- 676
I want a NPC that sells 1 million hp or mana for 1 item type of 2159 =ID.
Answer as soon as possible
Answer as soon as possible
-- Credits To: Ruggedmage.
function onUse(cid, item, fromPosition, itemEx, toPosition)
if doPlayerRemoveItem(cid, 2159) then
return setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+1000000)
end
return doPlayerSendCancel(cid, "You don't have this item.")
end
-- Credits To: Ruggedmage.
function onUse(cid, item, fromPosition, itemEx, toPosition)
if doPlayerRemoveItem(cid, 2159) then
return setCreatureMaxMana(cid, getCreatureMaxMana(cid)+1000000)
end
return doPlayerSendCancel(cid, "You don't have this item.")
end
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 buyMana(cid, message, keywords, parameters, node)
if doPlayerRemoveItem(cid, 2159, 1) then
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+1000000)
npcHandler:say("Thank you.", cid)
npcHandler:releaseFocus(cid)
else
npcHandler:say("You don't have items required yet...", cid)
npcHandler:releaseFocus(cid)
end
return true
end
function buyHealth(cid, message, keywords, parameters, node)
if doPlayerRemoveItem(cid, 2159, 1) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+1000000)
npcHandler:say("Thank you.", cid)
npcHandler:releaseFocus(cid)
else
npcHandler:say("You don't have items required yet..", cid)
npcHandler:releaseFocus(cid)
end
return true
end
local node1 = keywordHandler:addKeyword({'mana'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to buy 1000000 mana for xxxx?"})
node1:addChildKeyword({'yes'}, buyMana, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok then.', reset = true})
local node2 = keywordHandler:addKeyword({'health'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to buy 1000000 health for xxxx?"})
node2:addChildKeyword({'yes'}, buyMana, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok then.', reset = true})
npcHandler:addModule(FocusModule:new())