System Virtual Equipment

Steel

Software Engineer
Reaction score
109
Disclaimer: This is not meant for use by novice map makers. This system makes virtual equipment very easy, but there are some steps of implementation that basic map makers must know in order to use this system. Some basic knowledge is how to import other systems (Such as BonusMod) and modifying RAW ID's based on your map's data.

I am not responsible for making this system work in your map!


Changelog
Version 1.0.6:
-Fixed map to work with latest Warcraft III patch.

Version 1.0.5:
-Moved from bonusMod to Bonus (By Cohadar)
-Made the map use some of the systems from my RPG Framework. This is due to ease of use and simplification on cleanup.
-Object Editor Data can now be created through a trigger using the external ObjectMerger. This will greatly speed up the time it takes to implement this system in a map.

Version 1.0.4a:
Note: There is some bug that is causing things to lock up the map at certain situations. This isn't a full version release, just the release of ability features on items. Version B will hopefully fix the problem.
-System now allows items to have custom abilities. See FAQ below for more information
-Created custom player library for tracking of a player's units easier. This system functions independently of the Item System.

Version 1.0.3:
-System now handles addition of classes by function calls, configuration of global variables
-System has many more advanced functions for creating classes
-Complexity of many functions optimized for efficiency
-Item Creation can now support special abilities and movement speed
-Added in public functions to display multiboard at the user's whim. This is useful for people who wish to use multiple multiboards

Version 1.0.2:
-System can now handle dropping any number of items
-System maxs out at 37 slots (Maxes at 37 since the Multiboard cannot expand further)
-Row 9 on multiboard now properly displays icon
-Row for Total values now properly disables icon

Version 1.0.1:
-Structs data now properly saved
-User can now name the equipment slots how they wish
Ex: A user can make 10 "Finger" slots if they want
-User can now add any number of equipment slots they wish
Ex: A user can name a slot "Eyelash" if they so desire
Version 1.0.0:
-Initial Release

FAQ
Q: What is this?
A: This is a map that allows an extensive addition to the current item system belonging to the Warcraft III game. There have been systems like this before but I wanted people to have a look at mine and see how it works.

Q: What does this do?
A: It extends the basic 6 item slots of our unit and allows for multiple equipment slots such as a helm, accessory, boots, and such.

Q: Can you add more slots?
A: The system is completely modular, you can add and create whatever you want. The system is hardcapped at 37 since the multiboard cannot extend that far and frankly any more than that you should be slapped.

Q: (1.0.1) Can the system support multiple slots of the same type?
A: Yes, so long as the slot names are EXACTLY the same. The demo map includes 2 slots titled "Accessory" to show how this works. If you attempt to equip an item with the slot title "Accessory" the system cycles through all the slots created initially by the system for a slot called "Accessory". The system will check the first slot it comes accross, in our example, slot 5. If slot 5 has nothing there, it will use that slot. If slot 5 has something there, the system will recognize this and search for another slot named "Accessory", if no other slot is found, you cannot equip the item.

In the example, we call AddSlot in the order of the 5th and 6th calls to the function. This means if we create an item with the ItemCreation_CreateCustomItem, the slot variable must be either 5 or 6, it does not have to be slot 5 only.

Q: (1.0.1) How do I figure out the slot number now to create items?!
A: Very simple, if you call AddSlot 3 times, you will have 3 slots. You add them by calling the following
call AddSlot("Helm")
call AddSlot("Chest")
call AddSlot("Gloves")

