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

Lua [ACTION] TFS 1.2 Exploration points

Tbol

Active Member
Joined
Apr 7, 2019
Messages
359
Reaction score
38
Looking for exploration points script basically you would need to click on objects and once you click on all of them you get storage.

So i will try to explain it clearer: so around the map lets say i put 40 statues and all of those 40 status have a unique actionid i guess because without action it wont work so anyways lets say you find one statue you click on it and it says You found 1/40 statues and storage lets say would become 5000, 1 then you find a second one it would say You found 2/40 statues so now storage becomes 5000, 2 and once you find all of the 40/40 it would say You have discovered all statues and now storage would be 5000, 40

and thats it nothing else
 
Solution
Ok understood. Fixed it.

Okay so another issue so i click on
A-5500, U-5502
And it said You have found 2/5 even tho it should be You have found 1/5 tried with multiple clean created characters to make sure its not my character that is bugged

Lua:
    [5500] = { explorationName =  "The Hidden Statues", -- actionid
        {5501, "aaaaaaaaaaaaaa1"}, -- uniqueid
        {5502, "aaaaaaaaaaaaaa2"},
        {5503, "aaaaaaaaaaaaaa3"},
        {5504, "aaaaaaaaaaaaaa4"},
        {5505, "aaaaaaaaaaaaaa5"},
        {5506, "aaaaaaaaaaaaaa6"},
    }
}
This is the print going from 5501 - 5506
The Forgotten Server (gyazo.com)
Sorry, that was a small oversight, from fixing the previous issue.

Final version...

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,642
Solutions
26
Reaction score
1,300
Looking for exploration points script basically you would need to click on objects and once you click on all of them you get storage.

So i will try to explain it clearer: so around the map lets say i put 40 statues and all of those 40 status have a unique actionid i guess because without action it wont work so anyways lets say you find one statue you click on it and it says You found 1/40 statues and storage lets say would become 5000, 1 then you find a second one it would say You found 2/40 statues so now storage becomes 5000, 2 and once you find all of the 40/40 it would say You have discovered all statues and now storage would be 5000, 40

and thats it nothing else
This is simple to do. You need one overall storage but also one storage for each statue, once you update the storate for each single statue you can update the overall storage.
 
OP
Tbol

Tbol

Active Member
Joined
Apr 7, 2019
Messages
359
Reaction score
38
This is simple to do. You need one overall storage but also one storage for each statue, once you update the storate for each single statue you can update the overall storage.
Well probably thats the reason why i posted in [REQUEST] section which says its not that easy :D
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,558
Solutions
386
Reaction score
3,682
Looking for exploration points script basically you would need to click on objects and once you click on all of them you get storage.

So i will try to explain it clearer: so around the map lets say i put 40 statues and all of those 40 status have a unique actionid i guess because without action it wont work so anyways lets say you find one statue you click on it and it says You found 1/40 statues and storage lets say would become 5000, 1 then you find a second one it would say You found 2/40 statues so now storage becomes 5000, 2 and once you find all of the 40/40 it would say You have discovered all statues and now storage would be 5000, 40

and thats it nothing else
Untested, like all of my scripts. xD

Put ACTIONID's in actions.xml
Put actionid's and unique's on objects in map editor.

Lua:
local explorationPoints = {
	--[[
	
	[actionid] = { explorationName = "name",
		{uniqueid, "text"},
		{uniqueid, "text"}
	}
	
	[1111] = { explorationName = "The Great Trees",
		{1112, "The White Tree"},
		{1113, "The Green Tree"}, -- 1112, 1113, 1114 are UniqueID's
		{1114, "The Black Tree"}  -- the text will show as "You have found 1/3 of The Great Trees! The Black Tree discovered!"
	},
	
	[2222] = { explorationName = "The Trees of Wealth"
		{2222, "The Gold Tree"},
		{2223, "The Platinum Tree"},
		{2224, "The Crystal Tree"}
	}
	
	--]]
	
	[5000] = { explorationName =  "The Hidden Statues", -- actionid
		{5001, "aaaaaaaaaaaaaa"}, -- uniqueid
		{5002, "aaaaaaaaaaaaaa"},
		{5003, "aaaaaaaaaaaaaa"},
		{5004, "aaaaaaaaaaaaaa"},
		{5005, "aaaaaaaaaaaaaa"},
		{5006, "aaaaaaaaaaaaaa"},
		{5007, "aaaaaaaaaaaaaa"},
		{5008, "aaaaaaaaaaaaaa"},
		{5009, "aaaaaaaaaaaaaa"},
		{5010, "aaaaaaaaaaaaaa"},
		{5011, "aaaaaaaaaaaaaa"},
		{5012, "aaaaaaaaaaaaaa"},
		{5013, "aaaaaaaaaaaaaa"},
		{5014, "aaaaaaaaaaaaaa"},
		{5015, "aaaaaaaaaaaaaa"},
		{5016, "aaaaaaaaaaaaaa"},
		{5017, "aaaaaaaaaaaaaa"},
		{5018, "aaaaaaaaaaaaaa"},
		{5019, "aaaaaaaaaaaaaa"},
		{5020, "aaaaaaaaaaaaaa"},
		{5021, "aaaaaaaaaaaaaa"},
		{5022, "aaaaaaaaaaaaaa"},
		{5023, "aaaaaaaaaaaaaa"},
		{5024, "aaaaaaaaaaaaaa"},
		{5025, "aaaaaaaaaaaaaa"},
		{5026, "aaaaaaaaaaaaaa"},
		{5027, "aaaaaaaaaaaaaa"},
		{5028, "aaaaaaaaaaaaaa"},
		{5029, "aaaaaaaaaaaaaa"},
		{5030, "aaaaaaaaaaaaaa"},
		{5031, "aaaaaaaaaaaaaa"},
		{5032, "aaaaaaaaaaaaaa"},
		{5033, "aaaaaaaaaaaaaa"},
		{5034, "aaaaaaaaaaaaaa"},
		{5035, "aaaaaaaaaaaaaa"},
		{5036, "aaaaaaaaaaaaaa"},
		{5037, "aaaaaaaaaaaaaa"},
		{5038, "aaaaaaaaaaaaaa"},
		{5039, "aaaaaaaaaaaaaa"},
		{5040, "aaaaaaaaaaaaaa"},
	},
	[5041] = { explorationName =  "The Great Tree's", -- actionid
		{5042, "abc123"}, -- uniqueid
		{5042, "abc123"}
	}
}




