• 🏆 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 Backpack System v1.1 by xorkatoss

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Backpack System v1.1 by xorkatoss

HOW TO IMPLEMENT :
-Copy/Paste the Open/Close Backpack abilities into your map
-Copy/Paste the Triggers

That's all :)

NOTE:
Go to File -----> Preferences -----> Automatically create uknown variables while pasting trigger data
This is very important so the system will be successfully copied
You will also need this in the future trust me ;p

UPDATE:
I have updated the backpack system
special thanks to D4RK_G4ND4LF for improving my system :thumbs_up:

Keywords:
Simple Backpack System
Contents

Backpack (Map)

Reviews
12th Dec 2015 IcemanBo: For long time as NeedsFix. Rejected. 22:28, 10th Mar 2015 IcemanBo: http://www.hiveworkshop.com/forums/spells-569/simple-backpack-system-v1-1-xorkatoss-181742/index3.html#post2662962 12:56, 16th Jan 2011...
Level 8
Joined
Jun 30, 2010
Messages
259
Why not make it MUI using hashtables?
You are using set variables to create a backpack, use hashtables to store values over a longer time using:
  • If/Then/Else
    • If
      • BackPackTrue Equal to True
    • Then
      • Load key(String(BackPackSlot1)) of key(Triggering Unit)
    • Else
      • Set MUI = (MUI + 1)
      • Set Backpack_Slot[MUI] = (Item-type of (Item carried by (Triggering unit) in slot 1))
      • Save (Item-type of (Item carried by (Triggering unit) in slot 1)) as Key(string(BackPackSlot1)) of Key(Triggering Unit)
And then create a system to make the MUI get to 0 from time to time.
 
Level 8
Joined
Jun 30, 2010
Messages
259
ok maybe it will be better if i try to make this by myself :p
i have a question...
BackpackTrue [Index] Equal to True
what should i insert in the index? :p

EDIT:
Also where can i find the Load Key action?
(yeah i really suck at MUI sry :p)

I m done with making it MUI and the indexing nor MUI system was needed, except I did not find a proper way to store the item types (since save itempool handle was bugged, sadly) so I had to use the move function instead.
Here is the spell!
Have a look at it, and say what you think
View attachment Bag System MUI.w3x
Enjoy!
And a little credits if you use something rather like my system as a thanks for the help would be nice.
EDIT 2: Sorry!! It actually did work :D
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
I m done with making it MUI and the indexing nor MUI system was needed, except I did not find a proper way to store the item types (since save itempool handle was bugged, sadly) so I had to use the move function instead.
Here is the spell!
Have a look at it, and say what you think
View attachment 91900
Enjoy!
And a little credits if you use something rather like my system as a thanks for the help would be nice.
EDIT: it will not work properly at the moment, but if you add a MUI system it will work. I will fix it now, but have a look at my current progress meanwhile.

thnx man !! i really appreciate all your help +rep again :thumbs_up:
can you pls post here a MUI tutorial?
 
Level 8
Joined
Jun 30, 2010
Messages
259
Sorry, as I said, I was wrong, the system DOES work, no bugs! no mui needed!
EDIT: mui tutorial? Just try to compare my trigger to yours (which is still in my version of it) and try to figure out how to do it, since a whle tutorial for it would be quite hard to explain and would take quite some time.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
MUI and no leaks
  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This is the point where the saved items will be placed --------
      • -------- Does not really matter since they will be hidden anyway --------
      • Set Backpack_SavePoint = (Point(0.00, 0.00))
      • Hashtable - Create a hashtable
      • Set Backpack_Hashtable = (Last created hashtable)
  • OpenBackpack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Open Backpack
    • Actions
      • For each (Integer i) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot i) as (Key (Triggering unit)) of i in Backpack_Hashtable
          • Item - Move (Item carried by (Triggering unit) in slot i) to Backpack_SavePoint
          • Item - Hide (Item carried by (Triggering unit) in slot i)
          • Hero - Give (Load i of (Key (Triggering unit)) in Backpack_Hashtable) to (Triggering unit)
      • Unit - Remove Open Backpack from (Triggering unit)
      • Unit - Add Close Backpack to (Triggering unit)
  • CloseBackpack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Close Backpack
    • Actions
      • For each (Integer i) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot i) as i of (Key (Triggering unit)) in Backpack_Hashtable
          • Item - Move (Item carried by (Triggering unit) in slot i) to Backpack_SavePoint
          • Item - Hide (Item carried by (Triggering unit) in slot i)
          • Hero - Give (Load (Key (Triggering unit)) of i in Backpack_Hashtable) to (Triggering unit)
      • Unit - Remove Close Backpack from (Triggering unit)
      • Unit - Add Open Backpack to (Triggering unit)
 

