( Top of bolthole UDK pages
Simple Inventory Screen in UnrealScript
I don't like learning extra languages unneccessarily; I'm rather a
minimalist. So, rather than spend time and diskspace learning ScaleForm for
UDK GUIs, I decided to see if I could write a general-purpose inventory
Yup, I can!
It's rather plain and ugly; I'm no GUI artist. But hey, take the source
and make it all pretty yourself!
Why would you want this?
Lets say you were planning on something that used a LOT of items. You need
a flexible inventory display for it, but for whatever reason, you dont
want to use scaleform. This code can give you a small, easy to understand
(or at least easier than trying to make it yourself) base to
start from, and also possibly help new UnrealScript programmers
(like myself!) understand the overall UDK Game layout better.
For one thing, it might help explain a little bit of how the HUD
The HUD gets redrawn for Every Frame!
So, complex activities are not going to fly.
What I do, is render the player's inventory to a standby Texture,
and then just blast the Texture to screen.
At this point, I have spent many days just finding out if some of the
tricks I used were even possible!
There are some helpful hints in the comments at the top of the main class.
You DO have to
know the basics of getting started in UnrealScript first though.
How to compile stuff. How to get your own Gametype loaded.
- The "error", is because it doesnt know what to do about PhysicsGun in
- The PlayerController.DrawHUD() code might better belong in a subclass
of HUD. But that would make this demo longer than desirable.
What it does
Right now, you should be able to use your arrow keys to move the highlight
around over objects in your inventory, if you get it loaded properly,
and use or integrate my PlayerController code, below.
You can also get the currently highlighted item, via
M5InvDisplay.CursorInventoryIndex(). So with only a small bit of extra
work, you can then code your own hooks in PlayerController,
for keypresses to drop, or use, items of your choice.
I havent figured out how to render a mesh to a texture yet. So,
M5InvDisplay compromises for how to display an item.
First, it looks up the name of the mesh attached to the Inventory
item. Next, it looks in preconfigured places (IconBasePath, TextureBasePath) for
resources with a similar name. It uses the first match it finds.
Written by:Philip Brown