function onUse(player, item, fromPosition, target, toPosition, isHotkey) -- you might need to remove isHotkey, idk
	
	-- confirm if actionid is in table
	local actionID = item:getActionId()
	if not explorationPoints[actionID] then
		print("LUA ERROR: Exploration point actionid (" .. actionID .. ") is not in the table.")
		return true
	end
	
	-- confirm if uniqueid is setup on the item
	local uniqueID = item:getUniqueId()
	if uniqueID < 1 then
		print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not setup on the item.")
		return true
	end
	
	-- confirm that uniqueid is in the table
	-- update index
	local index = explorationPoints[actionID]
	local explorationCount = #index
	for i = 1, explorationCount do
		if index[i][1] == uniqueID then
			index = index[i]
			break
		end
		if i == explorationCount then
			print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not found in the table.")
			return true
		end
	end
	
	-- confirm if quest has been completed previously
	local actionidStorageValue = player:getStorageValue(actionID)
	local uniqueidStorageValue = player:getStorageValue(uniqueID)
	local explorationText = explorationPoints[actionID].explorationName
	if actionidStorageValue == explorationCount or uniqueidStorageValue == 1 then
		player:sendTextMessage(MESSAGE_STATUS_SMALL, "You have already " .. (uniqueidStorageValue ~= 1 and "finished the exploration of " .. explorationText .. "" or "found this exploration point") .. ".")
		return true
	end
	
	-- update quest status
	player:setStorageValue(actionID, actionidStorageValue + 1)
	player:setStorageValue(uniqueID, uniqueidStorageValue + 1)
	player:say("You have found " .. actionidStorageValue + 1 .. "/" .. explorationCount .. " of\n" .. explorationText .. "!\n\n" .. index[2] .. " discovered!", TALKTYPE_MONSTER_SAY)
	
	-- if quest completed, delay finish text by 2 seconds
	-- (delayed, so that it doesn't over-take the orange text completely)
	if actionidStorageValue == explorationCount then
		local playerID = player:getId()
		addEvent(function(playerID, explorationText)
			local player = Player(playerID)
			if not player then
				return true
			end
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have finished exploring\n" .. explorationText .. "!")
		end, 2000)
	end
	return true
end
 
Last edited:
OP
Tbol

Tbol

Active Member
Joined
Apr 7, 2019
Messages
359
Reaction score
38
Glad it worked first try. lol
Did tested yet but i have a feeling it works :D
Post automatically merged:

Okay so tested it. So i have few question because something is weird maybe its because my fault. So in rme i made 6 exploration points objects just for testing. All of them are like this
[A - ACTIONID] [U - UNIQUEID]

A-5500, U-5500
A-5500, U-5501
A-5500, U-5502
A-5500, U-5503
A-5500, U-5504
A-5500, U-5505

Not sure but maybe i should make them like this and i miss understood something :D
A-5500, U-5500
A-5501, U-5501
A-5502, U-5502
A-5503, U-5503
A-5504, U-5504
A-5505, U-5505

So the issues i got

    • If you click on [A]5500, 5500 i get LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not found in the table even tho its the first one

Lua:
[5500] = { explorationName =  "The Hidden Statues", -- actionid

    • Last issue i noticed you can click two times on them so lets say i click on [A]5500, 5504 it says You have found 0/5 of and i click on it again now it says You have found 1/5 of so basically you can duplicate click on it.


But maybe all of this happening because i miss understood how to setup actionid and uniqueid this is what we got so far from configs
XML:
<action actionid="5500" script="quests/exploration.lua" />
Lua:
    [5500] = { explorationName =  "The Hidden Statues", -- actionid
        {5501, "aaaaaaaaaaaaaa1"}, -- uniqueid
        {5502, "aaaaaaaaaaaaaa2"},
        {5503, "aaaaaaaaaaaaaa3"},
        {5504, "aaaaaaaaaaaaaa4"},
        {5505, "aaaaaaaaaaaaaa5"},
    }
}
 
Last edited:

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,558
Solutions
386
Reaction score
3,682
Did tested yet but i have a feeling it works :D
Post automatically merged:

Okay so tested it. So i have few question because something is weird maybe its because my fault. So in rme i made 6 exploration points objects just for testing. All of them are like this
[A - ACTIONID] [U - UNIQUEID]

A-5500, U-5500
A-5500, U-5501
A-5500, U-5502
A-5500, U-5503
A-5500, U-5504
A-5500, U-5505

Not sure but maybe i should make them like this and i miss understood something :D
A-5500, U-5500
A-5501, U-5501
A-5502, U-5502
A-5503, U-5503
A-5504, U-5504
A-5505, U-5505

So the issues i got

    • If you click on [A]5500, 5500 i get LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not found in the table even tho its the first one

Lua:
[5500] = { explorationName =  "The Hidden Statues", -- actionid

    • Last issue i noticed you can click two times on them so lets say i click on [A]5500, 5504 it says You have found 0/5 of and i click on it again now it says You have found 1/5 of so basically you can duplicate click on it.


But maybe all of this happening because i miss understood how to setup actionid and uniqueid this is what we got so far from configs
XML:
<action actionid="5500" script="quests/exploration.lua" />
Lua:
    [5500] = { explorationName =  "The Hidden Statues", -- actionid
        {5501, "aaaaaaaaaaaaaa1"}, -- uniqueid
        {5502, "aaaaaaaaaaaaaa2"},
        {5503, "aaaaaaaaaaaaaa3"},
        {5504, "aaaaaaaaaaaaaa4"},
        {5505, "aaaaaaaaaaaaaa5"},
    }
}

this is correct way

A-5500, U-5500
A-5500, U-5501
A-5500, U-5502
A-5500, U-5503
A-5500, U-5504
A-5500, U-5505

------

Changed nothing, but added a bunch of prints.

Please show the console after clicking a statue Once.

Lua:
local explorationPoints = {
	--[[
	
	[actionid] = { explorationName = "name",
		{uniqueid, "text"},
		{uniqueid, "text"}
	}
	
	[1111] = { explorationName = "The Great Trees",
		{1112, "The White Tree"},
		{1113, "The Green Tree"}, -- 1112, 1113, 1114 are UniqueID's
		{1114, "The Black Tree"}  -- the text will show as "You have found 1/3 of The Great Trees! The Black Tree discovered!"
	},
	
	[2222] = { explorationName = "The Trees of Wealth"
		{2222, "The Gold Tree"},
		{2223, "The Platinum Tree"},
		{2224, "The Crystal Tree"}
	}
	
	--]]
	
	[5000] = { explorationName =  "The Hidden Statues", -- actionid
		{5001, "aaaaaaaaaaaaaa"}, -- uniqueid
		{5002, "aaaaaaaaaaaaaa"},
		{5003, "aaaaaaaaaaaaaa"},
		{5004, "aaaaaaaaaaaaaa"},
		{5005, "aaaaaaaaaaaaaa"},
		{5006, "aaaaaaaaaaaaaa"},
		{5007, "aaaaaaaaaaaaaa"},
		{5008, "aaaaaaaaaaaaaa"},
		{5009, "aaaaaaaaaaaaaa"},
		{5010, "aaaaaaaaaaaaaa"},
		{5011, "aaaaaaaaaaaaaa"},
		{5012, "aaaaaaaaaaaaaa"},
		{5013, "aaaaaaaaaaaaaa"},
		{5014, "aaaaaaaaaaaaaa"},
		{5015, "aaaaaaaaaaaaaa"},
		{5016, "aaaaaaaaaaaaaa"},
		{5017, "aaaaaaaaaaaaaa"},
		{5018, "aaaaaaaaaaaaaa"},
		{5019, "aaaaaaaaaaaaaa"},
		{5020, "aaaaaaaaaaaaaa"},
		{5021, "aaaaaaaaaaaaaa"},
		{5022, "aaaaaaaaaaaaaa"},
		{5023, "aaaaaaaaaaaaaa"},
		{5024, "aaaaaaaaaaaaaa"},
		{5025, "aaaaaaaaaaaaaa"},
		{5026, "aaaaaaaaaaaaaa"},
		{5027, "aaaaaaaaaaaaaa"},
		{5028, "aaaaaaaaaaaaaa"},
		{5029, "aaaaaaaaaaaaaa"},
		{5030, "aaaaaaaaaaaaaa"},
		{5031, "aaaaaaaaaaaaaa"},
		{5032, "aaaaaaaaaaaaaa"},
		{5033, "aaaaaaaaaaaaaa"},
		{5034, "aaaaaaaaaaaaaa"},
		{5035, "aaaaaaaaaaaaaa"},
		{5036, "aaaaaaaaaaaaaa"},
		{5037, "aaaaaaaaaaaaaa"},
		{5038, "aaaaaaaaaaaaaa"},
		{5039, "aaaaaaaaaaaaaa"},
		{5040, "aaaaaaaaaaaaaa"},
	},
	[5041] = { explorationName =  "The Great Tree's", -- actionid
		{5042, "abc123"}, -- uniqueid
		{5042, "abc123"}
	}
}




function onUse(player, item, fromPosition, target, toPosition, isHotkey) -- you might need to remove isHotkey, idk
	print("-----------\nScript Start...")
	-- confirm if actionid is in table
	local actionID = item:getActionId()
	print("actionid = " .. actionID)
	if not explorationPoints[actionID] then
		print("LUA ERROR: Exploration point actionid (" .. actionID .. ") is not in the table.")
		return true
	end
	
	-- confirm if uniqueid is setup on the item
	local uniqueID = item:getUniqueId()
	print("uniqueid = " .. uniqueID)
	if uniqueID < 1 then
		print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not setup on the item.")
		return true
	end
	
	-- confirm that uniqueid is in the table
	-- update index
	local index = explorationPoints[actionID]
	local explorationCount = #index
	print("explorationCount = " .. explorationCount)
	for i = 1, explorationCount do
		print("index_uniqueid = " .. index[i][1] .. " | item_uniqueid = " .. uniqueID)
		if index[i][1] == uniqueID then
			index = index[i]
			break
		end
		if i == explorationCount then
			print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not found in the table.")
			return true
		end
	end
	
	-- confirm if quest has been completed previously
	local actionidStorageValue = player:getStorageValue(actionID)
	local uniqueidStorageValue = player:getStorageValue(uniqueID)
	local explorationText = explorationPoints[actionID].explorationName
	print("actionidStorageValue = " .. actionidStorageValue)
	print("uniqueidStorageValue = " .. uniqueidStorageValue)
	print("explorationText = " .. explorationText)
	if actionidStorageValue == explorationCount or uniqueidStorageValue == 1 then
		player:sendTextMessage(MESSAGE_STATUS_SMALL, "You have already " .. (uniqueidStorageValue ~= 1 and "finished the exploration of " .. explorationText .. "" or "found this exploration point") .. ".")
		return true
	end
	
	-- update quest status
	player:setStorageValue(actionID, actionidStorageValue + 1)
	player:setStorageValue(uniqueID, uniqueidStorageValue + 1)
	player:say("You have found " .. actionidStorageValue + 1 .. "/" .. explorationCount .. " of\n" .. explorationText .. "!\n\n" .. index[2] .. " discovered!", TALKTYPE_MONSTER_SAY)
	
	-- if quest completed, delay finish text by 2 seconds
	-- (delayed, so that it doesn't over-take the orange text completely)
	if actionidStorageValue == explorationCount then
		local playerID = player:getId()
		addEvent(function(playerID, explorationText)
			local player = Player(playerID)
			if not player then
				return true
			end
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have finished exploring\n" .. explorationText .. "!")
		end, 2000)
	end
	print("Script Completed.")
	return true
end
 
Last edited:
OP
Tbol

Tbol

Active Member
Joined
Apr 7, 2019
Messages
359
Reaction score
38
this is correct way

A-5500, U-5500
A-5500, U-5501
A-5500, U-5502
A-5500, U-5503
A-5500, U-5504
A-5500, U-5505

------

Changed nothing, but added a bunch of prints.

Please show the console after clicking a statue Once.

Lua:
local explorationPoints = {
    --[[
   
    [actionid] = { explorationName = "name",
        {uniqueid, "text"},
        {uniqueid, "text"}
    }
   
    [1111] = { explorationName = "The Great Trees",
        {1112, "The White Tree"},
        {1113, "The Green Tree"}, -- 1112, 1113, 1114 are UniqueID's
        {1114, "The Black Tree"}  -- the text will show as "You have found 1/3 of The Great Trees! The Black Tree discovered!"
    },
   
    [2222] = { explorationName = "The Trees of Wealth"
        {2222, "The Gold Tree"},
        {2223, "The Platinum Tree"},
        {2224, "The Crystal Tree"}
    }
   
    --]]
   
    [5000] = { explorationName =  "The Hidden Statues", -- actionid
        {5001, "aaaaaaaaaaaaaa"}, -- uniqueid
        {5002, "aaaaaaaaaaaaaa"},
        {5003, "aaaaaaaaaaaaaa"},
        {5004, "aaaaaaaaaaaaaa"},
        {5005, "aaaaaaaaaaaaaa"},
        {5006, "aaaaaaaaaaaaaa"},
        {5007, "aaaaaaaaaaaaaa"},
        {5008, "aaaaaaaaaaaaaa"},
        {5009, "aaaaaaaaaaaaaa"},
        {5010, "aaaaaaaaaaaaaa"},
        {5011, "aaaaaaaaaaaaaa"},
        {5012, "aaaaaaaaaaaaaa"},
        {5013, "aaaaaaaaaaaaaa"},
        {5014, "aaaaaaaaaaaaaa"},
        {5015, "aaaaaaaaaaaaaa"},
        {5016, "aaaaaaaaaaaaaa"},
        {5017, "aaaaaaaaaaaaaa"},
        {5018, "aaaaaaaaaaaaaa"},
        {5019, "aaaaaaaaaaaaaa"},
        {5020, "aaaaaaaaaaaaaa"},
        {5021, "aaaaaaaaaaaaaa"},
        {5022, "aaaaaaaaaaaaaa"},
        {5023, "aaaaaaaaaaaaaa"},
        {5024, "aaaaaaaaaaaaaa"},
        {5025, "aaaaaaaaaaaaaa"},
        {5026, "aaaaaaaaaaaaaa"},
        {5027, "aaaaaaaaaaaaaa"},
        {5028, "aaaaaaaaaaaaaa"},
        {5029, "aaaaaaaaaaaaaa"},
        {5030, "aaaaaaaaaaaaaa"},
        {5031, "aaaaaaaaaaaaaa"},
        {5032, "aaaaaaaaaaaaaa"},
        {5033, "aaaaaaaaaaaaaa"},
        {5034, "aaaaaaaaaaaaaa"},
        {5035, "aaaaaaaaaaaaaa"},
        {5036, "aaaaaaaaaaaaaa"},
        {5037, "aaaaaaaaaaaaaa"},
        {5038, "aaaaaaaaaaaaaa"},
        {5039, "aaaaaaaaaaaaaa"},
        {5040, "aaaaaaaaaaaaaa"},
    },
    [5041] = { explorationName =  "The Great Tree's", -- actionid
        {5042, "abc123"}, -- uniqueid
        {5042, "abc123"}
    }
}




function onUse(player, item, fromPosition, target, toPosition, isHotkey) -- you might need to remove isHotkey, idk
    print("-----------\nScript Start...")
    -- confirm if actionid is in table
    local actionID = item:getActionId()
    print("actionid = " .. actionID)
    if not explorationPoints[actionID] then
        print("LUA ERROR: Exploration point actionid (" .. actionID .. ") is not in the table.")
        return true
    end
   
    -- confirm if uniqueid is setup on the item
    local uniqueID = item:getUniqueId()
    print("uniqueid = " .. uniqueID)
    if uniqueID < 1 then
        print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not setup on the item.")
        return true
    end
   
    -- confirm that uniqueid is in the table
    -- update index
    local index = explorationPoints[actionID]
    local explorationCount = #index
    print("explorationCount = " .. explorationCount)
    for i = 1, explorationCount do
        print("index_uniqueid = " .. index[i][1] .. " | item_uniqueid = " .. uniqueID)
        if index[i][1] == uniqueID then
            index = index[i]
            break
        end
        if i == explorationCount then
            print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not found in the table.")
            return true
        end
    end
   
    -- confirm if quest has been completed previously
    local actionidStorageValue = player:getStorageValue(actionID)
    local uniqueidStorageValue = player:getStorageValue(uniqueID)
    local explorationText = explorationPoints[actionID].explorationName
    print("actionidStorageValue = " .. actionidStorageValue)
    print("uniqueidStorageValue = " .. uniqueidStorageValue)
    print("explorationText = " .. explorationText)
    if actionidStorageValue == explorationCount or uniqueidStorageValue == 1 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You have already " .. (uniqueidStorageValue ~= 1 and "finished the exploration of " .. explorationText .. "" or "found this exploration point") .. ".")
        return true
    end
   
    -- update quest status
    player:setStorageValue(actionID, actionidStorageValue + 1)
    player:setStorageValue(uniqueID, uniqueidStorageValue + 1)
    player:say("You have found " .. actionidStorageValue + 1 .. "/" .. explorationCount .. " of\n" .. explorationText .. "!\n\n" .. index[2] .. " discovered!", TALKTYPE_MONSTER_SAY)
   
    -- if quest completed, delay finish text by 2 seconds
    -- (delayed, so that it doesn't over-take the orange text completely)
    if actionidStorageValue == explorationCount then
        local playerID = player:getId()
        addEvent(function(playerID, explorationText)
            local player = Player(playerID)
            if not player then
                return true
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have finished exploring\n" .. explorationText .. "!")
        end, 2000)
    end
    print("Script Completed.")
    return true
end
Did multiple screens so it would give more information

This is what it prints when i click on
A-5500, U-5500
The Forgotten Server (gyazo.com)

This is what it prints when i click on
A-5500, U-5502
The Forgotten Server (gyazo.com)


This is what it prints when i click on
A-5500, U-5502 two times
The Forgotten Server (gyazo.com)

This is what it prints when i click
A-5500, U-5502 three times
The Forgotten Server (gyazo.com)
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,558
Solutions
386
Reaction score
3,682
Did multiple screens so it would give more information

This is what it prints when i click on
A-5500, U-5500
The Forgotten Server (gyazo.com)

This is what it prints when i click on
A-5500, U-5502
The Forgotten Server (gyazo.com)


This is what it prints when i click on
A-5500, U-5502 two times
The Forgotten Server (gyazo.com)

This is what it prints when i click
A-5500, U-5502 three times
The Forgotten Server (gyazo.com)
table is setup to start with uniqueid 5001. You're using 5000 on one of the statues.

Either alter the statue, or alter the table

-- edit..

That's the main issue. But there is another problem I see as well.
Give me a second to fix that.

-- edit 2

here's the fixed version.

Lua:
local explorationPoints = {
	--[[
	
	[actionid] = { explorationName = "name",
		{uniqueid, "text"},
		{uniqueid, "text"}
	}
	
	[1111] = { explorationName = "The Great Trees",
		{1112, "The White Tree"},
		{1113, "The Green Tree"}, -- 1112, 1113, 1114 are UniqueID's
		{1114, "The Black Tree"}  -- the text will show as "You have found 1/3 of The Great Trees! The Black Tree discovered!"
	},
	
	[2222] = { explorationName = "The Trees of Wealth"
		{2222, "The Gold Tree"},
		{2223, "The Platinum Tree"},
		{2224, "The Crystal Tree"}
	}
	
	--]]
	
	[5000] = { explorationName =  "The Hidden Statues", -- actionid
		{5001, "aaaaaaaaaaaaaa"}, -- uniqueid
		{5002, "aaaaaaaaaaaaaa"},
		{5003, "aaaaaaaaaaaaaa"},
		{5004, "aaaaaaaaaaaaaa"},
		{5005, "aaaaaaaaaaaaaa"},
		{5006, "aaaaaaaaaaaaaa"},
		{5007, "aaaaaaaaaaaaaa"},
		{5008, "aaaaaaaaaaaaaa"},
		{5009, "aaaaaaaaaaaaaa"},
		{5010, "aaaaaaaaaaaaaa"},
		{5011, "aaaaaaaaaaaaaa"},
		{5012, "aaaaaaaaaaaaaa"},
		{5013, "aaaaaaaaaaaaaa"},
		{5014, "aaaaaaaaaaaaaa"},
		{5015, "aaaaaaaaaaaaaa"},
		{5016, "aaaaaaaaaaaaaa"},
		{5017, "aaaaaaaaaaaaaa"},
		{5018, "aaaaaaaaaaaaaa"},
		{5019, "aaaaaaaaaaaaaa"},
		{5020, "aaaaaaaaaaaaaa"},
		{5021, "aaaaaaaaaaaaaa"},
		{5022, "aaaaaaaaaaaaaa"},
		{5023, "aaaaaaaaaaaaaa"},
		{5024, "aaaaaaaaaaaaaa"},
		{5025, "aaaaaaaaaaaaaa"},
		{5026, "aaaaaaaaaaaaaa"},
		{5027, "aaaaaaaaaaaaaa"},
		{5028, "aaaaaaaaaaaaaa"},
		{5029, "aaaaaaaaaaaaaa"},
		{5030, "aaaaaaaaaaaaaa"},
		{5031, "aaaaaaaaaaaaaa"},
		{5032, "aaaaaaaaaaaaaa"},
		{5033, "aaaaaaaaaaaaaa"},
		{5034, "aaaaaaaaaaaaaa"},
		{5035, "aaaaaaaaaaaaaa"},
		{5036, "aaaaaaaaaaaaaa"},
		{5037, "aaaaaaaaaaaaaa"},
		{5038, "aaaaaaaaaaaaaa"},
		{5039, "aaaaaaaaaaaaaa"},
		{5040, "aaaaaaaaaaaaaa"},
	},
	[5041] = { explorationName =  "The Great Tree's", -- actionid
		{5042, "abc123"}, -- uniqueid
		{5042, "abc123"}
	}
}




function onUse(player, item, fromPosition, target, toPosition, isHotkey) -- you might need to remove isHotkey, idk
	print("-----------\nScript Start...")
	-- confirm if actionid is in table
	local actionID = item:getActionId()
	print("actionid = " .. actionID)
	if not explorationPoints[actionID] then
		print("LUA ERROR: Exploration point actionid (" .. actionID .. ") is not in the table.")
		return true
	end
	
	-- confirm if uniqueid is setup on the item
	local uniqueID = item:getUniqueId()
	print("uniqueid = " .. uniqueID)
	if uniqueID < 1 then
		print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not setup on the item.")
		return true
	end
	
	-- confirm that uniqueid is in the table
	-- update index
	local index = explorationPoints[actionID]
	local explorationCount = #index
	print("explorationCount = " .. explorationCount)
	for i = 1, explorationCount do
		print("index_uniqueid = " .. index[i][1] .. " | item_uniqueid = " .. uniqueID)
		if index[i][1] == uniqueID then
			index = index[i]
			break
		end
		if i == explorationCount then
			print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not found in the table.")
			return true
		end
	end
	
	-- confirm if quest has been completed previously
	local actionidStorageValue = player:getStorageValue(actionID)
	local uniqueidStorageValue = player:getStorageValue(uniqueID)
	local explorationText = explorationPoints[actionID].explorationName
	print("actionidStorageValue = " .. actionidStorageValue)
	print("uniqueidStorageValue = " .. uniqueidStorageValue)
	print("explorationText = " .. explorationText)
	if actionidStorageValue == explorationCount or uniqueidStorageValue == 1 then
		player:sendTextMessage(MESSAGE_STATUS_SMALL, "You have already " .. (uniqueidStorageValue ~= 1 and "finished the exploration of " .. explorationText .. "" or "found this exploration point") .. ".")
		return true
	end
	
	-- update quest status
	actionidStorageValue = actionidStorageValue > 0 and actionidStorageValue + 1 or 1
	player:setStorageValue(actionID, actionidStorageValue)
	player:setStorageValue(uniqueID, 1)
	player:say("You have found " .. actionidStorageValue + 1 .. "/" .. explorationCount .. " of\n" .. explorationText .. "!\n\n" .. index[2] .. " discovered!", TALKTYPE_MONSTER_SAY)
	
	-- if quest completed, delay finish text by 2 seconds
	-- (delayed, so that it doesn't over-take the orange text completely)
	if actionidStorageValue + 1 == explorationCount then
		local playerID = player:getId()
		addEvent(function(playerID, explorationText)
			local player = Player(playerID)
			if not player then
				return true
			end
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have finished exploring\n" .. explorationText .. "!")
		end, 2000)
	end
	print("Script Completed.")
	return true
end
 
Last edited:
OP
Tbol

Tbol

Active Member
Joined
Apr 7, 2019
Messages
359
Reaction score
38
table is setup to start with uniqueid 5001. You're using 5000 on one of the statues.

Either alter the statue, or alter the table

-- edit..

That's the main issue. But there is another problem I see as well.
Give me a second to fix that.

-- edit 2

here's the fixed version.

Lua:
local explorationPoints = {
    --[[
 
    [actionid] = { explorationName = "name",
        {uniqueid, "text"},
        {uniqueid, "text"}
    }
 
    [1111] = { explorationName = "The Great Trees",
        {1112, "The White Tree"},
        {1113, "The Green Tree"}, -- 1112, 1113, 1114 are UniqueID's
        {1114, "The Black Tree"}  -- the text will show as "You have found 1/3 of The Great Trees! The Black Tree discovered!"
    },
 
    [2222] = { explorationName = "The Trees of Wealth"
        {2222, "The Gold Tree"},
        {2223, "The Platinum Tree"},
        {2224, "The Crystal Tree"}
    }
 
    --]]
 
    [5000] = { explorationName =  "The Hidden Statues", -- actionid
        {5001, "aaaaaaaaaaaaaa"}, -- uniqueid
        {5002, "aaaaaaaaaaaaaa"},
        {5003, "aaaaaaaaaaaaaa"},
        {5004, "aaaaaaaaaaaaaa"},
        {5005, "aaaaaaaaaaaaaa"},
        {5006, "aaaaaaaaaaaaaa"},
        {5007, "aaaaaaaaaaaaaa"},
        {5008, "aaaaaaaaaaaaaa"},
        {5009, "aaaaaaaaaaaaaa"},
        {5010, "aaaaaaaaaaaaaa"},
        {5011, "aaaaaaaaaaaaaa"},
        {5012, "aaaaaaaaaaaaaa"},
        {5013, "aaaaaaaaaaaaaa"},
        {5014, "aaaaaaaaaaaaaa"},
        {5015, "aaaaaaaaaaaaaa"},
        {5016, "aaaaaaaaaaaaaa"},
        {5017, "aaaaaaaaaaaaaa"},
        {5018, "aaaaaaaaaaaaaa"},
        {5019, "aaaaaaaaaaaaaa"},
        {5020, "aaaaaaaaaaaaaa"},
        {5021, "aaaaaaaaaaaaaa"},
        {5022, "aaaaaaaaaaaaaa"},
        {5023, "aaaaaaaaaaaaaa"},
        {5024, "aaaaaaaaaaaaaa"},
        {5025, "aaaaaaaaaaaaaa"},
        {5026, "aaaaaaaaaaaaaa"},
        {5027, "aaaaaaaaaaaaaa"},
        {5028, "aaaaaaaaaaaaaa"},
        {5029, "aaaaaaaaaaaaaa"},
        {5030, "aaaaaaaaaaaaaa"},
        {5031, "aaaaaaaaaaaaaa"},
        {5032, "aaaaaaaaaaaaaa"},
        {5033, "aaaaaaaaaaaaaa"},
        {5034, "aaaaaaaaaaaaaa"},
        {5035, "aaaaaaaaaaaaaa"},
        {5036, "aaaaaaaaaaaaaa"},
        {5037, "aaaaaaaaaaaaaa"},
        {5038, "aaaaaaaaaaaaaa"},
        {5039, "aaaaaaaaaaaaaa"},
        {5040, "aaaaaaaaaaaaaa"},
    },
    [5041] = { explorationName =  "The Great Tree's", -- actionid
        {5042, "abc123"}, -- uniqueid
        {5042, "abc123"}
    }
}




function onUse(player, item, fromPosition, target, toPosition, isHotkey) -- you might need to remove isHotkey, idk
    print("-----------\nScript Start...")
    -- confirm if actionid is in table
    local actionID = item:getActionId()
    print("actionid = " .. actionID)
    if not explorationPoints[actionID] then
        print("LUA ERROR: Exploration point actionid (" .. actionID .. ") is not in the table.")
        return true
    end
 
    -- confirm if uniqueid is setup on the item
    local uniqueID = item:getUniqueId()
    print("uniqueid = " .. uniqueID)
    if uniqueID < 1 then
        print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not setup on the item.")
        return true
    end
 
    -- confirm that uniqueid is in the table
    -- update index
    local index = explorationPoints[actionID]
    local explorationCount = #index
    print("explorationCount = " .. explorationCount)
    for i = 1, explorationCount do
        print("index_uniqueid = " .. index[i][1] .. " | item_uniqueid = " .. uniqueID)
        if index[i][1] == uniqueID then
            index = index[i]
            break
        end
        if i == explorationCount then
            print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not found in the table.")
            return true
        end
    end
 
    -- confirm if quest has been completed previously
    local actionidStorageValue = player:getStorageValue(actionID)
    local uniqueidStorageValue = player:getStorageValue(uniqueID)
    local explorationText = explorationPoints[actionID].explorationName
    print("actionidStorageValue = " .. actionidStorageValue)
    print("uniqueidStorageValue = " .. uniqueidStorageValue)
    print("explorationText = " .. explorationText)
    if actionidStorageValue == explorationCount or uniqueidStorageValue == 1 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You have already " .. (uniqueidStorageValue ~= 1 and "finished the exploration of " .. explorationText .. "" or "found this exploration point") .. ".")
        return true
    end
 
    -- update quest status
    actionidStorageValue = actionidStorageValue > 0 and actionidStorageValue + 1 or 1
    player:setStorageValue(actionID, actionidStorageValue)
    player:setStorageValue(uniqueID, 1)
    player:say("You have found " .. actionidStorageValue + 1 .. "/" .. explorationCount .. " of\n" .. explorationText .. "!\n\n" .. index[2] .. " discovered!", TALKTYPE_MONSTER_SAY)
 
    -- if quest completed, delay finish text by 2 seconds
    -- (delayed, so that it doesn't over-take the orange text completely)
    if actionidStorageValue + 1 == explorationCount then
        local playerID = player:getId()
        addEvent(function(playerID, explorationText)
            local player = Player(playerID)
            if not player then
                return true
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have finished exploring\n" .. explorationText .. "!")
        end, 2000)
    end
    print("Script Completed.")
    return true
end
Ok understood. Fixed it.

Okay so another issue so i click on
A-5500, U-5502
And it said You have found 2/5 even tho it should be You have found 1/5 tried with multiple clean created characters to make sure its not my character that is bugged

Lua:
    [5500] = { explorationName =  "The Hidden Statues", -- actionid
        {5501, "aaaaaaaaaaaaaa1"}, -- uniqueid
        {5502, "aaaaaaaaaaaaaa2"},
        {5503, "aaaaaaaaaaaaaa3"},
        {5504, "aaaaaaaaaaaaaa4"},
        {5505, "aaaaaaaaaaaaaa5"},
        {5506, "aaaaaaaaaaaaaa6"},
    }
}
Started from 5501 and ended with 5506. This is the print i got if its needed
The Forgotten Server (gyazo.com)
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,558
Solutions
386
Reaction score
3,682
Ok understood. Fixed it.

Okay so another issue so i click on
A-5500, U-5502
And it said You have found 2/5 even tho it should be You have found 1/5 tried with multiple clean created characters to make sure its not my character that is bugged

Lua:
    [5500] = { explorationName =  "The Hidden Statues", -- actionid
        {5501, "aaaaaaaaaaaaaa1"}, -- uniqueid
        {5502, "aaaaaaaaaaaaaa2"},
        {5503, "aaaaaaaaaaaaaa3"},
        {5504, "aaaaaaaaaaaaaa4"},
        {5505, "aaaaaaaaaaaaaa5"},
        {5506, "aaaaaaaaaaaaaa6"},
    }
}
This is the print going from 5501 - 5506
The Forgotten Server (gyazo.com)
Sorry, that was a small oversight, from fixing the previous issue.

Final version hopefully. xP
Lua:
local explorationPoints = {
	--[[
	
	[actionid] = { explorationName = "name",
		{uniqueid, "text"},
		{uniqueid, "text"}
	}
	
	[1111] = { explorationName = "The Great Trees",
		{1112, "The White Tree"},
		{1113, "The Green Tree"}, -- 1112, 1113, 1114 are UniqueID's
		{1114, "The Black Tree"}  -- the text will show as "You have found 1/3 of The Great Trees! The Black Tree discovered!"
	},
	
	[2222] = { explorationName = "The Trees of Wealth"
		{2222, "The Gold Tree"},
		{2223, "The Platinum Tree"},
		{2224, "The Crystal Tree"}
	}
	
	--]]
	
	[5000] = { explorationName =  "The Hidden Statues", -- actionid
		{5001, "aaaaaaaaaaaaaa"}, -- uniqueid
		{5002, "aaaaaaaaaaaaaa"},
		{5003, "aaaaaaaaaaaaaa"},
		{5004, "aaaaaaaaaaaaaa"},
		{5005, "aaaaaaaaaaaaaa"},
		{5006, "aaaaaaaaaaaaaa"},
		{5007, "aaaaaaaaaaaaaa"},
		{5008, "aaaaaaaaaaaaaa"},
		{5009, "aaaaaaaaaaaaaa"},
		{5010, "aaaaaaaaaaaaaa"},
		{5011, "aaaaaaaaaaaaaa"},
		{5012, "aaaaaaaaaaaaaa"},
		{5013, "aaaaaaaaaaaaaa"},
		{5014, "aaaaaaaaaaaaaa"},
		{5015, "aaaaaaaaaaaaaa"},
		{5016, "aaaaaaaaaaaaaa"},
		{5017, "aaaaaaaaaaaaaa"},
		{5018, "aaaaaaaaaaaaaa"},
		{5019, "aaaaaaaaaaaaaa"},
		{5020, "aaaaaaaaaaaaaa"},
		{5021, "aaaaaaaaaaaaaa"},
		{5022, "aaaaaaaaaaaaaa"},
		{5023, "aaaaaaaaaaaaaa"},
		{5024, "aaaaaaaaaaaaaa"},
		{5025, "aaaaaaaaaaaaaa"},
		{5026, "aaaaaaaaaaaaaa"},
		{5027, "aaaaaaaaaaaaaa"},
		{5028, "aaaaaaaaaaaaaa"},
		{5029, "aaaaaaaaaaaaaa"},
		{5030, "aaaaaaaaaaaaaa"},
		{5031, "aaaaaaaaaaaaaa"},
		{5032, "aaaaaaaaaaaaaa"},
		{5033, "aaaaaaaaaaaaaa"},
		{5034, "aaaaaaaaaaaaaa"},
		{5035, "aaaaaaaaaaaaaa"},
		{5036, "aaaaaaaaaaaaaa"},
		{5037, "aaaaaaaaaaaaaa"},
		{5038, "aaaaaaaaaaaaaa"},
		{5039, "aaaaaaaaaaaaaa"},
		{5040, "aaaaaaaaaaaaaa"},
	},
	[5041] = { explorationName =  "The Great Tree's", -- actionid
		{5042, "abc123"}, -- uniqueid
		{5042, "abc123"}
	}
}




function onUse(player, item, fromPosition, target, toPosition, isHotkey) -- you might need to remove isHotkey, idk

	-- confirm if actionid is in table
	local actionID = item:getActionId()
	if not explorationPoints[actionID] then
		print("LUA ERROR: Exploration point actionid (" .. actionID .. ") is not in the table.")
		return true
	end
	
	-- confirm if uniqueid is setup on the item
	local uniqueID = item:getUniqueId()
	if uniqueID < 1 then
		print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not setup on the item.")
		return true
	end
	
	-- confirm that uniqueid is in the table
	-- update index
	local index = explorationPoints[actionID]
	local explorationCount = #index
	for i = 1, explorationCount do
		if index[i][1] == uniqueID then
			index = index[i]
			break
		end
		if i == explorationCount then
			print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not found in the table.")
			return true
		end
	end
	
	-- confirm if quest has been completed previously
	local actionidStorageValue = player:getStorageValue(actionID)
	local uniqueidStorageValue = player:getStorageValue(uniqueID)
	local explorationText = explorationPoints[actionID].explorationName
	if actionidStorageValue == explorationCount or uniqueidStorageValue == 1 then
		player:sendTextMessage(MESSAGE_STATUS_SMALL, "You have already " .. (uniqueidStorageValue ~= 1 and "finished the exploration of " .. explorationText .. "" or "found this exploration point") .. ".")
		return true
	end
	
	-- update quest status
	actionidStorageValue = actionidStorageValue > 0 and actionidStorageValue + 1 or 1
	player:setStorageValue(actionID, actionidStorageValue)
	player:setStorageValue(uniqueID, 1)
	player:say("You have found " .. actionidStorageValue .. "/" .. explorationCount .. " of\n" .. explorationText .. "!\n\n" .. index[2] .. " discovered!", TALKTYPE_MONSTER_SAY)
	
	-- if quest completed, delay finish text by 2 seconds
	-- (delayed, so that it doesn't over-take the orange text completely)
	if actionidStorageValue == explorationCount then
		local playerID = player:getId()
		addEvent(function(playerID, explorationText)
			local player = Player(playerID)
			if not player then
				return true
			end
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have finished exploring\n" .. explorationText .. "!")
		end, 2000)
	end
	return true
end
 
Solution
OP
Tbol

Tbol

Active Member
Joined
Apr 7, 2019
Messages
359
Reaction score
38
Sorry, that was a small oversight, from fixing the previous issue.

Final version hopefully. xP
Lua:
local explorationPoints = {
    --[[
   
    [actionid] = { explorationName = "name",
        {uniqueid, "text"},
        {uniqueid, "text"}
    }
   
    [1111] = { explorationName = "The Great Trees",
        {1112, "The White Tree"},
        {1113, "The Green Tree"}, -- 1112, 1113, 1114 are UniqueID's
        {1114, "The Black Tree"}  -- the text will show as "You have found 1/3 of The Great Trees! The Black Tree discovered!"
    },
   
    [2222] = { explorationName = "The Trees of Wealth"
        {2222, "The Gold Tree"},
        {2223, "The Platinum Tree"},
        {2224, "The Crystal Tree"}
    }
   
    --]]
   
    [5000] = { explorationName =  "The Hidden Statues", -- actionid
        {5001, "aaaaaaaaaaaaaa"}, -- uniqueid
        {5002, "aaaaaaaaaaaaaa"},
        {5003, "aaaaaaaaaaaaaa"},
        {5004, "aaaaaaaaaaaaaa"},
        {5005, "aaaaaaaaaaaaaa"},
        {5006, "aaaaaaaaaaaaaa"},
        {5007, "aaaaaaaaaaaaaa"},
        {5008, "aaaaaaaaaaaaaa"},
        {5009, "aaaaaaaaaaaaaa"},
        {5010, "aaaaaaaaaaaaaa"},
        {5011, "aaaaaaaaaaaaaa"},
        {5012, "aaaaaaaaaaaaaa"},
        {5013, "aaaaaaaaaaaaaa"},
        {5014, "aaaaaaaaaaaaaa"},
        {5015, "aaaaaaaaaaaaaa"},
        {5016, "aaaaaaaaaaaaaa"},
        {5017, "aaaaaaaaaaaaaa"},
        {5018, "aaaaaaaaaaaaaa"},
        {5019, "aaaaaaaaaaaaaa"},
        {5020, "aaaaaaaaaaaaaa"},
        {5021, "aaaaaaaaaaaaaa"},
        {5022, "aaaaaaaaaaaaaa"},
        {5023, "aaaaaaaaaaaaaa"},
        {5024, "aaaaaaaaaaaaaa"},
        {5025, "aaaaaaaaaaaaaa"},
        {5026, "aaaaaaaaaaaaaa"},
        {5027, "aaaaaaaaaaaaaa"},
        {5028, "aaaaaaaaaaaaaa"},
        {5029, "aaaaaaaaaaaaaa"},
        {5030, "aaaaaaaaaaaaaa"},
        {5031, "aaaaaaaaaaaaaa"},
        {5032, "aaaaaaaaaaaaaa"},
        {5033, "aaaaaaaaaaaaaa"},
        {5034, "aaaaaaaaaaaaaa"},
        {5035, "aaaaaaaaaaaaaa"},
        {5036, "aaaaaaaaaaaaaa"},
        {5037, "aaaaaaaaaaaaaa"},
        {5038, "aaaaaaaaaaaaaa"},
        {5039, "aaaaaaaaaaaaaa"},
        {5040, "aaaaaaaaaaaaaa"},
    },
    [5041] = { explorationName =  "The Great Tree's", -- actionid
        {5042, "abc123"}, -- uniqueid
        {5042, "abc123"}
    }
}




function onUse(player, item, fromPosition, target, toPosition, isHotkey) -- you might need to remove isHotkey, idk

    -- confirm if actionid is in table
    local actionID = item:getActionId()
    if not explorationPoints[actionID] then
        print("LUA ERROR: Exploration point actionid (" .. actionID .. ") is not in the table.")
        return true
    end
   
    -- confirm if uniqueid is setup on the item
    local uniqueID = item:getUniqueId()
    if uniqueID < 1 then
        print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not setup on the item.")
        return true
    end
   
    -- confirm that uniqueid is in the table
    -- update index
    local index = explorationPoints[actionID]
    local explorationCount = #index
    for i = 1, explorationCount do
        if index[i][1] == uniqueID then
            index = index[i]
            break
        end
        if i == explorationCount then
            print("LUA ERROR: Exploration point uniqueid (" .. uniqueID .. ") is not found in the table.")
            return true
        end
    end
   
    -- confirm if quest has been completed previously
    local actionidStorageValue = player:getStorageValue(actionID)
    local uniqueidStorageValue = player:getStorageValue(uniqueID)
    local explorationText = explorationPoints[actionID].explorationName
    if actionidStorageValue == explorationCount or uniqueidStorageValue == 1 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You have already " .. (uniqueidStorageValue ~= 1 and "finished the exploration of " .. explorationText .. "" or "found this exploration point") .. ".")
        return true
    end
   
    -- update quest status
    actionidStorageValue = actionidStorageValue > 0 and actionidStorageValue + 1 or 1
    player:setStorageValue(actionID, actionidStorageValue)
    player:setStorageValue(uniqueID, 1)
    player:say("You have found " .. actionidStorageValue .. "/" .. explorationCount .. " of\n" .. explorationText .. "!\n\n" .. index[2] .. " discovered!", TALKTYPE_MONSTER_SAY)
   
    -- if quest completed, delay finish text by 2 seconds
    -- (delayed, so that it doesn't over-take the orange text completely)
    if actionidStorageValue == explorationCount then
        local playerID = player:getId()
        addEvent(function(playerID, explorationText)
            local player = Player(playerID)
            if not player then
                return true
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have finished exploring\n" .. explorationText .. "!")
        end, 2000)
    end
    return true
end
Its perfect now. Thank you so much!
 
Top