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

[Help] Demon oak npc Problem

murfus

New Member
Joined
Dec 6, 2007
Messages
85
Reaction score
0
Please help me




[01/01/2002 19:28:43] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/demon oak monk.lua
[01/01/2002 19:28:44] data/npc/scripts/demon oak monk.lua:31: 'then' expected near 'player_money'



__________________________________________________ _____________________
-- WAS NOT Made by Coltain13 // Coltain, I only made it work for TFS --


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

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end

player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
playerCap = getPlayerFreeCap(cid)
item = 8293 --Hallowed Axe
itemweight = getItemWeight(item, 1)

if msgcontains(msg, 'hallowed axe') then
if isPremium(cid) == TRUE then
if getPlayerItemCount(cid,2386) >= 1 player_money >= 3500000 then
selfSay('Do you want to buy a Hallowed Axe from me?')
talk_state = 1
else
selfSay('You have to bring me an axe and 1000 gp first.')
talk_state = 0
end
else
selfSay('You need premium to buy this axe from me.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2386) >= then and player_money >= 3500000 then
if doPlayerTakeItem(cid,2386,1) == 1 and pay(cid,3500000) and playerCap >= itemweight then
selfSay('Here you are. You can now defeat the demon oak with this axe.')
doPlayerAddItem(cid,item,1)
talk_state = 0
else
selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.')
talk_state = 0
end
else
selfSay('Please bring with you an axe and enough with money.')
talk_state = 0
end
elseif msgcontains(msg, 'demon oak') then
if getPlayerItemCount(cid,2386) >= then and player_money >= 3500000 then
selfSay('Did you defeat the demon oak?')
talk_state = 2
else
selfSay('Go defeat the demon oak.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,21545) == 1 then
selfSay('Good job!')
setPlayerStorageValue(cid,21545,2)
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
selfSay('Ok thanks.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())






What is wrong with the npc? :s
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end

player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
playerCap = getPlayerFreeCap(cid)
item = 8293 --Hallowed Axe
itemweight = getItemWeight(item, 1)

if msgcontains(msg, 'hallowed axe') then
if isPremium(cid) == TRUE then
if getPlayerItemCount(cid,2386) >= 1 player_money >= 3500000 then
selfSay('Do you want to buy a Hallowed Axe from me?')
talk_state = 1
else
selfSay('You have to bring me an axe and 1000 gp first.')
talk_state = 0
end
else
selfSay('You need premium to buy this axe from me.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2386) >= then and player_money >= 3500000 then
if doPlayerTakeItem(cid,2386,1) == 1 and pay(cid,3500000) and playerCap >= itemweight then
selfSay('Here you are. You can now defeat the demon oak with this axe.')
doPlayerAddItem(cid,item,1)
talk_state = 0
else
selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.')
talk_state = 0
end
else
selfSay('Please bring with you an axe and enough with money.')
talk_state = 0
end
elseif msgcontains(msg, 'demon oak') then
if getPlayerItemCount(cid,2386) >= and player_money >= 3500000 then
selfSay('Did you defeat the demon oak?')
talk_state = 2
else
selfSay('Go defeat the demon oak.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,21545) == 1 then
selfSay('Good job!')
setPlayerStorageValue(cid,21545,2)
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
selfSay('Ok thanks.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

TRY THIS
NOT TESTED
 
[01/01/2002 20:24:26] The Forgotten Server - Version 0.2.1 (Mystic Spirit).
[01/01/2002 20:24:26] A server developed by Talaturen, Kiper, Kornholijo, Jonern, Lithium & Elf.
[01/01/2002 20:24:26] Visit our forum for updates, support and resources: http://otland.net/.

[01/01/2002 20:24:26] >> Loading config
[01/01/2002 20:24:26] >> Loading RSA key
[01/01/2002 20:24:26] >> Testing SQL connection... SqLite.
[01/01/2002 20:24:26] >> Loading bans
[01/01/2002 20:24:26] >> Loading vocations
[01/01/2002 20:24:26] >> Loading commands
[01/01/2002 20:24:26] >> Loading items
[01/01/2002 20:24:27] >> Loading script systems
[01/01/2002 20:24:28] >> Loading monsters
[01/01/2002 20:24:32] >> Loading outfits
[01/01/2002 20:24:32] >> Loading admin protocol config
[01/01/2002 20:24:32] >> Loading experience stages
[01/01/2002 20:24:32] >> Using plaintext passwords
[01/01/2002 20:24:32] >> Checking world type... PVP
[01/01/2002 20:24:32] >> Loading map
[01/01/2002 20:24:38] > Map size: 4948x4920.
[01/01/2002 20:24:56] > Map loading time: 23.578 seconds.
[01/01/2002 20:25:00] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/demon oak monk.lua
[01/01/2002 20:25:00] data/npc/scripts/demon oak monk.lua:28: 'then' expected near 'player_money'
[01/01/2002 20:25:32] Notice: Map load (relational) took : 31.141 s
[01/01/2002 20:25:32] >> Setting gamestate to: GAME_STATE_INIT
[01/01/2002 20:25:33] >> All modules has been loaded, server starting up...
[01/01/2002 20:25:33] >> RoXoR Server Online!

Still the same ;/
 
Lua:
__________________________________________________ _____________________
-- WAS NOT Made by Coltain13 // Coltain, I only made it work for TFS --


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

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end

player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
playerCap = getPlayerFreeCap(cid)
item = 8293 --Hallowed Axe
itemweight = getItemWeight(item, 1)

if msgcontains(msg, 'hallowed axe') then
if isPremium(cid) == TRUE then
if ((getPlayerItemCount(cid,2386) >= 1) and (player_money >= 3500000)) then
selfSay('Do you want to buy a Hallowed Axe from me?')
talk_state = 1
else
selfSay('You have to bring me an axe and 1000 gp first.')
talk_state = 0
end
else
selfSay('You need premium to buy this axe from me.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2386) >=  and player_money >= 3500000 then
if doPlayerTakeItem(cid,2386,1) == 1 and pay(cid,3500000) and playerCap >= itemweight then
selfSay('Here you are. You can now defeat the demon oak with this axe.')
doPlayerAddItem(cid,item,1)
talk_state = 0
else
selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.')
talk_state = 0
end
else
selfSay('Please bring with you an axe and enough with money.')
talk_state = 0
end
elseif msgcontains(msg, 'demon oak') then
if getPlayerItemCount(cid,2386) >= and player_money >= 3500000 then
selfSay('Did you defeat the demon oak?')
talk_state = 2
else
selfSay('Go defeat the demon oak.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,21545) == 1 then
selfSay('Good job!')
setPlayerStorageValue(cid,21545,2)
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
selfSay('Ok thanks.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


you had some errors in the IF's comparisions. Now it should works
 
[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/demon oak monk.lua
[03/07/2009 21:29:22] data/npc/scripts/demon oak monk.lua:3: '=' expected near '_____________________' shall i remove the "_________________" line?
 
Back
Top