And I definitely put this in the wrong part of the forum, I'd appreciate it if I could get it moved to the support forum. Sorry for the hassle.
I'm having a bit of a problem with my NPC's using text lines that aren't preset in the npchandler.
I've looked around for a post that deals with this, but didn't find it. Then again, I could just be an idiot and have overlooked it. If there is one, then sorry, lol.
I tried adding the other parameters I needed to just this one, but I couldn't get them to work. It was the needmoremoney and the decline parameters.
And
The greeting line works fine, but when I get down to the script for it, I keep getting nil values. I highlighted the only text I changed. I'm guessing I screwed with the npchandler by changing the preset text in the script, I don't know. First time I've been back to messing with OT's in 2 years, so I'm not doin too well so far xD. I would appreciate any help I could get.
I'm having a bit of a problem with my NPC's using text lines that aren't preset in the npchandler.
I've looked around for a post that deals with this, but didn't find it. Then again, I could just be an idiot and have overlooked it. If there is one, then sorry, lol.
I tried adding the other parameters I needed to just this one, but I couldn't get them to work. It was the needmoremoney and the decline parameters.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Harrold the Tailor" script="data/npc/scripts/addons.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="309" head="78" body="88" legs="0" feet="88" addons="0"/>
[color=red]<parameters>
<parameter key="message_greet" value="Greetings |PLAYERNAME|. I am the Nexus tailor." />
</parameters>[/color]
</npc>
And
Code:
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 buyAddons(cid, message, keywords, parameters, node)
--TODO: buyAddons function in modules.lua
if(not npcHandler:isFocused(cid)) then
return false
end
local addon = parameters.addon
local cost = parameters.cost
local premium = (parameters.premium ~= nil and parameters.premium)
if isPlayerPremiumCallback == nil or (isPlayerPremiumCallback(cid) and premium) then
if doPlayerRemoveMoney(cid, cost) == TRUE then
doPlayerAddAddons(cid, addon)
npcHandler:say('There, you are now able to use all addons!', cid)
else
npcHandler:say('[color=red]What is this? Are you kidding me? GET OUT![/color]', cid)
end
else
npcHandler:say('I only serve customers with premium accounts.', cid)
end
keywordHandler:moveUp(1)
return true
end
local node1 = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first addons set for 5000 gold coins?'})
node1:addChildKeyword({'yes'}, buyAddons, {addon = 1, cost = 5000, premium = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = '[color=red]Then why are you here?[/color]'})
local node2 = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to buy the second addons set for 10000 gold coins?'})
node2:addChildKeyword({'yes'}, buyAddons, {addon = 2, cost = 10000, premium = true})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = '[color=red]Then why are you here?[/color]'})
keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell the first addons set for 5000 gold coins and the second addons set for 10000 gold coins.'})
npcHandler:addModule(FocusModule:new())
The greeting line works fine, but when I get down to the script for it, I keep getting nil values. I highlighted the only text I changed. I'm guessing I screwed with the npchandler by changing the preset text in the script, I don't know. First time I've been back to messing with OT's in 2 years, so I'm not doin too well so far xD. I would appreciate any help I could get.
Last edited: