HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[GUI] Basic Item Combining

12-27-2007, 01:11 AM#1
Tide-Arc Ephemera
Basic Item Combining
By Tide-Arc Ephemera

Foreword- For all those who just want a system as opposed to a step-by-step tutorial, a demo map has been attached which contains two systems.

For this tutorial, you will only need World Editor

Contents:
1. Combining System 1
- 1a. The events
- 1b. The conditions
- 1c. The actions
2. Combining System 2
- 2a. The events
- 2b. The conditions
- 2c. The actions
3. Some notes

1. Combining System 1
Trigger:
Item Combine 1
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_A) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_B
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_B) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_A
Collapse Actions
Item - Remove (Item carried by (Triggering unit) of type Item_A)
Item - Remove (Item carried by (Triggering unit) of type Item_B)
Hero - Create Product_C and give it to (Triggering unit)
This system activates and immediately combines as soon as the unit gathers both items. The event here is one piece of the recipe being picked up. This piece is refered to as "Item being manipulated". The other pieces of the recipe must already be present in the inventory of the unit and they are refered to as "Item carried by (Triggering unit) of type X".

1a. The event
Trigger:
Events
Unit - A unit Acquires an item
This is fairly straight forward, it activates the trigger when the unit acquires an item.

1b. The conditions
Trigger:
Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_A) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_B
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_B) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_A
This can be fairly complicated, so I will go through it.

Trigger:
Conditions
Collapse Or - Any (Conditions) are true
Conditions
This is to ensure that it's not just restricted to any one combination which could cause the trigger to mess itself up. If you had an AND instead of an OR, the trigger would not run because it would check if the item is two types at the same time. Since an item cannot, it would basically render the trigger useless.

Trigger:
Conditions
Collapse Or Any (Conditions) are true
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_A) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_B
You will need one AND condition INSIDE the OR condition for every item type you have. For each item type, you will need to make a "(Item-type of (Item being manipulated)) Equal to (==)" for every OTHER item in the recipe and a "((Triggering unit) has an item of type Item_A) Equal to (==)" for THE item.

This may seem a bit ambiguous, but here's an example if this recipe were to contain 3 items:
Trigger:
Or - Any (Conditions) are true
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_A) Equal to (==) True
((Triggering unit) has an item of type Item_C) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_B
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_B) Equal to (==) True
((Triggering unit) has an item of type Item_C) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_A
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_B) Equal to (==) True
((Triggering unit) has an item of type Item_A) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_C

As you can see, there is one "(Item-type of (Item being manipulated)) Equal to (==) " in ever AND bracket and a "((Triggering unit) has an item of type Item_B) Equal to (==)" for each other item.

With the boolean condition "((Triggering unit) has an item of type Item_B) Equal to (==) True", make sure that it is ALWAYS set to true otherwise you may have a strange recipe that will do things you may not want it to.

Hopefully that cleared up the conditions.

1c. The actions
Trigger:
Actions
Item - Remove (Item carried by (Triggering unit) of type Item_A)
Item - Remove (Item carried by (Triggering unit) of type Item_B)
Hero - Create Product_C and give it to (Triggering unit)

This part is fairly straight forward, all you need to do is remove the two items which are required and then give the product item to the unit collecting the item. Simple!
_____

END OF COMBINING SYSTEM ONE.
_____

2. Combining System 2
Trigger:
Item Combine 2
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_A) Equal to (==) True
((Triggering unit) has an item of type Item_B) Equal to (==) True
((Triggering unit) has an item of type Item_C) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_Combiner
Collapse Actions
Item - Remove (Item carried by (Triggering unit) of type Item_A)
Item - Remove (Item carried by (Triggering unit) of type Item_B)
Item - Remove (Item carried by (Triggering unit) of type Item_C)
Hero - Create Product_D and give it to (Triggering unit)

This system activates not when the unit gathers all the physical parts, but the "recipe piece" instead. The event here, much like System 1, activates upon an item being picked up, but unlike System 1, it will only work if it's a CERTAIN item.

2a. The event
Trigger:
Events
Unit - A unit Acquires an item
Much like System 1, the event is one of the simplest things ever. It is simply when a unit picks up an item!

2b. The conditions
Trigger:
Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_A) Equal to (==) True
((Triggering unit) has an item of type Item_B) Equal to (==) True
((Triggering unit) has an item of type Item_C) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_Combiner
This part is broken up into two parts for trivial reasons, yet I will explain them in case it still seems ambiguous. In short, it is checking that the unit has the required parts as well as the item that was picked up by the event is the item combining piece. The reason why this system activates only when the specific item is acquired is because of that last condition, it checks to make sure that it is the specific type.

Trigger:
Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_A) Equal to (==) True
((Triggering unit) has an item of type Item_B) Equal to (==) True
((Triggering unit) has an item of type Item_C) Equal to (==) True
This part ensures that the unit has all three items, keep in mind, since it's checking for types, it is unable to support multiple types of any one item.

Trigger:
Conditions
(Item-type of (Item being manipulated)) Equal to (==) Item_Combiner
This part ensures that the item being picked up is the item required to combine, usually it's an item like "Diamond Sword Recipe" or for those of you who play DotA, it's sort of like "Dagon" when being made for the first time. This is the magical piece that ensures that only one item is capable of activating the recipe instead of any of the pieces. Also, without this it'd work in this demented order:

Unit acquires item --> unit is holding items of type --> make recipe.

That would have the error of making the recipe when ANY item is acquired.

2c. The actions
Trigger:
Actions
Item - Remove (Item carried by (Triggering unit) of type Item_A)
Item - Remove (Item carried by (Triggering unit) of type Item_B)
Item - Remove (Item carried by (Triggering unit) of type Item_C)
Hero - Create Product_D and give it to (Triggering unit)
Looks familiar? This is because it is almost identical to System 1. All you have to do is remove the fixed parts (the parts that stay in your inventory permanently) and then give the product item to the acquiring unit.

But wait, there's four items, why are you removing three? Well this currently assumes that you're using a power up for the combiner, you CAN use a permanent item as the recipe item, however then you'd just use System 1 for that.
_____

END OF COMBINING SYSTEM TWO.
_____

3. Some Notes
If you require a show of how this can be used, then there is a demo map attached to show a demonstration on both systems.

Both of these systems have cons and pros, however they are shared between them both.

PROS:
  • Items don't need to be in specific slots
  • They are easy to manipulate
  • They don't need variables and just need your item types
  • Suitable for GUI users, beginners and pros alike
  • Could be a starting point when learning how to trigger with items
  • Doesn't leak (as far as I know)

CONS:
  • Can become bulky
  • May need multiple triggers for multiple recipes
  • Doesn't support having 2 or more of any 1 type of item in a recipe (e.g having 2 claws of attack)

If you choose to use these exact systems in your map, I'd like credit. That is a request, not a demand.
____

For those of you who are using the demo map AND reading this online tutorial at the same time, the variables ARE NOT needed, they are either aesthetics or for reading.

If you're wondering "In your conditions, why does it say 'equal to (==)'?", that is simply a graphical thing on my end due to my usage of UMSWE, but I guarantee ALL of that can be done without fancy WE plugins or alternations.

Trigger:
Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) has an item of type Item_A) Equal to (==) True
((Triggering unit) has an item of type Item_B) Equal to (==) True
((Triggering unit) has an item of type Item_C) Equal to (==) True
(Item-type of (Item being manipulated)) Equal to (==) Item_Combiner

That's an example of "equal to (==)".
___

If you have any questions, just feel free to post them here or PM me!
___


Edit 1, 25/2/2008 - recovered tutorial to the best that I could due to an unexpected event. Some things may be missing or other things inflated compared to what it used to be. If anything is missing from what was there before, I would appreciate a heads up on what it is.
Attached Files
File type: w3xRecipeDemo.w3x (16.8 KB)
12-28-2007, 04:27 AM#2
Anopob
Well it's okay for beginners, though wouldn't "triggering unit" leak (I haven't mapped in a long while so...)?
12-28-2007, 05:33 AM#3
Tide-Arc Ephemera
I heard it doesn't, well that's what people have told me.
01-07-2008, 10:01 AM#5
Tide-Arc Ephemera
@ Need_O2
Thanks!

@ Anyone
Um, anyone have a clue when Pitzer might come around? I know it may be sooner or later, but an idea would be nice. I don't mean to rush, but it'd be nice to have this tutorial reviewed by an official of some sort.

Criticisms are also nice.
02-19-2008, 05:44 AM#6
Tide-Arc Ephemera
I don't mean to be an ass hole and look like a triple poster (I'm pretty sure there was a post before my previous one) or a bump-addict, but...

Might anyone have a clue when Pitzermike (or the tutorial reviewer if I have the wrong name labeled) may look over this?
02-19-2008, 06:29 AM#7
Pyrogasm
No idea where he is.
02-24-2008, 10:28 AM#8
PitzerMike
Oh god, I just wanted to make a small edit to your tutorial and in the middle of saving the changes my internet connection died.

Now half of your tutorial is lost. I'm terribly sorry.
I hope you have a local backup of the tutorial on your computer.
It's good work and I'd like to approve it. Sorry again for my stupidity.
02-24-2008, 11:32 PM#9
WILL THE ALMIGHTY
With the first few paragraphs, I can still figure out how to do it, which is great.

Thanks a lot.
02-25-2008, 12:47 AM#10
Pyrogasm
Interweb backupz lol?
02-25-2008, 04:14 AM#11
Tide-Arc Ephemera
Uh... I should be able to back up this tutorial, but unfortunately I made my monthly clean up a few weeks ago... I should be able to recover it by next week, however I will start now.
02-25-2008, 04:45 AM#12
Pyrogasm
Check Archives at Alexa.com?
02-25-2008, 04:52 AM#13
Tide-Arc Ephemera
Too late, I already "repaired" it. In fact I sorta... started as soon as I posted as mentioned...

EDIT!
By the way, Pitzer, don't worry about it. Mistakes happen every now and then, just this one wasn't too great yet I was still able to fix it!
02-27-2008, 11:20 PM#14
PitzerMike
Great, well done Tide-Arc!
I approve.
02-28-2008, 03:56 AM#15
Tide-Arc Ephemera
Horray! I made my first contribution to WC3C!

Anyway, thanks a bunch!