HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Advanced inventory system?

06-08-2006, 01:28 AM#1
Sardius
Has anyone figured out a good system for a more advanced inventory setup for WC3 heroes? Rather then carrying only 6 items, possibly being able to divide up quest items, items like potions, and equipment onto seperate inventory pages?

And perhaps like an advanced equipment page with a weapon slot, armor slot, helm slot, etc. So you can't do things like, wear two helmets.
06-08-2006, 01:35 AM#2
map-maker
search the forums before posting...there are some great systems that already do this.
06-08-2006, 02:41 AM#3
Sardius
Yah I did do a bit of searching, but if there are quite a few different systems, which would you recommend is the best for the features I mentioned above?

Equipment Page, Quest Item Page, Items Page with a specialized equipment slot setup for parts of the body.
06-08-2006, 06:15 AM#4
Blade.dk
There are weaaddar's Drag and Drop systems and Vexorian's InvX.

Both are very good systems. I suggest you to look at them, and see which one fits best for what it is that you want to use it for.
06-09-2006, 04:04 AM#5
Sardius
Not sure if either of these are right for me, both are overly complex... Basicly I just need something simple, 3 pages, equipment, inventory, quest items. with 6 slots each. The equipment slot setup would be nice, but I don't much like how it is implemented in InvX
06-09-2006, 04:06 AM#6
st33m
Yes... how simple is that.
06-09-2006, 04:35 AM#7
Tiki
I have one that has a 11 slot inventory. Predefined spots for armor, helms, weapons, etc. But I dono how to use it lol.
06-09-2006, 04:54 AM#8
Linera
I personal never liked weaaddar's drag and drop system.
As it was impossible to customize unless you are like a jass expert(which i'm not).
06-09-2006, 07:31 AM#9
Captain Griffen
If you want to use the more advanced triggering stuff, you have to learn JASS. Advanced inventory systems are called 'advanced' for a reason.

Basic ones though, you could just use the back pack idea of having two other inventory units follow you around, maybe as heroes for F2 and F3 to be used. Setting it up so you can't wear two helmets if fairly simple, using something like an item array.
06-09-2006, 07:34 AM#10
Linera
I feel that weaaddar's drag and drop system should have some sort of config page in it so its easy to config the system to your liking.
06-09-2006, 08:05 AM#11
Blade.dk
It is easy enough. Last time I checked, it had a quite long read me explaining how to do everything.
____

I think that you should be able to configure one of these systems to do as you want, just check the read mes and that.
06-09-2006, 03:37 PM#12
weaaddar
Quote:
Originally Posted by Blade.dk
It is easy enough. Last time I checked, it had a quite long read me explaining how to do everything.
____

I think that you should be able to configure one of these systems to do as you want, just check the read mes and that.

There is a rather lengthy function called config. It has everything that can be adjusted globally for all systems.

Since I wanted to create different setting for different items and units, I decided it best to move most of these settings to the constructors for the type/actual item. Here are what settings are located on the constructors:
Bag>
1) The bag type
2) How many items can the bag take
3) What an item requires to enter a bag
Atr>
1) The hero
2) How many stats he gets.
Pitems>
1) The actual item
2) Its fake powerup part
Stack Screen>
Nothing :/
Everything for this system is located in the giant config function.


EItems for Dt4a (which is currently not in my drag and drop systems) were pretty hard to use I admit, unfortuantly making a constructor with about 40 fields seemed worse then about 9 or 10 different methods. However, I still think Eitems and DT4a is one of the best item systems made for warcraft III and made a heck of a lot more sense then InvX's equipment.

As far as my latest system, Pocket shop I think is pretty simple to set up. It's a bit complicated in the fact that there is a bit of set up, but I can describe it as such

Let say we have a global string variable named vector .

1) At map initialization add a line of custom script:
Collapse JASS:
 set udg_vector=CreateVector()
