A few days ago I heard in IRC that someone was worried about the functions in the regular UIs inventory, so I decided to create a tutorial about a non-blizzard-inventory like I use one in my current project (just look at the link in the signature).
Difficult: Middle
(You have to know what arrays are and how to use them. Also you should be able to make several links to only a few variables without losing the overview. You also need a good imagination when you are making dialogs.)
First of all we need to create two simple dialogs: one for a button to show/hide the inventory and a second for the inventory itself. (Of course you can ignore the button part and let the inventory always be shown)
Step one - The basics
For step one we only need 6 global, three local variables and two triggers.
The first trigger should looks like this (for a 9-slot inventory):
The second trigger is very simple:
When everything is done it should looks like this:
Step two - The engine
The main problem we have now is to create a complete engine, because in actual fact we created just an illusion of an inventory. First of all we have to pick up that item (the plasma gun of the campaign in this example).
Please be careful with the event. When you don't change the "Stage" it will trigger sevenfold.
Now we can see why we needed to create two dialog items. One problem with images is the following: they can't have a tooltip. And buttons can't have a background image. If I'm wrong please correct me.
Of course we could write tooltips for each item seperatly, but that needs an additional local variable which should be determinate in the "checking item"-if-then-else part.
When you are creating a map with more than one player, you have to change everything with "(All players)" to this:
Players: Convert Player To Player Group
Player: Owner Of Unit
Unit: Triggering Ability Target Unit You also need an additional array for "Inventory Slot Button Item" (the different players)
Step three - Evolve the engine
There is only one step ahead to the end of this tutorial and we need only two things: a dropdown for the inventory and a trigger which checks the items in the inventory.
The first thing you should do is to create a simple dialog which will work as a dropdown. When you're finished it should look like this.
And ingame:
The dropdown will only work correctly if the dialog and the dialog items have the same anchors. Else you have to write the positions for each button seperately.
We also should insert an action at the "Inventory Window show"-else function named "Hide Inventory Window Dropdown for..." So when the player click the inventory button and the dropdown is still active it will hide itself without clicking the close button.
For the trigger we don't need any pictures. Just copy the "Checking Item"-part of the "Pick up Item"-trigger and paste it into a new trigger. Set the event to "Dialog Item Is Used" and the condition to "Used Dialog Item = Dropdown Button [1]" and an additional trigger for Dropdown Button [2].
Step three point two - Linking the items (the edit)
I've noticed that something very important was missing. So you only have to insert some things at the right places.
First of all we need a global variable of type "Integer" called "Clicked Button".
Then we need to go to the "Inventory Dropdown show" Trigger and add the following.
The "Item Use" Trigger should look like this:
And the "Item Drop" Trigger like this:
Now you have a completly operational custom inventory with your own engine. You only need to write the orders for each item seperatly. This is the con of the custom inventory, but the pro in the same time. Do the things that the Blizzard UI can not do.
I strongly recommend you to use Catalog functions to get the image and name of each item. If you will have a lot of items this is the best way to spare time.
Correct If I'm wrong, but as far as I can see catalog functions can neither ask for images nor for the item name. I never worked with catalogs and after looking at them I don't think I would need to do so.
If I would be really wrong please write me the actions for them.
My own ORPG project () uses also a custom inventory and get the image path and texts from catalog functions. Yes it's possible by passing a lot of catalog gets.
You must to get the "Item" field in "Unit", then get the "Face" in "Item" then get the "Icon" in "Button".
I will write a short script to do that and copy/paste that in 3-4 hrs :)
You know that I don't use the items from the data editor, do you?
In this case trying to get values from the catalog is indeed useless.
But I recommend to use the data editor for items. The data editor is powerful for a lot of things, and the management of items, classes of items, loots from bosses and mobs is powerful for that.
With the Catalog functions included in the Trigger Editor, you can use the Data Editor as a data bank, but not using it as the Galaxy Editor default behavior.
For my ORPG, I use the Data Editor as a powerful data bank. The slowness of the Trigger Editor when used
with a lot of actions is so aweful (and this will be the case if you wil have a lot of items).
All fields are available in Read mode with Catalog functions. After that you can code your map to manage the Data Editor values as you want.
So, for me the best way to make a custom inventory is :
Using the Data Editor as a Data Bank.
Code in Trigger Editor the management of all needed fields in Data Editor.
Btw its my preference, not yours. It's just an opinion, so your method is simply a different approach, not necessarily bad (depending on the size of the project).
PS: With my system you must hide the Inventory panel.
The main reason I've create this system was the following: I'm working at a round-based singleplayer story-campaign.
For this system the whole SC2-enginge is almost completly useless for me. The only reason I use the data editor are for models and actors. All abilities and tactical structures are fully trigger based. Even the weapons are triggers, because the data editor isn't suited for this kind of map, or it would be a huge work around.
So I decided to ignore the data editor and create everything with triggers.
In mine I can also check two items to combine them into another type of item and display information by pressing Inspect. I made it for a Point and Click Adventure-type of map. It's also an engine that supports as many items as I want with a couple of additions to the engine for each item. What it doesn't support are scroll-over-names for the buttons/items.
It's cool how similar minds work sometimes :D (before anyone says I'm trying to accuse anyone of stealing; I don't, I just think it's cool).
I'm having a problem with using the inventory item. It might have been because I have modified the system quite a bit to show no pictures and only text for items. Anyways the game is not recognizing option 1 from the drop down list. I narrowed it down to this:
General - Switch (Actions) depending on Inventory Slot Button Item[Clicked Button]
Cases
General - If ((String(Healing Potion TEST Instant)))
This seems to be the problem. Anything I can change it to?
There are several possiblities to solve this issue. Either you have done something wrong with the "Pick up Item" trigger, or simply changed anywhere anything so the variables aren't matched.
Of course the easiest way would be for you to upload your map that I can see through it, but maybe you simply won't do it. Else you may copy all your inventory triggers into a several map and copy that item.
It's hard to tell what you've done wrong only from two lines.
Luckily I was building it in your tutorial map before loading in my map so it should be easier to find the problem. It's a recreation of the SNES game Earthbound so the system is you hit the check button when near the item to pick it up. Goods is the inventory button. Thanks for helping us all with this inventory. Here is the edited map.
You set the Item Name to "Potion" in the Item Pickup trigger, so the variable Inventory Slot Buton Item[1] was always "Potion".
But in the Item Use trigger you asked for the data string of Healing Potion TEST Instant and that is why it would not work.
Either you have to change the declaration of the potion in your pickup trigger or the declaration in your Item Use trigger. But they have to match when they should work.
Thank you sir. I changed that because it wasn't showing my item name on the button but was instead showing the original text of the item name. I fixed it though. Created a second variable for item name which is only used to change the text on the button and has my custom text.
One more question then I'm done with the inventory lol. How do I make a message appear if you try to pick up an item when the inventory is already full? I tried putting it under the else's and it didn't work. Then I tried making a separate trigger but wasn't sure of the conditions. I switched the one from item pickup to "Free inventory slot >" but that didn't work either.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
A few days ago I heard in IRC that someone was worried about the functions in the regular UIs inventory, so I decided to create a tutorial about a non-blizzard-inventory like I use one in my current project (just look at the link in the signature).
Difficult: Middle
(You have to know what arrays are and how to use them. Also you should be able to make several links to only a few variables without losing the overview. You also need a good imagination when you are making dialogs.)
First of all we need to create two simple dialogs: one for a button to show/hide the inventory and a second for the inventory itself. (Of course you can ignore the button part and let the inventory always be shown)
Step one - The basics
For step one we only need 6 global, three local variables and two triggers.
The first trigger should looks like this (for a 9-slot inventory):
The second trigger is very simple:
When everything is done it should looks like this:
Step two - The engine
The main problem we have now is to create a complete engine, because in actual fact we created just an illusion of an inventory. First of all we have to pick up that item (the plasma gun of the campaign in this example).
Please be careful with the event. When you don't change the "Stage" it will trigger sevenfold.
Now we can see why we needed to create two dialog items. One problem with images is the following: they can't have a tooltip. And buttons can't have a background image. If I'm wrong please correct me.
Of course we could write tooltips for each item seperatly, but that needs an additional local variable which should be determinate in the "checking item"-if-then-else part.
When you are creating a map with more than one player, you have to change everything with "(All players)" to this:
You also need an additional array for "Inventory Slot Button Item" (the different players)
Step three - Evolve the engine
There is only one step ahead to the end of this tutorial and we need only two things: a dropdown for the inventory and a trigger which checks the items in the inventory.
The first thing you should do is to create a simple dialog which will work as a dropdown. When you're finished it should look like this.
And ingame:
The dropdown will only work correctly if the dialog and the dialog items have the same anchors. Else you have to write the positions for each button seperately.
We also should insert an action at the "Inventory Window show"-else function named "Hide Inventory Window Dropdown for..." So when the player click the inventory button and the dropdown is still active it will hide itself without clicking the close button.
For the trigger we don't need any pictures. Just copy the "Checking Item"-part of the "Pick up Item"-trigger and paste it into a new trigger.Set the event to "Dialog Item Is Used" and the condition to "Used Dialog Item = Dropdown Button [1]" and an additional trigger for Dropdown Button [2].Step three point two - Linking the items (the edit)
I've noticed that something very important was missing. So you only have to insert some things at the right places.
First of all we need a global variable of type "Integer" called "Clicked Button".
Then we need to go to the "Inventory Dropdown show" Trigger and add the following.
The "Item Use" Trigger should look like this:
And the "Item Drop" Trigger like this:
Now you have a completly operational custom inventory with your own engine. You only need to write the orders for each item seperatly. This is the con of the custom inventory, but the pro in the same time. Do the things that the Blizzard UI can not do.
Zanryu
After a request I add the picture how the dropdown creation looked in my example:
@Zanryu1337: Go
Might you be willing to post the map?
No problem, the triggers were made on a separate map.
EU localisation
Edit: Updated to the current status
@Zanryu1337: Go
Thanks.
I strongly recommend you to use Catalog functions to get the image and name of each item. If you will have a lot of items this is the best way to spare time.
Correct If I'm wrong, but as far as I can see catalog functions can neither ask for images nor for the item name. I never worked with catalogs and after looking at them I don't think I would need to do so.
If I would be really wrong please write me the actions for them.
@Zanryu1337: Go
My own ORPG project () uses also a custom inventory and get the image path and texts from catalog functions. Yes it's possible by passing a lot of catalog gets.
You must to get the "Item" field in "Unit", then get the "Face" in "Item" then get the "Icon" in "Button".
I will write a short script to do that and copy/paste that in 3-4 hrs :)
You know that I don't use the items from the data editor, do you?
In this case trying to get values from the catalog is indeed useless.
But I recommend to use the data editor for items. The data editor is powerful for a lot of things, and the management of items, classes of items, loots from bosses and mobs is powerful for that.
With the Catalog functions included in the Trigger Editor, you can use the Data Editor as a data bank, but not using it as the Galaxy Editor default behavior.
For my ORPG, I use the Data Editor as a powerful data bank. The slowness of the Trigger Editor when used with a lot of actions is so aweful (and this will be the case if you wil have a lot of items).
All fields are available in Read mode with Catalog functions. After that you can code your map to manage the Data Editor values as you want.
So, for me the best way to make a custom inventory is :
Btw its my preference, not yours. It's just an opinion, so your method is simply a different approach, not necessarily bad (depending on the size of the project).
PS: With my system you must hide the Inventory panel.
EDIT:
The main reason I've create this system was the following: I'm working at a round-based singleplayer story-campaign.
For this system the whole SC2-enginge is almost completly useless for me. The only reason I use the data editor are for models and actors. All abilities and tactical structures are fully trigger based. Even the weapons are triggers, because the data editor isn't suited for this kind of map, or it would be a huge work around.
So I decided to ignore the data editor and create everything with triggers.
This looks a lot like my own Custom Inventory
In mine I can also check two items to combine them into another type of item and display information by pressing Inspect. I made it for a Point and Click Adventure-type of map. It's also an engine that supports as many items as I want with a couple of additions to the engine for each item. What it doesn't support are scroll-over-names for the buttons/items.
It's cool how similar minds work sometimes :D (before anyone says I'm trying to accuse anyone of stealing; I don't, I just think it's cool).
Like I've said before this is only an basic example what I've created in my current project.
This is the inventory of the current status and it's far more beyond the example that this tutorial is about.
Link for the inventory: http://www.sc2mapster.com/maps/misery-living-and-dying-magic/images/1-interface-outside-of-combats/
That's awesome!
I'm having a problem with using the inventory item. It might have been because I have modified the system quite a bit to show no pictures and only text for items. Anyways the game is not recognizing option 1 from the drop down list. I narrowed it down to this:
General - Switch (Actions) depending on Inventory Slot Button Item[Clicked Button]
Cases
General - If ((String(Healing Potion TEST Instant)))
This seems to be the problem. Anything I can change it to?
There are several possiblities to solve this issue. Either you have done something wrong with the "Pick up Item" trigger, or simply changed anywhere anything so the variables aren't matched.
Of course the easiest way would be for you to upload your map that I can see through it, but maybe you simply won't do it. Else you may copy all your inventory triggers into a several map and copy that item.
It's hard to tell what you've done wrong only from two lines.
Luckily I was building it in your tutorial map before loading in my map so it should be easier to find the problem. It's a recreation of the SNES game Earthbound so the system is you hit the check button when near the item to pick it up. Goods is the inventory button. Thanks for helping us all with this inventory. Here is the edited map.
My first guess was absolutly right.
You set the Item Name to "Potion" in the Item Pickup trigger, so the variable Inventory Slot Buton Item[1] was always "Potion".
But in the Item Use trigger you asked for the data string of Healing Potion TEST Instant and that is why it would not work.
Either you have to change the declaration of the potion in your pickup trigger or the declaration in your Item Use trigger. But they have to match when they should work.
Thank you sir. I changed that because it wasn't showing my item name on the button but was instead showing the original text of the item name. I fixed it though. Created a second variable for item name which is only used to change the text on the button and has my custom text.
One more question then I'm done with the inventory lol. How do I make a message appear if you try to pick up an item when the inventory is already full? I tried putting it under the else's and it didn't work. Then I tried making a separate trigger but wasn't sure of the conditions. I switched the one from item pickup to "Free inventory slot >" but that didn't work either.