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

Lua Oracle (luaGetCreatureStorage) Creature not found

vakacjus

Lua & C++ Study.
Joined
Oct 23, 2008
Messages
255
Solutions
1
Reaction score
26
Hi Otlanders,
I have script oracle and its working fine but TFS 0.3.6 v5 sending me this :

PHP:
[28/06/2012 15:26:16] [Error - Npc interface] 
[28/06/2012 15:26:16] data/npc/scripts/ooracle.lua
[28/06/2012 15:26:16] Description: 
[28/06/2012 15:26:16] (luaGetCreatureStorage) Creature not found
\
PHP:
 local keywordHandler = KeywordHandler:new()
 local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)
 local talkState = {}
 
 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
 
local sv = 76542
local prof = getPlayerStorageValue(cid, sv)
function creatureSayCallback(cid, type, msg)

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid		
	if(not npcHandler:isFocused(cid)) then	
		 return false
	elseif msgcontains(msg, "prepared") and getPlayerVocation(cid) == 0 then	
		npcHandler:say("So what vocation do you wish to become? {elect sorcerer}, {elect druid}, {elect paladin} or {elect knight}?", cid)	
		setPlayerStorageValue(cid,sv,0)
		talkState[talkUser] = 2
	elseif msgcontains(msg, "prepared") and getPlayerVocation(cid) ~= 0 then	
		npcHandler:say("Go Away!!", cid)	
		talkState[talkUser] = 0
	elseif msgcontains(msg, "yes") and getPlayerVocation(cid) == 0 and talkState[talkUser] == 3 and getPlayerStorageValue(cid,sv) > 0 then
		local prof = getPlayerStorageValue(cid,sv)
		destination = {x=1004, y=370, z=7}
		doTeleportThing(cid, destination)
		doPlayerSetVocation(cid,prof)
	elseif msgcontains(msg, "elect druid") then	
		npcHandler:say("Are you sure that a druid is what you wish to become? This decision is irreversible! If you are sure say {yes}.", cid)
		setPlayerStorageValue(cid,sv,2)
		talkState[talkUser] = 3
	elseif msgcontains(msg, "elect sorcerer") then	
		npcHandler:say("So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible! If you are sure say {yes}.", cid)
		setPlayerStorageValue(cid,sv,1)
		talkState[talkUser] = 3
	elseif msgcontains(msg, "elect paladin") then	
		npcHandler:say("'A ranged marksman. Are you sure? This decision is irreversible! If you are sure say {yes}.", cid)
		setPlayerStorageValue(cid,sv,3)
		talkState[talkUser] = 3
	elseif msgcontains(msg, "elect knight") then	
		npcHandler:say("A mighty warrior. Is that your final decision? This decision is irreversible! If you are sure say {yes}.", cid)
		setPlayerStorageValue(cid,sv,4)
		talkState[talkUser] = 3
	
	end
	return true 
 end
	 npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
	 npcHandler:addModule(FocusModule:new())
 
No, u'r wrong
I know something about lua, this basic one. So simple mistake with name won't appear :p

@please help
 
Last edited:
No, u'r wrong
I know something about lua, this basic one. So simple mistake with name won't appear :p

@please help

Did you add both .xml and .lua files?
Example:


XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="A Fluffy Squirrel" script="data/npc/scripts/a fluffy squirrel.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="274" head="0" body="0" legs="0" feet="0" />
<parameters>
<parameter key="module_shop" value="1" />
<parameter key="shop_sellable" value="acorn,11207,10;" />
        <parameter key="message_greet" value="Chhchh?"/>
        <parameter key="message_farewell" value="Chh..."/>
		<parameter key="message_walkaway" value="Chh..." />
		<parameter key="message_sendtrade" value="Chchch. Chh! you're not sure, but it seems that squirrel wants to trade your valuable acorns for useless stones that it found and considered uneatable" />
    </parameters>
</npc>


Lua:
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

npcHandler:addModule(FocusModule:new())

Let me know if you have both files that link to the correct one....
 
Did you add both .xml and .lua files?
Example:

Let me know if you have both files that link to the correct one....

WTF bro, I already told you that I have not made an error in the link... <_<

Anyone who KNOW SOMETHING about lua can help me here please?
God why...
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="The Governor" script="ooracle.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1">
<health now="100" max="100"/>
<look type="132" head="97" body="0" legs="95" feet="116" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. Are you prepared to become a resident of Broklin? If you are sure say {prepared}."/>
	<parameter key="message_walkaway" value="Good luck!"/>
    <parameter key="message_farewell" value="Good luck!"/>
</parameters>
</npc>
 
I've tested this script and it works now, you will have to change your position again though ;P

Lua:
local keywordHandler = KeywordHandler:new()
 local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)
 local talkState = {}
 
 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 creatureSayCallback(cid, type, msg)

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid        
    if(not npcHandler:isFocused(cid)) then    
         return false
    elseif msgcontains(msg, "prepared") and getPlayerVocation(cid) == 0 then    
        npcHandler:say("So what vocation do you wish to become? {elect sorcerer}, {elect druid}, {elect paladin} or {elect knight}?", cid)    
        setPlayerStorageValue(cid,76542)
        talkState[talkUser] = 2
    elseif msgcontains(msg, "prepared") and getPlayerVocation(cid) ~= 0 then    
        npcHandler:say("Go Away!!", cid)    
        talkState[talkUser] = 0
    elseif msgcontains(msg, "yes") and getPlayerVocation(cid) == 0 and talkState[talkUser] == 3 then
		if getPlayerStorageValue(cid, 76542) >= 1 then
		destination = {x=1045, y=1046, z=7}
        doTeleportThing(cid, destination, true)
        doPlayerSetVocation(cid,76542)
	
		else
		doPlayerSendTextMessage(cid, TALKTYPE_PRIVATE_NP, 'Storage not found.')
		end
    elseif msgcontains(msg, "elect druid") then    
        npcHandler:say("Are you sure that a druid is what you wish to become? This decision is irreversible! If you are sure say {yes}.", cid)
        setPlayerStorageValue(cid,76542,2)
        talkState[talkUser] = 3
    elseif msgcontains(msg, "elect sorcerer") then    
        npcHandler:say("So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible! If you are sure say {yes}.", cid)
        setPlayerStorageValue(cid,76542,1)
        talkState[talkUser] = 3
    elseif msgcontains(msg, "elect paladin") then    
        npcHandler:say("'A ranged marksman. Are you sure? This decision is irreversible! If you are sure say {yes}.", cid)
        setPlayerStorageValue(cid,76542,3)
        talkState[talkUser] = 3
    elseif msgcontains(msg, "elect knight") then    
        npcHandler:say("A mighty warrior. Is that your final decision? This decision is irreversible! If you are sure say {yes}.", cid)
        setPlayerStorageValue(cid,76542,4)
        talkState[talkUser] = 3
    
    end
    return true 
 end
     npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
     npcHandler:addModule(FocusModule:new())
 
Last edited:
Back
Top