This creates a vector, a vector is an array without a fixed length. It is useful as it is a random access structure with methods including adding and removing. It is left leaning, meaning that when you remove an index it will shift everything down until there is no holes. It also can be passed to functions. It is one of the fundamental objects in all my systems and allows me to make new systems very quickly since I've already built special functions to interact with them.


2) then add another line:
Collapse JASS:
 call Vector_addElem(udg_vector,CreatePurchaseItem(TheItemYouSeeInTheShop,TheActualPurchasedItem, InitialStock, MaxStock, restockTime))
The ItemYouSeeInTheShop is the rawcode of the purchasable item, and this item that you see in the pocket shop display.
The ActualPurchasedItem is the rawcode of the actual item, it has to be a powerup. If you want it to be a non powerup make the item a pitem.
The initialStock is how many of the item the shop will have when it is first picked up.
The MaxStock is how many at most the shop can have.

As far as restocktime, if you set it to a negative number, the item will never return (Useful for one time items). If the time is 0 seconds, the item will never go out of stock, and if the time is positive it will keep adding charges until the current stock==max stock.

You keep calling the above function until you've stocked the shop with all the items you want.


3) You then
Collapse JASS:
call CreatePShopId(Pocketshop,udg_vector,rate)
This registers Pocketshop as a Pocket shop, meaning that it can sell and purchase items.
The second parameter is its inventory vector, you've already built the vector of items it can take.
The rate is a number from 0-1 dictating how much you get when you pawn an item at the pocket shop. Thus setting it to .5 means that it returns 50% of the gold an item costs.

4) Optionally you can add requirements to open pages of a shop. You might want the controlling hero to have a max hp of over 500 before opening page 2 (this is very arbitrary but we will do it anyway), otherwise issue an error to the player informing him that his hero needs more hp.

To this we go
Collapse JASS:
call PShopId_setReq(Pocketshop,2,Condition(function MustHave500HP),"Need at least 500 hp to view this page")
Pocketshop is the shop type id we'd like to add a condition to acess its page
2 is the page number we'd like to restrict, setting it to 1 adds a condition to open the shop's inventory.
Condition(... This is our custom requirement. It needs to be a boolexpr, it takes a callback function i'll go over that shortly.
"Need..." Is the error message string. If the hero doesn't meet the requirement this is what is displayed when he tries to access that page.


Unfortuantly, we now need to create a new function called MustHave500HP, we go to the custom script area of the map, where one can add free code, and type::
Collapse JASS:
function MustHave500HP takes nothing returns boolean
This is a custom condition, and as a result you are given two callback variables much like you get the enumerated unit in a unit group loop, or an expiring timer, or even a triggering unit. They are as follows
Collapse JASS:
unit SR_Hero()
item SR_Shop()
SR_Hero(), is the hero who currently is trying to access page N
SR_Shop(), is the shop whose inventory the SR_Hero() is perusing.

Anyway, since we have the hero we can now set up our condition.
Collapse JASS:
function MustHave500HP takes nothing returns boolean
          return GetWidgetMaxLife(SR_Hero())>=500
endfunction
This will test if the hero's max life is greater then 500 and return true if it is.

And there you have it all the mystical hard functionality of the pocketshop probably the most complicated system in this soon to be re released Drag And Drop Systems.

Remember that there are many many functions, but you don't need to call them, they are for the systems need.

If you really have such difficulty please post in my threads as to why its hard to config, and give me a reasonable suggestion of ergonomic ease and I'll gladly implement it. Unfortuantly, I can't add a gui as I really don't know how to build something like WEU easily.
06-09-2006, 07:30 PM#13
Sardius
Well as I said, I am not looking for anything crazy, I just want a simple system to seperate quest items, useable items and equipment, thats all.
06-09-2006, 08:31 PM#14
Captain Griffen
Then you're stuffed.

You can't have a simple system with usable consumables and equipment that has an effect.
06-09-2006, 09:25 PM#15
Sardius
Well that sucks, cause drag n drop is of no use to me, and InvX is far more complex then what I am looking for.