• 🏆 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] 3d Shooter map problem.

Status
Not open for further replies.
Level 4
Joined
Feb 22, 2006
Messages
31
im making a 3d Shooter map alike Elimination tournament. however i seem to have a problem with my hovering projectile's flying heights when it come close to a high-amplitude height change. thoses r my creation/movement triggers:


  • Create missiles
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to Human Mortar Team - Flare
    • Actions
      • Unit - Create 1 Laser for Player 1 (Red) at ((Position of (Triggering unit)) offset by 70.00 towards (Facing of (Triggering unit)) degrees) facing (Angle from (Position of (Triggering unit)) to (Target point of issued order)) degrees
      • Special Effect - Create a special effect attached to the origin of (Last created unit) using war3mapimported/Projectile.mdl
      • Unit - Turn collision for (Last created unit) Off
      • Set VerticalDistance = ((Z height of (Position of (Triggering unit))) - (Z height of (Target point of issued order)))
      • Set HorizontalDistance = (Distance between (Position of (Triggering unit)) and (Target point of issued order))
      • Set Angle = (Atan((VerticalDistance / HorizontalDistance)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Angle Less than 0.00
        • Then - Actions
          • Unit Group - Add (Last created unit) to MissilesGoUp
          • Set Angle = (Angle - (2.00 x Angle))
          • Unit - Set mana of (Last created unit) to Angle
        • Else - Actions
          • Unit Group - Add (Last created unit) to MissilesGoDown
          • Unit - Set mana of (Last created unit) to Angle
      • Unit - Set life of (Last created unit) to ((Z height of (Position of (Triggering unit))) + 60.00)
      • Game - Display to (All players) the text: (String((Mana of (Last created unit))))


--------------------------------------------------------------------------

  • Move
    • Events
      • Time - Every 0.06 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in MissilesGoDown and do (Actions)
        • Loop - Actions
          • Unit - Add Crow Form to (Picked unit)
          • Set TempPoint1 = (Position of (Picked unit))
          • Set TempPoint2 = (TempPoint1 offset by ((80.00 x (Cos((Mana of (Picked unit))))) + 0.00) towards (Facing of (Picked unit)) degrees)
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (80.00 x (Sin((Mana of (Picked unit))))))
          • Animation - Change (Picked unit) flying height to ((Life of (Picked unit)) - (Z height of TempPoint2)) at 0.00
          • Unit - Move (Picked unit) instantly to TempPoint2
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current flying height of (Picked unit)) Less than or equal to 25.00
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
          • Unit - Remove Crow Form from (Picked unit)
          • Animation - Set current animation for (Picked unit) to its (90 - (Integer((Mana of (Picked unit)))))th animation
          • Custom script: call RemoveLocation (udg_TempPoint1)
          • Custom script: call RemoveLocation (udg_TempPoint2)
      • Unit Group - Pick every unit in MissilesGoUp and do (Actions)
        • Loop - Actions
          • Unit - Add Crow Form to (Picked unit)
          • Set TempPoint1 = (Position of (Picked unit))
          • Set TempPoint2 = (TempPoint1 offset by ((80.00 x (Cos((Mana of (Picked unit))))) + 0.00) towards (Facing of (Picked unit)) degrees)
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (80.00 x (Sin((Mana of (Picked unit))))))
          • Animation - Change (Picked unit) flying height to ((Life of (Picked unit)) - (Z height of TempPoint2)) at 0.00
          • Unit - Move (Picked unit) instantly to TempPoint2
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current flying height of (Picked unit)) Less than or equal to 25.00
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
          • Unit - Remove Crow Form from (Picked unit)
          • Animation - Set current animation for (Picked unit) to its (90 + (Integer((Mana of (Picked unit)))))th animation
          • Custom script: call RemoveLocation (udg_TempPoint1)
          • Custom script: call RemoveLocation (udg_TempPoint2)


-------------------------------------------------------------------------

as you can see, my dummy unit folows a x-y-z trajectory written in its mana.
it also uses its life to retain its base flying height, and then adjust it depending on the terrain height. however, my projectile seems to become crazy for like 0.1 sec when it comes on the really border of a deep hole or Z elevation difference. How can i fix that?


note: my unit movement is "hovering"
 
