1. The long-awaited results for Concept Art Contest #11 have finally been released!
    Dismiss Notice
  2. Join Texturing Contest #30 now in a legendary battle of mythological creatures!
    Dismiss Notice
  3. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  4. Hivers united and created a bunch of 2v2 melee maps. Vote for the best in our Melee Mapping Contest #4 - Poll!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice

[Spell] speed spell MUI

Discussion in 'World Editor Help Zone' started by Roflan, May 12, 2019.

  1. Roflan

    Roflan

    Joined:
    Mar 10, 2018
    Messages:
    15
    Resources:
    0
    Resources:
    0
    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?
     
  2. Roflan

    Roflan

    Joined:
    Mar 10, 2018
    Messages:
    15
    Resources:
    0
    Resources:
    0
    I can post the codes here but they are reaally messy to look at
     
  3. Sabe

    Sabe

    Joined:
    Jul 30, 2018
    Messages:
    165
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Use hashtables? They are pretty simple to make MUI as you can store information for each individual units.
     
  4. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,285
    Resources:
    0
    Resources:
    0
  5. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    85
    Resources:
    0
    Resources:
    0
    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: May 15, 2019 at 4:33 AM
  6. Roflan

    Roflan

    Joined:
    Mar 10, 2018
    Messages:
    15
    Resources:
    0
    Resources:
    0
    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.
     
  7. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    85
    Resources:
    0
    Resources:
    0
    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: May 16, 2019 at 11:09 PM
  8. Roflan

    Roflan

    Joined:
    Mar 10, 2018
    Messages:
    15
    Resources:
    0
    Resources:
    0
    Thanks, that was helpful!