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

[General] Help with giving the hero multiple items at a time

Status
Not open for further replies.
Level 2
Joined
Aug 27, 2019
Messages
11
Hello guys, I really wish to fix this trigger as it works until the point where it drops all "RearmBanItem" items, the ability then resets its cooldown but i have to pick all of the (RearmBanItem) items manually. I've been trying for days to solve this issue. Problem is, no item is given back to the Hero, sometimes when i finally get it to work, it only works for the "Undead Souls" items (which is a item to summon 3 skeletons), apparently it drops and gives back the items but only undead souls goes cooldown, i don't know what i'm doing wrong, also please don't be rude if i simply just messed up the whole trigger, i'm decent but not good with it so if you're going to help me then please be specific, specially with variables.

Hero has a chance with a passive ability to reset cooldown when hero finishes casting an ability.
The item Variable is all/any of the items it has to drop if he has them, so that these won't get refreshed (otherwise too op).
This trigger is runned by another trigger that checks if the unit has buff and gives the random integer chance to the hero to reset cooldowns (running this trigger).
WAKI32R.jpg


Here's the image of the trigger.

Any help is appreciated,

Thanks in advance!

Apparently i managed to get it to work smh making the hero move and give again the items BUT does not always work :/ which makes this "fix" useless
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,013
How To Post Your Trigger

I think the issue is that you used Item - Move Item when you should have used Hero - Drop Item. I made the following trigger and it works perfectly to reset cooldowns of abilities but not of any items. Note that the spell being cast will not have its cooldown reset by this action unless you use "stops casting" as your event (but that has its own associated issues).
  • GUI Test Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set DItem[(Integer A)] = (Item carried by (Triggering unit) in slot (Integer A))
          • Hero - Drop DItem[(Integer A)] from (Triggering unit)
      • Unit - Reset ability cooldowns for (Triggering unit)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Give DItem[(Integer A)] to (Triggering unit)
 
Level 2
Joined
Aug 27, 2019
Messages
11
Thanks for trying to help, However, i tried it and didn't work for what i'm trying to do. I want it to work for certain items carried by the hero, it doesn't just work like that.

