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

Quest Cheast

Teddy

SweStream.se
Joined
Oct 2, 2008
Messages
3,797
Reaction score
10
Location
Sweden 172
I download the new TFS today andd icant make easy Quest chest's .. when i only put ActionID in the chest and that ,, any ide how to fix so it works ?<_<

edit
Like this

17:45 You see a chest (Vol:15).
It weighs 120.00 oz.
ItemID: [1748].
ActionID: [2389].
UniqueID: [2389].

Position: [X: 113] [Y: 349] [Z: 6].
 
i using the old one from 0.2, it works but a new bug came then :p "you found a chest." <-- but its the item i want to get :p
 
set actionid to 2000 (it must be 2000 for standart quests)
UniqueID = Any free uniqueid(it need for checking, did player the quest or no)
And then, put item(s) into this chest(in the mapeditor), save and start server ;>
 
set actionid to 2000 (it must be 2000 for standart quests)
UniqueID = Any free uniqueid(it need for checking, did player the quest or no)
And then, put item(s) into this chest(in the mapeditor), save and start server ;>
Hmm Dont work ...

06:36 You see a chest (Vol:15).
It weighs 120.00 oz.
ItemID: [1748].
ActionID: [2000].
UniqueID: [1000].

Position: [X: 115] [Y: 354] [Z: 7].

and it is a firesword in it ?
 
Im getting it work now i use action quest .. but when i open the chest this come
06:50 You have found a -1.
and some time this :
06:50 You have found a Chest.
But i get me item like firesword ..
and i have errors in GUI

Errors:
Code:
[26/12/2008 06:50:22] [COLOR="Red"]Lua Script Error[/COLOR]: [Action Interface] 
[26/12/2008 06:50:22] data/actions/scripts/quest.lua:onUse

[26/12/2008 06:50:22] [B]luaGetItemName[/B](). Item not found

