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

DotA - Powershot

Status
Not open for further replies.
Level 8
Joined
Apr 30, 2009
Messages
338
Can anyone post a link to the code for the Powershot spell from DotA's Windrunner, or any other triggered line damage spell?
 
Level 11
Joined
Apr 6, 2008
Messages
760
Create a dummy unit and move it with acceleration? And for the damage part have like a real like 1.0 at the start and for every hit it does reduce it 0.1 (this makes it deal 10% less dmg each hit). Quite a basic projectile spell
 
Level 8
Joined
Apr 30, 2009
Messages
338
Create a dummy unit and move it with acceleration? And for the damage part have like a real like 1.0 at the start and for every hit it does reduce it 0.1 (this makes it deal 10% less dmg each hit). Quite a basic projectile spell

That's why I want the code
 
Level 11
Joined
Apr 6, 2008
Messages
760
Tried too make this one in GUI but havnt used GUI in like 2 years now, so it was very confusing ^^ You have so bad over view of the triggers. JASS ftw! (Could make you a VJass script in a sec if you'd like)

EDIT: Made a basic projectile spell for you, so you can see how you make the movement and stuff :)

  • Power Shot Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set PowerShot_Hashtable = (Last created hashtable)
  • Power Shot Cast
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to 'YourSpell'
    • Actions
      • -------- Casting Unit --------
      • Set TempUnit = (Triggering unit)
      • -------- Location of the casting unit --------
      • Set TempLoc = (Position of TempUnit)
      • -------- Location where the spell was casted --------
      • Set TempLoc2 = (Target point of ability being cast)
      • -------- ------------------------------------------ --------
      • -------- Save Data to the hasttable --------
      • -------- ------------------------------------------ --------
      • -------- Save angle between the hero and the target location --------
      • Hashtable - Save (Angle from TempLoc to TempLoc2) as 0 of (Key (Triggering unit)) in PowerShot_Hashtable
      • -------- Save Dummy unit (that is the projectile) --------
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at TempLoc facing TempLoc2
      • Hashtable - Save Handle Of(Last created unit) as 1 of (Key (Picked unit)) in PowerShot_Hashtable
      • -------- ------------------------------------------ --------
      • -------- Save the caster in the group --------
      • -------- ------------------------------------------ --------
      • Unit Group - Add (Triggering unit) to PowerShot_Group
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PowerShot_Count Equal to 0
        • Then - Actions
          • Trigger - Turn on Power Shot Move <gen>
        • Else - Actions
      • Set PowerShot_Count = (PowerShot_Count + 1)
  • Power Shot Move
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in PowerShot_Group and do (Actions)
        • Loop - Actions
          • -------- Load the stuff we save the the hash (or well the unit atleast) --------
          • Set TempUnit = (Load 1 of (Key (Picked unit)) in PowerShot_Hashtable)
          • Set TempLoc = (Position of TempUnit)
          • -------- You can see i load the angle in this line below (Reals cant leak and i only need to load it once) --------
          • Set TempLoc2 = (TempLoc offset by 10.00 towards (Load 0 of (Key (Picked unit)) from PowerShot_Hashtable) degrees)
          • -------- Move the dummy --------
          • Unit - Move TempUnit instantly to TempLoc2
          • -------- Below here you prolly want some thing that stops the spell eg. when it move X distance or something --------
These 2 last triggers leaks as hell, but well we can get everything here in life
 
Level 8
Joined
Apr 30, 2009
Messages
338
I already know exactly how to code the spell to do damage in a line, but it is impossible to make MUI.

All I need is how they make the spell MUI.

My problem is with my spell Infernal Wave, it causes damage in a line.

I make it pick all enemy units in 200 range of the projectile and do the following:
Deal damage
Add unit to "was hit" unit group

I can't have it MUI if the "was hit" group is a global variable (I am not going to make an 8192 array for it). But there is no way I can see, even with hashtables, to make it MUI. Since the hashtable unit group handle must refer to a global unit group.

