• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Item Trigger

Status
Not open for further replies.
Level 5
Joined
Jul 15, 2012
Messages
101
  • Untitled Trigger 005
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +1
    • Actions
      • For each (Integer A) from 1 to 6, do (If ((Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Claws of Attack +1) then do (Set ItemAmount = (ItemAmount + 1)) else do (Do nothing))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemAmount Equal to 2
        • Then - Actions
          • Hero - Drop (Item carried by (Hero manipulating item) of type Claws of Attack +1) from (Hero manipulating item)
          • Item - Remove (Last dropped item)
          • Hero - Drop (Item carried by (Hero manipulating item) of type Claws of Attack +1) from (Hero manipulating item)
          • Item - Remove (Last dropped item)
          • Hero - Create Claws of Attack +2 and give it to (Hero manipulating item)
        • Else - Actions
          • Set ItemAmount = 0
Is something wrong?
  • For each (Integer A) from 1 to 6, do (If ((Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Claws of Attack +1) then do (Set ItemAmount = (ItemAmount + 1)) else do (Do nothing))
When i enable it - "The trigger cannot be enabled because not all parameters have values."
 
Last edited:
Level 5
Joined
Jul 15, 2012
Messages
101
There is only 1 variable - ItemAmount = Integer

If i do this:

  • Untitled Trigger 007
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Claws of Attack +1
        • Then - Actions
          • Set ItemAmount = (ItemAmount + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemAmount Equal to 2
        • Then - Actions
          • Hero - Drop (Item carried by (Hero manipulating item) of type Claws of Attack +1) from (Hero manipulating item)
          • Item - Remove (Last dropped item)
          • Hero - Drop (Item carried by (Hero manipulating item) of type Claws of Attack +1) from (Hero manipulating item)
          • Item - Remove (Last dropped item)
          • Hero - Create Claws of Attack +2 and give it to (Hero manipulating item)
        • Else - Actions
          • Set ItemAmount = 0
it does not work.

EDIT*

If i do this:

  • Untitled Trigger 007
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +1
    • 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 (Hero manipulating item) in slot (Integer A))) Equal to Claws of Attack +1
            • Then - Actions
              • Set ItemAmount = (ItemAmount + 1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ItemAmount Equal to 2
                • Then - Actions
                  • Hero - Drop (Item carried by (Hero manipulating item) of type Claws of Attack +1) from (Hero manipulating item)
                  • Item - Remove (Last dropped item)
                  • Hero - Drop (Item carried by (Hero manipulating item) of type Claws of Attack +1) from (Hero manipulating item)
                  • Item - Remove (Last dropped item)
                  • Hero - Create Claws of Attack +2 and give it to (Hero manipulating item)
                • Else - Actions
                  • Set ItemAmount = 0
it does not work.
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
The only thing that comes to mind right now is that you need to set 'ItemAmount' to 0 at the end of the 'Then' branch as well, or just move that one to after the 'If/Then/Else'.
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
I made a test of myself with some changes in your triggers and it worked for me actually. Jut remove the last If/Then/Else from the other Else you contained it in. This is the trigger I used anyway (do not know if this is leakless but I am sure it's not so watchout for leaks and problems):

  • Untitled Trigger 001
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +12
    • 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 (Hero manipulating item) in slot (Integer A))) Equal to Claws of Attack +12
            • Then - Actions
              • Set ItemAmount = (ItemAmount + 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemAmount Equal to 2
        • Then - Actions
          • Hero - Drop (Item carried by (Hero manipulating item) of type Claws of Attack +12) from (Hero manipulating item)
          • Item - Remove (Last dropped item)
          • Hero - Drop (Item carried by (Hero manipulating item) of type Claws of Attack +12) from (Hero manipulating item)
          • Item - Remove (Last dropped item)
          • Hero - Create Claws of Attack +15 and give it to (Hero manipulating item)
        • Else - Actions
          • Set ItemAmount = 0
Triggers in map also for you to CnP. I guess you aim to make some sort of combining items, right? Lastly for a tip, dont use Do Nothing for it consumes space for no actual reason.
 

Attachments

  • Test - Item.w3x
    16.8 KB · Views: 36
Level 5
Joined
Jul 15, 2012
Messages
101
yip said:
The only thing that comes to mind right now is that you need to set 'ItemAmount' to 0 at the end of the 'Then' branch as well, or just move that one to after the 'If/Then/Else'.


Nope, it does not work. Btw,
  • Hero - Create Claws of Attack +2 and give it to (Hero manipulating item)
should be in Else actions not in Then (my mistake).
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
Nope, it does not work. Btw,
  • Hero - Create Claws of Attack +2 and give it to (Hero manipulating item)
should be in Else actions not in Then (my mistake).

What? I thought you were trying to combine the two claws (as Hell_Master thought too, and assembled a working trigger).

If it is as you say, then you want the hero to have both it's claws +1 destroyed if he picks up two, but to be given an extra +2 claws if he picks up only 1 (which would make him have one +2 and one +1)?

What exactly do you want the trigger to do?

EDIT: Well, looks like it has been solved, nevermind me.
 
Level 5
Joined
Jul 15, 2012
Messages
101
Btw,
  • Hero - Create Claws of Attack +2 and give it to (Hero manipulating item)
should be in Else actions not in Then (my mistake).

Ah, just ignore this part of post, i said a nonsense. (I checked the post where the trigger was and it was in Then actions)
 
Status
Not open for further replies.
Top