Looking for 2 tutorials, 1 on skill shots, and 1 on adding effects to linear AOE (Shockwave)

Status
Not open for further replies.
Level 4
Joined
Jun 10, 2019
Messages
69
tl;dr: I'm looking for a tutorial on making skill shots and another on adding effects to linear AOE.

Hi all,

I'm new to these forums so apologies if this isn't the right place to be posting this.

I'm working on a project for my friends and myself; it's a MOBA with all of our DnD characters in it. However, I'm struggling with 2 things:

The first is creating a skill shot. By that, I mean you launch a projectile in a target direction and it stops either when it travels its maximum distance or when it comes into contact with the first enemy unit.

The second is adding an effect to a linear AOE effect, like Shockwave or Carrion Swarm. Specifically, I'm trying to add a slowing effect, but knowing how to add extra effects in general would be a great addition.

I've found a few maps with similar abilities, but I'm not really able to replicate their work myself without more instruction. As such, I was hoping that someone could link me some tutorials? I feel like I've scoured the internet looking for them, but I've had little luck.

Edit: I forgot to mention that I do know the basics of triggering (but not much more).

Thank you in advance!

- A Rather Wily Beaver
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
You can't add effects to base wc3 spells, you will have to trigger that yourself. I honestly searched for a bit and couldn't really find anything (I'm surprised, since I swear I see posts about making triggered shockwaves all the time), but here are the best resources I did come up with to kind of cover the basics of trigger enhanced spells:

How to: Create Spells in GUI - The Beginning (this is old, some info is outdated)
Things That Leak (more in depth version: Memory Leaks)
Visualize: Dynamic Indexing (very important to understand how to do this)
MUI Spells Using Artificial Waits (an implementation of the above tutorial)
Hashtables and MUI (in a way this is kind of an alternative to dynamically indexing; this may be unnecessary to understand at the start but good info to have)

That being said, the simplest way to do this would probably be to use a projectile system or some other spell framework that makes the process really simple for you. Examples of this are below:
Missile [GUI] version 1.6.1
Knock-Back 3D - MMS 3D V. 3.2.1
Custom Projectiles System
Master Projectile System V1.02b
https://www.hiveworkshop.com/threads/gui-mui-missile-system-v1-03.112543/
Missile System with Arcs in GUI[Kingz]v1.4
GUI Bullet/Arc Missile System v1.02


But let's assume you want to do it yourself (for whatever reason). Basically you need a trigger to set up your cast like this:

  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) equal to YOUR_SPELL
  • Actions
    • Set SPELL_Count = (SPELL_Count + 1)
    • Set SPELL_Caster[SPELL_Count] = (Triggering Unit)
    • Set SPELL_Lvl[SPELL_Count] = (Level of (Ability being cast) for SPELL_Caster[SPELL_Count])
    • Set TempPoint = (Target point of ability being cast) //or position of unit if unit-targeted, or whatever if no target
    • Set SPELL_EffectPos[SPELL_Count] = (Position of SPELL_Caster[SPELL_Count])
    • Set SPELL_Angle[SPELL_Count] = (Angle between SPELL_EffectPos[SPELL_Count] and TempPoint)
    • Custom script: call RemoveLocation(udg_TempPoint)
    • Special Effect - Create a special effect at SPELL_EffectPos[SPELL_Count] using Your\Model.mdl
    • Set SPELL_Effect[SPELL_Count] = (last created special effect)
    • Set SPELL_Speed[SPELL_Count] = (300.00 x 0.04) //this moves the effect 300 units total every second in 0.04 second intervals, modify as necessary
    • Set SPELL_DistanceLeft[SPELL_Count] = 750.00 //this effect will move 750 distance before being terminated
    • Set SPELL_ImpactRadius[SPELL_Count] = 150.00 //will hit units within 150.00 of the effect
    • If (Conditions) then (Actions) else (Actions)
      • If - Conditions
        • SPELL_Count equal to 1
      • Then - Actions
        • Trigger - Turn on OTHER TRIGGER <gen>
      • Else - Actions
