• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

tibia outfiter help

tnecniiv

scripter to be
Joined
Jan 6, 2012
Messages
298
Solutions
3
Reaction score
25
i get this

[24/01/2014 20:02:18] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/outfiter.lua
[24/01/2014 20:02:18] data/npc/scripts/outfiter.lua:6: function arguments expected near ':'

i am using tfs o.2.14

my script looks like this


Code:
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 configs = {

ItemId = 10134,
ItemCount = 1,
Storage = 15200,

}


if(msgcontains(msg, 'outfit')) then
if (getPlayerStorageValue(cid, configs.Storage) > 0) then
selfSay('You already have this outfit.', cid)
talkState[talkUser] = 0
else
selfSay('Do you have all the items for the new outfit ?', cid)
talkState[talkUser] = 1
end
else
if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if (getPlayerItemCount(cid, configs.ItemId) == configs.ItemCount) then
doPlayerRemoveItem(cid, configs.ItemId, configs.ItemCount)
setPlayerStorageValue(cid, configs.Storage, 1)
doPlayerAddOutfit(cid, xxx)
doSendMagicEffect(getPlayerPosition(cid), 12)
selfSay('Congratz, you now have a brand new outfit.', cid)
talkState[talkUser] = 0
else
selfSay('You don\'t have all the items.', cid)
talkState[talkUser] = 0
end

end
return TRUE
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Change
Code:
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

To
Code:
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
 
i do not get the outfit i get this error in my console
[24/01/2014 20:24:29] Lua Script Error: [Npc interface]
[24/01/2014 20:24:29] data/npc/scripts/outfiter.lua:onCreatureSay
[24/01/2014 20:24:29] LuaScriptInterface::luaDoPlayerAddOutfit(). Player not found
[24/01/2014 20:24:29] stack traceback:
[24/01/2014 20:24:29] [C]: in function 'doPlayerAddOutfit'
[24/01/2014 20:24:29] data/npc/scripts/outfiter.lua:42: in function 'callback'
[24/01/2014 20:24:29] data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[24/01/2014 20:24:29] data/npc/scripts/outfiter.lua:8: in function <data/npc/scripts/outfiter.lua:8>
 
Line 42: doPlayerAddOutfit(cid, xxx)
You have to choose the outfit you want to add here.
The function works like this.
Code:
doPlayerAddOutfit(cid, looktype, addons)
Looktype should be the looktype number of the outfit and addons which addons they get (0-3).
 
Back
Top