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

How to create units in a line

Status
Not open for further replies.
Level 39
Joined
Feb 27, 2007
Messages
4,992
Depending on what you're using:
native CreateUnit takes player id, integer unitid, real x, real y, real face
  • Unit - Create 1 <whatever> for Player 1 at <location> facing Default building facing degrees
To damage enemies it depends how you want to do that. One time? Multiple times? DoT? Other conditions? You could use dummy units with Permanent Immolation (base on item version) to do the damage but the right unit won't get kill credit and the damage isn't very easily configured that way. Need more details.
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,492
Simple.

Haven't played DotA in forever, but give the Hero a simple point-target dummy spell (does nothing), then use a Trigger to create a special Dummy Caster (with Movespeed equal to however fast you want the 'line' to move).

Give this DC a custom ability based off of "Factory" (not "Pocket Factory"), of which you can modify the spawn-rate, life-time, and unit-type of unit summoned. In the same Trigger that you created him, Order the DC to Move to the Target Point of Ability Being Cast.

To make them damage, either give them a modified Permanent Immolation (as Pyrogasm suggested, though the issue of buff-stacking is raised), or alternatively, give them timed life/-hp regen & a modified "AoE Explode On Death" ability.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Take a look at this...

  • Untitled Trigger 023
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fissure
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempPoint = (Position of TempUnit)
      • Set TempPoint2 = (Target point of ability being cast)
      • Set TempReal = (Angle from TempPoint to TempPoint2)
      • Custom script: set udg_TempGroup = CreateGroup()
      • For each (Integer TempInteger) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set TempPoint3 = (TempPoint offset by (someDistance x (Real(TempInteger))) towards TempReal degrees)
          • Unit - Create 1 FissurePiece for (Owner of TempUnit) at TempPoint3 facing Default building facing degrees
          • Unit - Add a X second Generic expiration timer to (Last created unit)
          • Set TempGroup = (Units within someRange of TempPoint3)
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Set TempUnit2 = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit2 belongs to an enemy of (Owner of TempUnit)) Equal to True
                  • (TempUnit2 is in TempGroup) Equal to False
                  • // Other Conditions
                • Then - Actions
                  • Unit Group - Add TempUnit2 to TempGroup
                  • Unit - Cause TempUnit to damage TempUnit2, dealing someDamage damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint3)
          • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call DestroyGroup(udg_TempGroup)

So what's happening here is:

Unit casts the spell
We save their position
We save their target position
We use these two points to find the angle to make the wall along.

We create a group so units can be added to it and not damaged by multiple "pieces"

The Loop from 1 to 10 is an example of a distance, it could be longer or shorter.
Inside the loop we create a piece of the fissure at each offset so its basically a "line" of units. The someDistance is how close together these units should be.

It then creates a piece of the fissure, you add a generic expiration to the unit so it dies when the duration of the spell should end.

Each time a piece of the fissure spawns, we want to check around the unit to deal damage to it. So we create a group and search for acceptable targets. If you want it to stun, you'd probably create a unit before this loop and have that dummy do all the stunning rather than creating one per unit.

We add the unit to the tempgroup so it is not damaged/stunned more than once.

Rest is removing leaks.
 
Last edited:
Level 3
Joined
Aug 29, 2016
Messages
56
Depending on what you're using:
native CreateUnit takes player id, integer unitid, real x, real y, real face
  • Unit - Create 1 <whatever> for Player 1 at <location> facing Default building facing degrees
To damage enemies it depends how you want to do that. One time? Multiple times? DoT? Other conditions? You could use dummy units with Permanent Immolation (base on item version) to do the damage but the right unit won't get kill credit and the damage isn't very easily configured that way. Need more details.
one time only, right after spellcast
 
Level 3
Joined
Aug 29, 2016
Messages
56
Take a look at this...

  • Untitled Trigger 023
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fissure
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempPoint = (Position of TempUnit)
      • Set TempPoint2 = (Target point of ability being cast)
      • Set TempReal = (Angle from TempPoint to TempPoint2)
      • Custom script: set udg_TempGroup = CreateGroup()
      • For each (Integer TempInteger) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set TempPoint3 = (TempPoint offset by (someDistance x (Real(TempInteger))) towards TempReal degrees)
          • Unit - Create 1 FissurePiece for (Owner of TempUnit) at TempPoint3 facing Default building facing degrees
          • Unit - Add a X second Generic expiration timer to (Last created unit)
          • Set TempGroup = (Units within someRange of TempPoint3)
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Set TempUnit2 = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit2 belongs to an enemy of (Owner of TempUnit)) Equal to True
                  • (TempUnit2 is in TempGroup) Equal to False
                  • // Other Conditions
                • Then - Actions
                  • Unit Group - Add TempUnit2 to TempGroup
                  • Unit - Cause TempUnit to damage TempUnit2, dealing someDamage damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint3)
          • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call DestroyGroup(udg_TempGroup)

So what's happening here is:

Unit casts the spell
We save their position
We save their target position
We use these two points to find the angle to make the wall along.

We create a group so units can be added to it and not damaged by multiple "pieces"

The Loop from 1 to 10 is an example of a distance, it could be longer or shorter.
Inside the loop we create a piece of the fissure at each offset so its basically a "line" of units. The someDistance is how close together these units should be.

It then creates a piece of the fissure, you add a generic expiration to the unit so it dies when the duration of the spell should end.

