Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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
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 --------
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
