• 🏆 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!

Changeable Inventory

Level 9
Joined
Jan 11, 2009
Messages
282
I think much of you bother of blizzard's Inventory, that it can only carry 6 items and that you can't change it without knowing Jass or something else.

So, Here's my solution of making a Inventory with 12 places with only 2 triggers and 13 Variables:
Requirements:
13 Variables
2 Triggers
2 Abilitys
1 Unit

Variables (all have to be Item-Typ):
Inventory1A,B,C,D,E,F
Inventory2A,B,C,D,E,F
Unit

Abilitys:
Inventory1 (how the number says, give THIS ability to the unit FIRST)
Inventory2

Unit (Don't forget, set the Variable Unit = The Unit with the Ability):
Just one random unit, testet it on much units, all work properly.

Triggers :
Inventory 1
  • Events
  • Einheit - A unit stops casting an Ability
    • Conditions
  • (Ability being cast) is Inventory 1
    • Actions
  • Set Inventory1A = (Item-type of (Item carried by Unit in slot 1))
  • Set Inventory1B = (Item-type of (Item carried by Unit in slot 2))
  • Set Inventory1C = (Item-type of (Item carried by Unit in slot 3))
  • Set Inventory1D = (Item-type of (Item carried by Unit in slot 4))
  • Set Inventory1E = (Item-type of (Item carried by Unit in slot 5))
  • Set Inventory1F = (Item-type of (Item carried by Unit in slot 6))
  • Hero - Drop (Item carried by Unit in slot 1) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Drop (Item carried by Unit in slot 2) from Unit
  • Item - Remove (Last dropped item)
  • Held - Drop (Item carried by Unit in slot 3) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Drop (Item carried by Unit in slot 4) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Drop (Item carried by Unit in slot 5) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Drop (Item carried by Unit in slot 6) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Create Inventory2A and give it to Unit
  • Hero - Create Inventory2B and give it to Unit
  • Hero - Create Inventory2C and give it to Unit
  • Hero - Create Inventory2D and give it to Unit
  • Hero - Create Inventory2E and give it to Unit
  • Hero - Create Inventory2F and give it to Unit
  • Unit - Remove Inventory 1 from Unit
  • Unit - Add Inventory 2 to Unit
and

Inventory 2
  • Events
  • Einheit - A unit stops casting an Ability
    • Conditions
  • (Ability being cast) is Inventory 2
    • Actions
  • Set Inventory2A = (Item-type of (Item carried by Unit in slot 1))
  • Set Inventory2B = (Item-type of (Item carried by Unit in slot 2))
  • Set Inventory2C = (Item-type of (Item carried by Unit in slot 3))
  • Set Inventory2D = (Item-type of (Item carried by Unit in slot 4))
  • Set Inventory2E = (Item-type of (Item carried by Unit in slot 5))
  • Set Inventory2F = (Item-type of (Item carried by Unit in slot 6))
  • Hero - Drop (Item carried by Unit in slot 1) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Drop (Item carried by Unit in slot 2) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Drop (Item carried by Unit in slot 3) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Drop (Item carried by Unit in slot 4) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Drop (Item carried by Unit in slot 5) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Drop (Item carried by Unit in slot 6) from Unit
  • Item - Remove (Last dropped item)
  • Hero - Create Inventory1A and give it to Unit
  • Hero - Create Inventory1B and give it to Unit
  • Hero - Create Inventory1C and give it to Unit
  • Hero - Create Inventory1D and give it to Unit
  • Hero - Create Inventory1E and give it to Unit
  • Hero - Create Inventory1F and give it to Unit
  • Unit - Remove Inventory 2 from Unit
  • Unit - Add Inventory 1 to Unit
-Update-
Added a item Version, now the trigger has a little bit changed and you have only 10 places (2 for each bags) but it is instant cast time, so now there is no waiting in fight to change sets or items.
 

Attachments

  • Changeable Inventory #2.w3x
    19.2 KB · Views: 67
Last edited by a moderator:
Level 11
Joined
Jun 30, 2008
Messages
580
Ive seen so many of these. But I find this simple, Anyway +rep
i tried it:
Make it instant cast time. And people might like it better if the ability was a item in the inventory so instead of 12 its 10 but thats just me. :p
I would use this if you make those changes, Mod should approve this.
 
Level 9
Joined
May 10, 2009
Messages
542
Yeah, I know, but um... how is german going to really...help anyone...other then Germans...it won't, help, people who know German and English, because um...
 
Level 11
Joined
Jun 30, 2008
Messages
580
Mod approve it...
:)
Anyway thank you for the changes. I am going to use it in my orpg im making :)
+rep again :D

