How to make an ability that sweep enemies away from caster?

Yamuraiha

Member
Reaction score
1
I wanna make an new shock wave ability of which the missile sweep away enemies and push them back.
 

afisakov

You can change this now in User CP.
Reaction score
37
This would be trigger-based. and require 2 triggers

trigger 1: set caster to variable. define point1=caster position. enable trigger 2 for several seconds (how long the shockwave lasts)
trigger 2: timer periodic
detects enemies hit by the shockwave and moves them a short distance away from caster-
done as
set point2=position of picked unit.
set angle1= angle between points 1 and 1
set point3= point 2 translated 10 units in direction of angle 1
unit. move picked unit instantly to point3
remove points 2 and 3

The periodic timer should generally be between 0.02-0.05 seconds to look continuous without excessive processor drain.

I would strongly consider making the shockwave itself trigger-based since this makes it much easier to keep track of which units are hit by it.

an example of a trigger-based shockwave, albeit in Jass
Code:
 function Trig_getsuga_Conditions takes nothing returns boolean
    return (GetSpellAbilityId()=='A0VH') or (GetSpellAbilityId()=='A0VA')
endfunction
function Trig_getsuga_Actions takes nothing returns nothing
(activated when spell cast)
    set ichigo_w=GetSpellAbilityUnit()
    set tp1=GetUnitLoc(ichigo_w)
    set tp2=GetSpellTargetLoc()
    set rangle1=AngleBetweenPoints(tp1,tp2)
    set getsugahit=CreateGroup()
    set ablev[2]=GetUnitAbilityLevelSwapped(GetSpellAbilityId(),ichigo_w)
    set tp3=PolarProjectionBJ(tp1,30,rangle1)
    call RemoveLocation(tp1)
    call CreateNUnitsAtLoc(1,'h04X',GetOwningPlayer(ichigo_w),tp3,rangle1)
    call RemoveLocation(tp2)
    call RemoveLocation(tp3)
    set getsudummy=GetLastCreatedUnit()
    call UnitApplyTimedLifeBJ(1.00,'BTLF',getsudummy)
    call EnableTrigger(trg_getsugap)
    call TriggerSleepAction(0.55)
    call DisableTrigger(trg_getsugap)
    call DestroyGroup(getsugahit)
    set ichigo_w=null
    set getsudummy=null
endfunction

(condition for unit group hit)
function getsugap_enemy takes nothing returns boolean
    return IsUnitAliveBJ(GetFilterUnit()) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(ichigo_w)) and (IsUnitInGroup(GetFilterUnit(),getsugahit)==false)
endfunction
function getsugap_dam takes nothing returns nothing
    call GroupAddUnitSimple(GetEnumUnit(),getsugahit)
    call UnitDamageTargetBJ(ichigo_w,GetEnumUnit(),dx,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_MAGIC)
endfunction
 
(event for this is timer-periodec 0.02 seconds)
function Trig_getsugap_Actions takes nothing returns nothing
    set fint2=GetHeroStr(ichigo_w,true)
    set dx=I2R(ablev[2]*(100+fint2))/2.
    set tp1=GetUnitLoc(getsudummy)
    set tp2=PolarProjectionBJ(tp1, 14, rangle1)
    call SetUnitPositionLoc(getsudummy,tp2)
    set tg=GetUnitsInRangeOfLocMatching(140,tp2,Condition(function getsugap_enemy))
    call ForGroupBJ(tg,function getsugap_dam)
   call DestroyGroup(tg)
    call RemoveLocation(tp1)
    call RemoveLocation(tp2)
endfunction

If using the trigger-based shockwave, then you can build the moving of the hit enemies into the step where shockwave deals damage, making it nice and neat to keep track of.

I know some people have an easier time figuring out what JASS means and translating it into GUI then others, so please let me know which parts you have a hard time understanding and I will try to help.
Aside from the removelocation and destroygroup function, the entire thing can be don in GUI.
 

Yamuraiha

Member
Reaction score
1
I have 2 questions:
1/ how to enable trigger 2 for several seconds only?
2/ in trigger 1, I set point_1 = Position of (Casting Unit), then I haven't removed it <- leak?
 

Xialian

Member
Reaction score
8
1/ You make a loop (hence the 0,02 - 0,05 interval) of the trigger pushing them, and make that happen for X seconds and then turn off the loop.