For now, I have it MPI with "was hit [number of triggering player]" but this is still half-assed and it must be MUI if at all possible.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
there you go

  • Events
    • Unit - A unit Is issued an order targeting an object
    • Unit - A unit Is issued an order targeting a point
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Rifleman
  • Actions
    • Set loc = (Position of (Triggering unit))
    • Set loc2 = (Target point of issued order)
    • Set a = (Angle from loc to loc2)
    • Set Missile_Max = (Missile_Max + 1)
    • Set Missile_Damage[Missile_Max] = 50.00
    • Set Missile_Caster[Missile_Max] = (Triggering unit)
    • Unit - Create 1 Footman for (Owner of (Triggering unit)) at loc facing a degrees
    • Set Missile_Unit[Missile_Max] = (Last created unit)
    • Set Missile_Speed[(Missile_Max x 3)] = 30.00
    • Set Missile_Speed[((Missile_Max x 3) + 1)] = (Missile_Speed[(Missile_Max x 3)] x (Cos(a)))
    • Set Missile_Speed[((Missile_Max x 3) + 2)] = (Missile_Speed[(Missile_Max x 3)] x (Sin(a)))
    • -------- you may cut all the distance stuff by adding an expiration timer to the dummy --------
    • -------- cause expiration timers are 100% accurate (unlike "waits") --------
    • Set Missile_Distance[(Missile_Max x 2)] = 0.00
    • Set Missile_Distance[((Missile_Max x 2) + 1)] = 1000.00
    • Custom script: call RemoveLocation( udg_loc )
    • Custom script: call RemoveLocation( udg_loc2 )
    • Trigger - Turn on MissileLoop <gen>
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • For each (Integer i) from 1 to Missile_Max, do (Actions)
      • Loop - Actions
        • Set Missile_Distance[(i x 2)] = (Missile_Distance[(i x 2)] + Missile_Speed[(i x 3)])
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Missile_Caster[i] Not equal to No unit
            • Missile_Unit[i] Not equal to No unit
            • (Missile_Caster[i] is dead) Equal to False
            • (Missile_Unit[i] is dead) Equal to False
            • Missile_Distance[(i x 2)] Less than or equal to Missile_Distance[((i x 2) + 1)]
          • Then - Actions
            • -------- this part moves the unit --------
            • Custom script: set udg_x = GetUnitX( udg_Missile_Unit[udg_i] )
            • Custom script: set udg_y = GetUnitY( udg_Missile_Unit[udg_i] )
            • Set x = (x + Missile_Speed[((i x 3) + 1)])
            • Set y = (y + Missile_Speed[((i x 3) + 2)])
            • Custom script: call SetUnitX( udg_Missile_Unit[udg_i], udg_x )
            • Custom script: call SetUnitY( udg_Missile_Unit[udg_i], udg_y )
            • -------- this part deals the damage --------
            • Set loc = (Point(x, y))
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Units within 128.00 of loc matching ((((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False)) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is Magic Immune) Equal to False) and (((( and do (Actions)
              • Loop - Actions
                • Unit Group - Add (Picked unit) to Missile_Struck[i]
                • Unit - Cause Missile_Caster[i] to damage (Picked unit), dealing Missile_Damage[i] damage of attack type Spells and damage type Normal
                • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
                • Special Effect - Destroy (Last created special effect)
                • -------- this decreases the damage by 10% every hit --------
                • Set Missile_Damage[i] = (Missile_Damage[i] x 0.90)
            • Custom script: call RemoveLocation( udg_loc )
          • Else - Actions
            • Unit - Kill Missile_Unit[i]
            • -------- this shifts data --------
            • Set Missile_Unit[i] = Missile_Unit[Missile_Max]
            • Set Missile_Caster[i] = Missile_Caster[Missile_Max]
            • Set Missile_Damage[i] = Missile_Damage[Missile_Max]
            • Unit Group - Remove all units from Missile_Struck[i]
            • Unit Group - Add all units of Missile_Struck[Missile_Max] to Missile_Struck[i]
            • Unit Group - Remove all units from Missile_Struck[Missile_Max]
            • Set Missile_Speed[(i x 3)] = Missile_Speed[(Missile_Max x 3)]
            • Set Missile_Speed[((i x 3) + 1)] = Missile_Speed[((Missile_Max x 3) + 1)]
            • Set Missile_Speed[((i x 3) + 2)] = Missile_Speed[((Missile_Max x 3) + 2)]
            • Set Missile_Distance[(i x 2)] = Missile_Distance[(Missile_Max x 2)]
            • Set Missile_Distance[((i x 2) + 1)] = Missile_Distance[((Missile_Max x 2) + 1)]
            • Set Missile_Max = (Missile_Max - 1)
            • Set i = (i - 1)
            • -------- if there are no units left this trigger will be stopped --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Missile_Max Less than 1
              • Then - Actions
                • Trigger - Turn off (This trigger)
              • Else - Actions
right now the periodic unit group pic is the biggest performance eater so you should look out for some JASS dude who'll make you a function or something which damages units in an aoe around x/y-coordinates, adds them to a unit group and creates a special effect

the other stuff should be perfect (I hope)
at least you can spam it a few times without breaking the game

edit:
made damage adjustable
 

Attachments

  • Missile.w3x
    21.7 KB · Views: 188
Status
Not open for further replies.
Top