• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

Help mui item trigger

Status
Not open for further replies.
Level 6
Joined
Aug 5, 2015
Messages
202
i want a system in my map
example
i have hero
and there are a shop sell legendary item
if i buy that item
that item have ability; every xx second call whatever spell (example: frost nova or storm bolt to within 1000 aoe from my hero)

here is the hardest part
if i playing alone its still fine no prob
but if i play multiplayer my trigger wont work (since only the last hero acquired the item the only one will have the spell trigerred on that item), pro said i need MUI, dynamic indexing to be able that item work individually for each players
anyone can teach me that trigger allowed each player can use that item ability individually?

obviously its use player or unit group array that i cant understand?
 
Level 12
Joined
May 22, 2015
Messages
1,051
You don't need dynamic indexing for this. Just add the unit that gets the item to a unit group. In the trigger that periodically activates the effect, change it to "pick every unit in group and do multiple actions". Then do the exact same thing you did before, but replace the unit variable you had before with "picked unit". It will do it separately for each unit in the group. It will work with any number of units. Remove them from the group if they drop the item.
 
Level 6
Joined
Aug 5, 2015
Messages
202
hmm i didnt quite understand but here is my trigger

  • Sechzig
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff8800Claszureme Clock|r
      • (Unit-type of (Hero manipulating item)) Equal to Faceless King
    • Actions
      • Set FACELESSHERO = (Hero manipulating item)
      • Set FACELESSPOINT = (Position of FACELESSHERO)
      • Set FACELESSGROUP = (Units within 800.00 of FACELESSPOINT matching ((((Matching unit) belongs to an enemy of (Owner of FACELESSHERO)) Equal to True) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is A Hero) Not equal to True) and (((Matching unit) is A st
      • Trigger - Turn on Sechzig auto <gen>
  • Sechzig auto
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set FACELESSPOINT = (Position of FACELESSHERO)
      • Set FACELESSGROUP = (Units within 800.00 of FACELESSPOINT matching ((((Matching unit) belongs to an enemy of (Owner of FACELESSHERO)) Equal to True) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is A Hero) Not equal to True) and (((Matching unit) is A st
      • Special Effect - Create a special effect attached to the overhead of FACELESSHERO using Abilities\Spells\Undead\ReplenishMana\ReplenishManaCasterOverhead.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit Group - Pick every unit in FACELESSGROUP and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy (Sechzig) for (Owner of FACELESSHERO) at FACELESSPOINT facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) has buff Sechzig (Pause)) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in FACELESSGROUP and do (Actions)
            • Loop - Actions
              • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
              • Animation - Change (Picked unit)'s vertex coloring to (15.00%, 15.00%, 15.00%) with 0.00% transparency
        • Else - Actions
          • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
          • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Custom script: call RemoveLocation(udg_FACELESSPOINT)
      • Custom script: call DestroyGroup(udg_FACELESSGROUP)
which part i should change? sorry im really newbie at this
 
Level 12
Joined
May 22, 2015
Messages
1,051
  • Sechzig
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff8800Claszureme Clock|r
      • (Unit-type of (Hero manipulating item)) Equal to Faceless King
    • Actions
      • UnitGroup - Add (Hero manipulating item) to (FACELESSHEROES)
      • Trigger - Turn on Sechzig auto <gen>
  • Sechzig auto
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FACELESSHEROES and do (Actions)
        • Loop - Actions
          • Set FACELESSHERO = (Picked unit)
          • Set FACELESSPOINT = (Position of FACELESSHERO)
          • Set FACELESSGROUP = (Units within 800.00 of FACELESSPOINT matching ((((Matching unit) belongs to an enemy of (Owner of FACELESSHERO)) Equal to True) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is A Hero) Not equal to True) and (((Matching unit) is A st
          • Special Effect - Create a special effect attached to the overhead of FACELESSHERO using Abilities\Spells\Undead\ReplenishMana\ReplenishManaCasterOverhead.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit Group - Pick every unit in FACELESSGROUP and do (Actions)
            • Loop - Actions
              • Unit - Create 1 Dummy (Sechzig) for (Owner of FACELESSHERO) at FACELESSPOINT facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Sechzig (Pause)) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in FACELESSGROUP and do (Actions)
                • Loop - Actions
                  • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
                  • Animation - Change (Picked unit)'s vertex coloring to (15.00%, 15.00%, 15.00%) with 0.00% transparency
            • Else - Actions
              • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
              • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
          • Custom script: call RemoveLocation(udg_FACELESSPOINT)
          • Custom script: call DestroyGroup(udg_FACELESSGROUP)
In the first trigger, I removed a couple lines that I don't think do anything.
I made a new variable called FACELESSHEROES. It must be a unit group.

In the second trigger, you loop over the new unit group. To keep it simple, I set FACELESSHERO to Picked unit. This means the rest does not need to be changed. It will switch FACELESSHERO for each unit in the group that got added.

This would do exactly what it was doing before, except for all the units that are in the group. I did notice, however, that there is an if statement after the inner loops that looks like it was meant to be in the actual loop. It may be buggy, especially since picked unit before was null and now it will be the hero that it is currently on in the loop. Just thought this needed mentioning.
 
Level 6
Joined
Aug 5, 2015
Messages
202
thanks a lot , at least its better than before
well i have system if i buy same item the same item will be instantly dropped but i worried since its entered hero inventory 1st before dropped its occured trigger sechzig auto again

so my off trigger should be:
it is right?
  • Sechzig off
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff8800Claszureme Clock|r
      • (Unit-type of (Hero manipulating item)) Equal to Faceless King
    • Actions
      • Trigger - Turn off Sechzig auto <gen>
btw i will rep you +
 
Level 12
Joined
May 22, 2015
Messages
1,051
thanks a lot , at least its better than before
well i have system if i buy same item the same item will be instantly dropped but i worried since its entered hero inventory 1st before dropped its occured trigger sechzig auto again

so my off trigger should be:
it is right?
  • Sechzig off
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff8800Claszureme Clock|r
      • (Unit-type of (Hero manipulating item)) Equal to Faceless King
    • Actions
      • Trigger - Turn off Sechzig auto <gen>
btw i will rep you +

Not quite. Turning off the trigger would turn it off for everyone. All you have to do is remove the unit from the group. Like this:
  • Sechzig off
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff8800Claszureme Clock|r
      • (Unit-type of (Hero manipulating item)) Equal to Faceless King
    • Actions
      • Unit Group - Remove (Triggering unit) from (FACELESSHEROES)
If you want it to be a little more efficient, then you can check if the group is empty after and then turn off the periodic trigger, but once every 60 seconds is actually a pretty low amount. All it would do is make one call that does nothing because the group is empty once per minute.
 
Level 12
Joined
May 22, 2015
Messages
1,051
No problem!

It looks like those ones are labelled if they are not MUI. It looks like just IV and V are not MUI. IV could be made MUI the exact same way as with the trigger here - by using unit groups instead of single units. The knockback one would be more tricky, since the units getting knocked back also need to have a bunch of data associated with them. It could also be done with unit groups, but you would need indexing or a hashtable.
 
Level 6
Joined
Aug 5, 2015
Messages
202
honestly i dont like knockback because its can screwed up the scenario in my map (example knockbacking unit into forest or gate and led them to boss (shouldnt face the boss yet) like that haha
btw you know how to making http://www.hiveworkshop.com/forums/spells-569/fade-step-v1-7-a-190489/ not to pass through doodads or terain? i worried if i use it, the hero can stuck on terain or doodads
 
Level 12
Joined
May 22, 2015
Messages
1,051
Knockback and all that can be set up to not go through doodads, but you would have to find the right system or do some coding yourself. Fade step looks like you would need to add collision detection yourself so that it doesn't go through terran. You might be able to steal the code from a knockback system to detect pathing and plug it into the fade step ability. Make sure to credit the knockback system creator if you do that, though.
 
Status
Not open for further replies.
Top