Attachments

  • Backpack.w3x
    22.4 KB · Views: 289
Level 20
Joined
Jul 12, 2010
Messages
1,717
i found some bug,when i close bag,it return just now item,the item has been drop at ground==,when my slot is empty,i click close bagpack,the item of just now was come back= .=?

P\S:I only can click Close Bagpack,i cannot find Open Bagpack again=.=

yeah i found that bug too lol
but chill dude i never said that this is the best system ever xD
i have no idea about GUI/MUI or harshtables lol
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
MUI and no leaks
  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This is the point where the saved items will be placed --------
      • -------- Does not really matter since they will be hidden anyway --------
      • Set Backpack_SavePoint = (Point(0.00, 0.00))
      • Hashtable - Create a hashtable
      • Set Backpack_Hashtable = (Last created hashtable)
  • OpenBackpack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Open Backpack
    • Actions
      • For each (Integer i) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot i) as (Key (Triggering unit)) of i in Backpack_Hashtable
          • Item - Move (Item carried by (Triggering unit) in slot i) to Backpack_SavePoint
          • Item - Hide (Item carried by (Triggering unit) in slot i)
          • Hero - Give (Load i of (Key (Triggering unit)) in Backpack_Hashtable) to (Triggering unit)
      • Unit - Remove Open Backpack from (Triggering unit)
      • Unit - Add Close Backpack to (Triggering unit)
  • CloseBackpack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Close Backpack
    • Actions
      • For each (Integer i) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot i) as i of (Key (Triggering unit)) in Backpack_Hashtable
          • Item - Move (Item carried by (Triggering unit) in slot i) to Backpack_SavePoint
          • Item - Hide (Item carried by (Triggering unit) in slot i)
          • Hero - Give (Load (Key (Triggering unit)) of i in Backpack_Hashtable) to (Triggering unit)
      • Unit - Remove Close Backpack from (Triggering unit)
      • Unit - Add Open Backpack to (Triggering unit)

wow dude thnx!!
this one is very simple!! +rep:thumbs_up:
 
Level 8
Joined
Jun 30, 2010
Messages
259
MUI and no leaks
  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This is the point where the saved items will be placed --------
      • -------- Does not really matter since they will be hidden anyway --------
      • Set Backpack_SavePoint = (Point(0.00, 0.00))
      • Hashtable - Create a hashtable
      • Set Backpack_Hashtable = (Last created hashtable)
  • OpenBackpack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Open Backpack
    • Actions
      • For each (Integer i) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot i) as (Key (Triggering unit)) of i in Backpack_Hashtable
          • Item - Move (Item carried by (Triggering unit) in slot i) to Backpack_SavePoint
          • Item - Hide (Item carried by (Triggering unit) in slot i)
          • Hero - Give (Load i of (Key (Triggering unit)) in Backpack_Hashtable) to (Triggering unit)
      • Unit - Remove Open Backpack from (Triggering unit)
      • Unit - Add Close Backpack to (Triggering unit)
  • CloseBackpack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Close Backpack
    • Actions
      • For each (Integer i) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot i) as i of (Key (Triggering unit)) in Backpack_Hashtable
          • Item - Move (Item carried by (Triggering unit) in slot i) to Backpack_SavePoint
          • Item - Hide (Item carried by (Triggering unit) in slot i)
          • Hero - Give (Load (Key (Triggering unit)) of i in Backpack_Hashtable) to (Triggering unit)
      • Unit - Remove Close Backpack from (Triggering unit)
      • Unit - Add Open Backpack to (Triggering unit)

Nice one.
Similar to mine, but I can really see the differences with the hide item action, never thought of that.
I did not use loop actions, that was a huge miss.