I had to drop and give twice to get it to work.
This is the trigger i used, a bit messy but it works, not sure it works 100% of the times though for all the items but still better than nothing. I forced the Refresh Orb drop as it didn't work for the item because of its trigger and it seems to be working now.

  • Rearm
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Tinker
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Cluster Rockets
          • (Ability being cast) Equal to Cluster Rockets (Level 1)
          • (Ability being cast) Equal to Cluster Rockets (Level 2)
          • (Ability being cast) Equal to Cluster Rockets (Level 3)
          • (Ability being cast) Equal to Cluster Rockets (Level 4)
          • (Ability being cast) Equal to Cluster Rockets (Level 5)
          • (Ability being cast) Equal to Drunken Haze
          • (Ability being cast) Equal to Drunken Haze (Level 1)
          • (Ability being cast) Equal to Drunken Haze (Level 2)
          • (Ability being cast) Equal to Drunken Haze (Level 3)
          • (Ability being cast) Equal to Drunken Haze (Level 4)
          • (Ability being cast) Equal to Drunken Haze (Level 5)
    • Actions
      • Set Rearm_Triggering = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to (2 + ((Level of Rearm for Rearm_Triggering) x 3))
        • Then - Actions
          • Set RearmBanItem[1] = Undead Souls Level 1
          • Set RearmBanItem[2] = Undead Souls Level 2
          • Set RearmBanItem[3] = Undead Souls Level 3
          • Set RearmBanItem[4] = Refresh Orb
          • Set RearmBanItem[5] = Staff of Silence
          • Set RearmBanItem[6] = Bloom Bulb
          • Set RearmBanItem[7] = Big Bag
          • For each (Integer A) from 1 to 7, 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
                      • (Rearm_Triggering has an item of type RearmBanItem[1]) Equal to True
                      • (Rearm_Triggering has an item of type RearmBanItem[2]) Equal to True
                      • (Rearm_Triggering has an item of type RearmBanItem[3]) Equal to True
                      • (Rearm_Triggering has an item of type RearmBanItem[4]) Equal to True
                      • (Rearm_Triggering has an item of type RearmBanItem[5]) Equal to True
                      • (Rearm_Triggering has an item of type RearmBanItem[6]) Equal to True
                      • (Rearm_Triggering has an item of type RearmBanItem[7]) Equal to True
                • Then - Actions
                  • Set RearmPoint = (Position of Rearm_Triggering)
                  • Set Rearm_Item_Manipulated = (Item carried by Rearm_Triggering of type RearmBanItem[(Integer A)])
                  • Item - Move Rearm_Item_Manipulated to RearmPoint
                  • Hero - Give Rearm_Item_Manipulated to Rearm_Triggering
                  • Item - Move Rearm_Item_Manipulated to RearmPoint
                  • Unit - Reset ability cooldowns for Rearm_Triggering
                  • Hero - Give Rearm_Item_Manipulated to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[1]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[2]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[3]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[4]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[5]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[6]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[7]) to Rearm_Triggering
                  • Hero - Drop (Item carried by Rearm_Triggering of type Refresh Orb) from Rearm_Triggering
                  • Hero - Give (Last dropped item) to Rearm_Triggering
                  • Trigger - Run FloTex Rearm <gen> (checking conditions)
                • Else - Actions
                  • Item - Move Rearm_Item_Manipulated to RearmPoint
                  • Hero - Give Rearm_Item_Manipulated to Rearm_Triggering
                  • Item - Move Rearm_Item_Manipulated to RearmPoint
                  • Unit - Reset ability cooldowns for Rearm_Triggering
                  • Hero - Give Rearm_Item_Manipulated to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[1]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[2]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[3]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[4]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[5]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[6]) to Rearm_Triggering
                  • Hero - Give (Item carried by Rearm_Triggering of type RearmBanItem[7]) to Rearm_Triggering
                  • Hero - Drop (Item carried by Rearm_Triggering of type Refresh Orb) from Rearm_Triggering
                  • Hero - Give (Last dropped item) to Rearm_Triggering
                  • Trigger - Run FloTex Rearm <gen> (checking conditions)
        • Else - Actions
      • Custom script: call RemoveLocation (udg_RearmPoint)
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,013
Why are the different levels of your abilities actually different abilities??? Unless you want something like different projectile art for each level there's no reason to do things that way.
I want it to work for certain items carried by the hero, it doesn't just work like that.
I am fully aware of this. I just did it by removing every item to show you that the simple trigger works exactly like you want it to. You can choose to only remove those banned items so every other item does have their cooldown refreshed.

  • Events
    • Time - Elapsed game time is 0.50 seconds
  • Conditions
  • Actions
    • Set RearmBanCount = (ReamBanCount + 1)
    • Set ReamBanItem[RearmBanCount] = Undead Souls Level 1
    • Set RearmBanCount = (ReamBanCount + 1)
    • Set ReamBanItem[RearmBanCount] = Undead Souls Level 2
    • Set RearmBanCount = (ReamBanCount + 1)
    • Set ReamBanItem[RearmBanCount] = Undead Souls Level 3
    • Set RearmBanCount = (ReamBanCount + 1)
    • Set ReamBanItem[RearmBanCount] = Refresh Orb
    • Set RearmBanCount = (ReamBanCount + 1)
    • Set ReamBanItem[RearmBanCount] = Staff of Silence
    • Set RearmBanCount = (ReamBanCount + 1)
    • Set ReamBanItem[RearmBanCount] = Bloom Bulb
    • Set RearmBanCount = (ReamBanCount + 1)
    • Set ReamBanItem[RearmBanCount] = Big Bag
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
  • Actions
    • Set RearmTriggering = (Triggering Unit)
    • For each (Integer A) from 1 to 6, do (Actions)
      • Loop - Actions
        • Set TempItem = (Item carried by RearmTriggering in slot (Integer A))
        • For each (integer B) from 1 to RearmBanCount do (Actions)
          • Loop - Actions
            • If (All conditions are true) then do (Then actions) else do (Else Actions)
              • If - Conditions
                • (Item-type of TempItem) equal to RearmBanItem[(Integer B)]
              • Then - Actions
                • Hero - Drop TempItem from RearmTriggering
                • Set DItem[(Integer A)] = TempItem
                • Custom script: exitwhen true //leaves the innermost loop, since there's no use checking to see if it matches any other banned items
              • Else - Actions
    • Unit - Reset ability cooldowns for (Triggering unit)
    • For each (Integer A) from 1 to 6, do (Actions)
      • Loop - Actions
        • Hero - Give DItem[(Integer A)] to RearmTriggering
        • Set DItem[(Integer A)] = No Item //important so it doesn't get the items from a previous rearm
 
