• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Creating an 'double shockwave' ability

Status
Not open for further replies.
Level 8
Joined
Mar 20, 2011
Messages
264
Trying to create an ability with shoots two projectiles from each side. (Something like this)
All I could manage is creating the dummy caster at a set location, however that doesn't work when my caster changes it's facing angle as the dummy always spawn at X,X point.

Can someone show me an example on how to create uits based on where my caster is facing?

EDIT: Sorry for the noob question. Hope my description isn't too vague.
 
Level 10
Joined
Apr 4, 2010
Messages
286
Set TempPointCaster = location of casting unit
Set TempPointTarget = target location of ability being cast
Set TempPointShockwaveL = TempPointCaster offset by 150 towards (Facing angle of casting unit + 90)
Set TempPointShockwaveR = TempPointCaster offset by 150 towards (Facing angle of casting unit - 90)

Create dummy caster at (TempPointShockwaveL) facing point (TempPointTarget)
Order last created unit to (Shockwave) at (TempPointTarget)
Add expiration timer to last created unit
Create dummy caster at (TempPointShockwaveR) facing point (TempPointTarget)
Order last created unit to (Shockwave) at (TempPointTarget)
Add expiration timer to last created unit

call RemoveLocation(udg_TempPointCaster)
call RemoveLocation(udg_TempPointTarget)
call RemoveLocation(udg_TempPointShockwaveL)
call RemoveLocation(udg_TempPointShockwaveR)
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Something like this:
  • Set Point_PositionOfCaster = (Position of (Triggering unit))
  • Set Point_TargetPoint = (Target point of ability being cast)
  • Set Real_Angle = (Angle from Point_PositionOfCaster to Point_TargetPoint) + 30.00 //This adds 30 degree to the direction of the spell cast, meaning, on the right side.
  • Set Real_Distance = 200.00
  • Set Point_TempPoint = Point_PositionOfCaster offset by Real_Distance towards Real_Angle degrees)
  • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Point_TempPoint facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_Point_TempPoint) //This clears the location so we can use it again without leak. I will clear only once in my code so you can exercise in finding leaks ;)
  • Set Real_Angle = (Angle from Point_PositionOfCaster to Point_TargetPoint) - 30.00 //This takes 30 degree to the direction of the spell cast, meaning, on the left side.
  • Set Point_TempPoint = Point_PositionOfCaster offset by Real_Distance towards Real_Angle degrees)
  • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Point_TempPoint facing Default building facing degrees
The above code would create units on both sides of the caster, angle 30 degrece to the left of him and to the right of him, 200 units away.
Feel free to change those values until you get a good result to your needs.
The above code leaks points. Don't forget to clean all leaks.
The above code can be optimized. Save some (function calls) as variables.

Hope this helps!
-Ned
 
Level 8
Joined
Mar 20, 2011
Messages
264
Thank you to those who replied.

Apparently, Abovegame was correct in saying the ability was more complex than what I described.

What I'm now trying to do is:
When the two shockwaves meet, I want it to disappear and create an area that deals damage over time. Any idea on how to achieve this?


EDIT: How to add trigger tags again? XD
 
Level 9
Joined
Apr 23, 2011
Messages
527
When the two shockwaves meet, I want it to disappear and create an area that deals damage over time. Any idea on how to achieve this?

The way I'd do it is to make the shockwave itself a unit (which can be moved however you wish through triggers) and periodically check if both are near to each other (or near the target area), then remove the shockwave unit and cast another ability that deals AoE damage on the area.
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
I don't think that having dummy units cast a shockwave would work as shockwave is a line ability and you are looking for a crescent moon shape.
Rather, create two dummy units at the position of the caster and move them towards the target in a half-circle pattern while damaging everything in the way. When they reach the target, "explode" them or something for extra damage.

What I am thinking, set a point in-between the target and the caster and use it as centre point.
Then, spawn two dummies at the caster position and, as in my previous example start rotating two point around the centre point towards the target while moving the dummies to the next point.

If you succeed in making a simple circle then you can look into algorthythms & equations to achieve a more compact and better looking shape.

You have to copy your trigger "Copy as Text" and paste it between trigger tags as bellow:
Code:
[trigger]Those are trigger tags, exampled bellow[/trigger]
  • This is between trigger tags
Hope this helps!
-Ned
 
Level 8
Joined
Mar 20, 2011
Messages
264
The way I'd do it is to make the shockwave itself a unit (which can be moved however you wish through triggers) and periodically check if both are near to each other (or near the target area), then remove the shockwave unit and cast another ability that deals AoE damage on the area.
How do you check if they are near each other?

I don't think that having dummy units cast a shockwave would work as shockwave is a line ability and you are looking for a crescent moon shape.
Rather, create two dummy units at the position of the caster and move them towards the target in a half-circle pattern while damaging everything in the way. When they reach the target, "explode" them or something for extra damage.

What I am thinking, set a point in-between the target and the caster and use it as centre point.
Then, spawn two dummies at the caster position and, as in my previous example start rotating two point around the centre point towards the target while moving the dummies to the next point.

If you succeed in making a simple circle then you can look into algorthythms & equations to achieve a more compact and better looking shape.