And agreed, use the forums or tutorial section to find a tutorial.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
This spell, is pretty useless...
Its just like having 2 inventories with only 1 set of inventories' stats.

that's because it's a pain in the ass to emulate stats in wc3 properly
I made a system in GUI for it which required 100 custom abilities (with JNGP you can automate this task so it's a lot easier but still takes a lot of effort....most time it's not worth it)
 
Level 5
Joined
Oct 8, 2010
Messages
134
Nice Idea
Works well, but when I drop an item and switch backpack twice, the item I just dropped is in my backpack again. (-_-)
But Hey I can still use it as a second-gear-like-function-thingy (^_^)
Or U could fix it.
nevertheless +rep and for now 4.5/5 rating
 
Level 5
Joined
Oct 8, 2010
Messages
134
Btw is this compatible with item restriction systems? (only 1 weapon + 1 offhand, etc.).
hope that it is fixed soon, I'm going to use this awesome system for sure (^_^)
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
that's because you can't save "no item" in hashtables
just create a dummy item which does nothing and save it instead of "no item"
if the loaded item would be that item do nothing

keep in mind that this is just one of hundrets of possible solutions

actually I wanted to post this yesterday but just in the second I clicked on "post" my internet connection failed
 
Level 8
Joined
Jun 30, 2010
Messages
259
I wonder why nobody saw the big mistake in this trigger..?!..

If you add an item to slot 1 and then drop it change backpack add it again you have 2 items !.. so you can create more items yourself Oo..

Item creating backpack..?
However, I never noticed that.
But it might be useful, but, then again, you can do a trigger that creates items in less then a minute, so, I think this bug needs fixing.
 
Level 15
Joined
Nov 26, 2005
Messages
1,151
that's because you can't save "no item" in hashtables
just create a dummy item which does nothing and save it instead of "no item"
if the loaded item would be that item do nothing

keep in mind that this is just one of hundrets of possible solutions

actually I wanted to post this yesterday but just in the second I clicked on "post" my internet connection failed

Anyone have an idea how that can be done? As it really bugs the whole idea of the system ..
 
Level 1
Joined
Aug 16, 2012
Messages
2
Problem

There is a problem when I copy everything just like I have to when I get an item and open backpack the item appears on the center of the map :s Can you help me with this issue please.
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
There is a problem when I copy everything just like I have to when I get an item and open backpack the item appears on the center of the map :s Can you help me with this issue please.
Are you sure? Items are moved at the center of map BUT

  • Set Backpack_SavePoint = (Point(0.00, 0.00))
they are always hidden, im not sure what the problem is sorry=/

  • Item - Hide (Item carried by (Triggering unit) in slot i)
Did you copy all of the 3 triggers in your map? Did you modify anything?
 

EdgeOfChaos

E

EdgeOfChaos

-edit- nevermind.. rating system bugging out on me. didn't mean to rate 1/5 :\
 
Level 1
Joined
Aug 13, 2014
Messages
1
Are you sure? Items are moved at the center of map BUT

  • Set Backpack_SavePoint = (Point(0.00, 0.00))
they are always hidden, im not sure what the problem is sorry=/

  • Item - Hide (Item carried by (Triggering unit) in slot i)
Did you copy all of the 3 triggers in your map? Did you modify anything?

I have the same problem, everything is same as in your trigges. :goblin_cry:
 
Level 5
Joined
Jul 12, 2013
Messages
128
Is it possible to fix the bug when

item in backpack -> close backpack -> open backpack -> throw away item -> close backpack -> open backpack and then suddenly the item is teleported from the ground to my backpack ? :eekani:

Because if not then this is pretty much useless I think.
 
Is it possible to fix the bug when

item in backpack -> close backpack -> open backpack -> throw away item -> close backpack -> open backpack and then suddenly the item is teleported from the ground to my backpack ? :eekani:

Because if not then this is pretty much useless I think.
Thank you! That is indeed a bug.
You can look for an other one. There are some more inventory systems on hive.
Here the handles are not removed from table properly.

Needs Fix
 
Level 3
Joined
Dec 14, 2023
Messages
33
The test Map posted by D4RK_G4ND4LF is exactly what i needed:
No JASS, Working and most important MUI viable. tested with 2 Players without annoying Item Trades which arent intended.
 
Top