Hidden Object Game package

Name: Hidden Object Game
By AdamO on Discord

This package contains game logic for a Hidden Object game, based on the Treasure Hunt game from the Cursed Galleons Hub.

How it works

  • Each day, 5 objects are chosen to appear at 5 spawns
  • Players can start the game by entering the yellow doorway, which makes the objects appear
  • You are timed for collecting all 5 objects (this time can go on a leaderboard if one is set)
  • If you leave the red zone, your game is cancelled
  • Throughout a day, the same objects will appear at the same spawns, so you can play several times to try and get a better time

How to use

  • Install the “Hidden Object Game” package from the Community tab
  • Place the “HiddenObjectGame” template into your world (note, the main script has an “OnUserLogin” function, so make sure your game already has logic for spawning the player or this could prevent them from spawning. Any standard starter game will include this logic, so you don’t need to worry about this)
  • Drag the “UserHiddenObject” template onto your User template
  • Preview your game and enter through the yellow door to start the collectable race!

Make it your own

  • You can change all of the collectable templates; they start with “HiddenObject_”
  • All collectable templates inherit from “HiddenObject_Gold_Base”, so change properties here to apply changes to all collectables
  • Copy and paste more spawns, and move them around. They’re detected automatically so don’t worry about adding them to an array
  • Change the number of active objects to have more or less active per race
  • Adjust the UI on the UserHiddenObject template to suit your game
5 Likes

Amazing Thank you :slight_smile:

Hey !

I can’t find a way to make so that the minigame ends when the player found all active objects.

Thank you.

PS : The event :

image

It must be OnEndRace instead of of OnUSerEnd

Hey.

I’m wondering and looking how I can link a leaderboard :

  • One for the most objects found.

Can you help me :slight_smile:

Oops I did have a couple of mistakes in that package, my apologies. I’ve pushed an update where it should now work exactly as described in this forum post, without any dead event properties, if you want to update it. Thanks for pointing out

Add a property at the top of the UserHiddenObjectScript like this:

{name = "foundLeaderboardID", type = "string"}

Assign it the leaderboard ID you want for your Found Objects leaderboard.

Then around line 227 you want to add this line

self:GetEntity():AddToLeaderboardValue(self.properties.foundLeaderboardID, 1)

So you should end up with a function there that reads like this

function UserHiddenObjectScript:FindObject(objectIndex)
	self.hiddenObjects[objectIndex].found = true
	self:UpdateClientObjects()
	
	self:GetEntity():AddToLeaderboardValue(self.properties.foundLeaderboardID, 1)
	
	-- See if that was the last object to find
	for _, ho in pairs(self.hiddenObjects) do
		if ho.found == false then
			self:StartObjectNotFoundSchedule()
			return
		end
	end
	
	self.hiddenObjectGame:SendToScripts("OnUserEnd", self:GetEntity())
	self.properties.onAllFound:Send(self:GetEntity())
end

Haven’t actually tried it but that should work :wink:

1 Like