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

[Function] Functions useful in quests

Seminari

Banned User
Joined
Dec 13, 2009
Messages
1,496
Reaction score
34
Location
Poland
With functions: setPlayerMissionStatus and getPlayerMissionStatus you can easier make quests and you will be easier and faster to correct mistakes.
For example:
you made quest, but you gave the wrong order of storage values (example: in 6 mission script checks player_storage == 1, (but correct is storage == 2) then u will must change with all quest scripts after 6 mission to good values xD, with my functions u can make:
monday ninth mission
friday third mission
sunday eighth mission
:)


1. add to folder data/LIB quests.lua, then add to quests.lua this table:
Lua:
LIB_QUESTS_TBL = {
		["yalahar quest"] = {
							["third mission"] = {stg = 2222, start_value = 15, end_value = 17},
							["final battle"] = {stg = 2222, start_value = 39, end_value = 42},
							},
		["inquistion quest"] = {
							["first mission"] = {stg = 2222, start_value = 0, end_value = 6},
							["eclipse"] = {stg = 2222, start_value = 7, end_value = 9},
							["vampire hunter"] = {stg = 2222, start_value = 10, end_value = 15},
							},
					}


Now go to lib to file functions and add:
Lua:
function setPlayerMissionStatus(cid, quest_name, mission_name, value)
	for a,b in pairs(LIB_QUESTS_TBL) do
		if a == quest_name then
			for c,d in pairs(b) do
				if c == mission_name then
					return setPlayerStorageValue(cid, d.stg, d.start_value + value)
				else
					return print("cannot find mission called ".. mission_name .." in quest ".. quest_name ..".")
				end
			end
		else
			return print("cannot find quest called".. quest_name .." in LIB_QUESTS_TBL.")
		end
	end
end

function getPlayerMissionStatus(cid, quest_name, mission_name)
	for a,b in pairs(LIB_QUESTS_TBL) do
		if a == quest_name then
			for c,d in pairs(b) do
				if c == mission_name then
					if getPlayerStorageValue(cid, d.stg) < d.start_value then
						return -1
					elseif getPlayerStorageValue(cid, d.stg) <= d.end_value then
						return (getPlayerStorageValue(cid, d.stg) - d.start_value)
					elseif getPlayerStorageValue(cid, d.stg) > d.end_value then
						return 9999
					end
				else
					return print("cannot find mission called ".. mission_name .." in quest ".. quest_name ..".")
				end
			end
		else
			return print("cannot find quest called".. quest_name .." in LIB_QUESTS_TBL.")
		end
	end
end
 
Back
Top