Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

How can I detect if a player is carrying anything?

A topic by benzado created Feb 25, 2020 Views: 115 Replies: 3
Viewing posts 1 to 3
Submitted

My player character is a bird. He can only carry one item at a time in his beak, and if there's something in his beak he can't tweet or peck.

Thanks to the documentation, I've figured out how to set an inventory limit to prevent carrying more than one item at a time.

But I can't figure out how to determine whether the inventory is full when I'm handling another verb. In my case, knowing the number of items being carried would also work, because in my case I only need to see if that is 0 or 1.

(+1)

Have you tried: carried()
"Returns the number of items carried by the player excluding worn items (shallow)."

Submitted

D’oh! I swear I searched the documentation and didn’t find anything, but there it is. Thank you!

The lesson for me here is not to underestimate the value of a good night’s sleep.

Submitted (1 edit)

From memory:

: if (carried() < carry_limit()) {
   // room in inventory
}