I have finally coded a projectile spell on my test map. I see no way to do it in GUI without using 2 triggers: one to assign the variables and then another one to make the projectile move towards the target every 0.02 seconds:
Now I need to make this MUI with local variables. The problem is that the trigger would assign a local variable every 0.02 seconds, and it still would change in the middle of the spell if the global variable changed. I want the system to do this:
Trigger 1
+ executes with no waits or timers so multiple casts do not affect the globals
+ assigns the caster, target, projectile, etc to globals
+ starts an instance of Trigger 2
Trigger 2
+ converts the globals to locals
+ runs periodic function checking position every 0.02 seconds until impact
+ does not re-assign any locals during the 0.02 second intervals, except projectile position and target position
I know this is possible because this is how Phantom Assassin's dagger spell is coded in DOTA. If anyone has a link to this spell's code or any spell that does what I want (NO I WILL NOT USE STORM BOLT WITH 0.01 STUN).
I have the updated map with my projectile trigger attached. Feel free to mess around with it and check out the spellpower system.
-
fireball1
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Fireball
-
-
Actions
-
Set fireball_target = (Target unit of ability being cast)
-
Set fireball_caster = (Casting unit)
-
Set fireball_damage = ((0.00 + (75.00 x (Real((Level of (Ability being cast) for fireball_caster))))) + ((0.60 + (0.40 x (Real((Level of (Ability being cast) for fireball_caster))))) x (Real((Intelligence of fireball_caster (Include bonuses))))))
-
Unit - Create 1 projectile for (Owner of fireball_caster) at ((Position of fireball_caster) offset by 32.00 towards (Angle from (Position of fireball_caster) to (Position of fireball_target)) degrees) facing (Position of fireball_target)
-
Set fireball_projectile = (Last created unit)
-
Unit - Turn collision for fireball_projectile Off
-
Set fireball_position = (Position of fireball_projectile)
-
Trigger - Turn on fireball2 <gen>
-
-
-
fireball2
-
Events
-
Time - Every 0.02 seconds of game time
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Distance between (Position of fireball_projectile) and (Position of fireball_target)) Less than or equal to 10.00
-
-
Then - Actions
-
Unit - Cause fireball_caster to damage fireball_target, dealing fireball_damage damage of attack type Spells and damage type Fire
-
Unit - Explode fireball_projectile
-
Special Effect - Create a special effect at fireball_position using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
-
Floating Text - Create floating text that reads (- + ((String((Integer(fireball_damage)))) + -)) at (Position of fireball_target) with Z offset 96.00, using font size 14.00, color (100.00%, 92.50%, 0.00%), and 0.00% transparency
-
Floating Text - Change (Last created floating text): Disable permanence
-
Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
-
Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
-
Floating Text - Set the velocity of (Last created floating text) to 256.00 towards (Random real number between 105.00 and 135.00) degrees
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
Set fireball_position = (fireball_position offset by 20.00 towards ((Angle from (Position of fireball_projectile) to (Position of fireball_target)) + (Random real number between 0.00 and 0.00)) degrees)
-
Unit - Move fireball_projectile instantly to fireball_position, facing (Position of fireball_target)
-
-
-
-
Now I need to make this MUI with local variables. The problem is that the trigger would assign a local variable every 0.02 seconds, and it still would change in the middle of the spell if the global variable changed. I want the system to do this:
Trigger 1
+ executes with no waits or timers so multiple casts do not affect the globals
+ assigns the caster, target, projectile, etc to globals
+ starts an instance of Trigger 2
Trigger 2
+ converts the globals to locals
+ runs periodic function checking position every 0.02 seconds until impact
+ does not re-assign any locals during the 0.02 second intervals, except projectile position and target position
I know this is possible because this is how Phantom Assassin's dagger spell is coded in DOTA. If anyone has a link to this spell's code or any spell that does what I want (NO I WILL NOT USE STORM BOLT WITH 0.01 STUN).
I have the updated map with my projectile trigger attached. Feel free to mess around with it and check out the spellpower system.