Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

multiples of the same item?

8 years ago

I'm trying to figure out how to handle the player character's inventory in a game I'm working on. My first thought was to just use the default item system, but looking at it now, I'm not seeing a way to track multiples of the same item?

For instance, there's a 'high quality rabbit skin' item that can be gotten through a random event, from actually hunting a rabbit, or from straight up buying it in a store, and theoretically you could amass a pile of them to be used for various things. I just can't find it anywhere in the options for items where it would keep track of how many the player actually had and add or subtract as needed.

A workaround I've figured out is giving the player a knapsack item that takes them to an inventory page that just uses pagescripts to display everything, but as that would mean making a variable for every single item, and more work when it came to actually checking for and giving the option to use the items throughout the game,  I just wanted to double check and make sure there's not some simpler option I'm missing.

Also, I don't suppose there's any way to make an image display along with (or in place of) a variable number?  I know there's a way to have it show more natural text in place of COINS is 6 or whatever, but what about something like health being represented by a row of hearts instead of just a number?

multiples of the same item?

8 years ago

Can't you increase the number of times the rabbit skin can be used the more you collect it? 

multiples of the same item?

8 years ago
You can use a variable to keep track of how many of the item they have. If you want them to be able to know the amount, on page tricks work with item descriptions, so just do Quantity: %%AMOUNT%% in the description (replace amount with the variable name) then change the value as they use the item.

multiples of the same item?

8 years ago

All right, so if I'm following here, I can use $ITEMUSED in conjunction with a variable for each item to track the amount? The actual item page gave me the impression number of uses either maxed out at eight or were infinite, but if that's not the case then this suddenly got a lot more workable.

Of course it still means making a variable for every single item, but I can live with that.

I ran into a snag with the knapsack method anyhow because what I was wanting was a combination of what's in the article on on page variables and couldn't quite figure out the syntax.

Basically, I wanted to use %%VARIABLE%>%0%TEXT%% so that an item would only be mentioned if you actually had it, while including the %%VARIABLE%% inside there with the text as well. So, "You look inside your knapsack and see: 6 potatoes" or whatever. I wouldn't want the player to know they every other possible item that they had zero of right when they're starting out.

Or to phrase it another way, IF VARIABLE > 0 THEN $PAGETEXT := $PAGETEXT + "Item: %%VARIABLE%%" except whoops, doesn't look like it knew what to do with $PAGETEXT from the Item Script, and the inventory page wasn't accessible any other way.

The other option would've been brute forcing it with the removal of the knapsack item all together and putting a link with a script going to the inventory from every single page, but, yeah...looks like this is going to be a tedious headache for me either way, and that's once I actually figure out how to even do it right...

 

multiples of the same item?

8 years ago
Shouldnt need to use itemused and a variable, only one of then. Make it unlimited uses and dont drop it on use, then use a variable to keep track would be my suggestion.

Im kind of confused though. Do you just have tons of different TYPES of items, or do you expect the player to have many of the same items?

multiples of the same item?

8 years ago

Yeah, I figured out I wouldn't need both, should make it easier. It's pretty straightforward this way, just a little tedious.

And there will be lots of different kinds of items, with multiples of many of them. It's not too big of a game, but there's some resource management involved, and if I can get allllll of these variables and things to play nicely together it'll open the door for a couple of other projects I had in mind.

 

multiples of the same item?

8 years ago
With so many items how do you plan on having the player use them?

multiples of the same item?

8 years ago

As long as the items are less than 100, it should be fine.