Now to create an item for the helm slot, this was the FIRST call to AddSlot, so all items that you want put into the helm slot, are slot 1...call ItemCreation_CreateCustomItem('I000', 1....
If you wanted to create a pair of gloves, gloves are the [bTHIRD[/b] call to AddSlot, so they are slot 3....call ItemCreation_CreateCustomItem('I000', 3....

Q: (1.0.4a) How do you create custom item abilities?
A: There is an advanced user function for creating items that has more features than the normal function. Take a look at this example:
JASS:
call ItemCreation_CreateCustomItemAdvanced('I00B',8,"2h",16383,1,10,17,38,0,0,0,0,3,10,50, 'A021', 0, "ReplaceableTextures\\CommandButtons\\BTNBrilliance.blp")

This function creates an item like normal. I00B is the item, 8 is the slot, 2h is the type, etc etc...continuing to the 3 for armor, 10 for hp, 50 for mana. The A021 is the custom ability to be added to the unit. The 0 is to indicate movespeed increase which is currently disable due to some glitches. Finally the last is the icon for the multiboard like normal.

The A021 in this example is the Blizzard spell, it will show up on the hero like normal. If you want to hide a passive ability use the spellbook / disable trick to work that out, or modify the ability any other way you wish. I may change how this works because it uses icons and slots on the player's unit which can be rather annoying for active abilities.




Requirements
Editor
-vJASS

Systems (Included in the map)
-ABC (By Cohadar)
-Dialogs (By Cohadar)
-BonusMod (Emjlr3's version)






How To Use
Preface: This system is designed for a single hero unit of a player. Ex. A RPG where the player has only 1 unit they control primarily. The system requires that unit to be stored into the unit array Hero. This needs to be done because the system references that unit numerous times and that is based upon the player's index.

If you look at the Select Hero trigger in the Demo category, you can understand how this works.

Setup!
Aside from getting bonusMod established in your map there are two rawIDs that are required. The first is the ability to drop items, that is the rawID of the ability you create. The second is the dummy ability that is on each and every item to equip.


Functions
Look below for details on how to use these functions
1)
Trigger:
  • Custom script: call ItemCreation_CreateCustomItem('I004',4,"e", 16383,3,15,10,5,2,0,0,0,9,20,20, "ReplaceableTextures\\CommandButtons\\BTNBootsOfSpeed.blp")

JASS:
public function CreateCustomItem takes integer id, integer slot, string itype, integer who, integer level, integer str_r, integer agi_r,integer int_r, integer str, integer agi, integer int, integer dmg, integer armor, integer hp, integer mp, string model returns nothing

2)
Trigger:
  • Custom script: call ItemCreation_CreateCustomItemAdvanced('I003',11,"e",16383,1,0,0,0,1,1,1,1,1,1,1,'A01Y', 0, "ReplaceableTextures\\CommandButtons\\BTNNatureTouchGrow.blp")

JASS:
public function CreateCustomItemAdvanced takes integer id, integer slot, string itype, integer who, integer level, integer str_r, integer agi_r,integer int_r, integer str, integer agi, integer int, integer dmg, integer armor, integer hp, integer mp, integer abilityid, integer movespeed, string model returns nothing

3)
Trigger:
  • Custom script: call ItemSystem_AddClass('Hamg')

JASS:
public function AddClass takes integer i returns nothing

4)
Trigger:
  • Custom script: call ItemSystem_AddClassAdvanced('Hpal')

JASS:
public function AddClassAdvanced takes integer i, boolean dualwield returns nothing

5)
Trigger:
  • Custom script: call ItemSystem_AddSlot("Accessory")

JASS:
public function AddSlot takes string str returns nothing

6)
Trigger:
  • Custom script: call Multiboard_ItemSystem_Create()

JASS:
public function Create takes nothing returns nothing

7)
Trigger:
  • Custom script: call Multiboard_ItemSystem_DisplayAll()

JASS:
public function DisplayByPlayer takes player p returns nothing

8)
Trigger:
  • Custom script: call Multiboard_ItemSystem_DisplayByInt(0)

JASS:
public function DisplayByInt takes integer i returns nothing

9)
Trigger:
  • Custom script: call Multiboard_ItemSystem_DisplayByPlayer(Player(3))

JASS:
public function DisplayByPlayer takes player p returns nothing



