• 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.

[Spell] speed spell MUI

Status
Not open for further replies.
Level 3
Joined
Mar 10, 2018
Messages
32
My spell when activated gives the hero super speed, but I need to make it MUI, can you help?
How I made it:

1st trigger: just sets up some buffs and animations +turns on the 2nd trigger
2nd trigger(turned off): Event - Issued order Unit->Point
Action - Saves the issued unit and points to globals +turns on the 3rd trigger

3rd trigger(turned off): Event - Every 0.03 seconds
Action - moves the stored unit 20 meters forward the stored point (by Polar Offset) til the distance is covered.

I wrote this in Jass to use locals but it won't work because of this 'Every 0.03 seconds' event which requires variables from other functions.
How do I make this castable by many units at once?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,883
Do you need to use local variables? Without them you could always use a Unit Group and a Unit Indexer.

Store the units in a Unit Group whenever they cast the spell. Then store the points with the Unit Indexer.

1st Trigger: A Unit starts the effect of an ability -> add triggering unit to "Super Speed Unit Group"

2nd Trigger: A Unit is issued an order towards a point -> If ordered unit is in "Super Speed Unit Group" then set OrderPoint[Custom value of triggering unit] to the issued point.

Then in your timer trigger do:
Every 0.03 seconds

Pick every unit in "Super Speed Unit Group" and do If picked unit has Speed Buff = true then move picked unit towards OrderPoint[custom value of picked unit], else, Remove picked unit from "Super Speed Unit Group".
 
Last edited:
Level 3
Joined
Mar 10, 2018
Messages
32
Thanks! That should work.

Another question: what integer do I set as a 'custom value'? I need each caster to have its individual value so that they don't overwrite one another.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,883
Thanks! That should work.

Another question: what integer do I set as a 'custom value'? I need each caster to have its individual value so that they don't overwrite one another.

So unit's by default have a Custom Value of 0. Custom Value isn't an Integer that you need to create, it's something you can already assign through the native Actions in the editor. When you click the Array of your OrderPoint variable search for "Unit - Custom value of unit". Just make sure you download a Unit Indexer (I use Bribe's Unit Indexer) and import it into your map, it will automatically assign each unit a unique custom value when they enter the map and upon map initialization. Then from that point on all of your units will have their own unique # assigned to them that can be easily referenced. Here's a simple example:

We assign a special effect to a unit when it acquires an item and destroy that special effect when it loses an item. With this method you could have 100's of units each with their own flag and it will still create/destroy their respective special effect properly.
  • Acquire Flag
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Human Flag
    • Actions
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Objects\InventoryItems\BattleStandard\BattleStandard.mdl
      • Set FlagSfx[(Custom value of (Triggering unit))] = (Last created special effect)
  • Lose Flag
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Human Flag
    • Actions
      • Special Effect - Destroy FlagSfx[(Custom value of (Triggering unit))]
Another thing I like to do is create an Integer variable called "CV" or "Index" or whatever you want to name it. This just makes your life easier when you have to reference Custom Value a lot. Instead of "MyVariable(custom value of triggering unit)", you can do "MyVariable(CV)" and assign CV as the custom value of our desired unit beforehand.

  • Acquire Flag with Shortcut
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Human Flag
    • Actions
      • Set CV = (Custom value of (Triggering unit))
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Objects\InventoryItems\BattleStandard\BattleStandard.mdl
      • Set FlagSfx[CV] = (Last created special effect)
 
Last edited:
Status
Not open for further replies.
Top