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

Why does this script not work?

#1

Lua:
local config = {
		message = "BOSS +1",
		color = COLOR_WHITE,
        bosses = { -- Monster Name,  Storagevalue,
                ["Ra revenge"] = {storage=51001},
				["warshabaal"] = {storage=51002},
				["Seadevil"] = {storage=51003},
                ["Haunted dragon"] = {storage=51004},
                ["Thunder dragon"] = {storage=51005},
				["green-eyes red dragon"] = {storage=51006},
				["Chaos emperor dragon"] = {storage=51007},
				["Vampire genesis"] = {storage=51008},
				["dark ruler ha des"] = {storage=51009},
				["Amidamaru"] = {storage=51010},
				["Bason"] = {storage=51011},
				["eliza faust"] = {storage=51012},
				["fortress golem"] = {storage=51013},
				["illusionist"] = {storage=51014},
				["iron maiden jeanne"] = {storage=51015},
				["kouki"] = {storage=51016},
				["zenki"] = {storage=51017},
				["lanancuras"] = {storage=51018},
				["red eyes ultimate dragon"] = {storage=51019},
				["silva"] = {storage=51020},
				["zorc necrophadus"] = {storage=51021},
				["King scorpion"] = {storage=51022},
				["Bazir"] = {storage=51023},
				["Apocal"] = {storage=51024},
				["infernal"] = {storage=51025},
				["Orshabaal"] = {storage=51026},
				["Morgaroth"] = {storage=51027},
				["verminor"] = {storage=51028},
				["saggi the dark clown"] = {storage=51029}
			}
		}

function onKill(cid,target,lastHit)
local v,b = getThingPos(cid),config.bosses[getCreatureName(target)]
	if b then
		if getPlayerStorageValue(cid,b.storage) == 0 then
			setPlayerStorageValue(cid,b.storage,1)
			doSendAnimatedText(v,config.message,config.color)
		end
	end
	return true
end

what do you want as npc for #2?
script is really messy.
 
Well first it wasn't then i tried to make it more advanced/messy still no results

well it goes like this:

me: quest
NPC: Bring me 100 demonic essences
(Mission 1 started)
----------------------------------------------------
me: demonic essences
if got 100 demonic essences then: Thanks now i need 100 giant eyes
if you did this mission before then: You already gave it.
if you don't got the essences he say: When i get mine essences?

same with the 100 giant eyes, ultimate egg, eliza's tear
if you gave the eliza then he will say Congratulations you gave me everything i need! Have fun with your new outfit. (you received 20000000 points of experience).
And then give me 2 storagevalue's.

I will pray now then i will test your script :)
 
Sorry for doing it so late, and I dont know if it will work.
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}

 
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 t = { --[VALUE] = {Topic, itemID, Value},
[-1] = {1, 6500, 0},
[1] = {2, ????, 2},
[3] = {3, ????, 4},
[5] = {4, ????, 6}
}     
function creatureSayCallback(cid, type, msg)
local v = t[getPlayerStorageValue(cid,8000)]
if msgcontains(msg, 'mission') then
   if getPlayerStorageValue(cid,8000) == v then
      npcHandler:say('I can assign you a mission, would you like that?', cid)
      Topic[cid] = v[1]
   else
       npcHandler:say('You either have already finished all my missions or you are doing one!', cid)
       Topic[cid] = 0
   end
end

if Topic[cid] == v[1] then
   if msgcontains(msg, 'yes') then
      npcHandler:say('Please bring me 100 ' .. getItemNameById(v[2]) .. ' and {report} it to me', cid)
      setPlayerStorageValue(cid,getPlayerStorageValue(cid,8000)+1)
      Topic[cid] = 0
   else
       if msgcontains(msg, 'no') then
          npcHandler:say('Too bad', cid)
          Topic[cid] = 0
       end
   end
end

