• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Magic Missile (moving dummy)

Status
Not open for further replies.
Level 16
Joined
Jun 25, 2008
Messages
1,043
  • Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Magic Missile
    • Actions
      • Set MM_PlayerNumber = (Player number of (Owner of (Casting unit)))
      • Set MM_Caster[MM_PlayerNumber] = (Casting unit)
      • Set MM_TempPoint[1] = (Position of (Casting unit))
      • Set MM_TempPoint[2] = (Position of (Target unit of ability being cast))
      • Set MM_TempPoint[3] = (MM_TempPoint[1] offset by 5.00 towards (Angle from MM_TempPoint[1] to MM_TempPoint[2]) degrees)
      • Unit - Create 1 Magic Missile dummy for Player 1 (Red) at MM_TempPoint[3] facing (Distance between MM_TempPoint[1] and MM_TempPoint[2]) degrees
      • Set MM_Missile[MM_PlayerNumber] = (Last created unit)
      • Unit Group - Add MM_Missile[MM_PlayerNumber] to MM_ActiveMissiles
      • Custom script: call RemoveLocation(udg_MM_TempPoint[1])
      • Custom script: call RemoveLocation(udg_MM_TempPoint[2])
      • Custom script: call RemoveLocation(udg_MM_TempPoint[3])
  • Movement
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in MM_ActiveMissiles and do (Actions)
        • Loop - Actions
          • Set MM_TempPoint[1] = (Position of (Picked unit))
          • Set MM_TempPoint[2] = (MM_TempPoint[1] offset by 30.00 towards (Facing of (Picked unit)) degrees)
          • Set MM_MissileTargets = (Units within 50.00 of (Position of MM_Missile[MM_PlayerNumber]))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (MM_Missile[MM_PlayerNumber] is alive) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain pathing at MM_TempPoint[2] of type Walkability is off) Equal to False
                • Then - Actions
                  • Unit - Move MM_Missile[MM_PlayerNumber] instantly to MM_TempPoint[2]
                  • Unit - Kill MM_Missile[MM_PlayerNumber]
                  • Unit Group - Remove MM_Missile[MM_PlayerNumber] from MM_ActiveMissiles
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in MM_MissileTargets) Greater than or equal to 1
                    • Then - Actions
                      • Unit Group - Pick every unit in MM_MissileTargets and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Picked unit) belongs to an enemy of (Owner of MM_Caster[MM_PlayerNumber])) Equal to True
                            • Then - Actions
                              • Unit - Cause MM_Caster[MM_PlayerNumber] to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Magic
                            • Else - Actions
                      • Set MM_TempPoint[3] = (Position of MM_Missile[MM_PlayerNumber])
                      • Special Effect - Create a special effect at MM_TempPoint[3] using Abilities\Spells\Items\AIil\AIilTarget.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • Set MM_TempPoint[3] = (Position of MM_Missile[MM_PlayerNumber])
                      • Special Effect - Create a special effect at MM_TempPoint[3] using Abilities\Spells\Items\AIil\AIilTarget.mdl
                      • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Unit - Kill MM_Missile[MM_PlayerNumber]
                  • Unit Group - Remove MM_Missile[MM_PlayerNumber] from MM_ActiveMissiles
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in MM_MissileTargets) Greater than or equal to 1
                    • Then - Actions
                      • Unit Group - Pick every unit in MM_MissileTargets and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Picked unit) belongs to an enemy of (Owner of MM_Caster[MM_PlayerNumber])) Equal to True
                            • Then - Actions
                              • Unit - Cause MM_Caster[MM_PlayerNumber] to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Magic
                            • Else - Actions
                      • Set MM_TempPoint[3] = (Position of MM_Missile[MM_PlayerNumber])
                      • Special Effect - Create a special effect at MM_TempPoint[3] using Abilities\Spells\Items\AIil\AIilTarget.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • Set MM_TempPoint[3] = (Position of MM_Missile[MM_PlayerNumber])
                      • Special Effect - Create a special effect at MM_TempPoint[3] using Abilities\Spells\Items\AIil\AIilTarget.mdl
                      • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Set MM_Caster[MM_PlayerNumber] = No unit
              • Set MM_Missile[MM_PlayerNumber] = No unit
              • Custom script: call RemoveLocation(udg_MM_TempPoint[1])
              • Custom script: call RemoveLocation(udg_MM_TempPoint[2])
              • Custom script: call RemoveLocation(udg_MM_TempPoint[3])
              • Custom script: call DestroyGroup(udg_MM_MissileTargets)
              • Trigger - Turn off (This trigger)
          • Set MM_Caster[MM_PlayerNumber] = No unit
          • Set MM_Missile[MM_PlayerNumber] = No unit
          • Custom script: call RemoveLocation(udg_MM_TempPoint[1])
          • Custom script: call RemoveLocation(udg_MM_TempPoint[2])
          • Custom script: call RemoveLocation(udg_MM_TempPoint[3])
          • Custom script: call DestroyGroup(udg_MM_MissileTargets)

Hai. Where did I go wrong?
It just does nothing at all.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Try removing this condition:

  • (Terrain pathing at MM_TempPoint[2] of type Walkability is off) Equal to False
Apparently that pathing checking action is weird and I think I've heard that it actually returns the opposite. Anyways, that condition still won't work if there is some kind of an obstacle in the way, this just checks if the tile is generally unwalkable.

Anyways, that's the only thing that could cause nothing happening at all (as far as I can see atm).

Btw, a really minor thing, you don't need this:

  • Set MM_Caster[MM_PlayerNumber] = No unit
  • Set MM_Missile[MM_PlayerNumber] = No unit
Globals that are not nullified don't leak. But nice leak cleaning :D
 
Level 16
Joined
Jun 25, 2008
Messages
1,043
Heh, I'll try changing that when I get home again :)

Because I really can't see what else would cause the problem :p
(That walkability thing was mostly to make the unit stop at pathing blockers.. ^^)

I know the importance of leak cleaning, therefore I'm trying to learn everything about it so that it comes automatically in the future :]
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Try inserting a Game - Display text (or whatever it's called) here:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Terrain pathing at MM_TempPoint[2] of type Walkability is off) Equal to False
    • Then - Actions
      • Game - Display blabla
If the message isn't displayed when you test the map, then you know there's something wrong with the conditions.
 
Status
Not open for further replies.
Top