Hope this helps!
-Ned
Though it sounds good, I have no idea how to go about putting that in practice. :c My skills are lacking.
I tried messing around with triggers and have so far managed to create two dummies which travel in a straight line instead.
 
Level 9
Joined
Apr 23, 2011
Messages
527
How do you check if they are near each other?

I'd do it like this: The dummy variable is for the shockwaves, and the p variable is a point

  • Set p[0] = (Position of dummy[0])
  • Set p[1] = (Position of dummy[1])
  • Set real[1] = (Distance between p[0] and p[1])
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • real Less than or equal to 50.00
    • Then - Actions
      • (Do actions)
    • Else - Actions
  • Custom script: call RemoveLocation(udg_p[0])
  • Custom script: call RemoveLocation(udg_p[1])
Though it sounds good, I have no idea how to go about putting that in practice. :c My skills are lacking.
I tried messing around with triggers and have so far managed to create two dummies which travel in a straight line instead.

Going by what nedlo suggested: try looking into this thread or look some more about how to move a unit in a circle. This should be a rough trigger regarding the start of the spell:
  • galioQcast
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Winds of War
    • Actions
      • Set p[0] = (Position of caster)
      • Set p[1] = (Target point of ability being cast)
      • Set real[0] = (Distance between p[0] and p[1] / 2)
      • Set facing = (Facing of caster)
      • Set p[2] = (p[2] offset by real[0] towards facing degrees)
      • Unit - Create 1 Dummy for (Owner of caster) at p[2] facing Default building facing degrees
      • Set dummy[2] = (Last created unit)
      • Unit - Create 1 Shockwave for (Owner of caster) at p[0] facing Default building facing degrees
      • Set dummy[0] = (Last created unit)
      • Unit - Create 1 Shockwave for (Owner of caster) at p[0] facing Default building facing degrees
      • Set dummy[1] = (Last created unit)
      • Countdown Timer - Start spelltimer as a Repeating timer that will expire in 0.03 seconds
      • Trigger - Turn on galioQloop 001 <gen>
      • Custom script: call RemoveLocation(udg_p[0])
      • Custom script: call RemoveLocation(udg_p[1])
The timer will be how often your shockwaves move. I can't use the editor right now so not really complete, but this should give you enough information.
 
Level 8
Joined
Mar 20, 2011
Messages
264
I'd do it like this: The dummy variable is for the shockwaves, and the p variable is a point

  • Set p[0] = (Position of dummy[0])
  • Set p[1] = (Position of dummy[1])
  • Set real[1] = (Distance between p[0] and p[1])
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • real Less than or equal to 50.00
    • Then - Actions
      • (Do actions)
    • Else - Actions
  • Custom script: call RemoveLocation(udg_p[0])
  • Custom script: call RemoveLocation(udg_p[1])


Going by what nedlo suggested: try looking into this thread or look some more about how to move a unit in a circle. This should be a rough trigger regarding the start of the spell:
  • galioQcast
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Winds of War
    • Actions
      • Set p[0] = (Position of caster)
      • Set p[1] = (Target point of ability being cast)
      • Set real[0] = (Distance between p[0] and p[1] / 2)
      • Set facing = (Facing of caster)
      • Set p[2] = (p[2] offset by real[0] towards facing degrees)
      • Unit - Create 1 Dummy for (Owner of caster) at p[2] facing Default building facing degrees
      • Set dummy[2] = (Last created unit)
      • Unit - Create 1 Shockwave for (Owner of caster) at p[0] facing Default building facing degrees
      • Set dummy[0] = (Last created unit)
      • Unit - Create 1 Shockwave for (Owner of caster) at p[0] facing Default building facing degrees
      • Set dummy[1] = (Last created unit)
      • Countdown Timer - Start spelltimer as a Repeating timer that will expire in 0.03 seconds
      • Trigger - Turn on galioQloop 001 <gen>
      • Custom script: call RemoveLocation(udg_p[0])
      • Custom script: call RemoveLocation(udg_p[1])
The timer will be how often your shockwaves move. I can't use the editor right now so not really complete, but this should give you enough information.
Ah thanks for the help, really reaaaaally appreciate it. I've managed to make it work so far.
One question. How do I make the initial two 'winds' deal damage? Should I make it so that it deals area damage every time the dummy unit moves? Would that not cause a unit to take multiple damage?

I'll have to spend a lil more time on the arcing part.
 
Level 13
Joined
May 10, 2009
Messages
868
Create a unit group for each active instance, check if enemies are in it. If not, damage and add them to it. In the end, destroy it.

Note: If there won't be any more than 1 unit in your map that can cast that spell, then you just need 1 unit group, and just clear it as soon as that spell finishes its last active instance - no need to create/destroy groups all the time.
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
I'd rather not have a Unit Group(s) for this. (personal preference)
I'd just rather design the spell in a way that stacking damage from multiple movements would total to the amount of damage I wan't to deal.
Make it overlap in a way to stack the damage to my desired damage amount.

Another way is to put a buff on the unit that gets damaged, and check when dealing further damage.

Or make it even more epic like leaving a burning trail that stays for a few sec as an AoE DoT on the gorund !

~meh, choices...
-Ned
 
Status
Not open for further replies.
Top