if msgcontains(msg, 'report') then
   if getPlayerStorageValue(cid, 8000) == v[3] then
      if doPlayerRemoveItem(cid,v[2],100) then
         npcHandler:say('Thanks! You can now ask me for a new {mission}!', cid)
         setPlayerStorageValue(cid,getPlayerStorageValue(cid,8000)+1)
      else
          npcHandler:say('You did not bring the ' .. getItemNameById(v[2]) .. ' !', cid)
      end
   elseif getPlayerStorageValue(cid, 8000) == 6 then
       npcHandler:say('Congratulations! You have finished all my missions, get this as a reward!', cid)
       doPlayerAddExp(cid, 20000000)
       doPlayerAddOutfitId(cid, 1)
       for i = 8001, 8002 do
           setPlayerStorageValue(cid,i)
       end
   end
end
return true
end 

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

Get a XML file and done.
 
Last edited:
doesn't work no errors hmm
05:22 The reaper master: Hello Youssef eh kamal. Why are you disturbing me'?
05:22 Youssef eh kamal [414]: report
05:22 Youssef eh kamal [414]: mission
05:22 The reaper master: You either have already finished all my missions or you are doing one!
05:22 Youssef eh kamal [414]: report
 
You already assigned to storage 8000 a value?
Cause I did it as if 8000 was -1.
If you had, and set it to 1, then use this:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
 
 
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 t = { --[VALUE] = {Topic, itemID, Value},
[1] = {6500, 2},
[3] = {8000, 4},
[5] = {8001, 6}
}     
function creatureSayCallback(cid, type, msg)
local v = t[getPlayerStorageValue(cid,8000)]
if msgcontains(msg, 'mission') then
   if getPlayerStorageValue(cid,8000) == v then
      npcHandler:say('I can assign you a mission, would you like that?', cid)
      Topic[cid] = 1
   elseif getPlayerStorageValue(cid,8000) == 7 then
          npcHandler:say('This is your last mission, would you like to do it?', cid)
          Topic[cid] = 2
   elseif getPlayerStorageValue(cid,8000) > 8 then
       npcHandler:say('You either have already finished all my missions or you are doing one!', cid)
       Topic[cid] = 0
   end
end
 
if Topic[cid] == 1 then
   if msgcontains(msg, 'yes') then
      npcHandler:say('Please bring me 100 ' .. getItemNameById(v[1]) .. ' and {report} it to me', cid)
      setPlayerStorageValue(cid,getPlayerStorageValue(cid,8000)+1)
      Topic[cid] = 0
   else
       if msgcontains(msg, 'no') then
          npcHandler:say('Too bad', cid)
          Topic[cid] = 0
       end
   end
end

if Topic[cid] == 2 then
   if msgcontains(msg, 'yes') then
      npcHandler:say('Please bring me 100 elizas tear and {report} it to me', cid)
      setPlayerStorageValue(cid,getPlayerStorageValue(cid,8000)+1)
      Topic[cid] = 0
   else
       if msgcontains(msg, 'no') then
          npcHandler:say('Too bad', cid)
          Topic[cid] = 0
       end
   end
end
 
if msgcontains(msg, 'report') then
   if getPlayerStorageValue(cid, 8000) == v[2] then
      if doPlayerRemoveItem(cid,v[1],100) then
         npcHandler:say('Thanks! You can now ask me for a new {mission}!', cid)
         setPlayerStorageValue(cid,getPlayerStorageValue(cid,8000)+1)
      else
          npcHandler:say('You did not bring the ' .. getItemNameById(v[1]) .. ' !', cid)
      end
   elseif getPlayerStorageValue(cid, 8000) == 8 then
       npcHandler:say('Congratulations! You have finished all my missions, get this as a reward!', cid)
       doPlayerAddExp(cid, 20000000)
       doPlayerAddOutfitId(cid, 1)
       for i = 8001, 8002 do
           setPlayerStorageValue(cid,i)
       end
   end
