• 🏆 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!

Problem with custom Projectiles

Status
Not open for further replies.
Ok, I'm trying to make custom projectiles for a map that continue on a straight path, ignoring changes in the Z of the location under them unless the Z is too high causing them to die.

Well it works, to a point.
The problem is that though it works perfectly on flat terrain, when it goes of the edges of cliffs, it gets a sudden jump in altitude that isn't accounted for in the locations Z causing them to make a very ugly vertical climb and then decline.

For an arrow on a straight path, this looks very ugly.

How can I account for this altitude difference?

  • Arrow Movement
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Bb_ArrowGroup and do (Actions)
        • Loop - Actions
          • Set P = (Position of (Picked unit))
          • Set P2 = (P offset by Bb_ProjectileSpeed towards (Facing of (Picked unit)) degrees)
          • -------- Movement --------
          • Unit - Move (Picked unit) instantly to P2
          • -------- Projectiles Height --------
          • Custom script: set udg_Zz_Real = GetLocationZ(udg_P)
          • Custom script: set udg_Zz_Real2 = GetLocationZ(udg_P2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Zz_Real2 Not equal to Zz_Real
            • Then - Actions
              • Set Zz_Real3 = (Load (Key (Picked unit)) of 0 from Bb_Hash)
              • Set Zz_Real4 = (Zz_Real3 - Zz_Real2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Zz_Real4 Less than 0.00
                • Then - Actions
                  • Unit - Remove (Picked unit) from the game
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Zz_Real4 Greater than or equal to 0.00
                • Then - Actions
                  • Animation - Change (Picked unit) flying height to (Zz_Real4 + 10.00) at 99999.00
                • Else - Actions
            • Else - Actions
          • -------- ------------------- --------
          • Custom script: call RemoveLocation(udg_P)
          • Custom script: call RemoveLocation(udg_P2)


Here's the system in Wc3 map form
 
What is Zz_Real3 and Zz_Real2?

Well it's probably unnecasary, but I was too lazy to use arrays
Essentially the original one takes the Z of the original location, the second one takes the Z of the second location, the 3rd one is the height saved in a hash table of the Z and flying height when it was first made, the fourth is the 3rd minus the second
 
If you hold right/left arrow for a bit,camera will start rotating with epic speed,the more you hold it the faster it will rotate and you cant stop it. You should check this bug too.

Well this is just a small system for a larger project I'm working on - that movement system is something I made up pretty quickly, I have a much better one I did in vJass in the actual project.

I've done move systems like this before so I'm aware of that bug, I forget how I did it, but there is a way to get out of that once you get into it. I think it was something like hold both left and right while in that spin thing for a small amount of time and it stops it.
 
Status
Not open for further replies.
Top