Explanations
1/2) This may look like garbage but lets take a look at what we're passing in:
- I004 is the item's raw ID value
- 4 is the slot we're using (A list of usable slots can be found in the map)
- "e" is passed in to tell the system to equip. (There are only 4 different types used, "e" for normal items, "1h" for one handed items, "2h" for two handed items and "s" for shields (This can also be used for offhand items)
- 16383 tells our system all classes in the system may use the item. This is actually a complex formula...I've included a spreadsheet that will calculate the value for you: http://dl.getdropbox.com/u/517800/Item System.xls
Say for example we have 4 Heroes.
Hero 1 is assigned 1
Hero 2 is assigned 2
Hero 3 is assigned 4
Hero 4 is assigned 8
Now, say we want an item Heroes 1,2 and 4 can use...add their values! 1+2+8 = 11. 11 would be the value to let those 3 use that item and EXCLUDE Hero 3.
- 3 the level requirement
- 15 Strength Requirement
- 10 Agility Requirement
- 5 Intelligence Requirement
- 2 Bonus Strength
- 0 Agility Bonus
- 0 Intelligence Bonus
- 0 Damage Bonus
- 9 Armor Bonus
- 20 HP Bonus
- 20 MP Bonus
- "ReplaceableTextures\\CommandButtons\\BTNBootsOfSpeed.blp" this is the icon associate with the item for multiboard display

Look at the GUI trigger in the Item_System category for more examples.

2) This is the same as above but 2 more values are passed. The first you can see is 'A022' this tells the system to give the unit that special ability. In my demo map the 'A022' is a Spellbook that has an ability inside it that is hidden so the user gains the ability and does not gain visibility of it.
The second additional value passed into the function is an increase to the unit's movement speed.

3) To add a class to the system all you have to do is pass in the unit's rawID. Maximum number of classes you can add is 16. You should never need any more than that unless you are making an AOS.

Look at the GUI trigger in the Item_System category for more examples.

4) This is the same as above but it takes in a boolean. Passing in true means you want to allow the unit you're passing in to dual wield weapons.

5) This function allows you to add any type of slot you want to the system. You can have absolutely anything you want, 10 finger slots, leggings, eyelash, whatever. Simply just call this function with the string you want. If you want multiple slots of the same type you must use the EXACT same string name (NOTE: System is case sensitive). The system can only create 37 item slots, this limitation is hardcoded because the multiboard can only display a certain number of rows properly.

6) Initially creates the multiboards for all players to allow the display of our equipment

7) Forces ALL players to view their equipment multiboard

8) Displays the equipment multiboard for the Player's ID you pass in to the function (Note, Player ID values start at the array base of ZERO (0))

9) Displays the equipment multiboard for the Player you pass in to the function

Look at the GUI trigger in the Item_System category for more examples.

System Error Reference Guide
System Error 100: The item you are referencing is not in the database

System Error 101: Attempting to add more than the maximum number of classes allowed.

System Error 102: Attempting to add more than the maximum number of slots allowed.

System Error 103: ItemSlotCheck - "2h" string found in second available slot

System Error 104: Attempting to display ItemSystem Multiboard of invalid player









Screenshot
VirtualItem.jpg

Download Virtual Inventory 1.0.0
Download Virtual Inventory 1.0.1
Download Virtual Inventory 1.0.2
Download Virtual Inventory 1.0.3
Download Virtual Inventory 1.0.4a
Download Virtual Inventory 1.0.5
Download Virtual Inventory 1.0.6
 

Nexor

...
Reaction score
74
You could make the equipment removal to add to the empty inventory slots.
And change the item descriptions to a more readable one.

Anyway it's a nice system :)
 

BcBoy

Active Member
Reaction score
6
Hmmm... Excuse me if i'm sounding noobish, but I am... You wrote at the top that this needed Addons. What will happen if i'll try to play the map with someone that NOT have those addons? Will the addons come with the map, or do the other "clients" need to install them permanently to the game?

Btw. I downloaded it. I'm working on a map that me & my friend probably will release on the net. Is that Ok if i use your codes? Ofc i will write Credits.
 

Steel

Software Engineer
Reaction score
109
Hmmm... Excuse me if i'm sounding noobish, but I am... You wrote at the top that this needed Addons. What will happen if i'll try to play the map with someone that NOT have those addons? Will the addons come with the map, or do the other "clients" need to install them permanently to the game?

The system has dependencies to other libraries (Systems written by other people).

vJASS is the only true thing you need open and run my map. If you copy the appropriate files over you shouldn't have a problem.

Also, note that I did not include instructions on setting up the other libraries. BonusMod is a system that requires a lot of setup. Now if you already have these systems installed on your map, then you don't need to worry about setting them up again.
Btw. I downloaded it. I'm working on a map that me & my friend probably will release on the net. Is that Ok if i use your codes? Ofc i will write Credits.
Thats perfectly fine, but I've said that this isn't really meant for people to use, its just a technical demonstration for people to learn from.
 

BcBoy

