Please help this noob using UInv

Hi all.

I am trying to make a game in Twine (version 2.3.9) with Sugarcube (2.31.1). I have made a lot of passages, created some artwork and implemented a time system. I now come to the point where I need to implement an inventory system. The system must be able to give me:

  • an inventory for the player (clothing, armor and weapons he/she is wearing)
  • a chest/wardrobe where the player can stash clothing, armor and weapons he/she is currently not wearing.
  • the opportunity to find pieces of clothing, armor or weapons in a passage.
  • a system where you can buy stuff in a shop (all purchases can be delivered to the chest/wardrobe).

Now I have been looking at UInv because I think it can do all that. The problem is that after a week I still can’t do much in UInv. I can make stuff that can be found in a passage (and pick them up) but I haven’t even succeeded showing the inventory. Does someone know where I can find a tutorial or small example project where I can find out the basics?

I already found this UInv_Help_File but that doesn’t make it much clearer for me.

Is there anyone here who can help me?
(… or is there perhaps something that would be a better option then UInv?)

Wow. I looked at that universal inventory page and it looks really complicated. My response to hitting this sort of roadblock would be to ask myself “does my story really need this degree of complexity?”

I mean, you’re writing the story, right? You know where all the bits of treasure/armor/keys etc are going to be, so I’d be tempted to just fake inventory with a bunch of flags: $hasElvenSword etc.

Money systems in games are really just a way of getting the player to grind a bunch of minor quests before getting to the the Big Fight – so can I get away with the player only being able to trade a few items, rather than buy and sell everything? Could I get the same effect more simply (e.g. gating off a chain of passages until the player has obtained the C40 cybercrystal?)

This isn’t defeatism: an important part of game design is being able to scale back parts of the design that are too complicated or too ambitious.

“Yeah, full Turing compliant Characters – next time!”

Remember the great strength of Twine games is that there isn’t a world model whirring away behind the scenes, constraining what you can and can’t do. To make something happen, you just have to tell the player it’s happened. All you have to do is (cough) write the story.

Welcome to the world of happy fakery!


I think that might be good advice to be honest. I will have to keep track of a load of $hasItem variables, but at least I know how to do that.
Thank you for the response, much appreciated.

1 Like

If you’re looking for a simpler inventory, you may want to try out mine. It’s less powerful and sophisticated than UInv by quite a bit, but it is far better than a bunch of $hasX variables.

1 Like

The advantage of “rolling your own” is that it’s also part of the learning process. I would expect that some way into implementing it I’d have some sort of bright idea, and think “oh yeah, I can use lists!” (or arrays or something.)

Using other people’s code is kind of a double edged gift – sure, it lets you get on with working on your game, but the business of understanding how the Twine system works gets put off until “sometime later.”

I find the people here really friendly, and they’ve given me a bunch of help, but I find it’s most useful when I’m posting a bit of code that I’ve been trying to get to work and have gone temporarily “code blind.”

I guess, but where does that stop? Why not make your own story format then? And your own editor to replace Twine? I do think you should thoroughly understand how to use the libraries you put in your game, but I don’t think it’s necessary you be able to make them yourself.

Given that this is a hobby, it stops at the point(s) where the author lacks the interest to make learning that area rewarding for them. As for writing your own format, or any version of “rolling your own whatever” – well, a great many improvements that we now take for granted have their origin in someone getting irritated and hacking something together in order to scratch their personal itch!

For example, when the web was young there was hardly any means of controlling whitespace, because the people who wrote the html protocols lacked the skills to appreciate how white space, properly used, contributes to legibility. (They thought of the clarity of a document in terms of its structure of headings and subheadings, which html has always supported. I can’t help wondering if this pattern of awareness and blindness was the result of spending a lot of time writing compiled languages that are organized by functions and whitespace agnostic.)

As the internet became more widely used, so people who did have those skills found ways to (ab)use the code to affect the layout, and the resulting er… discussion led to css.

“Rolling your own” and “standing on the shoulders of giants” are both useful strategies.

I have been looking at your system this weekend and I must say, it got it working at the first try. I’m still figuring out if the system is going to be sufficient for what I want though. It does give me a great insight in what’s possible and in how things work.

I want my game to be a bit RPG-ish. I’m planning on having different types of armor, the player can own multiple armors but wear only one at the time. The player can also combine parts of armor (elfish armor with orcish boots and a dragon helmet) to get different buffs. Some creatures you encounter in the game will react differently based on the armor you are wearing. Some gates will only open if you wear a certain type of armor etc.

UInv uses objects and it would let me give properties to objects. So things like type, price, location of the artwork (all armors get their own pic) etc. would be ‘tied’ to the object. That is why is first tried that but for me the learning curve is too steep.

So … I’m not sure what I’m going to use in the end but at least you and @Dizzydonut got me two alternatives at a time I was stuck. Thanks!

1 Like