And a trigger that moves all you projectiles, checks for targets, and ends casts:

  • Events
    • Time - Every 0.04 seconds of game-time //note this is the same 0.04 used in the above trigger; if you change one you must change the other
  • Conditions
  • Actions
    • For each integer SPELL_Index from 1 to SPELL_Count do (Actions)
      • Loop - Actions
        • Set SPELL_DistanceLeft[SPELL_Index] = (SPELL_DistanceLeft[SPELL_Index] - SPELL_Speed[SPELL_Index])
        • Set TempPoint = SPELL_EffectPos[SPELL_Index] offset by SPELL_Speed[SPELL_Index] towards SPELL_Angle[SPELL_Index] degrees
        • Special Effect - Move SPELL_Effect[SPELL_Index] to TempPoint
        • Custom script: call RemoveLocation(udg_SPELL_EffectPos[udg_SPELL_Index]) //remove old location before overwriting it in the next line
        • Set SPELL_EffectPos[SPELL_Index] = TempPoint //TempPoint does not have a leak that needs to be cleaned here
        • Set TempGroup = (Units within SPELL_ImpactRadius[SPELL_Index] of TempPoint matching (YOUR MATCHING CONDITIONS TO FILTER TARGETS HERE))
        • Unit Group - Pick every unit in TempGroup and do (Actions)
          • Loop - Actions
            • Unit - Cause SPELL_Caster[SPELL_Index] to damage (Picked Unit) dealing (SPELL DAMAGE HERE, USING WHATEVER INFO/VARIABLES YOU NEED) damage and DAMAGE TYPES HERE
            • -------- Here you can also create a dummy unit and cast the appropriate spell (slow here) --------
            • Unit - Create 1 Dummy for (Owner of SPELL_Caster[SPELL_Index] at TempPoint) facing (Default building facing degrees)
            • Unit - Add a 1.00 second generic expiration timer to (Last created unit)
            • Unit - Add SLOW ABILITY to (Last created unit)
            • Unit - Set level of SLOW ABILITY for (last created unit) to SPELL_Lvl[SPELL_Index]
            • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked Unit)
            • -------- if you want the spell to end instantly after impacting something, just set the remaining distance to 0 prematurely and it will automatically get cleaned up --------
            • Set SPELL_DistanceLeft[SPELL_Index] = 0.00
        • Custom script: call DestroyGroup(udg_TempGroup)
        • If (Conditions) then (Actions) else (Actions)
          • If - Conditions
            • SPELL_DistanceLeft[SPELL_Index] less than or equal to 0.00
          • Then - Actions
            • Special Effect - Destroy SPELL_Effect[SPELL_Index]
            • Custom script: call RemoveLocation(udg_SPELL_EffectPos[udg_SPELL_Index])
            • -------- move the last instance into this now unoccupied spot --------
            • Set SPELL_Caster[SPELL_Index] = SPELL_Caster[SPELL_Count]
            • Set SPELL_Lvl[SPELL_Index] = SPELL_Lvl[SPELL_Count]
            • Set SPELL_Effect[SPELL_Index] = SPELL_Effect[SPELL_Count]
            • Set SPELL_EffectPos[SPELL_Index] = SPELL_EffectPos[SPELL_Count]
            • Set SPELL_Angle[SPELL_Index] = SPELL_Angle[SPELL_Count]
            • Set SPELL_Speed[SPELL_Index] = SPELL_Speed[SPELL_Count]
            • Set SPELL_DistanceLeft[SPELL_Index] = SPELL_DistanceLeft[SPELL_Count]
            • Set SPELL_ImpactRadius[SPELL_Index] = SPELL_ImpactRadius[SPELL_Count]
            • -------- reduce counter variables to properly move the swapped instance --------
            • Set SPELL_Index = (SPELL_Index - 1)
            • Set SPELL_Count = (SPELL_Count -1)
            • If (Conditions) then (Actions) else (Actions)
              • If - Conditions
                • SPELL_Count equal to 0
              • Then - Actions
                • Trigger - Turn off (This trigger)
              • Else - Actions
          • Else - Actions
 
Level 4
Joined
Jun 10, 2019
Messages
69
I figured out how to apply an effect to Shockwave! :D

What I did is, I made a dummy spawn next to the caster, and every 0.01 seconds, I had them teleport a short distance, keeping in pace with the projectile. Every time they teleported, I had it pick any units around it, and for every unit it picked, it spawn additional dummies that would cast the slow effect on the picked units.

I'm sure that there was a simpler way of going about it, but it seems to be working for now!
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
0.01 is more frequently than you reasonably need to move the dummy. Consider that 50 FPS means that frames happen every 1/50 = 0.02 seconds. You won’t even see things moving every 0.01 most of the time and it will likely cost you performance in the long run.

If you look closely the method you described using is exactly what I wrote in the above trigger except I used effects instead of dummy units. In the past moving a unit was important because the unit usually had the appropriate SFX attached to it for visual purposes. A recent update added the ability to move SFX so the units are unnecessary now. In your specific instance you actually don’t need the unit at all as long as you keep track of the location it ‘should’ have been at. This is what EffectPos is for in my trigger.

Also Shockwave itself is bad because it creates a terrain deformation, and those have been known to cause map desyncs frequently. If anything use Carrion Swarm instead since it’s the same spell without the deformation.
 
Level 4
Joined
Jun 10, 2019
Messages
69
@Pyrogasm thank you so much for your replies! You've been extremely helpful to me, and I greatly appreciate it.

It took me quite awhile to notice the map deformation that shockwave causes, but now that I see it, I can't unsee it. I think I probably will make the swap over to Carrion Swarm. Thanks for the tip!
 
Status
Not open for further replies.
Top