Level 3
Joined
Apr 4, 2004
Messages
41
I'm not sure what you mean by "high amplitude height change" but if you are implying a drop in the terrain such as if the cliff height were raised then I think i understand your problem. Flying height is always determined from the ground that the unit is currently over, and each raise in cliff height by 1 is about +100 flying height, give or take. So, the same unit with a flying height on cliff height 1 of 100 will then have a relative flying height of 200 from where it used to be once it enters cliff 2. There is not much you can do about this fault in units' flying heights, but all i know is the projectiles used in units' attacks and abilities do not have this problem. Or perhaps I misunderstood you and just wasted my own time and yours since you seem to know what ur doing thusfar.
 
Level 4
Joined
Feb 22, 2006
Messages
31
High amplitude means the terrain height suddenly change from say 0 to -300. the projectile becomes kind of crazy for half a sec when its on the border of the crevasse and then its fine until it reach the other end (and gets crazy again).

i want to know how to fix that =/
 
Level 3
Joined
Apr 4, 2004
Messages
41
It was very intellectual of you to use triangular math to do a 3 dimensional type system, but ultimately it does not seem that something along that lines can cut it when using flying height. Here's an example to explain why using Z heights doesn't translate into flying height well. If you have one unit shooting a projectile at a unit who is 100 units higher on the Z height, that means that there is some change in the cliff level, or possibly a hill. The flying height is ALWAYS calculated from the ground that the object is flying over, whereas the Z height is measured from a common ground. So yes, your projectile will follow the correct path as if it were travelling along the hypotenuse of a triangle, but the second it climbs up to a cliff level that is 1 higher, the height of ur projectile will be about 100 units in flying height higher than your target. Try it out.
 
Level 4
Joined
Feb 22, 2006
Messages
31
i dont really understand what you mean. i know the flying height is calculated from the ground. this is why i set my flying height to "life- z height". lets say the base height of my flying unit is 100 (life=100). it travels at 100 height for like 10 sec. then it falls on a -200 height terrain. the calculations does "100- (-200)". the flying heights become 300. it annihilates the z height of the terrain to ensure the real height of the unit is constant w/e the terrain height is. the projectile becomes crazy only when its on the really border of the crevasse. once its IN it, the height of my projectile is correct.

im not even sure its about triangles...because i often test it by ordering my unit to fire on the other side of a crevasse. the other side point is at the same Z height as my firing unit. however the same thing happens when it comes near the crevasse.
 
Level 3
Joined
Apr 4, 2004
Messages
41
leaks. and if you really want to learn and use math in WE, you should learn jass, it would also make some things unlaggier.

Jass is for bitches. I think i know what you mean now though. You're saying that the area that the unit flies over in between the change in cliff heights is where it messes up i think? I think the problem is that the drop down is a verticle line so the game gets confused as to what the Z height on that verticle line is. Maybe think of it as graphing an undefined equation on a cartesian coordinate system. I THINK thats what the problem is.
 
Level 4
Joined
Feb 22, 2006
Messages
31
its not really on the drop-down. i decided to watch my missile movement on a slow motion and this is what i observed.


projectile's trajectory

------/"\_/------->
_______
--------|
--------|
--------|______________________

I hope my drawing is clear enough...the projectile height becomes slightly higer 0.5 centimeter before the fall, then it goes slightly down 0.5 centimeter after the fall and then comes back up to normal.

i tried checking a few vector-function systems in jass to learn how it work, as most jass can easily be converted in trigger, but every functions i checked were about bouncing balls.

too bad Gadden has protected his map. i just hope what i want to do is possible to do in GUI.


im not even sure the problem comes from my triggers.. it might even be a movement or gameplay constant problem. AARGGH this is tough >.<

FIXED!!!

i replaced my dummy unit (peasant based) by a dummy unit (wisp based) and....it works... =/ thanks for all your time to help me, tough. i really appreciated it.
 
Last edited by a moderator:
Level 7
Joined
Feb 9, 2007
Messages
56
I always wondered how the people got the Z height...

  • Set VerticalDistance = ((Z height of (Position of (Triggering unit))) - (Z height of (Target point of issued order)))[/ trigger]
  • Oo
  • VerticalDistance is a real, isn't it...
  • But there I only got "X of point" and "Y of point" to choose. do you use another editor (like we unlimited) or something like that?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Yes, you do. Or, easier, you can use a "Custom Script" Tag and write this (assuming you have a Point var called myPointVar and a Real var called myRealVar)

Custom script: set udg_myRealVar = GetLocationZ( udg_myPointVar )

It's better not to use editors like WE Unlimited

Oh, and please in the future don't revive threads that are this old.
 
Status
Not open for further replies.
Top