| 08-23-2004, 04:20 AM | #1 |
This trigger is the perfect way to combine 3 items of any type (including same type!). Code:
Temp Item System
Events
Unit - A unit Acquires an item
Conditions
Actions
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Bracer of Agility
Then - Actions
For each (Integer B) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot (Integer B))) Equal to Bracer of Intelligence
(Integer B) Not equal to (Integer A)
Then - Actions
For each (Integer Integer_C) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_C)) Equal to Bracer of Strength
Integer_C Not equal to (Integer A)
Integer_C Not equal to (Integer B)
Then - Actions
Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
Item - Remove (Item carried by (Triggering unit) in slot (Integer B))
Item - Remove (Item carried by (Triggering unit) in slot Integer_C)
Hero - Create Sword Engraved with Pure Agility and give it to (Triggering unit)
Else - Actions
Else - Actions
Else - ActionsAnitaarf basically gave me this trigger and I want to share it with anyone who wants to add ITEM CRAFTING, ITEM FORGING, ITEM COMBINING and any thing else for combining combinations of items. Sticky this if you like. |
| 08-23-2004, 05:17 PM | #2 |
Personally it looks a little cumbersome for just 1 item combination, although it might be a good reference. Additionally I think this should go in the trigger repository as it is not a trigger question. But good work on the trigger. |
| 08-23-2004, 06:43 PM | #3 |
What about making two arrays of items. The first would contain items to be crafting and the second would contain items needed to craft it. So if you want the max amount of items needed to crafting something to be 3 it would work like this: CraftItems[0] would correspond to NeededItems[0-2]. then CraftItems[1] would correspond to NeededItems[3-5]. |
| 08-24-2004, 10:19 AM | #4 |
Why are you trying to change this trigger? It's perfect. It works. That's what matters. The only cumbersum part is entering in the 3 items that you want to create the new item. However, that is fairly easy in itself. Plz, don't speculate, use the trigger if you need it, if you already have a WORKING better version of this trigger please, post it, but no more critiquing. Oh, try to do this on your own, I'm sure it will be a lot more cumbersum :P Trust me, if you need this trigger for your map, you'll be happy I posted this :D |
| 08-24-2004, 05:55 PM | #5 |
Code:
Temp Item System
Events
Unit - A unit Acquires an item
Conditions
Actions
[b]For each (Integer D) from 0 to 999 (however many combos you have), do (Actions)[/b]
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
[b](Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to CraftingItems[Integer D*3][/b]
Then - Actions
For each (Integer B) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
[b](Item-type of (Item carried by (Triggering unit) in slot (Integer B))) Equal to CraftingItems[Integer D*3+1][/b]
(Integer B) Not equal to (Integer A)
Then - Actions
For each (Integer Integer_C) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
[b](Item-type of (Item carried by (Triggering unit) in slot Integer_C)) Equal to CraftingItems[Integer D*3+2][/b]
Integer_C Not equal to (Integer A)
Integer_C Not equal to (Integer B)
Then - Actions
Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
Item - Remove (Item carried by (Triggering unit) in slot (Integer B))
Item - Remove (Item carried by (Triggering unit) in slot Integer_C)
[b]Hero - Create CraftedItems[Integer D] and give it to (Triggering unit)[/b]
Else - Actions
Else - Actions
Else - ActionsNow if I'm not mistaken this will loop through your entire array automatically and it puts all the combinations into one trigger (two if you count setting up the arrays). |
| 09-07-2004, 12:56 PM | #6 |
Guest | I like Anitaarf's trigger a lot more than yours, Ceo. It's much more clean, much more simple, much more logical. Salutions® |
| 09-07-2004, 06:12 PM | #7 |
I think CEO had a good point, and I like the direction he's gone with his trigger, though it is a little confusing, especially if you aren't used to looking at trigger code. It's a little bit more involved to get it working, because you aren't just changing the names of the items. I wouldn't recommend it for someone that's just starting with triggers, while I would recommend the original trigger. If you have the attitude of volatile ("It works. That's what matters.") then the original trigger will work perfectly for you. His is a little bit less efficient in the sense that it will take longer to run, but much more efficient in the sense that it will not take up nearly as much space in the trigger editor. Since you don't have to individually code for every combination, you'd want to use a system like this if you had a LOT of combinations. I'm not trying to make Antiaarf's trigger sound any worse, but you have to admit it would be cumbersome with a large number of item combinations, since every combination has to be specifically coded for and checked. It is simple and easy to understand though :). I work as a programmer, and that probably heavily influences my decision to to use a variation on CEO's method if I were going to use one in my map. |
| 09-07-2004, 08:44 PM | #8 |
I agree with aaero. A smaller, easier, less complex trigger is good, but if you have to make a million of them, then the larger, more complex one will be better. Better one trigger then twenty. I'm moving this to the repository, since that is where it really belongs. Good job to both anitaarf and CEO for these triggers. But please, use the CODE formatting. It makes it so much easier to read... |
| 09-08-2004, 12:08 AM | #9 |
um.. Code:
events Unit acquires item conditions and Hero manipulating item has item of type [item a] Hero manipulating item has item of type [item d] Hero manipulating item has item of type [item c] actions remove items [a][b][c]//really 3 triggers add [crafted item] |
| 09-08-2004, 12:49 AM | #10 |
twistar i dont get what you are trying to say, your trigger isnt very helpful because what is the "and" doing under conditions? is the and suppose to be a condition or something please explain.. |
| 09-08-2004, 01:53 AM | #11 |
Sorry if I seem a bit newb, but would somebody mind explaining exactly what the variables in this trigger mean? And how would I set up the arrays? |
| 09-08-2004, 02:36 AM | #12 |
I tried to make it as much as the actual trigger cause i didnt have WE with me. it just checks to see if they have all of the items for crafting something and then it gets crafted. the Hero has item of type is the exact same as looping through each slot and checking if its the right item. ceos system is good tho if you have lots of items purely cause it takes 2 triggers, one to set the vars and one to make the item. but mine is so simple and it works.. |
| 09-09-2004, 02:44 AM | #13 | |
Quote:
Listen up every one. This trigger works perfect (i just used it) so if you want an item recipie trigger i strongly suggest you use this. but i would like 2 no how i can make a 2 and 4 item recipie. p.s. very good job on this trigger ![]() |
| 09-09-2004, 12:58 PM | #14 |
Code:
events Unit acquires item conditions and Hero manipulating item has item of type [item a] Hero manipulating item has item of type [item b] Hero manipulating item has item of type [item c] Hero manipulating item has item of type [item d] actions remove items [a][b][c][d]//really 3 triggers add [crafted item] |
| 09-09-2004, 03:12 PM | #15 | |
Quote:
Yeah, that would work, unless the recipie requires multiple items of same type, in that case, this method cannot work. The original method can be easily modified for 2 or 4 item combinations; basicaly, what the trigger does is, it loops through all the items a hero has, looking for the first combo item; if it finds it, it then starts looking for the next one; in case there are two same items required, the second loop also checks that the item it finds isn't the same item that it found the first time it looked for the first item; for two items, you can stop here; for four items, you must repeat the loops two times more. Note that each loop must use it's own integer, because you use these integers to make sure no item gets selected twice, and you also use them at the end to remove the appropriate items: that's why, with 4 items, you would need an additional integer variable. |
