bpm91
Intermediate OT User
- Joined
- May 23, 2019
- Messages
- 928
- Solutions
- 7
- Reaction score
- 127
- Location
- Brazil
- YouTube
- caruniawikibr
hello, i started editing my quests, and i would like to know how i do for npc or anything to set an action id on the item, for example a key..
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
function key(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
local player_gold = getPlayerItemCount(cid,2148)
local player_plat = getPlayerItemCount(cid,2152)*100
local player_crys = getPlayerItemCount(cid,2160)*10000
local player_money = player_gold + player_plat + player_crys
if player_money >= 800 then
if doPlayerRemoveMoney(cid,800) then
npcHandler:say('Here, take the key!', cid)
local playerID = getPlayerGUID(cid)
local item = doPlayerAddItem(cid, 2087, 1)
doItemSetActionId(item, 3940)
end
else
npcHandler:say('You don\'t have enough money for the key!', cid)
end
end
node4 = keywordHandler:addKeyword({'key'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get the fibula key you need to give me 800 gold coins, do you have them with you?'})
node4:addChildKeyword({'yes'}, key, {})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})
npcHandler:addModule(FocusModule:new())