• 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] Missile Spell Problem

Status
Not open for further replies.
Level 7
Joined
Feb 18, 2007
Messages
216
I have a missile launcher weapon in my map, which fires a homing missile on the target enemy. The missile will collide with walls and other enemies on the way.

Here's the missile movement trigger. I know it leaks, but that's not my first priority atm.

  • Missile Movement
    • 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
          • (missile is alive) Equal to True
        • Then - Actions
          • Unit - Move missile instantly to ((Position of missile) offset by missile_speed towards ((Facing of missile) + (((Angle from (Position of missile) to (Position of missile_target)) - (Facing of missile)) / 2.00)) degrees), facing ((Facing of missile) + (((Angle from (Position of missile) to (Position of missile_target)) - (Facing of missile)) / 2.00)) degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units within 40.00 of (Position of missile) matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) Not equal to Player 1 (Red)) and (((Owner of (Matching unit)) Not equal to Player 2 (Blue)) and ((Owner of ( Greater than 0
        • Then - Actions
          • Unit - Kill missile
        • Else - Actions
      • For each (Integer A) from 0 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at ((Position of missile) offset by ((Real((Integer A))) x 10.00) towards (Facing of missile) degrees) of type Walkability is off) Equal to True
            • Then - Actions
              • Unit - Kill missile
            • Else - Actions
When enemy is within degrees 0-180 from you (northside), it works as it should. Like this:
missile1.JPG

But when enemy is within degrees 180-360 from you (southside), this is what happens:
missile2.JPG

The problem is within the first action of the trigger, I'm just not able to figure it out. I guess I'm not good enough with math.. So if anyone could explain me where the problem is and how to fix it I'd be very grateful.
 
Level 7
Joined
Feb 18, 2007
Messages
216
Oh, it's supposed to be like that. The trigger moves the missile BETWEEN the facing of missile, and angle between missile and the target. That way it follows the target with small curves. If you understand what I mean..
 
Last edited:
Level 12
Joined
Aug 12, 2008
Messages
350
That's a spell that I made for my map that in process ><
I wonder this will help you? Somehow, I haven't update the indexing system of this spell yet. Thus, this spell is still using an old indexing system. At least it still works perfectly well in my map.
Description
Launch a missile that chases a target unit. The missile explode when it reaches the target or collide with any enemies, damaging nearby enemies within the 225 range of radius of the explode point.
Level 1: 15 x Intelligence of Mortar Team
Level 2: 20 x Intelligence of Mortar Team
Level 3: 25 x Intelligence of Mortar Team
Level 4: 30 x Intelligence of Mortar Team
  • HM cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Homing Missile
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HM_index1 Equal to 0
        • Then - Actions
          • Trigger - Turn on HM loop <gen>
        • Else - Actions
      • Set HM_index1 = (HM_index1 + 1)
      • Set HM_index2 = (HM_index2 + 1)
      • Set HM_check[HM_index2] = False
      • Set HM_caster[HM_index2] = (Triggering unit)
      • -------- -------------------------------------------------------------------------- --------
      • -------- Damage: (15 + 5 x level) x intelligence --------
      • Set HM_damage[HM_index2] = ((10.00 + (5.00 x (Real((Level of Homing Missile for HM_caster[HM_index2]))))) x (Real((Intelligence of HM_caster[HM_index2] (Include bonuses)))))
      • -------- -------------------------------------------------------------------------- --------
      • Set HM_accelerate[HM_index2] = 0.00
      • Set HM_casterpoint = (Position of HM_caster[HM_index2])
      • Set HM_target[HM_index2] = (Target unit of ability being cast)
      • Set HM_targetpoint[HM_index2] = (Position of HM_target[HM_index2])
      • Set HM_dummyfacing[HM_index2] = (Angle from HM_casterpoint to HM_targetpoint[HM_index2])
      • Set HM_dummycreate = (HM_casterpoint offset by 100.00 towards HM_dummyfacing[HM_index2] degrees)
      • Unit - Create 1 Homing Missile for (Owner of HM_caster[HM_index2]) at HM_dummycreate facing HM_dummyfacing[HM_index2] degrees
      • Set HM_dummy[HM_index2] = (Last created unit)
      • Custom script: call RemoveLocation (udg_HM_dummycreate)
      • Custom script: call RemoveLocation (udg_HM_casterpoint)
  • HM loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer HM_index3) from 1 to HM_index2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (HM_dummy[HM_index3] is alive) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • HM_accelerate[HM_index3] Less than 10.00
                • Then - Actions
                  • Set HM_accelerate[HM_index3] = (HM_accelerate[HM_index3] + 1.00)
                • Else - Actions
              • Set HM_dummypoint = (Position of HM_dummy[HM_index3])
              • Set HM_targetpoint[HM_index3] = (Position of HM_target[HM_index3])
              • Set HM_dummyfacing[HM_index3] = (Angle from HM_dummypoint to HM_targetpoint[HM_index3])
              • Set HM_offset = (HM_dummypoint offset by (4.00 + HM_accelerate[HM_index3]) towards HM_dummyfacing[HM_index3] degrees)
              • Unit - Move HM_dummy[HM_index3] instantly to HM_offset, facing HM_dummyfacing[HM_index3] degrees
              • Custom script: call RemoveLocation (udg_HM_offset)
              • Custom script: call RemoveLocation (udg_HM_targetpoint[udg_HM_index3])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units within 150.00 of HM_dummypoint matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of HM_caster[HM_index3])) Equal to True)))) Greater than or equal to 1
                • Then - Actions
                  • Unit - Explode HM_dummy[HM_index3]
                  • Custom script: set bj_wantDestroyGroup = true
                  • Unit Group - Pick every unit in (Units within 225.00 of HM_dummypoint matching ((((Matching unit) belongs to an enemy of (Owner of HM_caster[HM_index3])) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Actions)
                    • Loop - Actions
                      • Unit - Cause HM_caster[HM_index3] to damage (Picked unit), dealing HM_damage[HM_index3] damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect at HM_dummypoint using ExplosionBIG.mdx
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation (udg_HM_dummypoint)
                  • Custom script: call RemoveLocation (udg_HM_targetpoint[udg_HM_index3])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HM_check[HM_index3] Equal to False
                    • Then - Actions
                      • Set HM_check[HM_index3] = True
                      • Set HM_index1 = (HM_index1 - 1)
                    • Else - Actions
                • Else - Actions
              • Custom script: call RemoveLocation (udg_HM_dummypoint)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HM_index1 Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Set HM_index2 = 0
        • Else - Actions
 
Status
Not open for further replies.
Top