Script :
Code:
local quests =
	{
		[1001] = {
			storageId = 1001,
			rewardId = 2190,
			count = 1
		},
		[1002] = {
			storageId = 1002,
			rewardId = 2182,
			count = 1
		},
		[1003] = {
			storageId = 1003,
			rewardId = 2518,
			count = 1
		},
		[1004] = {
			storageId = 1004,
			rewardId = 2457,
			count = 1
		},
		[1005] = {
			storageId = 1005,
			rewardId = 2486,
			count = 1
		},
		[1006] = {
			storageId = 1006,
			rewardId = 2647,
			count = 1
		},
		[1007] = {
			storageId = 1007,
			rewardId = 2160,
			count = 1
		},
		[1008] = {
			storageId = 1008,
			rewardId = 2392,
			count = 1
		},
		[9999] = {
			storageId = 9999,
			rewardId = 2160,
			count = 5
		},
		[8165] = {
			storageId = 12000,
			rewardId = 2487,
			count = 1
		},

		[13332] = {
			storageId, 12001,
			rewardId = 2519,
			count = 1
		},
		[8103] = {
			storageId = 12002,
			rewardId = 2515,
			count = 1
		},
		[3462] = {
			storageId = 12003,
			rewardId = 2647,
			count = 1
		},
		[3348] = {
			storageId = 12004,
			rewardId = 2432,
			count = 1
		},
		[4672] = {
			storageId = 12005,
			rewardId = 2414,
			count = 1
		},
		[5631] = {
			storageId = 12006,
			rewardId = 2534,
			count = 1
		},
		[6601] = {
			storageId = 12007,
			rewardId = 2494,
			count = 1
		},
		[6600] = {
			storageId = 12007,
			rewardId = 2400,
			count = 1
		},
		[6602] = {
			storageId = 12007,
			rewardId = 2431,
			count = 1
		},
		[6603] = {
			storageId = 12007,
			rewardId = 2326,
			count = 1
		},
		[6201] = {
			storageId = 12008,
			rewardId = 2493,
			count = 1
		},
		[6202] = {
			storageId = 12009,
			rewardId = 2520,
			count = 1
		},
		[4671] = {
			storageId = 12010,
			rewardId = 2466,
			count = 1
		},
		[6334] = {
			storageId = 12011,
			rewardId = 2427,
			count = 1
		},
		[9413] = {
			storageId = 12012,
			rewardId = 2171,
			count = 1
		},
		[6131] = {
			storageId = 12013,
			rewardId = 2407,
			count = 1
		},
		[3567] = {
			storageId = 12014,
			rewardId = 2195,
			count = 1
		},
		[7895] = {
			storageId = 12015,
			rewardId = 2152,
			count = 100
		},
		[6145] = {
			storageId = 12016,
			rewardId = 2393,
			count = 1
		},
		[4168] = {
			storageId = 12017,
			rewardId = 2536,
			count = 1
		},
		[4673] = {
			storageId = 12018,
			rewardId = 2197,
			count = 5
		},
		[4691] = {
			storageId = 12019,
			rewardId = 2165,
			count = 1
		},
		[6123] = {
			storageId = 12020,
			rewardId = 2662,
			count = 1
		},
		[6371] = {
			storageId = 12021,
			rewardId = 2268,
			count = 20
		},
		[7894] = {
			storageId = 12022,
			rewardId = 6561,
			count = 1
		},
		[4362] = {
			storageId = 12023,
			rewardId = 2361,
			count = 1
		},
		[4361] = {
			storageId = 12024,
			rewardId = 5791,
			count = 1
		},
		[3165] = {
			storageId = 12025,
			rewardId = 2268,
			count = 100
		},
		[51413] = {
			storageId = 12026,
			rewardId = 2365,
			count = 1
		},
		[3152] = {
			storageId = 12027,
			rewardId = 6132,
			count = 1
		},
		[3151] = {
			storageId = 12028,
			rewardId = 2152,
			count = 100
		},
		[6103] = {
			storageId = 12029,
			rewardId = 5803,
			count = 1
		},
		[6100] = {
			storageId = 12029,
			rewardId = 6528,
			count = 1
		},
		[8101] = {
			storageId = 12029,
			rewardId = 2453,
			count = 1
		},
		[9000] = {
			storageId = 12030,
			rewardId = 2536,
			count = 1
		},
		[9001] = {
			storageId = 12031,
			rewardId = 2436,
			count = 1
		},
		[9002] = {
			storageId = 12032,
			rewardId = 2656,
			count = 1
		},
		
		[9003] = {
			storageId = 12033,
			rewardId = 2464,
			count = 1
		},
		[9004] = {
			storageId = 12034,
			rewardId = 2152,
			count = 3
		},
		[9005] = {
			storageId = 12035,
			rewardId = 2490,
			count = 1
		},
		[9006] = {
			storageId = 12036,
			rewardId = 2395,
			count = 1
		},
		[9007] = {
			storageId = 12037,
			rewardId = 2580,
			count = 1
		},
		[9008] = {
			storageId = 12038,
			rewardId = 2468,
			count = 1
		},
		[9009] = {
			storageId = 12039,
			rewardId = 2412,
			count = 1
		},
		[9010] = {
			storageId = 12040,
			rewardId = 2530,
			count = 1
		},
		[9011] = {
			storageId = 12041,
			rewardId = 2384,
			count = 1
		},
		[9012] = {
			storageId = 12042,
			rewardId = 2214,
			count = 1
		},
		[9013] = {
			storageId = 12043,
			rewardId = 2327,
			count = 1
		},
		[9014] = {
			storageId = 12044,
			rewardId = 2163,
			count = 1
		},
		[9015] = {
			storageId = 12045,
			rewardId = 2152,
			count = 100
		},
		[9016] = {
			storageId = 12046,
			rewardId = 2200,
			count = 1
		},
	}

function useQuestChest(cid, quest)
	local queststatus = getPlayerStorageValue(cid, quest.storageId)
	if queststatus == -1 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. [B]getItemName[/B](quest.rewardId) .. ".")
		doPlayerAddItem(cid, quest.rewardId, quest.count)
		setPlayerStorageValue(cid, quest.storageId, 1)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
	end
end

function onUse(cid, item, frompos, item2, topos)
	if quests[item.uid] ~= nil then
		useQuestChest(cid, quests[item.uid])
	end
	return TRUE
