• 🏆 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] Parabola Glitch

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
Hi poeple iv been new using some formula to make my own jump/missile engine :at first i wanted to make it jumps than adding missile compatibility while giving xtra option to make them as spell anyway this isnt engine for the moment but more as a spell


glitch : if i target in a terrain height same as me its ok but if i spell on a cliff the go right until its reach a certain point than its glitch
gui can eyes bleed so i added code and mini map :/ i am new into those parabola so plz give exemple ^^ + any tips concerning formula is appreciated


i guess i would neex tra variable to check if the height end is higher than height start than etc ..... but i dont know it O_O can some1 show me an well explained exemple on how i could fix it + im not really sure if i used best way to detect of the missile course was end or not

here i added a picture of the glitch : the red circle is supposed to be the end point





  • JumpX Engine
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ice Missile
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • JPX_Index_Size Equal to 0
        • Then - Actions
          • Trigger - Turn on JumpX Loop <gen>
        • Else - Actions
      • -------- Increase the index size --------
      • Set JPX_Index_Size = (JPX_Index_Size + 1)
      • -------- Dynamic Index --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • JPX_Index_Size Greater than JPX_Index_maxSize
        • Then - Actions
          • Set JPX_Index[JPX_Index_Size] = JPX_Index_Size
          • Set JPX_Index_maxSize = JPX_Index_Size
        • Else - Actions
      • -------- Dynamic Index End --------
      • Set JPXInt = JPX_Index[JPX_Index_Size]
      • -------- Setup those arrays --------
      • -------- ################ --------
      • Set TempLoc = (Position of (Triggering unit))
      • Set TempLoc2 = (Target point of ability being cast)
      • Set JPX_POINT[JPXInt] = (Target point of ability being cast)
      • -------- ################ --------
      • Set JPX_CASTER[JPXInt] = (Triggering unit)
      • Set JPX_ANGLE[JPXInt] = (Angle from TempLoc to TempLoc2)
      • Set JPX_SPEED[JPXInt] = 75.00
      • Set JPX_CurDistance[JPXInt] = 0.00
      • Set JPX_MaxDistance[JPXInt] = (Distance between TempLoc and TempLoc2)
      • Set JPX_FHEIGHT[JPXInt] = 0.00
      • Set JPX_Formula[JPXInt] = 0.00
      • -------- ################ --------
      • -------- if true than set arc if false set max height --------
      • Set JPX_ARCYesNo[JPXInt] = True
      • Set JPX_ARC[JPXInt] = 0.15
      • Set JPX_MAXHEIGHT[JPXInt] = 700.00
      • -------- ################ --------
      • Unit - Create 1 DummyMissile for (Owner of JPX_CASTER[JPXInt]) at TempLoc facing (Angle from TempLoc to TempLoc2) degrees
      • Set JPX_MISSILE[JPXInt] = (Last created unit)
      • Set TempLoc3 = (Position of JPX_MISSILE[JPXInt])
      • -------- ################ --------
      • Special Effect - Create a special effect attached to the origin of JPX_MISSILE[JPXInt] using Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
      • Set JPX_SFX[JPXInt] = (Last created special effect)
      • -------- ################ --------
      • Set JPX_BOOLEAN[JPXInt] = True
      • Set JPX_BOOLEANBomb[JPXInt] = True
      • -------- basic stuff to make the missile take height when need :) --------
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add Storm Crow Form to JPX_MISSILE[JPXInt]
      • Unit - Remove Storm Crow Form from JPX_MISSILE[JPXInt]
      • Custom script: set udg_JPX_FHEIGHT[udg_JPXInt] = GetLocationZ(udg_TempLoc3 ) + GetUnitDefaultFlyHeight( udg_JPX_MISSILE[udg_JPXInt] )
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call RemoveLocation(udg_TempLoc2)
      • Custom script: call RemoveLocation(udg_TempLoc3)
  • JumpX Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer JPX_LOOP) from 1 to JPX_Index_Size, do (Actions)
        • Loop - Actions
          • -------- This let look everything cleaner. --------
          • Set JPXInt = JPX_Index[JPX_LOOP]
          • Set TempLoc = (Position of JPX_MISSILE[JPXInt])
          • Set JPX_CURRENTHEIGHT[JPXInt] = (Current flying height of JPX_MISSILE[JPXInt])
          • Set JPX_CurDistance[JPXInt] = (JPX_CurDistance[JPXInt] + JPX_SPEED[JPXInt])
          • -------- Condition... --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • JPX_CURRENTHEIGHT[JPXInt] Greater than or equal to JPX_INITIALHEIGHT[JPXInt]
              • JPX_CurDistance[JPXInt] Less than JPX_MaxDistance[JPXInt]
            • Then - Actions
              • -------- Actions --------
              • Set TempLoc2 = (TempLoc offset by JPX_SPEED[JPXInt] towards JPX_ANGLE[JPXInt] degrees)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • JPX_ARCYesNo[JPXInt] Equal to True
                • Then - Actions
                  • Custom script: set udg_JPX_Formula2[udg_JPXInt] = ( 4 * udg_JPX_ARC[udg_JPXInt])
                • Else - Actions
                  • Custom script: set udg_JPX_Formula2[udg_JPXInt] = ( 4 * udg_JPX_MAXHEIGHT[udg_JPXInt] / udg_JPX_MaxDistance[udg_JPXInt])
              • Custom script: set udg_JPX_Formula3[udg_JPXInt] = (udg_JPX_MaxDistance[udg_JPXInt] - udg_JPX_CurDistance[udg_JPXInt])
              • Custom script: set udg_JPX_Formula4 [udg_JPXInt] =(udg_JPX_CurDistance[udg_JPXInt] / udg_JPX_MaxDistance[udg_JPXInt])
              • Custom script: set udg_JPX_Formula[udg_JPXInt] = udg_JPX_Formula2[udg_JPXInt] * udg_JPX_Formula3[udg_JPXInt] * udg_JPX_Formula4[udg_JPXInt] - GetLocationZ( udg_TempLoc ) + udg_JPX_FHEIGHT[udg_JPXInt]
              • Animation - Change JPX_MISSILE[JPXInt] flying height to JPX_Formula[JPXInt] at 0.00
              • Unit - Move JPX_MISSILE[JPXInt] instantly to TempLoc2, facing JPX_ANGLE[JPXInt] degrees
              • Custom script: call RemoveLocation(udg_TempLoc2)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • JPX_BOOLEANBomb[JPXInt] Equal to True
                  • JPX_CurDistance[JPXInt] Greater than or equal to JPX_MaxDistance[JPXInt]
                • Then - Actions
                  • Set JPX_BOOLEANBomb[JPXInt] = False
                  • Game - Display to (All players) the text: KILL THE MISSILE
                  • Unit - Kill JPX_MISSILE[JPXInt]
                  • Special Effect - Destroy JPX_SFX[JPXInt]
                  • Unit - Create 1 DummyMissile for (Owner of JPX_CASTER[JPXInt]) at TempLoc facing Default building facing degrees
                  • Set JPX_DUMMY[JPXInt] = (Last created unit)
                  • Unit - Add a 1.00 second Generic expiration timer to JPX_DUMMY[JPXInt]
                  • Animation - Change JPX_DUMMY[JPXInt]'s size to (300.00%, 300.00%, 300.00%) of its original size
                  • Animation - Change JPX_DUMMY[JPXInt]'s vertex coloring to (25.00%, 25.00%, 100.00%) with 0.00% transparency
                  • Animation - Change JPX_DUMMY[JPXInt]'s animation speed to 25.00% of its original speed
                  • Special Effect - Create a special effect attached to the origin of JPX_DUMMY[JPXInt] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Special Effect - Create a special effect attached to the origin of JPX_DUMMY[JPXInt] using Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
              • -------- SPELL END --------
              • -------- i use a counter to replace wait ^^ so spell will end after some effect :P --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • JPX_COUNTER[JPXInt] Greater than or equal to 3
                  • JPX_XCOUNTER[JPXInt] Less than 5
                  • JPX_BOOLEANBomb[JPXInt] Equal to False
                  • JPX_BOOLEAN[JPXInt] Equal to True
                • Then - Actions
                  • Set JPX_GROUP[JPXInt] = (Units within 200.00 of JPX_POINT[JPXInt] matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of JPX_CASTER[JPXInt])) Equal to False)))
                  • Game - Display to (All players) the text: FROST AOE
                  • Unit Group - Pick every unit in JPX_GROUP[JPXInt] and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (JPX_CASTER[JPXInt] belongs to an enemy of (Owner of (Picked unit))) Equal to True
                        • Then - Actions
                          • Unit - Cause JPX_CASTER[JPXInt] to damage (Picked unit), dealing 75.00 damage of attack type Spells and damage type Normal
                          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                        • Else - Actions
                  • Custom script: call DestroyGroup(udg_JPX_GROUP[udg_JPXInt])
                  • Set JPX_COUNTER[JPXInt] = 0
                  • Set JPX_XCOUNTER[JPXInt] = (JPX_XCOUNTER[JPXInt] + 1)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • JPX_XCOUNTER[JPXInt] Greater than or equal to 5
                  • JPX_BOOLEAN[JPXInt] Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: END
                  • Set JPX_BOOLEAN[JPXInt] = False
                  • Set JPX_XCOUNTER[JPXInt] = 0
                  • -------- Destroy handles --------
                  • Custom script: call RemoveLocation(udg_JPX_POINT[udg_JPXInt])
                  • -------- RecycleIndex --------
                  • Set JPX_Index[JPX_LOOP] = JPX_Index[JPX_Index_Size]
                  • Set JPX_Index[JPX_Index_Size] = JPXInt
                  • Set JPX_Index_Size = (JPX_Index_Size - 1)
                  • Set JPX_LOOP = (JPX_LOOP - 1)
                • Else - Actions
              • Set JPX_COUNTER[JPXInt] = (JPX_COUNTER[JPXInt] + 1)
          • Custom script: call RemoveLocation(udg_TempLoc)
      • -------- Turn the trigger again off if the index_size is below 0... --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • JPX_Index_Size Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 

