SC2Mapster Forums

Resources > Trigger Libraries & Scripts

[Library] Dialog based Inventory

  • 19 posts
    #1 Aug 16, 2010 at 13:48 UTC - 0 likes

    ASSET: Dialog based Inventory
    Thought I'd create a thread for it so you can request additional features for this asset.

    Latest Version: 1.3

    if anyone has some ideas on how to implement the second missing function I'm open for ideas.

    I'll be updating this first post with new information regarding the current state of the asset.

    Usage Notes

    A manual is under construction in the pages section of the Asset.

    Basicly there are 3 functions to created the inventory and equipment bit:

    Create Inventory Setup (creates an inventory of the given size)
    Create Equipment Setup (creates an equipment panel)
    Add Equipment Slot (creates equipment slots in the equipment panel)
    Then you have functions for adding and removing items from the inventory.
    (the item removing is already handled by the system itself, so no need to call it unless you want to forcibly remove a certain item from the inventory)

    Add Item To Inventory (returns true if the item fits, false if the item doesn't fit)
    Remove Item from Position (currently just returns true)

    The SC2Inventory requirements are as follows:

    Instead of picking up items like you normally do you need to call the Add Item To Inventory action for it.
    Using items is only possible if you have an inventory slot that supports the item classes that can be used. (usable item classes may not match with equipable item classes)
    Equiping items is only possible if you have inventory slots that match the correct item class, which is set to equip in the data editor.
    Picking up items require a free slot in the default sc2inventory. recommended is to create a slot at row 7, column 7 in which all items can be placed.(picking up an item will add it to the inventory for 0.1 second, or less, before being removed from it again and placed inside the dialog-based-inventory.
    This is the list in short. I'll be creating a somewhat bigger list in the feature, and I might even make picking up items work correctly automatically, instead of the need to call that add item to inventory bit manually.

    Existing Problems

    • An inventory item that is usable but also requires a target is not available for usage through this Asset yet.
    • Not a problem but a feature request:
      Changing the mouse icon while dragging an item, instead of using a itemdragging dialog.

    Change Log

    Changes in v1.3

    • Item pickup using the default SC2inventory system is now detected and handled as if the call to AddItemToInventory is made.
    • fixed the Name display of the Item in the Dragged Item window.
    • made retrieving the dialogs possible, so you can reposition them as you want. (might have already been available though)

    Changes in v1.2
    A dialog now displays the item information of the item being dragged around.

    Changes in v1.1
    Dropping of items is now possible

    Movies

    Movies of how the inventory looks, including past movies.
    Music in any of these movies is accidental :)
    Version 1.0

    Version 0.2

    Version 0.1

    Last edited Sep 20, 2010 by Helral

    Helral's Lair
    Meow meoow meeow. I'm ze evil SC2MapsterKitten.

    UI Tutorials listing

    current projects:

    #2 Aug 16, 2010 at 13:54 UTC - 0 likes

    @Helral: Go

    For the second, maybe create a dialog with a hidden background and an image. When you pick something up it shows the dialog, sets the image to that image and moves the dialog continuously to the mouse pointer, or is just shown at the side of the dialog.

    #3 Aug 16, 2010 at 13:56 UTC - 0 likes

    @wOlfLisK: Go

    Problem with moving, you can not retrieve the mouse position unless the user clicks, A dialog at a certain location is possible though.

    Last edited Aug 16, 2010 by Helral
    #4 Aug 16, 2010 at 15:02 UTC - 0 likes

    Maybe possible to change mouse pointer to scaled icon image?

    Hero Selection Library v3.0.1 Final - Completely free to use and edit. Create a beautiful, fully featured hero selection in seconds.

    #5 Aug 16, 2010 at 15:14 UTC - 0 likes

    @SweetZombieJesus: Go

    If you can figure out a way to do it that doesn't affect all players at once then I'll implement it.
    I've tried it and without luck so far.

    #6 Aug 16, 2010 at 15:58 UTC - 0 likes

    Have not actually used mouse pointer yet so it was just a wild suggestion :P

    But I guess the best, working, alternative would be something like a dialog with its icon next to the bag at a static position

    #11 Aug 30, 2010 at 11:34 UTC - 0 likes

    @Helral: Go

    If anyone has any ideas for this inventory system like stuff you want to see implemented.

    For example:

    • Item Requirements, limit the usage of items so that you can start using it when you reach a certain level instead of being able to use it constantly.

    Feel free to reply here with ideas.

    #12 Sep 07, 2010 at 22:12 UTC - 0 likes

    @Helral: Go

    or if anyone has any ideas to make this more user friendly. or should I say map maker friendly :)

    #14 Sep 23, 2010 at 16:27 UTC - 0 likes

    @Helral: Go

    yop nice changes ;) Could you add some offset points for the equipement window ? I would like to be able to set it on middle you see ? Also would it be possible to add custom image selection for equipement slots ? Keep the good work :D

    #15 Sep 23, 2010 at 20:44 UTC - 0 likes

    @MisterTeaRealOne: Go

    at this moment you can use the Get Equipment Dialog function to retrieve the dialog, and use the move dialog action to position it as you want.
    both the inventory and dragged item dialog have such a function.

    #16 Sep 24, 2010 at 09:10 UTC - 0 likes

    @Helral: Go

    Oh nice :D what about a background image for equipement slots ?

    #17 Sep 24, 2010 at 13:21 UTC - 0 likes

    @MisterTeaRealOne: Go

    I'll take a look, shouldn't be hard to implement.

    #18 Oct 12, 2010 at 11:30 UTC - 0 likes

    Upcoming version will have the following changes:

    • Background Images for the Equipment Slot (feature)
    • Dropping an item now correctly removes the dragged item dialog window (bug fix)
    • The dialog buttons, that used to show up as blue blocks, do not show up visible anymore. (bug fix)
    • some more changes which I can't remember now :)

    this post will be updated when I have access to my data and I can list the correct information.

    #19 Nov 15, 2010 at 04:07 UTC - 0 likes

    This is awesome but I seem to be having some trouble with the system.

    It seems items aren't being detected upon pickup for me, the unit acquires whatever benefits and equips them properly, it just doesn't seem to show up in the dialog system.

    EDIT: I fixed the problem :P, I didn't know that Inventory ID and Equipment ID had to correspond with the player :P

    Last edited Nov 16, 2010 by Roar_Man
    #20 Mar 01, 2012 at 22:14 UTC - 0 likes

    I'm not sure if anyone is still working on this or interested in using it but when playing with it I noticed some bugs which I have fixed.

    • a) Importing the library causes the "Inventory Item Clicked" trigger to break. I fixed it by removing the Set Catalog for Cursor action. I'm not sure why this doesn't work but I'm guessing it has something to do with not hiding the cursor.
    • b) Double clicking on an item which may be equipped will cause it to become equipped but not show on the equipment dialog. Added a used item check to make sure the item was removed upon use. If not, the item is removed and no longer removed from dragging. Thus you will hold and put down your weapon if you try to double click it. This fix would break stacked items if that is implemented in your asset system.
    • c) Tooltips would stick around for long periods of time after I have picked up and moved or dropped the item. Now tooltips are removed by destroying the dialog item creating it and remaking that dialog item. Please let me know if you know a better way to do this properly.
    • d) In trigger "Inventory Item Clicked": UnitIssueOrder(lib2_gv_inventories[EventPlayer()].lv_linkedUnit, OrderTargetingItem(lib2_gf_AbilityCommand("ZealotInventory", 3), UnitInventoryLastCreated()), c_orderQueueAddToFront); This trigger references the ability "ZealotInventory" which does not exist in most maps. This has been fixed to reflect the current unit's inventory ability whatever that may be: UnitIssueOrder(lib1_gv_inventories[EventPlayer()].lv_linkedUnit, OrderTargetingItem(lib1_gf_AbilityCommand((lib1_gf_GetInventoryAbility(EventPlayer())), 3), UnitInventoryLastCreated()), c_orderQueueAddToFront);
    • e) Added two public functions "Toggle Equipment Dialog" and "Toggle Inventory Dialog". Hook these up to your own buttons or abilities to trigger the display of a beautiful interface :)
    • f) Handling a full inventory was not completed. Now it removes the item from the actual inventory and creates a new one on the floor.
    • g) Dragged Item Panel now has a 100x100 image preview of the button of the item. I'm not sure if it should be resizable or how it should look but it's an early beta I suppose.

    I have also organized the library into its separate components. If Helral doesn't mind, I'd love to take over development for this dialog based asset system.

    I have also attached a map demonstrating the use of this Dialog Based Inventory.

    Last edited Mar 02, 2012 by LegacyWeapon: a few more fixes
    Name Size MD5
    DBAS_Test.SC2Map 293.5 KiB e03c137196c4...
    Dialog_Based_Asset_System__DBAS_.SC2Lib 623.7 KiB ed580b911711...
    #21 Mar 03, 2012 at 06:20 UTC - 0 likes

    @LegacyWeapon: Go

    Hi LegacyWeapon, was just looking over the demo map, noticed a couple things (that you probably already knew about), but mentioning them anyways. The boots of haste upon being picked up would give me the haste buff for a brief moment, then I wouldn't have it. Also, I found it was not possible to move an item from my equipment area back to my inventory area. Third, it kept dropping items directly where I stood, a little random offset might make the dropping more believable.

    All that said, I'm definitely interested in inventories lately, but it seems like the more interested in functional you are, the less likely you are to get a pretty inventory/equipment area. Does your current iteration of the project currently support slots that only support certain item types, class types, that sort of thing? My current equipment area has about 13 armor slots, and 2-4 weapon/shield slots depending on class chosen, is just ugly as hell, lol.

    I'm overall pretty happy with the default inventory system besides two major things. Stacking ability of items like scrolls, potions, food, whatever. Ability to alter the dialog box's looks, such as a nice wallpaper for the back, little greyed out pictures for unused slots, etceteras. That said, very interested to see what else you come up with, I might redo inventories at some point if the map turns out to be popular enough.

    Horologium Super Cluster RPG

    #22 Mar 03, 2012 at 16:04 UTC - 0 likes

    @Deadzergling:

    "The boots of haste upon being picked up would give me the haste buff for a brief moment, then I wouldn't have it."

    • So yes I saw this bug and I'm not sure what the best way is to deal with it. Apparently on pickup, if the unit has an equippable slot with the same item class as the item you are picking up, it will automatically equip. Is there any way to deal with this?

    "Also, I found it was not possible to move an item from my equipment area back to my inventory area."

    • This seems odd as I don't remember being unable to move the equipment back. Let me know how you recreate this.

    "Third, it kept dropping items directly where I stood, a little random offset might make the dropping more believable."

    • Yes this is also something I'm not sure how to deal with. I will try this out though (so the item doesn't just drop on top of your current location).

    "Does your current iteration of the project currently support slots that only support certain item types, class types, that sort of thing?"

    • For equipment yes it does. This was part of the original design provided by Helral. If you look into the way I create the inventory (in the "Initialization" folder) you will see how I specify specific slots to be for specific item classes.

    "Stacking ability of items like scrolls, potions, food, whatever."

    • This seems to be an important thing to people and I may support this in the future but for now it seems like a headache. Having different item sizes works well though.

    Thanks for your interest in this library!

    Edit: Well since you haven't responded I'm assuming you haven't seen this post yet but I've gone ahead and tried to fix certain issues which you may have been having. Let me know how this works out for you: http://www.sc2mapster.com/assets/dbas/files/2-dialog-based-asset-system-dbas-beta-v1/

    Last edited Mar 03, 2012 by LegacyWeapon: update
    #23 Mar 31, 2012 at 23:31 UTC - 0 likes

    Looks neat, but not approved; it looks very much to be a work in progress. Poor documentation and some rather inscrutable contents (such as the Ability Command function wrapper and the empty Order Set Target Item action) make it something of a hazard, and without a demonstration map, implementing it could be an ordeal.

    #24 Mar 31, 2012 at 23:37 UTC - 0 likes

    I'm using a heavily modified version of this for my map. Unfortunately I think I messed around with it too much to fit my own purposes so it's no longer easy to use for other purposes.

    If you have some time, I feel this is a good thing to build upon for it to suit your needs.

  • 19 posts

You must login to post a comment. Don't have an account? Register to get one!