end
return true
end 
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
You must say mission to the NPC activate the script.

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

local c = { -- item table
	egg = $$$ -- itemid of ultimate egg.
	tear = $$$ -- itemid of Eliza's tear.
	}
local t = {
	[0] = {1241,2241}, -- [getPlayerStorageValue(cid,storage)] = {valueToNextMission,count how many items left to be gained}
	[1] = {3241,4241}
	}
local premium = false -- false = anyone can do this mission, true = only premium can do this mission.
local Topic = {}
function creatureSayCallback(cid, type, msg)
local v,bms = getPlayerStorageValue(cid,1592),t[getPlayerStorageValue(cid,1592)],1592
	if msgcontains(msg,'mission') then
		if premium == 'false' then
			if v < 0 then
				setPlayerStorageValue(cid,s,0)
				npcHandler:say('Bring me 100 demonic essences.',cid)
				setPlayerStorageValue(cid,b[2],100)
			elseif v == 0 then
				if doPlayerRemoveItem(cid,getItemIdByName('demonic essence'):lower(),100) then
					npcHandler:say('Thank you, now you must bring me 100 giant eyes',cid)
					setPlayerStorageValue(cid,b[2],0)
					setPlayerStorageValue(cid,s,1)
					setPlayerStorageValue(cid,t[1][2],100)
				else
				 local l = 100
					for i = 1,getPlayerItemCount(cid,getItemIdByName('demonic essence'):lower()) do
						l = l-1
					end
					setPlayerStorageValue(cid,b[2],l)
					npcHandler:say('Thank you, but I need '..l..' more demonic essences.',cid)
					if getPlayerStorageValue(cid,b[2]) == 0 then
						setPlayerstorageValue(cid,s,1)
						npcHandler:say('Thank you, now bring me 100 giant eyes!',cid)
					end
				end
			elseif v == 1 then
				if doPlayerRemoveItem(cid,getItemIdByName('giant eye'):lower(),100) then
					npcHandler:say('Thank you, now you must bring me the ultimate egg!',cid)
					setPlayerStorageValue(cid,b[2],0)
					setPlayerStorageValue(cid,s,2)
				elseif getPlayerItemCount(cid,getItemIdByName('giant eye'):lower()) > 0 then
				 local l = getPlayerStorageValue(b[2])
					for i = 1,getPlayerItemCount(cid,getItemIdByName('giant eye'):lower()) do
						l = l-1
					end
					setPlayerStorageValue(cid,b[2],l)
					npcHandler:say('Thank you, but I need '..l..' more giant eyes.',cid)
						if getPlayerStorageValue(cid,b[2]) == 0 then
							setPlayerstorageValue(cid,s,2)
							npcHandler:say('Thank you, now bring me the ultimate egg!',cid)
						end
					end
				elseif v == 2 then
					if doPlayerRemoveItem(cid,c.egg,1) then
						npcHandler:say('Thanks once again, now bring me Eliza\'s tear.',cid)
						setPlayerStorageValue(cid,s,3)
					else
						npcHandler:say('I already told you to bring me Eliza\'s tear!',cid)
					end
				elseif v == 3 then
					if doPlayerRemoveItem(cid,c.tear,1) then
						npcHandler:say('Thanks once again, now bring me Eliza\'s tear.',cid)
						setPlayerStorageValue(cid,s,4)
					else
						npcHandler:say('I already told you to bring me Eliza\'s tear!',cid)
					end
				elseif v == 4 then
					npcHandler:say('You\'ve already given everything I need!',cid)
					npcHandler:releaseFocus(cid)
				end
			else
				npcHandler:say('I only trust premium members with these missions',cid)
				npcHandler:releaseFocus(cid)
			end
		else
			if isPremium( cid) then
				if v < 0 then
					setPlayerStorageValue(cid,s,0)
					npcHandler:say('Bring me 100 demonic essences.',cid)
					setPlayerStorageValue(cid,b[2],100)
				elseif v == 0 then
					if doPlayerRemoveItem(cid,getItemIdByName('demonic essence'):lower(),100) then
						npcHandler:say('Thank you, now you must bring me 100 giant eyes',cid)
						setPlayerStorageValue(cid,b[2],0)
						setPlayerStorageValue(cid,s,1)
						setPlayerStorageValue(cid,t[1][2],100)
					else
					 local l = 100
						for i = 1,getPlayerItemCount(cid,getItemIdByName('demonic essence'):lower()) do
							l = l-1
						end
						setPlayerStorageValue(cid,b[2],l)
						npcHandler:say('Thank you, but I need '..l..' more demonic essences.',cid)
						if getPlayerStorageValue(cid,b[2]) == 0 then
							setPlayerstorageValue(cid,s,1)
							npcHandler:say('Thank you, now bring me 100 giant eyes!',cid)
						end
					end
				elseif v == 1 then
					if doPlayerRemoveItem(cid,getItemIdByName('giant eye'):lower(),100) then
						npcHandler:say('Thank you, now you must bring me the ultimate egg!',cid)
						setPlayerStorageValue(cid,b[2],0)
						setPlayerStorageValue(cid,s,2)
					elseif getPlayerItemCount(cid,getItemIdByName('giant eye'):lower()) > 0 then
					 local l = getPlayerStorageValue(b[2])
						for i = 1,getPlayerItemCount(cid,getItemIdByName('giant eye'):lower()) do
							l = l-1
						end
						setPlayerStorageValue(cid,b[2],l)
						npcHandler:say('Thank you, but I need '..l..' more giant eyes.',cid)
							if getPlayerStorageValue(cid,b[2]) == 0 then
								setPlayerstorageValue(cid,s,2)
								npcHandler:say('Thank you, now bring me the ultimate egg!',cid)
							end
						end
					elseif v == 2 then
						if doPlayerRemoveItem(cid,c.egg,1) then
							npcHandler:say('Thanks once again, now bring me Eliza\'s tear.',cid)
							setPlayerStorageValue(cid,s,3)
						else
							npcHandler:say('I already told you to bring me Eliza\'s tear!',cid)
						end
					elseif v == 3 then
						if doPlayerRemoveItem(cid,c.tear,1) then
							npcHandler:say('Thanks once again, now bring me Eliza\'s tear.',cid)
							setPlayerStorageValue(cid,s,4)
						else
							npcHandler:say('I already told you to bring me Eliza\'s tear!',cid)
						end
					elseif v == 4 then
						npcHandler:say('You\'ve already given everything I need!',cid)
						npcHandler:releaseFocus(cid)
					end	
				end	
			else
				npcHandler:say('I only trust premium members with these missions',cid)
				npcHandler:releaseFocus(cid)
			end
		else
			npcHandler:say('I only trust premium members with these missions',cid)
			npcHandler:releaseFocus(cid)
		end
	else
		if premium == 'false' then
			npcHandler:say('You have to say \'mission\'.',cid)
		elseif premium == 'true' and not isPremium(cid) then
			npcHandler:say('I only trust premium members with these missions',cid)
			npcHandler:releaseFocus(cid)
		end
	end
	return true
end
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewel...")
npcHandler:setMessage(MESSAGE_FAREWELL, "Goodbye..")
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

TFS 0.3.x

P.S. you must edit the egg and tear itemid at the table 'c'.
 
Last edited:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="NPC_NAME" script="SCRIPT_NAME.lua" walkinterval="8000" floorchange="0">
	<health now="100" max="100"/>
	<look type="128" head="57" body="115" legs="58" feet="114" addons="3"/>
	<parameters>
      <parameter key="message_greet" value="Hey, I might have {mission} for you." />
    </parameters>
</npc>

use this as npc format
 
Back
Top