HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Nested Item Combinations (spell craft like)

08-14-2004, 07:04 AM#1
volatile
I'm curious if anyone already has a system in place that I could use to create nested item combos. For instance, when a person picks up 3 items of the same type the 3 items are instantly removed from the hero and a new item is put in it's place. I want to do this with many many combinations. I already attempted to do it using a custom value for each item given but I gave up on it because it didn't seem to be working. If someone knows the answer to this let me know. I think it might require some JASS working to get it right. HELP :) Thx.
08-14-2004, 07:37 AM#2
Anitarf
Doing item combinations is just a matter of removing original items and adding the new one to the hero, all this can be done in GUI. Do a little search, there have been many item-merging threads around, some quite recently. Search for words like "item merging", or "set items"...
08-14-2004, 04:41 PM#3
wwsage
Actually Im doing item "recipes" in my map using GUI, so it's entirely possible.

All you have to do is make enough if/then/elses so that when you pick up one item, and you own the others, the trigger removes the 3 items and adds the 1.

Right now I haven't actually made the trigger, just the items ;o
08-15-2004, 04:39 AM#4
volatile
What's difficult about the item "recipes" is that when you pick up an item how exactly do you set a function that "detects" what items you have and checks them against the recipes? If I have many recipes each involving perhaps more than 1 of the same item how do I know what items I have? If someone has this already working please let me know.
08-15-2004, 06:35 AM#5
volatile
My Trigger can get in real time the 6 slots and can get the items in those slots. I'm having a hard time identifying different combinations of items/custom value. Basically, if I try to use numbers they're so ambiguous that there's always a way to get the same number from a different combination of numbers. I need a unique system for getting each different type of item in the slots. Any help would be greatly appreciated.


Actions
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
Set Item_Custom_GET[(Integer A)] = (Custom value of (Item carried by Item_Hero in slot (Integer A)))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Item_Custom_GET[(Integer A)] Equal to 1
Then - Actions
Set Player_Count_Items[(Player number of Item_Player)] = (Player_Count_Items[(Player number of Item_Player)] + 1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Item_Custom_GET[(Integer A)] Equal to 2
Then - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Player_Count_Items[(Player number of Item_Player)] Equal to 3
Then - Actions
Item - Remove (Item carried by Item_Hero of type Bracer of Agility)
Item - Remove (Item carried by Item_Hero of type Bracer of Agility)
Item - Remove (Item carried by Item_Hero of type Bracer of Agility)
Hero - Create Bracer of Pure AAA and give it to Item_Hero
Else - Actions
Set Player_Count_Items[(Player number of Item_Player)] = 0
08-15-2004, 11:15 PM#6
volatile
*bump, come on people, I really need help with this. I know you might think it's simple, but maybe you're misunderstanding me.
08-16-2004, 01:11 AM#7
volatile
ok, let me re-explain myself. I am having 3 items in my recipes. These recipes work if I have 3 different items in my inventory. The trouble comes when you're trying to detect 3 items, 2 OR 3 of which are the same item, for example...

Untitled Trigger 001 Copy 3
Events
Unit - A unit Acquires an item
Conditions
(Item-type of (Item being manipulated)) Equal to Bracer of Agility
Actions
Set Item_Type[1] = (Item being manipulated)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has Item_Type[1]) Equal to True <---RIGHT HERE
((Triggering unit) has Item_Type[1]) Equal to True <---RIGHT HERE
((Triggering unit) has Item_Type[3]) Equal to True
Then - Actions
Item - Remove (Item carried by (Triggering unit) of type Bracer of Agility)
Item - Remove (Item carried by (Triggering unit) of type Bracer of Agility)
Item - Remove (Item carried by (Triggering unit) of type Bracer of Strength)
Hero - Create Bracer of SAA and give it to (Triggering unit)
Else - Actions
Do nothing

The issue comes when I say "if unit has item type1 equal to true" I need a system that can give independent values to items of the SAME TYPE. THAT'S my issue.
08-16-2004, 01:57 AM#8
Bluemage427
Well there's one way that'd work for sure, but it's kinda complicated. Just make a variable for each item, and when you pick up one of those add one to that variable. Then have each combination trigger check the variables instead of the possession of the items. You just have to make sure you subtract one from the variable when you drop the item so you don't built up points in your variables. I'll let ya know if I think of anything better.
08-16-2004, 07:43 AM#9
Anitarf
Well, if you want this to work with multiple same items, you'll have to check the item slots one by one:
Code:
For each integer A from 1 to 6 do actions
  loop - actions:
    If - then - Else multiple functions
      If - condtions:
        item-type of item in slot (integer A) equal to requireditem[1]
      Then - actions:
        For each integer B from 1 to 6 do actions
          loop - actions:
            If - then - Else multiple functions
              If - condtions:
                item-type of item in slot (integer B) equal to requireditem[2]
              Then - actions:
                For each variableC from 1 to 6 do actions
                  loop - actions:
                    If - then - Else multiple functions
                      If - condtions:
                        item-type of item in slot (variableC) equal to requireditem[3]
                      Then - actions:
                        remove item in slot (integer A)
                        remove item in slot (integer B)
                        remove item in slot (variableC)
                        add merged item to hero
                      Else - actions:
              Else - actions:
      Else - actions:
