HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Charged item stacking

10-19-2004, 02:05 PM#1
Jase_Morden
Hey,
I need a little help with a map I'm making. I have most of the guns ready and they all have a set amount of ammo, problem is, I don't want people having three or four of the same gun in their inventory. I want the charges to stack up on the original gun.

For example:
A unit has a shotgun, they find and pick up another one. Now instead of making a new shotgun item in their inventory, the original shotgun gets all the shots from the new gun.

Does that make sense? Can somebody help me work this trigger out please? I'd be really grateful and give rep points to anybody that can help me out with this.

Thanks,
-Jase
10-19-2004, 02:32 PM#2
AFB-DieHard
Events
Unit - YOUR UNIT Acquires an item
Conditions
(Item-type of (Item being manipulated)) Equal to SHOTGUN
((Hero manipulating item) has an item of type SHOTGUN Equal to true


I don't know if there is a trigger to set charges, but you can add something like

Order (Hero manipulating item) to drop (Item being manipulated)

or something like that.
10-19-2004, 03:01 PM#3
iNfraNe
Quote:
Originally Posted by AFB-DieHard
Events
Unit - YOUR UNIT Acquires an item
Conditions
(Item-type of (Item being manipulated)) Equal to SHOTGUN
((Hero manipulating item) has an item of type SHOTGUN Equal to true


I don't know if there is a trigger to set charges, but you can add something like

Order (Hero manipulating item) to drop (Item being manipulated)

or something like that.
yes there is an action for that:
Item - Set Charges Remaining

and btw, then u should not drop the item, but remove it!
10-20-2004, 01:15 AM#4
logik
check the repository, i put a trigger in there which does item stacking... just grab that and copy the trigger over and it should work all good and stuff.
10-20-2004, 10:47 AM#5
Jase_Morden
Quote:
Originally Posted by logik
check the repository, i put a trigger in there which does item stacking... just grab that and copy the trigger over and it should work all good and stuff.

I downloaded that, but I'm making my map in UMSWE4, and for some reason when I open the trigger map, several of the functions are missing, so it won't help in my map.
10-20-2004, 01:32 PM#6
logik
hmmm really? coz it only uses a simple loop and stuff...

oh well... if you want i can pop her open and post the code?
10-20-2004, 02:28 PM#7
Jase_Morden
Quote:
Originally Posted by logik
hmmm really? coz it only uses a simple loop and stuff...

oh well... if you want i can pop her open and post the code?

That'd be awesome, thanks!
10-20-2004, 03:17 PM#8
Guest
here is the link to repository:

http://www.wc3campaigns.com/showthread.php?t=64904

a note when using acquires an item event:

that event is fired after the item is picked up, i.e. it already is in the hero's inventory the time the trigger runs

using item carried by hero of type (item-type of (item being manipulated)) will hence always yield an item, eventually that one that was just picked up

so be careful, they way to work around this is just not to use item carried by hero of type, but loop through inventory slots instead and comparing if the item in current slot is an item of same type, but not the same item as picked up!
(this is the way it is done in the demo map from repository, and this is the way i have coded a similar jass function; probably, this is the only way)
10-20-2004, 11:12 PM#9
Gandalf2349
Um, did you even read the thread. It looked like to me he had the question answered.
10-21-2004, 12:47 PM#10
Jase_Morden
Oh, never mind re-opening the map and reposting the code, Logik, I managed to open it in WE Unlimited, so it all works cool now, thanks, anyway!
10-21-2004, 03:14 PM#11
logik
thats kool... its good that you figured it out...


the only problem is that if you want the items to stack, you need to have at least 1 free inventory slot if not, it will come up with the message "you inventory is full"... i find its just a trivial thing to fix or do... but meh


manald, sorry but i didnt understand what you said?