Level 2
Joined
Aug 27, 2019
Messages
11
Thank you for the effort Pyrogasm, i've combined your trigger (which is way more clear and specific than mine) and it works except for the fact that he doesn't pick up the items.

  • Rearm
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Tinker
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Cluster Rockets
          • (Ability being cast) Equal to Cluster Rockets (Level 1)
          • (Ability being cast) Equal to Cluster Rockets (Level 2)
          • (Ability being cast) Equal to Cluster Rockets (Level 3)
          • (Ability being cast) Equal to Cluster Rockets (Level 4)
          • (Ability being cast) Equal to Cluster Rockets (Level 5)
          • (Ability being cast) Equal to Drunken Haze
          • (Ability being cast) Equal to Drunken Haze (Level 1)
          • (Ability being cast) Equal to Drunken Haze (Level 2)
          • (Ability being cast) Equal to Drunken Haze (Level 3)
          • (Ability being cast) Equal to Drunken Haze (Level 4)
          • (Ability being cast) Equal to Drunken Haze (Level 5)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to (2 + ((Level of Rearm for Rearm_Triggering) x 3))
        • Then - Actions
          • Set Rearm_Triggering = (Triggering unit)
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set TempItemRearm = (Item carried by Rearm_Triggering in slot (Integer A))
              • For each (Integer B) from 1 to RearmBanCount, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of TempItemRearm) Equal to RearmBanItem[(Integer B)]
                    • Then - Actions
                      • Hero - Drop TempItemRearm from Rearm_Triggering
                      • Set Ditem[(Integer A)] = TempItemRearm
                      • Custom script: exitwhen true
                    • Else - Actions
          • Unit - Reset ability cooldowns for Rearm_Triggering
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Hero - Give Ditem[(Integer A)] to Rearm_Triggering
              • Set Ditem[(Integer A)] = No item
          • Trigger - Run FloTex Rearm <gen> (checking conditions)
        • Else - Actions
Any suggestions? Did i do something wrong?

