HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Creating Hero Item to Stash and vice versa transfer system

12-20-2003, 10:05 PM#1
QuatreDan
Ok, I have a pretty good idea on how to do this, but I just have a few questions. If a player tries to store an inventory slot that is empty, will that crash the game? And, also, will it give the item they wish to be stored to the Stash unit even if its inventory is full (i.e. drop it next to that unit)? Oh, and one last thing, how would I check if an inventory slot is empty? Is that even possible? I've just never tried making this before, and, as you can see, I'm not too sure about different things. Thx a lot. :D

If I've been too unclear for you, please just tell me.
12-20-2003, 11:24 PM#2
Dead-Inside
Well... When you check for an item in the inventory (In whatever slot). Check for "No item" or "No unit" or whatever it says, instead of entering an item or a variable.
I believe it should be possible, even thougth I've never worked with items.


Regards
Dead-Inside
12-20-2003, 11:48 PM#3
ObsidianTitan
first off if your storing items with a chat message there shouldnt be any problem. but if the player can directly put items in and out of the stash it makes it a little more work (especially if they can put in an item in from across the map, if the stash is full it will drop the item)

There are 2 ways to checkif the stash has room, the first will record everytime an item is put in and taken out, and set an intiger to the amout of items. basicly +1 if an item is put in and -1 if an item is taken out. the other does a check everytime a player does the store command, it checks to see if there are any open slot (uses a loop to check if any slots anve no item). if there is an open slot then move the item, if not dont.

If you dont have an item in the slot that you try to store it will not crash the game, but to be sure you can put at the beging an if/then/else that is if item is slot(slot being checked) is not equal to no item then do nothing else ekip remaining actions.
12-21-2003, 01:32 AM#4
weaaddar
Check out my dialog test 3.8 it does most of what you want. And no you won't crash the game by storing null to a variable...
12-21-2003, 05:10 AM#5
QuatreDan
Thx but...I'm not a JASS person, or rather...I'm just not very fluent with JASS. I understand the format of it, but I find it difficult to remember all the different functions and what they do and what they may need (take) and return. Anyway, I was hoping to create something similar to what they have in Legacies. You type in "-store1" and it will take the item in your 1st slot and place it in the next available space (if any) in a "backpack" unit. It doesn't matter where you are on the map, so no, it's not a matter of physically trading an item with this "stash". I just need to know how to check for "empty spaces". I can't find "null". How do I get that? The only thing that's really keeping me from getting it done is that I don't know how to check for "empty spaces". You keep telling me to check for them, but I already realize that I need to check for them. What I don't know is how to check for them. Please, won't someone help me? :(
12-21-2003, 07:13 AM#6
ObsidianTitan
basically No item is null.

(Item carried by (Last created unit) in slot 1) Equal to No item
12-21-2003, 04:20 PM#7
weaaddar
Well my dialog test III uses a dialog menu in place of chat messages as I think they're easier to use then remembering text commands no matter how easy.

And its mostly copy and paste to get it to work inside your map.

I do need to update for 1.13...since they added a Item2String function and made mine rather superflous...