that code works with multiple same items in the recipie.
08-17-2004, 06:40 AM#10
volatile
anitarf VERY VERY CLOSE. It almost works. It doesn't work for 3 of the same item type. Also if I get for instance "agility agility strength" it gives me the next item but doesn't take away 1 agility. So it's very very close. If you can get this working I would be GREATLY APPRECIATIVE. Very nice work though. I was very excited to see someone actually replying with exactly what I wanted :D
08-17-2004, 02:46 PM#11
Anitarf
Yeah, I see where I went wrong, I forgot something. Right now, it doesn't work properly at all, you just had some luck for it to work almost right. :)

In the if-then-else functions, under conditions, you must also check that the items aren't the same as the ones found before. So, in the if-then-else under loop B, yo need the condition:
Code:
              and - multiple conditions:
                item-type of item in slot (integer B) equal to requireditem[2]
                (integer B) not equal to (integer A)

Code:
              and - multiple conditions:
                item-type of item in slot (variableC) equal to requireditem[3]
                (variableC) not equal to (integer A)
                (variableC) not equal to (integer B)
08-17-2004, 07:03 PM#12
volatile
OK HERE'S THE TRIGGER, I used antiarf's first situation to build a system that works. You will have to have a trigger for each combination (in every order) and a hero variable that is set in "trigger A". All these triggers are passive, and ALL ARE RUN at the same time from "trigger A" on event "unit aquires item"

AAA
Events
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 Item_Hero[0] in slot (Integer A))) Equal to Bracer of Agility
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer A) Equal to 1
Then - Actions
For each (Integer B) from ((Integer A) + 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 Item_Hero[0] in slot (Integer B))) Equal to Bracer of Agility
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer B) Equal to 2
Then - Actions
For each (Integer Integer_C) from ((Integer B) + 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 Item_Hero[0] in slot Integer_C)) Equal to Bracer of Agility
Then - Actions
Item - Remove (Item carried by Item_Hero[0] in slot (Integer A))
Item - Remove (Item carried by Item_Hero[0] in slot (Integer B))
Item - Remove (Item carried by Item_Hero[0] in slot Integer_C)
Hero - Create Bracer of AAA and give it to Item_Hero[0]
Special Effect - Create a special effect attached to the origin of Item_Hero[0] using Objects**Spawnmodels**Other**ToonBoom**ToonBoom.mdl
Else - Actions
Do nothing
Else - Actions
For each (Integer Integer_C) from ((Integer B) + 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 Item_Hero[0] in slot Integer_C)) Equal to Bracer of Agility
Then - Actions
Item - Remove (Item carried by Item_Hero[0] in slot (Integer A))
Item - Remove (Item carried by Item_Hero[0] in slot (Integer B))
Item - Remove (Item carried by Item_Hero[0] in slot Integer_C)
Hero - Create Bracer of AAA and give it to Item_Hero[0]
Special Effect - Create a special effect attached to the origin of Item_Hero[0] using Objects**Spawnmodels**Other**ToonBoom**ToonBoom.mdl
Else - Actions
Do nothing
For each (Integer Integer_C) from ((Integer B) + 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 Item_Hero[0] in slot Integer_C)) Equal to Bracer of Agility
Then - Actions
Item - Remove (Item carried by Item_Hero[0] in slot (Integer A))
Item - Remove (Item carried by Item_Hero[0] in slot (Integer B))
Item - Remove (Item carried by Item_Hero[0] in slot Integer_C)
Hero - Create Bracer of AAA and give it to Item_Hero[0]
Special Effect - Create a special effect attached to the origin of Item_Hero[0] using Objects**Spawnmodels**Other**ToonBoom**ToonBoom.mdl
Else - Actions
Do nothing
Else - Actions
Do nothing
Else - Actions
For each (Integer B) from ((Integer A) + 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 Item_Hero[0] in slot (Integer B))) Equal to Bracer of Agility
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer B) Equal to 3
Then - Actions
For each (Integer Integer_C) from ((Integer B) + 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 Item_Hero[0] in slot Integer_C)) Equal to Bracer of Agility
Then - Actions
Item - Remove (Item carried by Item_Hero[0] in slot (Integer A))
Item - Remove (Item carried by Item_Hero[0] in slot (Integer B))
Item - Remove (Item carried by Item_Hero[0] in slot Integer_C)
Hero - Create Bracer of AAA and give it to Item_Hero[0]
Special Effect - Create a special effect attached to the origin of Item_Hero[0] using Objects**Spawnmodels**Other**ToonBoom**ToonBoom.mdl
Else - Actions
Do nothing
Else - Actions
For each (Integer Integer_C) from ((Integer B) + 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 Item_Hero[0] in slot Integer_C)) Equal to Bracer of Agility
Then - Actions
Item - Remove (Item carried by Item_Hero[0] in slot (Integer A))
Item - Remove (Item carried by Item_Hero[0] in slot (Integer B))
Item - Remove (Item carried by Item_Hero[0] in slot Integer_C)
Hero - Create Bracer of AAA and give it to Item_Hero[0]
Special Effect - Create a special effect attached to the origin of Item_Hero[0] using Objects**Spawnmodels**Other**ToonBoom**ToonBoom.mdl
Else - Actions
Do nothing
Else - Actions
Do nothing
Else - Actions
Do nothing


