• 🏆 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!

The Keg - Ability

Status
Not open for further replies.
Level 5
Joined
Nov 29, 2007
Messages
106
Hi
I made an ability that is thrown to target location and when it lands, it deals damage to caught enemy units. It also should move towards units hited by this ability, example: if the keg lands behind target it push it 250 units ahead, if used on face of unit it pushes it 250 units back. But I don't know how to push them by triggers. Need help.

Throws a keg at target location, impacting after a 1 second delay. Enemy units in radius take 100 / 150 / 200 / 250 Magic damage, and are pushed 250 units away from the impact point.
 

Attachments

  • 1.JPG
    1.JPG
    81.7 KB · Views: 2,642
Level 13
Joined
Jun 1, 2008
Messages
360
As somebody told you in your last post, you should copy the trigger as text (edit -> copy as text) and paste it here in trigger-tags.
And please translate it...

For pushing units around you can either use a knock-back system (use search), or trigger it urself.. something like this:
  • events:
  • time - every 0.03sec
  • actions:
  • For each integer A from 1 to PushingUnits_Count (integer) do
    • Set Point1 = Position of PushingUnits_Unit[Integer A]
    • Set Point2 = Point1 offset by PushinUnits_Speed[Integer A] (real) toward PushingUnits_Angle[Integer A] (real)
    • Unit - Move PushingUnits_Unit[Integer A] (unit array) to Point2
    • Remove Point 1 and Point 2 (leaks)
    • set PushinUnits_Speed[Integer A] = PushinUnits_Speed[Integer A] - 0.5 (or something like that)
 
Last edited:
Level 5
Joined
Nov 29, 2007
Messages
106
here you go ;)
  • Events
    • Unit - A unit beign cast a spell
  • Conditions
    • (Ability being cast) = The Keg
  • Actions
    • Set TemporaryPoint = (Position of (Triggering unit))
    • Set TemporaryPoint2 = (Target point of ability being cast)
    • Unit - Create 1 dummy unit for (Owner of (Triggering unit)) at TemporaryPoint facing The default orientation of the building degrees
    • Set TemporaryUnit = (Last created unit)
    • Unit - Add The Keg Projectile to TemporaryUnit
    • Unit - Add a 6.00 second general expiration timer to TemporaryUnit
    • Unit - Create 1 dummy unit (vulnerable) for (Owner of (Triggering unit)) at TemporaryPoint2 facing The default orientation of the building degrees
    • Set TemporaryUnit2 = (Last created unit)
    • Unit - Add The Keg Explosion to TemporaryUnit2
    • Unit - Set level of The Keg Explosion for TemporaryUnit2 to (Level of The Keg for (Triggering unit))
    • Unit - Add a 6.00 second OgĂłlny expiration timer to TemporaryUnit2
    • Unit - Order TemporaryUnit to Neutral Alchemic - Acid Bomb TemporaryUnit2
    • Wait ((Distance between TemporaryPoint and TemporaryPoint2) / 700.00) seconds
    • Unit - Order TemporaryUnit2 to Human - Mountain King: Thunder Clap
    • Special Effect - Create a special effect at TemporaryPoint2 using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_TemporaryPoint)
    • Custom script: call RemoveLocation(udg_TemporaryPoint2)
And I want to knockback units that are hited by spell "the keg" (knockback only works on enemies), but don;t know how :) Need your help ;d btw. found some knockback systems in Spells Category but made in Jass or so complicated.
 
Level 13
Joined
Jun 1, 2008
Messages
360
Well in my first post I basically showed you how it works.
You just have define in your Keg trigger which units are supposed to be pushed in which direction.
  • Pick all unit in range of X around TemporaryPoint2 and do
    • set PushingUnits_Count = PushingUnits_Count + 1
    • set PushingUnits_Unit[PushingUnits_Count] = picked unit
    • set PushingUnits_Angle[PushingUnits_Count] = angle from TemporaryPoint2 to position of picked unit
    • set PushingUnits_Speed[PushingUnits_Count] = 30
 
