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

CreatureEvent Show Quests Completed onLook

Ancores

Active Member
Joined
Jan 17, 2010
Messages
538
Reaction score
28
Here's a script that shows how many quests a player has completed.
Simple, but pretty cool :)



creaturescripts/scripts/questLook.lua
Code:
function onLook(cid, thing, position, lookDistance)
local quests = {20001, 20003, 20009}
local completed = {}
	if isPlayer(thing.uid) then
		for i = 1, #quests do
			if getPlayerStorageValue(thing.uid, quests[i]) > 0 then
				table.insert(completed, 1)
			end
		end
		doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " has completed ".. #completed .. "/" .. #quests .. " quests")
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerName(thing.uid) .. " has completed " .. #completed .. "/" .. #quests .. " quests.")
	end
return true
end

creaturescripts/scripts/login.lua
Code:
registerCreatureEvent(cid, "questLook")

creaturescripts/creaturescripts.xml
Code:
<event type="look" name="questLook" event="script" value="questLook.lua"/>
 
Last edited:
I use something a lot like this but a bit longer. Thanks for making it cleaner :)
 
PHP:
function getQuests(cid)
	local quests = {20001, 20060, 20019, 18742} -- Change/add numbers to the unique ids on your quest chests.
	local completed = 0
	for _,quest in ipairs(quests) do
       		if(getPlayerStorageValue(cid, quest) > 0)then
			completed = completed+1
		end
	end
	doPlayerSetSpecialDescription(cid, (getPlayerSex(cid) == 0 and ".\nShe" or ".\nHe") .. " has completed ".. completed .. "/" .. #quests .. " quests.")
	return addEvent(getQuests, 60, cid)
end

function onLogin(cid)
	getQuests(cid)
	return true
end

my version, updating every 60 secs. no only by relog. : )
 
Last edited:
PHP:
function getQuests(cid)
    local quests = {20001, 20060, 20019, 18742} -- Change/add numbers to the unique ids on your quest chests.
    local completed = 0
    for _,quest in ipairs(quests) do
               if(getPlayerStorageValue(cid, quest) > 0)then
            completed = completed+1
        end
    end
    doPlayerSetSpecialDescription(cid, (getPlayerSex(cid) == 0 and ".\nShe" or ".\nHe") .. " has completed ".. completed .. "/" .. #quests .. " quests.")
    return addEvent(getQuests, 60, cid)
end

function onLogin(cid)
    getQuests(cid)
    return true
end
my version, updating every 60 secs. no only by relog. : )
what about onLook? it's always updated
 
Back
Top