• 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!

npc addon script ( mayby? )

melroth

Scripter / GFX
Joined
Mar 24, 2008
Messages
51
Reaction score
0
hi all,

been working on these npc scripts but it seems ... im having no luck and not 100% sure whats wrong with it..

the idea of the npcs are nightmare + brotherhood clans..

u can buy the addon for each clan at those npcs but once u buy the outfit from 1 clan u cant buy the other.. hope that makes sense but here take a look and let me know where you think ive gone wrong..

NIGHTMARE NPC SCRIPT
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

-- Storage IDs --
local nightmare = 22029
local brotherhood = 22008



local newaddon = 'Here you are, enjoy your brand new addon!'
local noitems = 'You do not have all the required items.'
local noitems2 = 'You do not have all the required items or you do not have the first addon, which by the way, is a requirement for this addon.'
local already = 'It seems you already have this addon, Or you are already part of the nightmare clan!'

-- NIGHTMARE START --
function NightmareFirst(cid, message, keywords, parameters, node)

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

if isPremium(cid) then
addon = getPlayerStorageValue(cid,nightmare)
addon = getPlayerStorageValue(cid,brotherhood)
if addon == -1 then
if getPlayerItemCount(cid,6500) >= 500 then
if doPlayerRemoveItem(cid,6500,500) then
npcHandler:say('Here you are, enjoy your brand new addon!', cid)

doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerAddOutfit(cid, 268, 1)
doPlayerAddOutfit(cid, 269, 1)
setPlayerStorageValue(cid,nightmare,1)
setPlayerStorageValue(cid,brotherhood,1)
end
else
npcHandler:say('You do not have all the required items.', cid)
end
else
npcHandler:say('It seems you already have this addon, Or you are already part of the brotherhood clan!', cid)
end
end

end

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

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

if isPremium(cid) then
addon = getPlayerStorageValue(cid,nightmare)
addon = getPlayerStorageValue(cid,brotherhood)

if addon == -1 then
if getPlayerItemCount(cid,6500) >= 1000 then
if doPlayerRemoveItem(cid,6500,1000) then
npcHandler:say('Here you are, Also Here is a symbol of our clan, wear it with pride!', cid)

doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerAddOutfit(cid, 268, 2)
doPlayerAddOutfit(cid, 269, 2)
setPlayerStorageValue(cid,nightmare+1,1)
setPlayerStorageValue(cid,brotherhood+1,1)
doPlayerAddItem(cid,6391,1)
end
else
npcHandler:say('You do not have all the required items.', cid)
end
else
npcHandler:say('It seems you already have this addon, Or you are already part of the brotherhood clan!', cid)
end
end

end
-- NIGHTMARE END --

keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you first & second addons of the Nightmare outfit."})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "What you do is that type 'first nightmare addon' or 'second nightmare addon'. Assuming that you already collected all the required pieces, say 'yes' and voíla - you got yourself an addon!"})

local node1 = keywordHandler:addKeyword({'first nightmare addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the first nightmare addon you need to give me 500 demonic essences. Do you have them with you?'})
node1:addChildKeyword({'yes'}, NightmareFirst, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

local node2 = keywordHandler:addKeyword({'second nightmare addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the second nightmare addon you need to give me 1000 demonic essences. Do you have them with you?'})
node2:addChildKeyword({'yes'}, NightmareSecond, {npcHandler = npcHandler, onlyFocus = true, reset = true})
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())

BROTHERHOOD NPC SCRIPT
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

-- Storage IDs --
local brotherhood = 22008



local newaddon = 'Here you are, enjoy your brand new addon!'
local noitems = 'You do not have all the required items.'
local noitems2 = 'You do not have all the required items or you do not have the first addon, which by the way, is a requirement for this addon.'
local already = 'It seems you already have this addon, Or you are already part of the nightmare clan!'

-- BROTHERHOOD START --
function brotherhoodFirst(cid, message, keywords, parameters, node)

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

if isPremium(cid) then
addon = getPlayerStorageValue(cid,nightmare)
getPlayerStorageValue(cid,brotherhood)
if addon == -1 then
if getPlayerItemCount(cid,6500) >= 500 then
if doPlayerRemoveItem(cid,6500,500) then
npcHandler:say('Here you are, enjoy your brand new addon!', cid)

doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerAddOutfit(cid, 278, 1)
doPlayerAddOutfit(cid, 279, 1)
setPlayerStorageValue(cid,nightmare,1)
setPlayerStorageValue(cid,brotherhood,1)
end
else
npcHandler:say('You do not have all the required items.', cid)
end
else
npcHandler:say('It seems you already have this addon, Or you are already part of the nightmare clan!', cid)
end
end

end

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

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

if isPremium(cid) then
addon = getPlayerStorageValue(cid,nightmare+1)
getPlayerStorageValue(cid,brotherhood+1)
if addon == -1 then
if getPlayerItemCount(cid,6500) >= 1000 then
if doPlayerRemoveItem(cid,6500,1000) then
npcHandler:say('Here you are, Also Here is a symbol of our clan, wear it with pride!', cid)

doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerAddOutfit(cid, 278, 2)
doPlayerAddOutfit(cid, 279, 2)
setPlayerStorageValue(cid,brotherhood+1,1)
setPlayerStorageValue(cid,nightmare+1,1)
doPlayerAddItem(cid,6391,1)
end
else
npcHandler:say('You do not have all the required items.', cid)
end
else
npcHandler:say('It seems you already have this addon, Or you are already part of the nightmare clan!', cid)
end
end

end
-- BROTHERHOOD END --

keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you first & second addons of the Nightmare outfit."})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "What you do is that type 'first nightmare addon' or 'second nightmare addon'. Assuming that you already collected all the required pieces, say 'yes' and voíla - you got yourself an addon!"})

local node1 = keywordHandler:addKeyword({'first brotherhood addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the first brotherhood addon you need to give me 500 demonic essences. Do you have them with you?'})
node1:addChildKeyword({'yes'}, brotherhoodFirst, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

local node2 = keywordHandler:addKeyword({'second brotherhood addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the second brotherhood addon you need to give me 1000 demonic essences. Do you have them with you?'})
node2:addChildKeyword({'yes'}, brotherhoodSecond, {npcHandler = npcHandler, onlyFocus = true, reset = true})
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())

hope someone can take a look at them and see if they know whats wrong..

another example of what i mean..

player speaks to "nightmare clan leader" buys 1st + 2nd addon he gets a nightmare shield and reward..

player then speaks to "brotherhood clan leader" but can not buy addon because he has allready bought nightmare addons

at the moment u can buy the addons but from both npcs evan if u have the other outfit

hope that makes sense thank you
Melroth.
 
Back
Top