Last edited:
Level 5
Joined
Nov 29, 2007
Messages
106
yes, but that knockback all units, and knocked units cant move, attack casts etc. here is trigger:
  • Events
    • Unit - A unit beign cast a spell
  • Conditions
    • (Ability being cast) is equal to The Keg
  • Actions
    • Set TemporaryPoint = (Position of (Triggering unit))
    • Set TemporaryPoint2 = (Target point of ability being cast)
    • Unit - Create 1 dummy unit for (Owner of (Triggering unit)) at TemporaryPoint facing default orientation of the building degrees
    • Set TemporaryUnit = (Last created unit)
    • Unit - Add The Keg Projectile to TemporaryUnit
    • Unit - Add a 6.00 second general expiration timer to TemporaryUnit
    • Unit - Create 1 dummy unit (vulnerable) for (Owner of (Triggering unit)) at TemporaryPoint2 facing default orientation of the building degrees
    • Set TemporaryUnit2 = (Last created unit)
    • Unit - Add The Keg Explosion to TemporaryUnit2
    • Unit - Set level of The Keg Explosion for TemporaryUnit2 to (Level of The Keg for (Triggering unit))
    • Unit - Add a 6.00 second OgĂłlny expiration timer to TemporaryUnit2
    • Unit - Order TemporaryUnit to Neutral Alchemic - Acid Bomb TemporaryUnit2
    • Wait ((Distance between TemporaryPoint and TemporaryPoint2) / 700.00) seconds
    • Unit - Order TemporaryUnit2 to Human - Mountain King: Thunder Clap
    • Special Effect - Create a special effect at TemporaryPoint2 using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
    • Special Effect - Destroy (Last created special effect)
    • Unit Group - Pick every unit in (Units within 200.00 of TemporaryPoint2) and do (Actions)
      • Loop - Actions
        • Set PushingUnits_Count = (PushingUnits_Count + 1)
        • Set PushingUnits_Unit[PushingUnits_Count] = (Picked unit)
        • Set PushingUnits_Angle[PushingUnits_Count] = (Angle from TemporaryPoint2 to (Position of (Picked unit)))
        • Set PushingUnits_Speed[PushingUnits_Count] = 30.00
    • Trigger - Turn on keg 2 <gen>
    • Custom script: call RemoveLocation(udg_TemporaryPoint)
    • Custom script: call RemoveLocation(udg_TemporaryPoint2)

And the second trigger:
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • For each (Integer A) from 1 to PushingUnits_Count, do (Actions)
      • Loop - actions
        • Set Point1 = (Position of PushingUnits_Unit[(Integer A)])
        • Set Point2 = (Point1 offset by PushingUnits_Speed[(Integer A)] towards PushingUnits_Angle[(Integer A)] degrees)
        • Unit - Move PushingUnits_Unit[(Integer A)] instantly to Point2
    • Set PushingUnits_Speed[(Integer A)] = (PushingUnits_Speed[(Integer A)] - 0.50)
    • Custom script: call RemoveLocation(udg_Point1)
    • Custom script: call RemoveLocation(udg_Point2)
Variables:
PushingUnits_Angle - VARIABLE TYPE REAL (Array marked)
PushingUnits_Count - VARIABLE TYPE COUNT (Array marked)
PushingUnits_Speed - VARIABLE TYPE REAL (Array marked)
PushingUnits_Unit - VARIABLE TYPE UNIT (Array marked)
 
Level 13
Joined
Jun 1, 2008
Messages
360
Oh right I forgot:
  • Set PushingUnits_Speed[(Integer A)] = (PushingUnits_Speed[(Integer A)] - 0.50)
This will at some point make the unit have a negative speed becoming bigger and bigger...

  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • Set x = 0
    • For each (Integer A) from 1 to PushingUnits_Count, do (Actions)
      • Loop - actions
        • Set Point1 = (Position of PushingUnits_Unit[(Integer A)])
        • Set Point2 = (Point1 offset by PushingUnits_Speed[(Integer A)] towards PushingUnits_Angle[(Integer A)] degrees)
        • Unit - Move PushingUnits_Unit[(Integer A)] instantly to Point2
    • Set PushingUnits_Speed[(Integer A)] = (PushingUnits_Speed[(Integer A)] - 0.50)
    • If PushingUnits_Speed[(Integer A)] less than 0 then
      • Set PushingUnits_Speed[(Integer A)] = 0
      • else Set x = 1
    • Custom script: call RemoveLocation(udg_Point1)
    • Custom script: call RemoveLocation(udg_Point2)
    • If x = 0 then do
      • Trigger - Turn off (this trigger)
      • Set PushingUnits_Count = 0
And in the spell trigger, turn on the second trigger.

knocked units cant move, attack casts etc.
If you want them to be able to do that, you have to use the Jass functions SetUnitX and SetUnitY:
  • Set tempunit = PushingUnits_Unit[(Integer A)]
  • Set posX = X of Point2
  • Set posY = Y of Point2
  • call SetUnitX(udg_tempunit,udg_posX)
  • call SetUnitY(udg_tempunit,udg_posY)
 
Level 5
Joined
Nov 29, 2007
Messages
106
I can't do that, always is something wrong, I attach the map and please do that, maybe my variables are wrong type or something, coz I done everything like you said.
The Keg - ability based on channel
The Keg Projectile - Projectile
The Keg Damage - Thunderclap with damage
 

Attachments

  • HoN~6.w3x
    8.6 MB · Views: 2,642
Level 13
Joined
Jun 1, 2008
Messages
360
You just didn't put all triggers in the loop that's all :)
I also changed the dummies a bit:
The dummy (vulnerable) is now targeted as air, decoration so other units don't attack it, and i disabled both their attack.

Further I made it MUI by using local variables for the temporary points and units, so they stay the same after the wait. (Otherwise if a second unit was casting the same ability it would cause bugs.)

I uploaded the map here:
http://www.megaupload.com/?d=2ZH06WHF
 
Level 5
Joined
Nov 29, 2007
Messages
106
Thanks but bug is here - when u use that u got imba mega giga super uber pro LAG! Each time I use that i got LAG!!! How can I fix that??
 
Status
Not open for further replies.
Top