Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] make dummy unit stick to unit

Discussion in 'World Editor Help Zone' started by Ender Wiggins, May 27, 2020.

  1. Ender Wiggins

    Ender Wiggins

    Joined:
    Mar 29, 2020
    Messages:
    485
    Resources:
    3
    Icons:
    3
    Resources:
    3
    hey,

    I know this has been asked many times before, and I have bumped into answers about this in the past - but obviously now that I am actively looking for it I can't seem to find it anywhere...

    how do I get a dummy unit to move in tandem with a unit? is there a different way than insta-moving it periodically? - I feel like this would create a lot of extra memory and would rather avoid it if there is a better way. (using -follow unit just makes it follow from a distance...)

    its just for adding hero glow to units who's models I rescaled, whereas adding the glow via an ability scales the glow too and makes it humongous,and by doing this through a dummy unit i can rescale the glow model as needed...
     
  2. Warseeker

    Warseeker

    Joined:
    Feb 18, 2014
    Messages:
    3,112
    Resources:
    2
    Maps:
    2
    Resources:
    2
    SetUnitX and SetUnitY using a periodic timer.
     
  3. Ender Wiggins

    Ender Wiggins

    Joined:
    Mar 29, 2020
    Messages:
    485
    Resources:
    3
    Icons:
    3
    Resources:
    3
    a. is that any different than 'move to point of location of unit' using a periodic timer?
    b. if I have this very-frequent periodic timer on a lot of units wont that be pretty memory heavy?
     
  4. hemmedo

    hemmedo

    Joined:
    Jun 13, 2008
    Messages:
    333
    Resources:
    0
    Resources:
    0
    a. Same thing but you should do it the way he said.
    b. Depends on how much units you're talking about. But regardless there should be no problem with todays pc's computational power.
     
  5. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,394
    Resources:
    0
    Resources:
    0
    You can uncheck Art - Scale Projectiles for your unit in the Object Editor and there's also Art - Required Animation Names - Attachments that can resize effects. Mountain Giant has the "large" animation name for example.

    These two fields can potentially fix your scaling issues.

    And how to move a unit periodically. Note that Periodic Intervals minimum is 0.03125 seconds, so despite me using every 0.01 seconds, it will default to 0.03125. If you use a Timer you can get around this minimum.
    • Example
      • Events
        • Time - Every 0.01 seconds of game time
      • Conditions
      • Actions
        • Custom script: call SetUnitX(udg_Dummy, GetUnitX(udg_Unit))
        • Custom script: call SetUnitY(udg_Dummy, GetUnitY(udg_Unit))
     
  6. Ender Wiggins

    Ender Wiggins

    Joined:
    Mar 29, 2020
    Messages:
    485
    Resources:
    3
    Icons:
    3
    Resources:
    3
    interestingly enough this worked great with one out of the two units i tried it with, and didn't do anything to the other one, so i'll trigger that one. (both with the same ability, but the one it didn't work on was enlarged more, so maybe it worked but only a little).

    It seems i have been unnecessarily trying to avoid using periodic triggers. I figured if leaks are such a big thing, and every little bit of extra memory counts, than triggers that fire so frequently are probably also a problem.

    thanks guys!
     
  7. Macadamia

    Macadamia

    Joined:
    Jan 30, 2020
    Messages:
    876
    Resources:
    0
    Resources:
    0
    Well it is usually a good thing to avoid short repeating timers in an event-driven scripting context.

    But sometimes there is absolutely no viable alternative, or avoiding them ends up increasing complexity to a point where it becomes counter-productive.

    This said in your case you don't need any triggers, but the behavior you are describing is quite strange.
    If you resized the model in a model editing program, the glow model should not scale with the model if you attach it as an sfx
    This usually rather happens when setting the field "Art - Scaling value" different from 1.0 in the object editor.

    If this is an imported model, changing its size in something like Retera Model Studio to make it fit the size you want while keeping the Scaling Value to 1.0 should fix your problem without any dummy.

    If it is a original game model, it is probably better to make a dedicated version of the glow model by resizing it to fit this specific unit.
    Glow models are made of a few planes with a specific Team Color texture, so they are ridiculously small in size.

    You could even consider making one for each of your units requiring a glow, to have full control of the glow size for each and everyone of them.


    That would be the proper clean and efficient way to deal with this.


    Hope this helps !!!
     
  8. Ender Wiggins

    Ender Wiggins

    Joined:
    Mar 29, 2020
    Messages:
    485
    Resources:
    3
    Icons:
    3
    Resources:
    3
    I have 0 experience in modeling. is that easy to do? also can that be done in magos?
     
  9. Macadamia

    Macadamia

    Joined:
    Jan 30, 2020
    Messages:
    876
    Resources:
    0
    Resources:
    0
    Yes very easy, all you have to do is import the glow model, tick everything on the list of elements in the left panel, then select the scale tool on the right panel, then make sure the part inside the square angle is highlighted.
    This means it will scale the model in all directions (if only the angle part looking like \\ is selected, you will only scale it on the current side of the view.

    If you have difficulties with it, I would recommend quickly watching some of @Retera's videos from his YouTube channel :
    Retera
     
  10. Ender Wiggins

    Ender Wiggins

    Joined:
    Mar 29, 2020
    Messages:
    485
    Resources:
    3
    Icons:
    3
    Resources:
    3
    wow, that was pretty simple. thanks!
     
  11. Macadamia

    Macadamia

    Joined:
    Jan 30, 2020
    Messages:
    876
    Resources:
    0
    Resources:
    0
    Wonderful news !