eskimojoe_66
Member
- Reaction score
- 2
Hi, I'm trying to make a spell that fires out a missile, hitting all enemies it passes through once per missile. Although the first missile works as expected, all subsequent casts cause the missiles to damage enemies it passes through multiple times.
For the life of me, I can't figure out what's going wrong! Maybe all I need is a fresh pair of eyes (see GUI code below).
Cast Trigger:
Missile Move/Damage Enemies Trigger:
Any help will be greatly appreciated!
For the life of me, I can't figure out what's going wrong! Maybe all I need is a fresh pair of eyes (see GUI code below).
Cast Trigger:
Code:
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Reaper
Actions
Set WPreaper_lochero = (Position of hero_unit)
Set WPreaper_loccast = (Target point of ability being cast)
Set WPreaper_anglecast = (Angle from WPreaper_lochero to WPreaper_loccast)
Set WPreaper_locspawn = (WPreaper_lochero offset by 50.00 towards WPreaper_anglecast degrees)
Unit - Create 1 missile reaper for Player 1 (Red) at WPreaper_locspawn facing WPreaper_anglecast degrees
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WPreaper_intslots Greater than or equal to 5
Then - Actions
Set WPreaper_intslots = 1
Else - Actions
Set WPreaper_intslots = (WPreaper_intslots + 1)
Unit - Set the custom value of (Last created unit) to WPreaper_intslots
Unit Group - Add (Last created unit) to WPreaper_groupmissile
Trigger - Turn on reaper move <gen>
Custom script: call RemoveLocation(udg_WPreaper_lochero)
Custom script: call RemoveLocation(udg_WPreaper_loccast)
Custom script: call RemoveLocation(udg_WPreaper_locspawn)
Missile Move/Damage Enemies Trigger:
Code:
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in WPreaper_groupmissile) Greater than 0
Then - Actions
Unit Group - Pick every unit in WPreaper_groupmissile and do (Actions)
Loop - Actions
Set WPreaper_tempint = (Custom value of (Picked unit))
Set WPreaper_anglemove = (Facing of (Picked unit))
Set WPreaper_locstart = (Position of (Picked unit))
Set WPreaper_locend = (WPreaper_locstart offset by 7.00 towards WPreaper_anglemove degrees)
Unit - Move (Picked unit) instantly to WPreaper_locend
Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 7.00)
Unit Group - Remove all units from WPreaper_grouptarget
Set WPreaper_grouptarget = (Units within 85.00 of WPreaper_locend matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) is in WPreaper_grouphit[(Custom value of (Picked unit))]) Equal to False)) and (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to
Unit Group - Pick every unit in WPreaper_grouptarget and do (Actions)
Loop - Actions
Unit Group - Add (Picked unit) to WPreaper_grouphit[WPreaper_tempint]
Unit - Cause hero_unit to damage (Picked unit), dealing 90.00 damage of attack type Spells and damage type Normal
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Mana of (Picked unit)) Less than or equal to 0.00
Then - Actions
Unit - Kill (Picked unit)
Unit Group - Remove (Picked unit) from WPreaper_groupmissile
Else - Actions
Custom script: call RemoveLocation(udg_WPreaper_locstart)
Custom script: call RemoveLocation(udg_WPreaper_locend)
Else - Actions
Trigger - Turn off (This trigger)
Any help will be greatly appreciated!