Attachments

  • JumpX Engine.w3x
    116 KB · Views: 51
Last edited:
Wherever you do your whole parabola thing, use this:
  • Custom script: set udg_myrealvarZ = GetLocationZ(udg_myLocBeneathTheParabola)
  • Animation - Set unit fly height to myrealvarZ+ParabolaZ blah blah
Obviously just freehand though. =P I was too lazy to look through the functions.

JASS:
native GetLocationZ             takes location whichLocation returns real
 
Yeah, instead of:
  • Animation - Change JPX_MISSILE[JPXInt] flying height to JPX_Formula[JPXInt] at 0.00
Use this custom script:
  • Custom script: call SetUnitFlyHeight(udg_JPX_MISSILE[udg_JPXInt],GetLocationZ(udg_TempLoc)+udg_JPX_Formula[udg_JPXInt],0.)
It will basically make the missile fly normally rather than through the ground.

That should fix it.
 
Yeah, you basically need it. Say you have some terrain that is raised. The world editor can track 3 values: (x,y,z) of a certain point.

x is the x-coordinate, y is the y-coordinate, z is the height from the ground. So if you have terrain raised gradually of a factor of 5 or something and ends with a height of 300, the parabola will increase it's height with the terrain (the terrain height + the normal parabolic motion). It might look a little weird in some cases (such as if you do it in a lowered terrain) but it is much better than having it travel through the ground.
 
  • Set Parabolas[1] = ((4*MaxHeight) / MaxDistance)
  • Custom script: set udg_Parabolas[2] = (udg_MaxDistance - udg_CurrentDistance)
  • Custom script: set udg_Parabolas[3] = (udg_CurrentDistance / udg_MaxDistance)
  • Custom script: set udg_Parabolas[4] = GetLocationZ (udg_loc)
  • Set Parabolas[5] = (((Parabolas[1]) * (Parabolas [2]) * (Parabolas[3])) + (Parabolas[4]))
 
Status
Not open for further replies.
Top