If someone can give me an easier way I would appreciate it, this is very complicated and a little messy but it works every time :D That's the important thing :) This is for 1 combo, you will need this trigger for each combo. Also, this is only for 3 items. If you want to combine 4 or more, you have to add another "integer d" etc... The first item picked up is "integer a" the 2nd item picked up is "integer b" and the 3rd is "integer c" when you see the action "item type of item carried by hero in INTEGER A/B/C" That's how you know where to put your 1/2/3rd items.
08-23-2004, 03:46 AM#13
volatile
Ok, this thread hasn't had any more replies.

Can someone please give me a "shortened" version of the trigger that I gave above? The system I have above checks the slots in a specific order, slot 1, slot 2, slot 3, slot 4, slot 5 and slot 6. The problem with this is it not only checks combinations but it checks the ORDER of the combination. So for example it will catch

1. boots of speed
3. gloves of haste
5. ring of regeneration

but it wont catch

1. gloves of haste
3. boots of speed
5. ring of regeneration

Ultimately I would like a trigger that catches the items in ANY order in the hero's inventory.
08-23-2004, 07:14 AM#14
Anitarf
O M G ! That trigger is a pain to see. Can't you just use the trigger I posted above, with the correction I posted later? You wouldn't even need multiple triggers for the whole thing, just store the required items in an array, 1-3 for the firt item combo, 4-6 for the second, 7-9 for the third... and then just loop through them with an additional loop.

Edit: oh, I see you used my system in the end anyway.
08-23-2004, 08:20 AM#15
sgtteflon
That trigger is ridiculous. All you need is the following:

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 PlayerHero[(Player number of (Triggering player))] in slot (Integer A))) Equal to Oak Branch
Then - 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 PlayerHero[(Player number of (Triggering player))] in slot (Integer A))) Equal to Iron Ingot
Then - 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 PlayerHero[(Player number of (Triggering player))] in slot (Integer A))) Equal to Firing Mechanism
Then - Actions
Item - Remove (Item carried by PlayerHero[(Player number of (Triggering player))] of type Firing Mechanism)
Item - Remove (Item carried by PlayerHero[(Player number of (Triggering player))] of type Iron Ingot)
Item - Remove (Item carried by PlayerHero[(Player number of (Triggering player))] of type Oak Branch)
Item - Create Musket at (Position of PlayerHero[(Player number of (Triggering player))])
Hero - Give (Last created item) to PlayerHero[(Player number of (Triggering player))]
Game - Display to (Player group((Triggering player))) the text: |cffffcc00You have ...
Else - Actions
Game - Display to (Player group((Triggering player))) the text: |cffffcc00A Musket ...
Else - Actions
Game - Display to (Player group((Triggering player))) the text: |cffffcc00A Musket ...
Else - Actions
Game - Display to (Player group((Triggering player))) the text: |cffffcc00A Musket ...


It likely looks worse than it is, but itsjust copy/pase. You copy pase the if/then loop, so it goes if then, then if then, then if then, 3 times in this case (for 3 required items). If he doesnt have the proper items, it cuts out of the loop, and displays a message saying what the items are. Thats because I use dialogues and button click events. For aquires item events, they arent necesarry.

EDIT: The above was ripped directly from a map Im working on.