2/ As far as I know, point_1 is a variable and won't leak, because you change it's position.
I might be wrong on this. (Thanks to O.A for clearing this up for me as well)
 

O.A

Quantum physics rules
Reaction score
29
1. Either turn the periodic trigger on in trigger 1 and use wait, then turn the periodic trigger off: Turn on Your Trigger / Wait 2 seconds / Turn off Your Trigger OR use a loop counter in the periodic trigger itself.

2. When the ability is cast the first time and the point not removed, it's not a leak yet. But when the ability is cast the second time, a new point is assigned to the variable, making the first one a leak if it has not been removed. So you should remove point_1.
 

Yamuraiha

Member
Reaction score
1
More question:
3/ How to detects enemies hit by the shockwave ?
4/ If I move picked unit instantly to point3, then in some case the pushed unit would be in a place that he couldn't get out any more (like a hole) ?
 

afisakov

You can change this now in User CP.
Reaction score
37
My plan for point 1 as laid out in writing is to make it in the activation trigger, use it in trigger 2 (periodic) to set the angle (without redefining point1) and then remove it again in the end of trigger 1.
eg.
set point_1=unit position of triggering unit
other setup stuff
enable trigger2
wait 0.5 seconds
disable trigger 2
call RemoveLoaction(udg_point_1)

The most reliable way I know of to detect units hit by shockwave is to make a triggered shockwave like I put in spoiler tags. then the damage is dealt by the shockwave trigger and you can do the move enemy parts during the same step, knowing that any enemy taking damage also gets moved.
If you have trouble figuring out how that trigger works (since I left it in Jass), let me know what part you are having difficulty with and progress thus far so I know what to help with.
 

Xialian

Member
Reaction score
8
4/ You could make it check for "walkable" when it stops pushing. If false, make it teleport to a walkable space.
 

Yamuraiha

Member
Reaction score
1
I don't know JASS, I think I should study about JASS first and resume editting my map someday huh
 

afisakov

You can change this now in User CP.
Reaction score
37
I don't know JASS, I think I should study about JASS first and resume editting my map someday huh
Almost all the lines I used in the Jass have a GUI equivalent, that is why I thought u could look at what they seem to say and then take a guess at what that translates into.
for instance
Code:
call CreateNUnitsAtLoc(1,'h04X',GetOwningPlayer(ichigo_w),tp3,rangle1)
means create 1 unit at location tp3 for player (owner of ichigo)
of type 'h04X' (the rawcode of that unit).and once you see
that the create unit function in GUI requires you to choose a
direction facing you can figure out that rangle1 is just the facing degrees.

Most of it could be figured out this way, and then just ask on the parts you don't get.
 

Yamuraiha

Member
Reaction score
1
what are the typr of those variables ?
ichigo_w , rangle1 ,
And I don't under stand those 2 lines
set ablev[2]=GetUnitAbilityLevelSwapped(GetSpellAbilityId(),ichigo_w)
set tp3=PolarProjectionBJ(tp1,30,rangle1)
 

afisakov

You can change this now in User CP.
Reaction score
37
ichigo_w is a unit variable, meant to hold the casting unit.
rangle1 is a real, intended to be the angle at which spell cast.
set ablev[2]: set integer variable = level of ability(ability being cast) for triggering unit


set tp3: set point tp3= point with offset, point tp1 offset by 30 towards angle rangle1

You are of course free to rename the variables as you see fit, these names are just the ones I happened to be using in one of my maps.
 

Yamuraiha

Member
Reaction score
1
ichigo_w is a unit variable, meant to hold the casting unit.
rangle1 is a real, intended to be the angle at which spell cast.
set ablev[2]: set integer variable = level of ability(ability being cast) for triggering unit


set tp3: set point tp3= point with offset, point tp1 offset by 30 towards angle rangle1

You are of course free to rename the variables as you see fit, these names are just the ones I happened to be using in one of my maps.

Tks, You're sure love Bleach huh :v
 

afisakov

You can change this now in User CP.
Reaction score
37
Of course, I guess naming the ability getsuga really gave it away.
I had it deal strength-based damage and even have modifiers to increase range and damage if used while in bankai in my main trigger. advantage of having it move by a number I define.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top