end
 
Here is system.lua for thats quests in 0.3 TFS(!).And make chest actionid 2000, uniqueid - any free(use 2000-10000), and reward(fire sword) in the chest on mapeditor.


PHP:
local specialQuests = {
        [2001] = 30015 --Anhilator
}
 
local questsExperience = {
        [30015] = 10000
} 
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if(getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == TRUE) then
                return TRUE
        end
 
        local storage = specialQuests[item.actionid]
        if(storage == nil) then
                storage = item.uid
                if(storage > 65535) then
                        return FALSE
                end
        end
 
        local result = "It is empty."
        if(getPlayerStorageValue(cid, storage) == -1) then
                local items = {}
                local reward = 0
 
               	local size = isContainer(item.uid) == TRUE and getContainerSize(item.uid) or 0
                if(size == 0) then
                        reward = doCopyItem(item, FALSE)
                else
                        for i = 0, size do
                                local tmp = getContainerItem(item.uid, i)
                                if(tmp.itemid > 0) then
                                        table.insert(items, tmp)
                                end
                        end
                end
 
                size = table.maxn(items)
                if(size == 1) then
                        reward = doCopyItem(items[1], TRUE)
                end
 
                		if(reward ~= 0) then
			local ret = getItemDescriptions(reward.uid)
			if(reward.type > 0 and isItemRune(reward.itemid) == TRUE) then
				result = reward.type .. " charges " .. ret.name
			elseif(reward.type > 0 and isItemStackable(reward.itemid) == TRUE) then
				result = reward.type .. " " .. ret.plural
			else
				result = ret.article .. " " .. ret.name
			end
		else
			result = ""
			if(size > 20) then
				reward = doCopyItem(item, FALSE)
			elseif(size > 8) then
				reward = getThing(doCreateItemEx(1988, 1))
			else
				reward = getThing(doCreateItemEx(1987, 1))
			end

			for i = 1, size do
				local tmp = doCopyItem(items[i], TRUE)
				if(doAddContainerItemEx(reward.uid, tmp.uid) ~= RETURNVALUE_NOERROR) then
					print("[Warning] QuestSystem:", "Could not add quest reward")
				else
					local ret = ", "
					if(i == 2) then
						ret = " and "
					elseif(i == 1) then
						ret = ""
					end

					result = result .. ret
					ret = getItemDescriptions(tmp.uid)
					if(tmp.type > 0 and isItemRune(tmp.itemid) == TRUE) then
						result = result .. tmp.type .. " charges " .. ret.name
					elseif(tmp.type > 0 and isItemStackable(tmp.itemid) == TRUE) then
						result = result .. tmp.type .. " " .. ret.plural
					else
						result = result .. ret.article .. " " .. ret.name
					end
				end
			end
		end

		if(doPlayerAddItemEx(cid, reward.uid, FALSE) ~= RETURNVALUE_NOERROR) then
			result = "You have found a reward weighing " .. getItemWeight(reward.uid) .. " oz. It is too heavy or you have not enough space."
		else
			result = "You have found " .. result .. "."
			setPlayerStorageValue(cid, storage, 1)
			if(questsExperience[storage] ~= nil) then
				doPlayerAddExp(cid, questsExperience[storage])
				doSendAnimatedText(getCreaturePosition(cid), questsExperience[storage], TEXTCOLOR_WHITE)
			end
		end
	end

	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, result)
	return TRUE
end
 
I'm getting this error message:

[08/01/2009 18:02:11] data/actions/scripts/quests/system.lua:10: attempt to call global 'getPlayerCustomFlagValue' (a nil value)
[08/01/2009 18:02:11] stack traceback:
[08/01/2009 18:02:11] data/actions/scripts/quests/system.lua:10: in function <data/actions/scripts/quests/system.lua:9>

Know anything for me?
 
I know...I hate that the guy changed the system, or if he had to.
Anyway...here's how to:

The action id of the chest MUST ALWAYS be on '2000'.
Then what you want to loot in the quest at Unuiqe id :D And it works :p

/Limannen
 
Back
Top