• 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 ADDONS PER ITEMS 1.0 by Cronox

Cronox

www.Searz-Online.com
Joined
Jul 5, 2011
Messages
1,810
Reaction score
123
Location
Mexico
Well i see all try put 1 npc addon items and get errors for many lines changed in 1.0
I create 1 simple script and easy configuration here you go ;)
Lua:
---- Created by Cronox 
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


-- Storage IDs --

fbarbarian    = 22015
sbarbarian    = 22016

newaddon    = 'Ah, right! The warrior shoulder spike! Here you go.'
noitems        = 'You do not have all the required items.'
noitems2    = 'You do not have all the required items or you do not have the outfit, which by the way, is a requirement for this addon.'
already        = 'It seems you already have this addon, don\'t you try to mock me son!'


function BarbarianSecond(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,sbarbarian)
    if addon == -1 then
        if getPlayerItemCount(cid,5884) >= 1 and getPlayerItemCount(cid,5885) >= 1 and getPlayerItemCount(cid,5911) >= 50 and getPlayerItemCount(cid,5910) >= 50 and getPlayerItemCount(cid,5886) >= 10 then
        if doPlayerRemoveItem(cid,5884,1) and doPlayerRemoveItem(cid,5885,1) and doPlayerRemoveItem(cid,5911,50) and doPlayerRemoveItem(cid,5910,50) and doPlayerRemoveItem(cid,5886,10) then
              doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
              doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "I have kept this traditional barbarian wig safe for many years now. It is now yours! I hope you will wear it proudly, friend.")
              doPlayerAddOutfit(cid, 147, 2) 
              doPlayerAddOutfit(cid, 143, 2) 
			setPlayerStorageValue(cid,sbarbarian,1)
			end
        else
            selfSay(noitems)
        end
    else
        selfSay(already)
    end
    end

end

node1 = keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get barbarian wig you need give me a fighting spirit, the warrior\'s sweat, 50 red pieces of cloth, 50 green pieces of cloth and 10 spider silk yarns. Do you have them with you?'})
node1:addChildKeyword({'yes'}, BarbarianSecond, {})
node1: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())

and..
for only changed 1 item for your addon example ,ferumbras hat for hat mage
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


-- Storage IDs --

mage        = 33007
  
newaddon    = 'Ah, right! The barbarian axe! Here you go.'
noitems        = 'You do not have all the required items.'
noitems2    = 'You do not have all the required items or you do not have the outfit, which by the way, is a requirement for this addon.'
already        = 'It seems you already have this addon, don\'t you try to mock me son!'

function SummonerSecond(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,mage)
    if addon == -1 then
       if getPlayerItemCount(cid,5903) >= 1 then
        if doPlayerRemoveItem(cid,5903,1) then	
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
             doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "I bow to you, player, and hereby grant you the right to wear Ferumbras hat as accessory. Congratulations! ")
              doPlayerAddOutfit(cid, 130, 2) 			
                setPlayerStorageValue(cid,mage,1)
			end
        else
            selfSay(noitems)
        end
    else
        selfSay(already)
    end
    end

end

node1 = keywordHandler:addKeyword({'proof'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = '... I cannot believe my eyes. You retrieved this hat from Ferumbras remains? That is incredible. If you give it to me, I will grant you the right to wear this hat as addon. What do you say? ,please for next step say yes'})
node1:addChildKeyword({'yes'}, SummonerSecond, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got ferumbras hat.', reset = true})

node2 = keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = '... I cannot believe my eyes. You retrieved this hat from Ferumbras remains? That is incredible. If you give it to me, I will grant you the right to wear this hat as addon. What do you say? ,please for next step say yes'})
node2:addChildKeyword({'yes'}, SummonerSecond, {})
node2: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())

Post Updated:

easy config explain:
fbarbarian = 22015 <- storage ( Remember changed in all npcs )
sbarbarian = 22016 <- storage ( Remember changed in all npcs )

function BarbarianSecond <-- this you can edit ;)
is easy just only need remove Barbarian and changed for warrior put example.. Warrior the script is:
Lua:
---- Created by Cronox 
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


-- Storage IDs --

swarrior    = 22098
fwarrior    = 22099

newaddon    = 'Ah, right! The warrior shoulder spike! Here you go.'
noitems        = 'You do not have all the required items.'
noitems2    = 'You do not have all the required items or you do not have the outfit, which by the way, is a requirement for this addon.'
already        = 'It seems you already have this addon, don\'t you try to mock me son!'


function WarriorSecond(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,swarrior)
    if addon == -1 then
        if getPlayerItemCount(cid,5884) >= 1 and getPlayerItemCount(cid,5885) >= 1 and getPlayerItemCount(cid,5911) >= 50 and getPlayerItemCount(cid,5910) >= 50 and getPlayerItemCount(cid,5886) >= 10 then  -- edit what items requeried you..
        if doPlayerRemoveItem(cid,5884,1) and doPlayerRemoveItem(cid,5885,1) and doPlayerRemoveItem(cid,5911,50) and doPlayerRemoveItem(cid,5910,50) and doPlayerRemoveItem(cid,5886,10) then -- put same id here are remove items..
              doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
              doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "I have kept this traditional barbarian wig safe for many years now. It is now yours! I hope you will wear it proudly, friend.")
              doPlayerAddOutfit(cid, 147, 2)-- edit outfit 1 - first addon  <- second addon 
              doPlayerAddOutfit(cid, 143, 2)-- edit outfit 1 - first addon  <- second addon
			setPlayerStorageValue(cid,swarrior,1)
			end
        else
            selfSay(noitems)
        end
    else
        selfSay(already)
    end
    end

end

node1 = keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get sword addon need give me a 100 Iron Ores and 1 piece of royal steel. Do you have them with you?'})
node1:addChildKeyword({'yes'}, WarriorSecond, {})
node1: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())

Pictures works 100% in all npcs ;)
aq.jpg as.jpg
azz.jpg qq.jpg

You wanna get my system in your ot ;)? Like? don't works your scripts in new version 1.0??
created your script put my script edit item count and remove ,outfit 1 or 2 and here you ^^
 
Last edited:
Back
Top