Hello guys.
Can some1 fix that script for meh ? The npc doesnt respond if i say for example 'first brotherhood addon'
Can some1 remake this for me ? Im using the latest tfs (0.3.3)
Can some1 fix that script for meh ? The npc doesnt respond if i say for example 'first brotherhood addon'
Can some1 remake this for me ? Im using the latest tfs (0.3.3)
Code:
--------------------------------------------------------------------------------------------
------------------------------------ Advanced Addon NPC ------------------------------------
-------------------------------- Script made by teh_pwnage ---------------------------------
--------------- Special thanks to: mokerhamer, Xidaozu and Jiddo, deaths'life --------------
------------------------------- Thanks also to everyone else -------------------------------
------------------------------ NPC based on Evolutions V0.7.7 ------------------------------
-----------------------Totally working for The Forgotten Server---------------------------
--------------------------------------------------------------------------------------------
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)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
addon_need_premium = 'Sorry, you need a premium account to get addons.'
addon_have_already = 'Sorry, you already have this addon.'
addon_have_not_items = 'Sorry, you don\'t have these items.'
addon_give = 'Here you are.'
player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
if msgcontains(msg, 'addons') then
selfSay('I can give you Nighmare and Brotherhood addons.')
elseif msgcontains(msg, 'help') then
selfSay('To buy the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'.')
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first brotherhood addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,6500) >= 300 then
selfSay('Did you bring me 300 Demonic essences?')
talk_state = 33
else
selfSay('I need 300 Demonic essences, to give you the first brotherhood addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 33 then
talk_state = 0
if getPlayerItemCount(cid,6500) >= 300 then
addon = getPlayerStorageValue(cid,170001)
if addon == -1 then
if doPlayerTakeItem(cid,6500,300) == 0 then
selfSay(addon_give)
doPlayerAddOutfit(cid, 278, 1)
doPlayerAddOutfit(cid, 279, 1)
setPlayerStorageValue(cid,170001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second brotherhood addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,6500) >= 500 then
selfSay('Did you bring me 500 Demonic essences?')
talk_state = 34
else
selfSay('I need 500 Demonic essences, to give you the second Brotherhood addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 34 then
talk_state = 0
if getPlayerItemCount(cid,6500) >= 500 then
addon = getPlayerStorageValue(cid,170002)
if addon == -1 then
if doPlayerTakeItem(cid,6500,500) == 0 then
selfSay(addon_give)
doPlayerAddOutfit(cid, 278, 2)
doPlayerAddOutfit(cid, 279, 2)
setPlayerStorageValue(cid,170002,2)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first nightmare addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,6500) >= 300 then
selfSay('Did you bring me 300 Demonic essences?')
talk_state = 35
else
selfSay('I need 300 Demonic essences, to give you the first nightmare addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 35 then
talk_state = 0
if getPlayerItemCount(cid,6500) >= 300 then
addon = getPlayerStorageValue(cid,180001)
if addon == -1 then
if doPlayerTakeItem(cid,6500,300) == 0 then
selfSay(addon_give)
doPlayerAddOutfit(cid, 268, 1)
doPlayerAddOutfit(cid, 269, 1)
setPlayerStorageValue(cid,180001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second nightmare addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,6500) >= 500 then
selfSay('Did you bring me 500 Demonic essences?')
talk_state = 36
else
selfSay('I need 500 Demonic essences, to give you the second nightmare addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 36 then
talk_state = 0
if getPlayerItemCount(cid,6500) >= 500 then
addon = getPlayerStorageValue(cid,180002)
if addon == -1 then
if doPlayerTakeItem(cid,6500,500) == 0 then
selfSay(addon_give)
doPlayerAddOutfit(cid, 268, 2)
doPlayerAddOutfit(cid, 269, 2)
setPlayerStorageValue(cid,180002,2)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 38) then
selfSay('Ok thanks.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())