Edit: I must spread some first lol

Edit2: :O
Uh owz! This system isn't MUI!
:(
hey I can make it mui for you? If you want? But it requires arrays though :(
 
Level 9
Joined
May 10, 2009
Messages
542
Multi user interface, or something where multiple players and units can do it. Its a fucking pain to do it, without slightly smart stuff. Anyway, maybe a section you could have is a spell-book bit (for any newbie, or simply a suggestion) where you access stuff such as Potions Inventory and Misc Inventory. Or...
 
Level 11
Joined
Jun 30, 2008
Messages
580
Actually MUI and MPI are really easy if you use 2D arrays. Because it isn't MUI what happens when 2 people play or more is if someone switches their inventory then someone else switches, AND then the first person switches back they end up with player 2's stuff. The variables get overwritten. Its very simple. Here look I edited your code and made it both MUI and MPI. Made the code alot shorter and also more efficient.
  • Inventory 1 Kopieren
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Inventory 2
    • Actions
      • For each (Integer Loop[10]) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set Inventory1[((Player number of (Owner of (Hero manipulating item))) + (10 x Loop[10]))] = (Item-type of (Item carried by (Hero manipulating item) in slot Loop[10]))
          • Hero - Drop (Item carried by (Hero manipulating item) in slot Loop[10]) from (Hero manipulating item)
          • Item - Remove (Last dropped item)
          • Hero - Create Inventory2[((Player number of (Owner of (Hero manipulating item))) + (10 x Loop[10]))] and give it to (Hero manipulating item)
      • If (Cond_Inv Equal to 0) then do (Hero - Create Inventory 1 and give it to (Hero manipulating item)) else do (Do nothing)
      • Set Cond_Inv = 1
  • Inventory 2 Kopieren
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Inventory 1
    • Actions
      • For each (Integer Loop[11]) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set Inventory2[((Player number of (Owner of (Hero manipulating item))) + (10 x Loop[11]))] = (Item-type of (Item carried by (Hero manipulating item) in slot Loop[11]))
          • Hero - Drop (Item carried by (Hero manipulating item) in slot Loop[11]) from (Hero manipulating item)
          • Item - Remove (Last dropped item)
          • Hero - Create Inventory1[((Player number of (Owner of (Hero manipulating item))) + (10 x Loop[11]))] and give it to (Hero manipulating item)

Loop is a integer array. I use it instead of Integer A or Integer B because they can clash.

Here is how a 2D array works. A 2D array makes a array equal to each player.
Here let me break it down for you:

  • [((Player number of (Owner of (Hero manipulating item))) + (10 x Loop[11]))]
Lets do this: Lets say the trigger is triggered by player one.
so the array is this [((1)) + (10 x Loop[11]))]

10 is the amount of slots you are using. For this its the amount of players. So when the first loop goes the array looks like so:
1 + (10 x 1)

So For the first loop and the first player equals 11

Making sense so far?

For player 2 loop 1 it is 12
and so on for all the players.

And then when it goes to loop 2 player 1 is 21
player 2 is 22
player 3 is 23... etc

I hope my description of how a 2D array works :wink:

This is how you use 2D arrays:

in the array part of a variable you need a Player number of((Somthing)) + ((how many slots you need) x ((youractualarraynumber))

2D arrays are very excellent at making your code shorter, readable, and more efficient.

Without 2D arrays you would have to make a variable array for each person and set each one. Which would be a pain.
For example if this wasn't a 2D array I would need 10 variables x each variable you need. Like
Inventory1_Player1
Inventory1_Player2
Inventory1_Player3
.....
Inventory2_Player1
Inventory2_Player2
etc

I hope this helped :thumbs_up:
 
Top