• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Simple Personal Inventory System v1.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
- This system allows you to store items from a Hero.
- Max of 6 items per Hero that can be stored.
- You can only use this system 1 unit selected at a time.
- It is useful for RPGs - or dynamic games, your creativity !
- It is fully MUI, so you can have multiple of Heroes per player.
- If you think this system that having pets to follow you all around the map or a backpack which spawns for you, but you're the the one that is changing the items is less-convenient, well this system is for you :)
- Well, it's GUI :)

HOW IT WORKS
- When a Hero enters the game (Unit Indexer), it provides that Hero with a single dummy unit (has 6 slots of Inventory Slot)
- When you -store/-get, the system will allow the Hero and the Dummy to interact with each other (switching items).


External Instructions
- Object Editor - Units Tab - Copy the Dummy Inventory (Personal Inventory) unit to your map.
- Open World Editor - File - Preferences... - General Tab - Tick the Automatically create unknown variables while pasting trigger data
- Copy the Simple Personal Inventory System folder.

Copy this code into your map header (Trigger Editor - you can see on your left-corner, the map icon, left-click on it until you see the Custom Script Code, paste this code into there)
JASS:
function SimError takes nothing returns nothing
    if udg_TempItem != null then
        set udg_TempString = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_TempString+"."+"|r"
        set udg_TempItem = null
    else
        set udg_TempString = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_TempString+"|r"
    endif
    if (GetLocalPlayer() == udg_TempPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer(udg_TempPlayer, 0.52, 0.96, 2.00, udg_TempString)
        call StartSound(udg_ErrorSound)
    endif
endfunction

- Further instructions inside the PI Setup Trigger.
- Further-further instructions are inside the game (Press F9).


  • PI Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ---------- --------
      • -------- Make sure this setting match --------
      • -------- It varies with your World Editor Raw ID, that is why you have to make sure it is the correct ID for this dummy --------
      • -------- ---------- --------
      • -------- Set PI_DummyType = Dummy Inventory (Personal Inventory) --------
      • -------- ---------- --------
      • -------- MISC CONFIGURABLES --------
      • -------- ---------- --------
      • -------- PI_OccupiedMessage sets the message to appear on screen when there is an item at that slot (you should leave a space at the end of the message) --------
      • -------- PI_InvalidSlotMessage sets the message to appear on screen when you are trying to store/get to an invalid slot (other than 1 - 6) --------
      • -------- PI_1UnitOnlyMessage sets the message to appear on screen when you are selecting more than 1 unit at a time --------
      • -------- PI_NoItemMessage sets the message to appear on screen when you are trying to store/get a null item at that slot --------
      • -------- ---------- --------
      • Set PI_DummyType = Dummy Inventory (Personal Inventory)
      • Set PI_OccupiedSlotMessage = This slot has been occupied by
      • Set PI_InvalidSlotMessage = Invalid slot.
      • Set PI_1UnitOnlyMessage = You must select only 1 unit at a time.
      • Set PI_NoItemMessage = There is no item at that slot.
      • -------- ---------- --------
      • -------- END OF CONFIGURABLES --------
      • -------- ---------- --------
      • -------- Do not clean this location as it will be re-use when new Hero with new Index enters the map --------
      • Set PI_SpawnDummyLoc = (Center of (Playable map area))
      • For each (Integer LoopingInteger) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to PI Store <gen> the event (Player - (Player(LoopingInteger)) types a chat message containing -store as A substring)
      • For each (Integer LoopingInteger) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to PI Get <gen> the event (Player - (Player(LoopingInteger)) types a chat message containing -get as A substring)
  • PI Save
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
    • Conditions
      • (UDexUnits[UDex] is A Hero) Equal to True
    • Actions
      • Set PI_Key = (Custom value of UDexUnits[UDex])
      • Unit - Create 1 PI_DummyType for (Owner of UDexUnits[UDex]) at PI_SpawnDummyLoc facing Default building facing degrees
      • Set PI_Dummy[PI_Key] = (Last created unit)
  • PI Store
    • Events
    • Conditions
    • Actions
      • Set TempPlayer = (Triggering player)
      • Set TempInteger = (Integer((Substring((Entered chat string), 8, 9))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInteger Greater than 0
          • TempInteger Less than 7
        • Then - Actions
          • Set TempGroup = (Units currently selected by (Triggering player))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempGroup) Greater than 1
            • Then - Actions
              • Set TempString = PI_1UnitOnlyMessage
              • Custom script: call SimError()
            • Else - Actions
              • Set TempUnit = (Random unit from TempGroup)
              • Set PI_Key = (Custom value of TempUnit)
              • Set TempItem = (Item carried by PI_Dummy[PI_Key] in slot TempInteger)
              • Set TempItem2 = (Item carried by TempUnit in slot TempInteger)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempItem2 Equal to No item
                • Then - Actions
                  • Set TempString = PI_NoItemMessage
                  • Custom script: call SimError()
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempItem Not equal to No item
                    • Then - Actions
                      • Custom script: set udg_TempString = udg_PI_OccupiedSlotMessage + GetItemName(udg_TempItem)
                      • Custom script: call SimError()
                    • Else - Actions
                      • Hero - Give TempItem2 to PI_Dummy[PI_Key]
                      • Unit - Order PI_Dummy[PI_Key] to move TempItem2 to inventory slot TempInteger
          • Custom script: call DestroyGroup(udg_TempGroup)
        • Else - Actions
          • Set TempString = PI_InvalidSlotMessage
          • Custom script: call SimError()
  • PI Get
    • Events
    • Conditions
    • Actions
      • Set TempPlayer = (Triggering player)
      • Set TempInteger = (Integer((Substring((Entered chat string), 6, 7))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInteger Greater than 0
          • TempInteger Less than 7
        • Then - Actions
          • Set TempGroup = (Units currently selected by (Triggering player))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempGroup) Greater than 1
            • Then - Actions
              • Set TempString = PI_1UnitOnlyMessage
              • Custom script: call SimError()
            • Else - Actions
              • Set TempUnit = (Random unit from TempGroup)
              • Set PI_Key = (Custom value of TempUnit)
              • Set TempItem = (Item carried by PI_Dummy[PI_Key] in slot TempInteger)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempItem Equal to No item
                • Then - Actions
                  • Set TempString = PI_NoItemMessage
                  • Custom script: call SimError()
                • Else - Actions
                  • Set TempItem2 = (Item carried by TempUnit in slot TempInteger)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempItem2 Not equal to No item
                    • Then - Actions
                      • Custom script: set udg_TempString = udg_PI_OccupiedSlotMessage + GetItemName(udg_TempItem2)
                      • Custom script: call SimError()
                    • Else - Actions
                      • Hero - Give TempItem to TempUnit
                      • Unit - Order TempUnit to move TempItem to inventory slot TempInteger
          • Custom script: call DestroyGroup(udg_TempGroup)
        • Else - Actions
          • Set TempString = PI_InvalidSlotMessage
          • Custom script: call SimError()
D4RK_G4ND4LF (inspired by this system) - Visual Bag System
Bribe - Unit Indexer
Vexorian - SimError


v1.0
- Initial release
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 19:32, 27th Sep 2012 Magtheridon96: SimError is not a proper function name because it is "owned" by Vexorian's SimError library :/ Change it to PI_SimError. And instead of setting a...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

19:32, 27th Sep 2012
Magtheridon96: SimError is not a proper function name because it is "owned" by Vexorian's SimError library :/

Change it to PI_SimError.

And instead of setting a string variable to the string you want to display, you can make the function take a string argument.

JASS:
function PI_SimError takes string s returns nothing
    // use s as the string you want to display.
endfunction

You can even make it take an item argument too.

JASS:
function PI_SimError takes string s, item i returns nothing
    // use s as the string you want to display
    // use i as the item you're using
endfunction

It helps shorten the code a bit and doesn't conflict with other major systems :p
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
This. Is. Neat.
The only thing i don't like is that you have to use commands. Can you make it somehow deal the actions when you press numbers 1,2,3,4,5,6? Players who play the map of the user of this system will be pretty annoyed. I mean, someone may want to use it to store potions or something. If they have to type something to get them, it will be kinda awful.

Otherwise it's really, really good!
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
You could take it a step further and store item types with corresponding charges, for an infinite-sized bag, then add more commands/abilities to list and retrieve them.

If you can tell me an Event to detect that, I'd be glad to implement it in this system.

You'll have to make all items actively used, so this wouldn't work. What would work, is to have a spellbook ability with 6 spells, one for each item.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
If you can tell me an Event to detect that, I'd be glad to implement it in this system.
Well, i don't know. :D I thought Jass can do this, somehow. I am a GUIer and i know that Jass is a lot more flexible, so... You can at least make it configurable about what is the command. The best way might be to type "/x" where x is the inventory slot. You can make your system detect whether or not it has to give the item or store it. Which means that you type /1, it stores the item in slot 1, you type /1 again, the item comes back.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You could take it a step further and store item types with corresponding charges, for an infinite-sized bag, then add more commands/abilities to list and retrieve them.
I want the items to be saved/get at the same slot
If I save like 30 Items, where should I place it
Currently I saved all the items inside a dummy unit, but if I make it more than 6, who is to save it ?
Also, I don't want to dynamically Create/Remove item, it's not efficient - this is why I avoid saving it into infinite-sized bag, because you're gonna need to Create/Remove item each time (because infinite-sized bag does not need any dummy unit) then where they placed the item ? Yes, Create/Remove.
I want to use the same item, and that item alone.

You'll have to make all items actively used, so this wouldn't work. What would work, is to have a spellbook ability with 6 spells, one for each item.
Are you talking about Numpad ?
Haven't thought about that, but yeah as you said, it requires all items to be actively used (while some of it, is not).

Spell Book ?
No.


You can at least make it configurable about what is the command. The best way might be to type "/x" where x is the inventory slot. You can make your system detect whether or not it has to give the item or store it. Which means that you type /1, it stores the item in slot 1, you type /1 again, the item comes back.
So the whole story - is just you're bragging about the commands ? Lol.
Okay I'll somehow try to lessen the command - but seriously, -store X / -get X, how lazy can you be lol.


NOTE: THIS SYSTEM DOES NOT SUPPORT INFINITE-SIZED INVENTORY. If you want infinite-sized inventory, there is another system for it. But I'll keep this in my things to do list (but not now).
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Just found out that item is moved to somewhere in the map and hidden.
I thought they Create/Remove item, that's what I try to avoid.
But since I know it can be hidden, yeah practically it can support infinite-sized personal inventory.

But if I turn this system to support infinite-sized, do you think Player would memorize each Item slot they stored ?
THAT, what I want to avoid.

Compared to D4RK_G4ND4LF's system, it is convenient, why ?
Because it has Multiboards for you, so you don't have to memorize which item belongs to what slot.
But ? Yeah, it is MPI, mine is MUI.

We have pros and cons apparently, gotta deal with it.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
But if I turn this system to support infinite-sized, do you think Player would memorize each Item slot they stored ?
THAT, what I want to avoid.

-list
Displaying items 1-4 of 7 in inventory:
1 - Boots of Speed
2 - Healing Potion (4)
3 - Ring of Regeneration
4 - Ring of Protection
Type -list2 to view items 5-7.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Wow your idea is amazing, will be looking forward to implement it ;p

But that would require a new source of system which save item library, item list, maxList, algorithms, etc.
Hmmm... I'll think about this, currently I'll just let it be in its current state.
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
So what this does is to create a dummy unit with an inventory for every Hero that enters the map. Then, with -store command you create the same item into the dummy inventory and with -get you give it to the Hero again?

Well, I wouldn't call it a system.. I see many people using this category as if they have created something big...

You could add alot more things, such as ingame UI which shows stored items via trackables and even have
more than only 6 items stored. And:

  • (UDexUnits[UDex] is A Hero) Equal to True
What if people use normal units instead of heroes?

I also see that you don't check if the Hero inventory is full.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
So what this does is to create a dummy unit with an inventory for every Hero that enters the map. Then, with -store command you create the same item into the dummy inventory and with -get you give it to the Hero again?
I hate when people said to our work "So what this does is bla bla bla bla bla ?"
Wt*, you just repeat what my system does, and you made it sound simple and not worthy to be uploaded to the THW Resource ???
Please, stop this.

It's like saying "Well, what this does is to assign an index value to a unit on mapInit and when new unit enters the map, new index is created for that unit ?" (Unit Indexer)
No offense Bribe, this is just an example to people that uses this "so-called" trend.
Stop this "trend", please, it doesn't make you superior, at all :/

Well, I wouldn't call it a system.. I see many people using this category as if they have created something big...
Define your understanding of "big".
Yeah, sorry about that, I should create a system that is at least 300kB size.
Also, system is meant to be "simple" and "useful", not to mention user-friendly (which I will fix it - currently "-store/-get X is annoying lol")
Systems should be lightweight and easy to be implemented, not "something big".
If you don't find this resource useful, then don't use it, simple.


You could add alot more things, such as ingame UI which shows stored items via trackables and even have
more than only 6 items stored. And:
Things I hate: Trackables.
I will use them in Single-player, but never for Multi-player.
Also, if you're planning to make it "Trackable-support", it will become MPI, I can't imagine your method will succeed creating a Trackable, MUI, for each unit.
My system aims for MUI - noted.
(In this case, your suggestion is flawed - can't be MUI).

What if people use normal units instead of heroes?
I hope you read the "INTRODUCTIONS".
But I'll re-consider this to make it support both Unit and Heroes.


I also see that you don't check if the Hero inventory is full.
What for ?
The system already checked it by calling SimError(), it says why you can't -get item if there is another item at that slot.
And if you want to -store an item at Slot 1, whereas your dummy has an item at Slot 1, it will also call SimError() and stated why you can't -store your item.
I'd like to avoid the "default message" as possible, the "Inventory is full" message/sound.

as a player, I simply don't like the idea of using commands for storage... it seems so tedious for the players...
Instead of just giving comments, you should also include on how to improve.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
The main idea is that its tedious for the player to use commands, isn't it obvious that I'm implying that you should find a workaround which does not use commands?
As I said, yes it is nice comment, but if you don't tell me suggestion on how to improve it, it's no use :/
It's like saying "diz sistem hard 2 uze, sux azz sistem eva!!111", without suggesting me any idea on how to improve it.

I tried to use abilities, but this will collide with the user's needs (maybe they want a full Spell List in the UI, who knows).
That's why I'm trying to evade all those possibilities by turning it into Chat Event.

I also thinking about pressing ESC key, but what if the user wants to use ESC key for other reason ?
I've thought about these possibilities way before.

why not just use udg_UDex? instead of using GetUnitUserData?(in Bribes indexer, when you use his Index events, UDex is the units CustomValue.
Yeah, I just used his system, thanks for this ;p
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
  • Set TempUnit = (Random unit from TempGroup)
For efficiency's sake, use Custom script to just set TempUnit to FirstOfGroup(udg_TempGroup)

Definitely add some kind of -view command to show what the player has in the inventory (even if you don't support an infinite-sized inventory) as -get is already pretty restrictive on its own.

Instead of limiting your system to just using the chat commands, you could provide alternative ways (like some of the methods you thought about) to interact with the dummy unit's inventory and then allow the user to choose which method he wants in his map. This requires more work on your part but would make the system more flexible.

Personally, I'd favor an Esc method which would select the dummy unit that has a selected hero's inventory and allow the player to just drop items from the dummy unit.
I can't think of a good way of storing items besides using a chat command, but in this version, storing items won't care about storage in specific item slots.
 
Top