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

Shockwave with caster movement issue

Status
Not open for further replies.
Level 4
Joined
Sep 21, 2022
Messages
30
Hello! I decided to create an ability for my Berserker hero. It's some kind of Shockwave but hero moves with the wave. It works but there is a problem: if I cast it just at the behind of hero (near 180 degrees), he doesn't have time to turn around completely so he moves not correctly. Is there any way to deal with it? I'll put trigger screens. First one launches the movement and the second one is the movement itself
 

Attachments

  • RamIssue.png
    RamIssue.png
    11.6 KB · Views: 9
  • RamIssue2.png
    RamIssue2.png
    17.9 KB · Views: 9

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
You can deal with it by calculating and storing the Angle he's supposed to be facing before you begin moving him. Then update your Periodic Interval trigger to use this Angle when calculating the Position he should move to.

Here's a working example:
  • Ram Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave
    • Actions
      • Set VariableSet Ram_Caster = (Triggering unit)
      • -------- --------
      • Set VariableSet Ram_Point[0] = (Position of Ram_Caster)
      • Set VariableSet Ram_Point[1] = (Target point of ability being cast)
      • Set VariableSet Ram_Angle = (Angle from Ram_Point[0] to Ram_Point[1])
      • -------- --------
      • Custom script: call RemoveLocation( udg_Ram_Point[0] )
      • Custom script: call RemoveLocation( udg_Ram_Point[1] )
      • -------- --------
      • Trigger - Turn on Ram Loop <gen>
      • Wait 0.40 game-time seconds
      • Trigger - Turn off Ram Loop <gen>
I've stored the Angle in a variable and can reference it in our Loop trigger:
  • Ram Loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Ram_Point[0] = (Position of Ram_Caster)
      • Set VariableSet Ram_Point[1] = (Ram_Point[0] offset by 18.00 towards Ram_Angle degrees.)
      • -------- --------
      • Unit - Make Ram_Caster face Ram_Angle
      • -------- --------
      • -------- This custom script lets you move a unit while ignoring collision restrictions: --------
      • Custom script: call SetUnitX( udg_Ram_Caster, GetLocationX( udg_Ram_Point[1] ) )
      • Custom script: call SetUnitY( udg_Ram_Caster, GetLocationY( udg_Ram_Point[1] ) )
      • -------- --------
      • Custom script: call RemoveLocation( udg_Ram_Point[0] )
      • Custom script: call RemoveLocation( udg_Ram_Point[1] )
I use Custom Script to access special functions that don't exist in the normal Trigger Editor. SetUnitX() and SetUnitY() let you move a unit while ignoring collision restrictions. I also address the memory leaks by removing the Point variables (locations), this is optional but recommended.

Note that your triggers as well as mine are not MUI or even MPI. They will only work properly if you have ONE unit on the map that can use this ability and only if ONE instance of the ability can be active at a time. To make it work smoothly for everyone I would suggest adapting these same triggers to use a system and technique called Unit Indexing. It remains mostly the same logic, we just introduce more variables and the concept of indexing Arrays to handle multiple sets of data at a time.
 

Attachments

  • Shockwave Move Basic.w3m
    19.3 KB · Views: 3
Last edited:
Level 4
Joined
Sep 21, 2022
Messages
30
Great! Thank you, I'll check it when I'll return home. According to everything what you said - my unit is the only who can use this ability. Other units will have their own unique abilities, but anyway it's an interesting option, I'm sure it will be useful later
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Great! Thank you, I'll check it when I'll return home. According to everything what you said - my unit is the only who can use this ability. Other units will have their own unique abilities, but anyway it's an interesting option, I'm sure it will be useful later
No problem :D The good news is that your Unit can't cast the ability again while it's moving since it's essentially "stunned" during this process. So as long as only ONE unit has the ability you should never run into an issue. Also, if the cooldown is longer than the duration and you don't have any "reset cooldown" features then this issue becomes even less apparent.
 
Status
Not open for further replies.
Top