• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Projectile System Help

Status
Not open for further replies.
Level 9
Joined
Jan 17, 2009
Messages
372
Hi,
I am making a projectile system but i cannot find out how to make my projectiles adjust to the terrain. For example, if i fire my projectile up a hill it will not run into the hill, it will simply walk over it as if were a unit... Can someone help me fix this..
  • Right Click
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ProjectileNumber Equal to 600
        • Then - Actions
          • Set ProjectileNumber = 0
        • Else - Actions
      • Set ProjectileNumber = (ProjectileNumber + 1)
      • Set Temp_Point[ProjectileNumber] = (Position of Firing_Unit[(Player number of (Triggering player))])
      • Unit - Create 1 Unit_Type[(Player number of (Triggering player))] for (Triggering player) at Temp_Point[ProjectileNumber] facing (Facing of Firing_Unit[(Player number of (Triggering player))]) degrees
      • Set Projectiles[ProjectileNumber] = (Last created unit)
      • Custom script: call RemoveLocation(udg_Temp_Point[udg_ProjectileNumber])
  • Projectiles
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 600, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Projectiles[(Integer A)] is alive) Equal to True
            • Then - Actions
              • Set Temp_Point[(Integer A)] = (Position of Projectiles[(Integer A)])
              • Set Temp_Point2[(Integer A)] = (Temp_Point[(Integer A)] offset by ProjectileSpeed[(Player number of (Owner of Projectiles[(Integer A)]))] towards (Facing of Projectiles[(Integer A)]) degrees)
              • Set ProjectileRegions[(Integer A)] = (Region centered at Temp_Point[(Integer A)] with size (96.00, 96.00))
              • Unit - Move Projectiles[(Integer A)] instantly to Temp_Point2[(Integer A)]
              • Custom script: call RemoveLocation(udg_Temp_Point[GetForLoopIndexA()])
              • Custom script: call RemoveLocation(udg_Temp_Point2[GetForLoopIndexA()])
              • Destructible - Pick every destructible in ProjectileRegions[(Integer A)] and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Destructible-type of (Picked destructible)) Equal to (Destructible-type of (Picked destructible))
                    • Then - Actions
                      • Unit - Kill Projectiles[(Integer A)]
                    • Else - Actions
              • Set LoopCounter[(Integer A)] = (LoopCounter[(Integer A)] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LoopCounter[(Integer A)] Equal to Projectile_Distance[(Player number of (Owner of Projectiles[(Integer A)]))]
                • Then - Actions
                  • Unit - Kill Projectiles[(Integer A)]
                  • Set LoopCounter[(Integer A)] = 0
                • Else - Actions
              • Set Unit_Group[(Integer A)] = (Units in ProjectileRegions[(Integer A)])
              • Unit Group - Pick every unit in (Units in ProjectileRegions[(Integer A)]) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Picked unit) belongs to an ally of (Owner of Projectiles[(Integer A)])) Equal to False
                          • (Life of (Picked unit)) Greater than or equal to 1.00
                    • Then - Actions
                      • Unit - Cause Projectiles[(Integer A)] to damage (Picked unit), dealing Projectile_Damage[(Player number of (Owner of Projectiles[(Integer A)]))] damage of attack type Normal and damage type Normal
                      • Unit - Kill Projectiles[(Integer A)]
                      • Set LoopCounter[(Integer A)] = 0
                    • Else - Actions
              • Custom script: call RemoveRect(udg_ProjectileRegions[GetForLoopIndexA()])
              • Custom script: call DestroyGroup(udg_Unit_Group[GetForLoopIndexA()])
            • Else - Actions
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
Here:
  • Right Click
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ProjectileNumber Equal to 600
        • Then - Actions
          • Set ProjectileNumber = 0
        • Else - Actions
      • Set ProjectileNumber = (ProjectileNumber + 1)
      • Set Temp_Point[ProjectileNumber] = (Position of Firing_Unit[(Player number of (Triggering player))])
      • Unit - Create 1 Unit_Type[(Player number of (Triggering player))] for (Triggering player) at Temp_Point[ProjectileNumber] facing (Facing of Firing_Unit[(Player number of (Triggering player))]) degrees
      • Set Projectiles[ProjectileNumber] = (Last created unit)
      • Custom script: set udg_Height[udg_ProjectileNumber] = GetLocationZ(udg_TempPoint[udg_ProjectileNumber]) + GetUnitFlyHeight(udg_Projectiles[udg_ProjectileNumber])
      • Custom script: call RemoveLocation(udg_Temp_Point[udg_ProjectileNumber])
  • Projectiles
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 600, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Projectiles[(Integer A)] is alive) Equal to True
            • Then - Actions
              • Set Temp_Point[(Integer A)] = (Position of Projectiles[(Integer A)])
              • Set Temp_Point2[(Integer A)] = (Temp_Point[(Integer A)] offset by ProjectileSpeed[(Player number of (Owner of Projectiles[(Integer A)]))] towards (Facing of Projectiles[(Integer A)]) degrees)
              • Custom script: set udg_TempReal = GetLocationZ(udg_TempPoint2[bj_forLoopAIndex])
              • Set Height[(Integer A)] = (Height[(Integer A)] - TempReal)
              • Unit - Set flying height of Projectiles[(Integer A)] to Height[(Integer A)] at a rate of 0
              • Set Height[(Integer A)] = (Height[(Integer A)] + TempReal)
              • Set ProjectileRegions[(Integer A)] = (Region centered at Temp_Point[(Integer A)] with size (96.00, 96.00))
              • Unit - Move Projectiles[(Integer A)] instantly to Temp_Point2[(Integer A)]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Height Less than or Equal to 0
                • Then - Actions
                  • END IT!
                • Else - Actions
              • Custom script: call RemoveLocation(udg_Temp_Point[GetForLoopIndexA()])
              • Custom script: call RemoveLocation(udg_Temp_Point2[GetForLoopIndexA()])
              • Destructible - Pick every destructible in ProjectileRegions[(Integer A)] and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Destructible-type of (Picked destructible)) Equal to (Destructible-type of (Picked destructible))
                    • Then - Actions
                      • Unit - Kill Projectiles[(Integer A)]
                    • Else - Actions
              • Set LoopCounter[(Integer A)] = (LoopCounter[(Integer A)] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LoopCounter[(Integer A)] Equal to Projectile_Distance[(Player number of (Owner of Projectiles[(Integer A)]))]
                • Then - Actions
                  • Unit - Kill Projectiles[(Integer A)]
                  • Set LoopCounter[(Integer A)] = 0
                • Else - Actions
              • Set Unit_Group[(Integer A)] = (Units in ProjectileRegions[(Integer A)])
              • Unit Group - Pick every unit in (Units in ProjectileRegions[(Integer A)]) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Picked unit) belongs to an ally of (Owner of Projectiles[(Integer A)])) Equal to False
                          • (Life of (Picked unit)) Greater than or equal to 1.00
                    • Then - Actions
                      • Unit - Cause Projectiles[(Integer A)] to damage (Picked unit), dealing Projectile_Damage[(Player number of (Owner of Projectiles[(Integer A)]))] damage of attack type Normal and damage type Normal
                      • Unit - Kill Projectiles[(Integer A)]
                      • Set LoopCounter[(Integer A)] = 0
                    • Else - Actions
              • Custom script: call RemoveRect(udg_ProjectileRegions[GetForLoopIndexA()])
              • Custom script: call DestroyGroup(udg_Unit_Group[GetForLoopIndexA()])
            • Else - Actions
I believe this is correct.
Remember to create the variables Height (Real Array) and TempReal (Real).
 
Status
Not open for further replies.
Top