Each time a piece of the fissure spawns, we want to check around the unit to deal damage to it. So we create a group and search for acceptable targets. If you want it to stun, you'd probably create a unit before this loop and have that dummy do all the stunning rather than creating one per unit.

We add the unit to the tempgroup so it is not damaged/stunned more than once.

Rest is removing leaks.
thank you! it helped me, but does it only summon three fissurepieces? like 0= fissure: C=Caster: C 0 0 0 looks like these.it has gaps. But much appreciated, thank you again :)
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
So I've done some more testing and coding for it. Take a look at the test map and see if its to your liking.

  • Fissure
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fissure
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempPlayer = (Owner of TempUnit)
      • Set TempPoint = (Position of TempUnit)
      • Set TempPoint2 = (Target point of ability being cast)
      • Set TempReal = (Angle from TempPoint to TempPoint2)
      • Custom script: set udg_TempGroup = CreateGroup()
      • For each (Integer TempInteger) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set TempPoint3 = (TempPoint offset by (100.00 x (Real(TempInteger))) towards TempReal degrees)
          • Unit - Create 1 Fissure Piece for TempPlayer at TempPoint3 facing (Facing of TempUnit) degrees
          • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
          • Unit - Create 1 Path Blocker Dummy for TempPlayer at TempPoint3 facing (Facing of TempUnit) degrees
          • Custom script: call SetUnitX(bj_lastCreatedUnit, GetLocationX(udg_TempPoint3))
          • Custom script: call SetUnitY(bj_lastCreatedUnit, GetLocationY(udg_TempPoint3))
          • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
          • Set TempGroup2 = (Units within 100.00 of TempPoint3)
          • Unit Group - Pick every unit in TempGroup2 and do (Actions)
            • Loop - Actions
              • Set TempUnit3 = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit3 belongs to an enemy of (Owner of TempUnit)) Equal to True
                  • (TempUnit3 is in TempGroup) Equal to False
                • Then - Actions
                  • Unit Group - Add TempUnit3 to TempGroup
                  • Unit - Create 1 Generic Dummy for (Owner of TempUnit3) at TempPoint3 facing Default building facing degrees
                  • Set TempUnit4 = (Last created unit)
                  • Unit - Add Fissure Stun to TempUnit4
                  • Unit - Set level of Fissure Stun for TempUnit4 to (Level of Fissure for TempUnit)
                  • Unit - Add a 1.00 second Generic expiration timer to TempUnit4
                  • Unit - Order TempUnit4 to Human Mountain King - Storm Bolt TempUnit3
                  • Unit - Cause TempUnit to damage TempUnit3, dealing (100.00 x (Real((Level of Fissure for TempUnit)))) damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint3)
          • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call DestroyGroup(udg_TempGroup)
 

Attachments

  • Fissure Ex.w3x
    18.9 KB · Views: 23
Level 3
Joined
Aug 29, 2016
Messages
56
So I've done some more testing and coding for it. Take a look at the test map and see if its to your liking.

  • Fissure
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fissure
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempPlayer = (Owner of TempUnit)
      • Set TempPoint = (Position of TempUnit)
      • Set TempPoint2 = (Target point of ability being cast)
      • Set TempReal = (Angle from TempPoint to TempPoint2)
      • Custom script: set udg_TempGroup = CreateGroup()
      • For each (Integer TempInteger) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set TempPoint3 = (TempPoint offset by (100.00 x (Real(TempInteger))) towards TempReal degrees)
          • Unit - Create 1 Fissure Piece for TempPlayer at TempPoint3 facing (Facing of TempUnit) degrees
          • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
          • Unit - Create 1 Path Blocker Dummy for TempPlayer at TempPoint3 facing (Facing of TempUnit) degrees
          • Custom script: call SetUnitX(bj_lastCreatedUnit, GetLocationX(udg_TempPoint3))
          • Custom script: call SetUnitY(bj_lastCreatedUnit, GetLocationY(udg_TempPoint3))
          • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
          • Set TempGroup2 = (Units within 100.00 of TempPoint3)
          • Unit Group - Pick every unit in TempGroup2 and do (Actions)
            • Loop - Actions
              • Set TempUnit3 = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit3 belongs to an enemy of (Owner of TempUnit)) Equal to True
                  • (TempUnit3 is in TempGroup) Equal to False
                • Then - Actions
                  • Unit Group - Add TempUnit3 to TempGroup
                  • Unit - Create 1 Generic Dummy for (Owner of TempUnit3) at TempPoint3 facing Default building facing degrees
                  • Set TempUnit4 = (Last created unit)
                  • Unit - Add Fissure Stun to TempUnit4
                  • Unit - Set level of Fissure Stun for TempUnit4 to (Level of Fissure for TempUnit)
                  • Unit - Add a 1.00 second Generic expiration timer to TempUnit4
                  • Unit - Order TempUnit4 to Human Mountain King - Storm Bolt TempUnit3
                  • Unit - Cause TempUnit to damage TempUnit3, dealing (100.00 x (Real((Level of Fissure for TempUnit)))) damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint3)
          • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call DestroyGroup(udg_TempGroup)
yeah,, i'll try it. uhh how do i make a unit move to a specific distance?, also damaging anything it passes
 
Level 39
Joined
Feb 27, 2007
Messages
4,992
Unit - move UNIT to LOCATION
Or SetUnitX() and SetUnitY()

To damage, check out what pOke did-- get a group of the units in range and use the "Unit - Cause UNIT to damage UNIT for X damage of attack type spells and damage type normal" command like he did.
 
Status
Not open for further replies.
Top