Active Member
Reaction score
6
Okay... I'm pretty new to JASS, trying to learn but now in the beginning it's lot's of information to understand.
 

Steel

Software Engineer
Reaction score
109
Version 1.0.3 -- Released

Read the initial post for changes.

I also cleaned up the post so it is more user friendly.
 

CaptDeath

New Member
Reaction score
103
wow good job keep up the great work
i really like the multi board display being togleable
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
Why would one want to download an inferior, and/or buggy version of the system?
 

Steel

Software Engineer
Reaction score
109
Why would one want to download an inferior, and/or buggy version of the system?

I leave them as a legacy. As I originally stated this was intended for instructional purpose so learning how I went from point A to point B may require a different version of the map.




Aside from optimizing complexity I don't quite know how to expand the system to make it "better". I thought about doing Set Items, I had it working in a much older version but never felt the need to use it. If you guys have suggestions, I can tackle them. What I am doing though is attempting to expand on the focus of the map. Moving from an item system and bringing it to encompass other aspects:
Advanced Player Creation - Tools to manage a player better in your map.
Save / Load Code tutorial and rough demonstration (This one is for you CaptDeath)

Continued Mapping Goal: Create systems that anyone can use. Its a very difficult thing to have some code in your head, you write it out and make a program with it. In our case we are dealing with functions, systems, and spells. The systems I make public I wish to be as simple and easy to use, with that, I want to set an example for others. I hope that the functions and the tutorial I have provided have given ample understanding of how things work.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
You don't need the "onDestroy" method in the "ItemStruct" struct.

Use array variables together with a loop to make the "ClassSetup" function more efficient.

The same goes for the "MainDropDialogCallback" function - you can easily remove all the conditionals.


Anyway, the whole system itself can be more compact and efficient.

You do a lot of useless function calls, for example.

In addition, it lacks configuration options, namely, the option to add more slots easily.


Overall, it's a nice yet seriously complex system.

I'll graveyard it currently, until further updates.
 

Steel

Software Engineer
Reaction score
109
Anyway, the whole system itself can be more compact and efficient.

You do a lot of useless function calls, for example.

Tell me where? The system is optimized in a number of ways and no function reaches a complexity higher than O(n log n) so the complexity of the entire program is rather simple. Variation of any code will at best bring us a complexity of O(n) which is a marginal difference from n log n. I do a lot of function analysis and my code is not bad by any means, sure it can work and it gets the job done but when all is said and done 3.39348 seconds is almost as good as 3.2 and in the world of computers thats all that matters.

In addition, it lacks configuration options, namely, the option to add more slots easily.

You're funny.
JASS:
public function AddSlot takes string str returns nothing
I guess this is too complicated for you?

Overall, it's a nice yet seriously complex system.
It's extremely easy...the functions are right infront of your face in my first post. Read it. You want to display a multiboard for 1 player? You have a function for that. You want to create a slot? You have a function for that. You want to add an item into the system? You have a function for that. What is complicated about this at all?

Please. If you actually spent the time to download the map and look at it you'd notice major improvements from what I had posted in the second message.
 

Steel

Software Engineer
Reaction score
109
I'd really appreciate this getting un-graveyarded or at least an explanation as to why it was put here in the first place because Andrewgosu seemed to dismiss this without even f*cking trying it.
 

Steel

Software Engineer
Reaction score
109
The only problem is that items can't have spells.

Easily fixed, I had that coded in an unreleased version so here it is.

v1.0.4a release, please check the changelog for details.

P.S. Un-graveyard my system!
 

wraithseeker

Tired.
Reaction score
122
I think you should use TimerUtils to replace ABC? I'm not sure what ABC does but it's a struct attachment system.

BonusMod changed to UnitProperties, it's the latest bonus mod in this era.

Post your system script.

That SimError seems to be a little off by your ss.
 

Steel

Software Engineer
Reaction score
109
I think you should use TimerUtils to replace ABC? I'm not sure what ABC does but it's a struct attachment system.

BonusMod changed to UnitProperties, it's the latest bonus mod in this era.

Post your system script.

That SimError seems to be a little off by your ss.

Apples and Oranges my friend. I will not post my code either because the last time I did this AndrewGosu decided to edit my post.

Edit - Still don't quite know what the cause of the freezing is
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top