• 🏆 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!

[Solved] Problem with 'Acquires an Item'

Status
Not open for further replies.
Level 8
Joined
Jun 26, 2019
Messages
318
Hello all. I am working on a Battleships map. I have problem with 'Acquires an Item' event. I am trying to have this to be worked in all 6 slots on inventory, but it's only works with one slot. When I changed a ship with 2 items in the inventory, it only took one item out to refund, while there's one more item to take out too. Supposed to take all the items out that match the conditions in the inventory at once when changing the ship. How do you make loop for all 6 slots on this? I don't want drop item automatically.

Example. Let's say you have 2 Rocket Cannon(s) in your inventory. But, when you changed to the ship that doesn't match the conditions for Rocket Cannon, it only took the first and one Rocket Cannon out and refunded, but still not taking the second Rocket Cannon, it still stay in the inventory, and still need to take it out. You know what I am saying?

  • Artillery Weapons
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Rocket Cannon
          • (Item-type of (Item being manipulated)) Equal to Bombard Cannon
          • (Item-type of (Item being manipulated)) Equal to Stark's Jericho Missile
      • PlayerCheckMissileBay[(Player number of (Owner of (Triggering unit)))] Equal to False
    • Actions
      • Set VariableSet PlayerCheckMissileBay[(Player number of (Owner of (Triggering unit)))] = True
      • Wait 0.10 seconds
      • Item - Move (Item being manipulated) to (Center of Temp Item Region <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to |cffffff00Artillery|r
        • Then - Actions
          • Hero - Give (Item being manipulated) to (Triggering unit)
        • Else - Actions
          • Player - Add (Integer((Current life of (Item being manipulated)))) to (Owner of (Triggering unit)).Current gold
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your ship does not ...
          • Item - Remove (Item being manipulated)
      • Set VariableSet PlayerCheckMissileBay[(Player number of (Owner of (Triggering unit)))] = False
--------------------------------------------------------------------


I tried this and it doesn't work properly, still having same problem...

  • Artillery Weapons
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Rocket Cannon
          • (Item-type of (Item being manipulated)) Equal to Bombard Cannon
          • (Item-type of (Item being manipulated)) Equal to Stark's Jericho Missile
      • PlayerCheckMissileBay[(Player number of (Owner of (Triggering unit)))] Equal to False
    • Actions
      • Set VariableSet PlayerCheckMissileBay[(Player number of (Owner of (Triggering unit)))] = True
      • Wait 0.10 seconds
      • Item - Move (Item being manipulated) to (Center of Temp Item Region <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to |cffffff00Artillery|r
        • Then - Actions
          • Hero - Give (Item being manipulated) to (Triggering unit)
        • Else - Actions
          • For each (Integer tempInt1) 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 tempInt1)) Equal to Rocket Cannon
                  • (Item-type of (Item carried by (Triggering unit) in slot tempInt1)) Equal to Bombard Cannon
                  • (Item-type of (Item carried by (Triggering unit) in slot tempInt1)) Equal to Stark's Jericho Missile
                • Then - Actions
                  • Player - Add (Integer((Current life of (Item carried by (Triggering unit) in slot tempInt1)))) to (Owner of (Triggering unit)).Current gold
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your ship does not ...
                  • Item - Remove (Item carried by (Triggering unit) in slot tempInt1)
                • Else - Actions
      • Set VariableSet PlayerCheckMissileBay[(Player number of (Owner of (Triggering unit)))] = False
--------------------------------------------------------------------


I also tried other way is when you (triggering unit) changed to the ship that doesn't fit some items in the inventory would be automatically dropped at the triggering unit. But, looks like I didn't do it right in this trigger for that...

  • Artillery Weapons 1
    • 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 Rocket Cannon
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Bombard Cannon
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Stark's Jericho Missile
              • (Unit-type of (Triggering unit)) Not equal to |cffffff00Artillery|r
            • Then - Actions
              • Hero - Drop (Item carried by (Triggering unit) in slot (Integer A)) from (Triggering unit).
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your ship does not ...
            • Else - Actions
 
Last edited:
Level 12
Joined
Mar 21, 2008
Messages
358
i don't know if this will fix your issue, but shouldn't there be an "or" surrounding the three item conditions?? like this:

  • Artillery Weapons 1
    • 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
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Rocket Cannon
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Bombard Cannon
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Stark's Jericho Missile
              • (Unit-type of (Triggering unit)) Not equal to |cffffff00Artillery|r
            • Then - Actions
              • Hero - Drop (Item carried by (Triggering unit) in slot (Integer A)) from (Triggering unit).
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your ship does not ...
            • Else - Actions
 
Level 8
Joined
Jun 26, 2019
Messages
318
Finally! I figured it out! All solved! It is this...

  • Artillery Weapons1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Wait 0.50 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Rocket Cannon
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Bombard Cannon
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Stark's Jericho Missile
              • (Unit-type of (Triggering unit)) Not equal to |cffffff00Artillery|r
            • Then - Actions
              • Hero - Drop (Item carried by (Triggering unit) in slot (Integer A)) from (Triggering unit).
              • Wait 0.01 seconds
              • Hero - Drop (Item carried by (Triggering unit) in slot (Integer A)) from (Triggering unit).
              • Wait 0.01 seconds
              • Hero - Drop (Item carried by (Triggering unit) in slot (Integer A)) from (Triggering unit).
              • Wait 0.01 seconds
              • Hero - Drop (Item carried by (Triggering unit) in slot (Integer A)) from (Triggering unit).
              • Wait 0.01 seconds
              • Hero - Drop (Item carried by (Triggering unit) in slot (Integer A)) from (Triggering unit).
              • Wait 0.01 seconds
              • Hero - Drop (Item carried by (Triggering unit) in slot (Integer A)) from (Triggering unit).
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your ship does not ...
            • Else - Actions
 
Status
Not open for further replies.
Top