Thank you.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
Why are the different levels of your abilities actually different abilities??? Unless you want something like different projectile art for each level there's no reason to do things that way.
Still confused about these abilities (and why one of them doesn't have a "Level X" attached to it) and I have a feeling there's a better solution than whatever you've done this for. You can also move the Random Int condition to the main trigger conditions instead of using another If block.

As for why it's not working? Not really sure because that trigger does work for me. I've attached my current testmap where I've been running this and in the GUI Test trigger you will see this trigger like the first one I posted. I added in the wait command so you can see that the items are clearly being dropped and then picked up again without issue. Type any chat message in and the archmage will drop its items, refresh cooldowns, and pick them back up again.

  • GUI Test Copy
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set DItem[(Integer A)] = (Item carried by Archmage 0040 <gen> in slot (Integer A))
          • Hero - Drop DItem[(Integer A)] from Archmage 0040 <gen>
      • Unit - Reset ability cooldowns for Archmage 0040 <gen>
      • Wait 2.00 seconds
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Give DItem[(Integer A)] to Archmage 0040 <gen>
My best guess is that you have some trigger that runs when a unit acquires an item and inside that trigger you have an Integer A loop, which messes up the 'original' Int A loop that gave back the unit its items. You can fix this by creating a new integer variable and using that instead of Integer A (there's a For each integer <variable> do <Actions> command).
 

Attachments

  • Test Fixed.w3x
    49.4 KB · Views: 22
Level 2
Joined
Aug 27, 2019
Messages
11
Hello Pyrogasm, i've had told you that these abilities are the same abilities updated by engineering update thats why i added them all but then the page crashed and forgot to add this line. I'll check this out thank you.
 
Level 2
Joined
Aug 27, 2019
Messages
11
Hey Pyrogasm, this works, i've also had to set the variable for integerB, however, there's one more problem that we didn't have before: if i use the refresh orb item (triggered drop - reset ability - then give dropped item with a unit uses item event) all abilities refresh as they should but then if i get the rearm before using these, these go cooldown even if they've not been used yet... Any guesses of what could be the cause of this? Thank you so much again for the help dude!

This is the trigger:

  • Rearm
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Tinker
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Cluster Rockets
          • (Ability being cast) Equal to Cluster Rockets (Level 1)
          • (Ability being cast) Equal to Cluster Rockets (Level 2)
          • (Ability being cast) Equal to Cluster Rockets (Level 3)
          • (Ability being cast) Equal to Cluster Rockets (Level 4)
          • (Ability being cast) Equal to Cluster Rockets (Level 5)
          • (Ability being cast) Equal to Drunken Haze
          • (Ability being cast) Equal to Drunken Haze (Level 1)
          • (Ability being cast) Equal to Drunken Haze (Level 2)
          • (Ability being cast) Equal to Drunken Haze (Level 3)
          • (Ability being cast) Equal to Drunken Haze (Level 4)
          • (Ability being cast) Equal to Drunken Haze (Level 5)
      • (Random integer number between 1 and 100) Less than or equal to (2 + ((Level of Rearm for Rearm_Triggering) x 3))
    • Actions
      • Set Rearm_Triggering = (Triggering unit)
      • For each (Integer IntegerARearm) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set TempItemRearm = (Item carried by Rearm_Triggering in slot IntegerARearm)
          • For each (Integer IntegerBRearm) from 1 to RearmBanCount, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of TempItemRearm) Equal to RearmBanItem[IntegerBRearm]
                • Then - Actions
                  • Hero - Drop TempItemRearm from Rearm_Triggering
                  • Set Ditem[IntegerARearm] = TempItemRearm
                  • Custom script: exitwhen true
                • Else - Actions
      • Unit - Reset ability cooldowns for Rearm_Triggering
      • For each (Integer IntegerARearm) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Give Ditem[IntegerARearm] to Rearm_Triggering
          • Set Ditem[IntegerARearm] = No item
      • Trigger - Run FloTex Rearm <gen> (checking conditions)
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
if i use the refresh orb item (triggered drop - reset ability - then give dropped item with a unit uses item event) all abilities refresh as they should but then if i get the rearm before using these, these go cooldown even if they've not been used yet...
So basically your refresh orb trigger works the same as this Rearm trigger, right? It drops banned refreshable items, resets cooldowns, then gives items back. That it produces this behavior is very weird to me, not sure what would cause it. If you cast one of the skills between refresh orb and rearm, just that particular skill doesn't go on cooldown? Can you post the refresh orb trigger?
 
Level 2
Joined
Aug 27, 2019
Messages
11
Nope, the refresh orb doesn't drop any banned items, it just drops himself (for let the item go cooldown) and refreshes everything and gives back "refresh orb" so it's really a simple trigger:

  • Refresh Orb
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Refresh Orb
    • Actions
      • Hero - Drop (Item being manipulated) from (Hero manipulating item)
      • Unit - Reset ability cooldowns for (Hero manipulating item)
      • Hero - Give (Last dropped item) to (Hero manipulating item)
What is weird is that my old "drop/take banned items rearm" trigger worked with "refresh orb" trigger before. This problem is new.
I don't know what is the problem now... Thanks for the help man.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
Unlikely to fix the problem but I'm just curious what happens if you try this:
  • Refresh Orb
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Refresh Orb
    • Actions
      • Set RefItem = (Item being manipulated)
      • Wait 0.50 seconds
      • Hero - Drop RefItem from (Triggering unit)
      • Wait 0.50 seconds
      • Unit - Reset ability cooldowns for (Triggering unit)
      • Wait 0.50 seconds
      • Hero - Give RefItem to (Triggering unit)
 
Level 2
Joined
Aug 27, 2019
Messages
11
Just tested it and won't work, maybe only fix could be to change the refresh orb item trigger.
Maybe by removing all items and giving new ones back or something like that, dunno. Or maybe edit a bit the Rearm trigger because the old messy trigger that i did was completely bugged but when it worked it also worked with the refresh orb... maybe combining the two? This is annoying :/
 
Last edited:
Status
Not open for further replies.
Top