Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Using the inventory_worn limit

A topic by Dee Cooke created Nov 04, 2019 Views: 155 Replies: 7
Viewing posts 1 to 5
Submitted (1 edit)

I'm currently trying to make it so that you can only wear one wearable item at a time:

integers {

   clothes_limit : integer "1" ;
   inventory_limit : integer "20" ;

}

settings {

   inventory_items_limit_var = inventory_limit
   inventory_worn_items_limit_var = clothes_limit

}

The inventory limit works absolutely fine.  The clothes limit doesn't - the game still allows the player to pick up and wear multiple wearable items at once.

There are only four wearable items to deal with, so I can work around it, but I'd like to understand what I'm doing wrong - any ideas?

Host

A nice fresh bug in Adventuron - well spotted.

I have now fixed this, so press refresh on your adventuron editor page. The Adventuron version called "1.0.0 Beta 8f" should have this bug fixed now.

Submitted

Many thanks!

Submitted

Have just tested in 1.0.0 Beta 8f and still not working.

Host (1 edit)

Sorry about this Dee.

Can you make a runnable Adventuron source code snippet that demonstrates it not working (as well as instructions on what you expect to see versus what is happening)?

My own game file that I tested it with does seem to work.

You can style text as code using the top left icon above the comments textbox in this forum.

Submitted

In making the snippet I think I've identified the problem.  I'm using custom wear and unwear commands because I'm changing a boolean when clothes are worn and unworn, and that seems to be overriding the inventory_worn limit.

Like I say, it's easily worked around!

######################################
#  Adventuron                        #
###################################### start_at                 = house_upstairs ######################################
#  Locations                         #
###################################### locations {    house_upstairs : location "You are upstairs." ;
} ######################################
#  Objects                           #
###################################### objects {
   
   clothes : object "your normal clothes" wearable = "true" initially_worn = "true" ;
   
   outfit : object "an outfit" wearable = "true" start_at = "house_upstairs" ;
   
   dress : object "a dress" wearable = "true" start_at = "house_upstairs" ;
   
   jacket : object "a jacket" wearable = "true" start_at = "house_upstairs" ;
   
} ######################################
#  On Command                        #
###################################### on_command {    : match "unwear clothes"  {
      : if (is_worn "clothes") {
         : unwear "clothes" ;
         : set_true "not_wearing_clothes" ;
         : done ;
      }
   }
   
   : match "unwear outfit"  {
      : if (is_worn "outfit") {
         : unwear "outfit" ;
         : set_true "not_wearing_clothes" ;
         : done ;
      }
   }
   
   : match "unwear dress"  {
      : if (is_worn "dress") {
         : unwear "dress" ;
         : set_true "not_wearing_clothes" ;
         : done ;
      }
   }
   
   : match "unwear jacket"  {
      : if (is_worn "jacket") {
         : unwear "jacket" ;
         : set_true "not_wearing_clothes" ;
         : done ;
      }
   }
   
   : match "wear clothes"  {
      : wear "clothes" ;
      : if (is_worn "clothes") {
         : set_false "not_wearing_clothes" ;
      }
      : done ;
   }
   
   : match "wear outfit"  {
      : wear "outfit" ;
      : if (is_worn "outfit") {
         : set_false "not_wearing_clothes" ;
      }
      : done ;
   }
   
   : match "wear dress"  {
      : wear "dress" ;
      : if (is_worn "dress") {
         : set_false "not_wearing_clothes" ;
      }
      : done ;
   }
   
   : match "wear jacket"  {
      : wear "jacket" ;
      : if (is_worn "jacket") {
         : set_false "not_wearing_clothes" ;
      }
      : done ;
   }
   
} ######################################
#  Booleans                          #
###################################### booleans {
   
   not_wearing_clothes : boolean "false" ;
   
}
######################################
#  Integers                          #
###################################### integers {
   
   clothes_limit : integer "1" ;
   
} ######################################
#  Settings                          #
###################################### settings {
   inventory_worn_items_limit_var = clothes_limit
}
Host

I tested and this should be resolved now.

Now Adventuron will take care of wear limits. If you want to perform some complex logic in your game to do with a lot of independent tests, might I suggest use of a dynamic boolean. A dynamic boolean will act as like the conditional part of an if statement, but you can just refer to it as a variable (you can't set a dynamic boolean variable, it is always calculated fresh every time you refer to it).

If this doesn't make any sense, don't worry about it. It's entirely optional.

booleans {
   is_wearing_something : boolean_dynamic {(
      is_worn "clothes" ||
      is_worn "dress"   || 
      is_worn "jacket"  || 
      is_worn "outfit"
   )}   
   is_not_wearing_something : boolean_dynamic {(
      is_wearing_something == false
   )}
}
on_command {
   : match "leave _" {
      : if (is_at "hut" && is_not_wearing_something) {
         : print "You can't go outside unless you put something on.";
         : done ;
      }
   }
}
Submitted

Thanks!