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

Windows Npc Call Stack Overflow error

juansanchez

Intermediate OT User
Joined
Apr 2, 2015
Messages
217
Reaction score
130
Hey otland, for some reason some Npcs i create, they answer to a "Hi" like this:
13:35 Roxti: Hello ADM Chez. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?
13:35 Roxti: Hello Roxti. You want to rent a mount?

And this error shows in console:

[13:35:59.410] [Warning - Npc::createNpc] Cannot find npc with name: peac.
[13:36:03.957] [Error - NpcEvents::eek:nCreatureSay] NPC Name: Roxti - Call stack o
verflow
[13:36:03.957] [Error - NpcEvents::eek:nCreatureSay] NPC Name: Roxti - Call stack o
verflow

The npc works fine, but it's kind of annyoing when this happens, i haven't seen any major bugs from this, but if anyone can help me fix it, i'd be glad.

I'm using Tfs 0.3.6
 
Post the script, would you?

I got two npcs that this happens:

Bento.xml
<npc name="bento" script="data/npc/scripts/bless.lua" access="5" lookdir="1">
<health now="1000" max="1000"/>
<look type="133" head="95" body="86" legs="86" feet="38" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|! Do you want to buy bless?"/>
</parameters>
</npc>

Bless.lua
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

local node1 = keywordHandler:addKeyword({'first bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first blessing for 2000 (plus level depending amount) gold?'})
node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 1, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

local node2 = keywordHandler:addKeyword({'second bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the second blessing for 2000 (plus level depending amount) gold?'})
node2:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

local node3 = keywordHandler:addKeyword({'third bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the third blessing for 2000 (plus level depending amount) gold?'})
node3:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 3, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

local node4 = keywordHandler:addKeyword({'fourth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fourth blessing for 2000 (plus level depending amount) gold?'})
node4:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 4, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

local node5 = keywordHandler:addKeyword({'fifth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fifth blessing for 2000 (plus level depending amount) gold?'})
node5:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 5, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

npcHandler:addModule(FocusModule:new())

Peach.xml
<?xml version="1.0"?>
<npc name="Peach" script="data/npc/scripts/aluguelmount.lua" walkinterval="2000" floorchange="0">
<health now="1000" max="1000"/>
<look type="130" head="0" body="114" legs="114" feet="0" addons="0"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. You want to {rent} a {mount}?"/>
</parameters>
</npc>

Mount Rent.lua

domodlib('aluguel_func')
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local msg = string.lower(msg)
if isInArray({'aluguel','alugar', 'rent', 'mounts', 'mount'}, msg) then
npcHandler:say("Voce pode comprar {war horse}, {brown horse}, {grey horse} e {light brown horse}!", cid)
talkState[talkUser] = 1
elseif talkState[talkUser] == 1 then
if Aluguel_mounts[msg] then
if Aluguel_mounts[msg].premium == true and not isPremium(cid) then
npcHandler:say('Voce precisa ser premium para alugar essa montaria.', cid) return true
elseif getPlayerLevel(cid) < Aluguel_mounts[msg].level then
npcHandler:say('voce precisa ter level ' .. Aluguel_mounts[msg].level .. ' ou mais para alugar essa montaria.', cid) return true
elseif getPlayerStorageValue(cid, Aluguel_mounts[msg].storage) >= os.time() then
npcHandler:say('voce ja alugou essa montaria!', cid) return true
end
name,price,stor,days,mountid = msg,Aluguel_mounts[msg].price,Aluguel_mounts[msg].storage,Aluguel_mounts[msg].days,Aluguel_mounts[msg].mountid
npcHandler:say('Voce quer alugar a montaria '..name..' por '..days..' dia'..(days > 1 and 's' or '')..' no preco de '..price..' gps? {yes}', cid)
talkState[talkUser] = 2
else
npcHandler:say('Desculpe, eu nao vendo essa montaria.', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if doPlayerRemoveMoney(cid, price) then
doPlayerAddMount(cid, mountid)
setPlayerStorageValue(cid, stor, os.time()+days*86400)
npcHandler:say('Aqui esta sua montaria '..name..', ela ira durar ata '..os.date("%d %B %Y %X", getPlayerStorageValue(cid,stor))..'.', cid)
else
npcHandler:say('voce nao tem dinheiro suficiente para alugar a montaria!', cid)
talkState[talkUser] = 0
end
elseif msg == "no" then
selfSay("Then not", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

The mount one, is also in mods, don't know if you need it.
 
Back
Top Bottom