You are out and killing like wolfs then the wolf drops a Meat. you pick up the meat and keep killing.
The problem: Now i killed a wolf more and 1 more meat was dropped, i take it up and now i have 2 meats in to inventory slots, i want it to be so when you pick up a item of the same kind then the items "stocks/Groups" so instead of 2 meats in to slots it will be 2 meats on 1 slot. understanding my problem?
Gnaa it works of course with only one item type. You will need a dummy integer variable for this (I'll call it dInteger):
Events:
- A Unit Aquires an Item
Conditions:
- Item-type of(Item Being Manipulated) == *Meat*
- (Triggering Unit) has an item of type (*Meat*)
Actions:
- Set dInteger = 0
- For each (Integer A) from 1 to 6 do(Actions):
- IF
- Item-type of (Item carried by (Triggering Unit) in slot (Integer A) ) == *Meat*
- THEN
- Set dInteger = dInteger + Charges remaining in (Item carried by (Triggering Unit) in slot (Integer A) )
- Remove (Item carried by (Triggering Unit) in slot (Integer A) )
- ELSE
(nothing)
- Create (*Meat*) and give it to (Triggering Unit)
- Set charges remaining for (Last Created Item) to (dInteger)
Ok what we do: whenever a hero picks up or recieves a *meat* (or however you named it) we "scan" all slots of the hero for *meat* and sum up the charges of the items we find there. additionally, every meat is being removed. after we did this, we create a new *meat* and set the charges to the number we summed up before. This also supports picking up a *meat* with more than one charge which might be useful.
Thx Excite. But klovadis that is almost like my trigger, just that he can pick up an item whithout having to drop another to do this. Or my trigger doesnt work?
well not really ^^ your trigger doesn't work, starting from here:
.) "Picked Item" refers to the item in the "pick every item in ..." loop. "Item Being Manipulated" is what you are looking for.
.) As far as I understand, you want to make one item for each charge, thus one meat with 1 charge, one meat with 2 charges, etc. this is not necessary since you can manipulate the charge count.
.) What if the player picks up more than 2 "meats"? what if he gathers more than 10 meats? 100? a lot of triggering work. what if the player picks up a meat with 2 charges? And so on..
I am quite shure that my code works with any combinations and any number of charges remaining on different "meats".