• 🏆 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] Formula : Keeping same height

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
hey

i am making a spell......known.......kamehameha..........but most of failed or do ugly things like not keeping the same height .

even if the terrain ripples the beam should do a straight line from the caster to the end point!! if the terrain goes up than the beam should stop .

i tryed at but it failed.... maybe you would like to get the map instead ?
here is the code about

here is the code

  • Else - Actions
    • Set JumpXCaster = (Triggering unit)
    • Set JumpXPoint = (Position of JumpXCaster)
    • Set JumpXPoint2 = (Target point of ability being cast)
    • Set JumpXAngle = (Angle from JumpXPoint to JumpXPoint2)
    • Set JumpXMaxDistance = (Distance between JumpXPoint and JumpXPoint2)
    • Set JumpX_MissileOrUnit = True
    • Set JumpXArcOrHeight = True
    • Set JumpXArc = 0.15
    • Set JumpXMaxHeight = 700.00
    • Set JumpXSpeed = 75.00
    • Set JumpXDMG = (100.00 x (Real((Level of (Ability being cast) for JumpXCaster))))
    • Set JumpXString = Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
    • Set JumpXString2 = Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
    • Set JumpXDMG_AOE = 200.00
    • Set JumpXDUMMY_ANIMATION_SPEED = 25.00
    • Set JumpXDUMMY_BLUE = 100.00
    • Set JumpXDUMMY_GREEN = 100.00
    • Set JumpXDUMMY_RED = 100.00
    • Set JumpXDUMMY_SIZE = 200.00
    • Trigger - Run Trigger (checking conditions)
    • Custom script: call RemoveLocation(udg_JumpXPoint)
    • Custom script: call RemoveLocation(udg_JumpXPoint2)

  • JumpX Engine
    • Events
    • Conditions
    • 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 --------
      • -------- --------------------------------------------------------- --------
      • Custom script: set udg_JPX_GROUPUnit[udg_JPXInt] = CreateGroup()
      • Unit Group - Add all units of JumpXGroupUnit to JPX_GROUPUnit[JPXInt]
      • Unit Group - Pick every unit in JPX_GROUPUnit[JPXInt] and do (Actions)
        • Loop - Actions
          • Unit - Add Storm Crow Form to (Picked unit)
          • Unit - Remove Storm Crow Form from (Picked unit)
      • -------- ################ --------
      • Set TempLoc = (Position of JPX_CASTER[JPXInt])
      • Set TempLoc2 = JumpXPoint2
      • -------- ################ --------
      • Set JPX_MISSILE[JPXInt] = JPX_CASTER[JPXInt]
      • -------- --------------------------------------------------------- --------
      • Set JPX_ANGLE[JPXInt] = JumpXAngle
      • Set JPX_MaxDistance[JPXInt] = JumpXMaxDistance
      • -------- --------------------------------------------------------- --------
      • -------- ################ --------
      • -------- --------------------------------------------------------- --------
      • Set JPX_CurDistance[JPXInt] = 0.00
      • Set JPX_FHEIGHT[JPXInt] = 0.00
      • Set JPX_Formula[JPXInt] = 0.00
      • -------- --------------------------------------------------------- --------
      • Set JPX_COUNTER[JPXInt] = 0
      • Set JPX_XCOUNTER[JPXInt] = 0
      • -------- --------------------------------------------------------- --------
      • -------- ################ --------
      • -------- --------------------------------------------------------- --------
      • -------- if true than set arc if false set max height --------
      • Set JPX_SPEED[JPXInt] = JumpXSpeed
      • Set JPX_ARC[JPXInt] = JumpXArc
      • Set JPX_MAXHEIGHT[JPXInt] = JumpXMaxHeight
      • -------- --------------------------------------------------------- --------
      • -------- --------------------------------------------------------- --------
      • Set JPX_ARCYesNo[JPXInt] = JumpXArcOrHeight
      • Set JPX_MissileOrUnit[JPXInt] = JumpX_MissileOrUnit
      • -------- --------------------------------------------------------- --------
      • -------- --------------------------------------------------------- --------
      • Set JPX_TIME_COUNTER1[JPXInt] = JumpXTIME_COUNTER1
      • Set JPX_TIME_COUNTER2[JPXInt] = JumpXTIME_COUNTER2
      • -------- --------------------------------------------------------- --------
      • -------- --------------------------------------------------------- --------
      • 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])
      • -------- --------------------------------------------------------- --------
      • -------- ################ --------
      • -------- ################ --------
      • -------- --------------------------------------------------------- --------
      • Set JPX_INITIALHEIGHT[JPXInt] = (Current flying height of JPX_MISSILE[JPXInt])
      • -------- some stuff to make it good mui --------
      • Set JPX_BOOLEAN[JPXInt] = True
      • Set JPX_BOOLEANBomb[JPXInt] = True
      • -------- --------------------------------------------------------- --------
      • -------- basic stuff to make the missile take height when need :) --------
      • Unit - Add Storm Crow Form to JPX_MISSILE[JPXInt]
      • Unit - Remove Storm Crow Form from JPX_MISSILE[JPXInt]
      • Unit - Turn collision for JPX_MISSILE[JPXInt] Off
      • 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)
      • Unit Group - Remove all units of JumpXGroupUnit from JumpXGroupUnit
  • 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 TempLoc2 = (TempLoc offset by JPX_SPEED[JPXInt] towards JPX_ANGLE[JPXInt] degrees)
          • Set JPX_CURRENTHEIGHT[JPXInt] = (Current flying height of JPX_MISSILE[JPXInt])
          • Set JPX_CurDistance[JPXInt] = (JPX_CurDistance[JPXInt] + JPX_SPEED[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]
          • Unit Group - Pick every unit in JPX_GROUPUnit[JPXInt] and do (Actions)
            • Loop - Actions
              • Custom script: call SetUnitFlyHeight( GetEnumUnit(),GetLocationZ(udg_TempLoc)+udg_JPX_Formula[udg_JPXInt],0.)
          • -------- Condition... --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • JPX_CurDistance[JPXInt] Less than or equal to JPX_MaxDistance[JPXInt]
            • Then - Actions
              • -------- Actions --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Playable map area) contains TempLoc2) Equal to True
                • Then - Actions
                • Else - Actions
                  • Set JPX_MaxDistance[JPXInt] = 0.00
                  • Custom script: set udg_JPX_Formula[udg_JPXInt] = 0.
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • JPX_MissileOrUnit[JPXInt] Equal to True
                    • Then - Actions
                    • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • JPX_Formula[JPXInt] Greater than 0.00
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Playable map area) contains TempLoc) Equal to True
                    • Then - Actions
                    • Else - Actions
                      • Set JPX_MaxDistance[JPXInt] = 0.00
                      • Custom script: set udg_JPX_Formula[udg_JPXInt] = 0.
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • JPX_MissileOrUnit[JPXInt] Equal to True
                        • Then - Actions
                        • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • JPX_BOOLEANBomb[JPXInt] Equal to True
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • JPX_Formula[JPXInt] Less than or equal to 0.00
                        • Then - Actions
                          • Set JPX_BOOLEANBomb[JPXInt] = False
                          • Game - Display to (All players) the text: KILL THE MISSILE
                          • Unit Group - Pick every unit in JPX_GROUPUnit[JPXInt] and do (Actions)
                            • Loop - Actions
                              • Animation - Change (Picked unit) flying height to JPX_INITIALHEIGHT[JPXInt] at 0.00
                              • Unit Group - Remove all units of JPX_GROUPUnit[JPXInt] from JPX_GROUPUnit[JPXInt]
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • JPX_MissileOrUnit[JPXInt] Equal to True
                            • Then - Actions
                            • Else - Actions
                              • Unit - Turn collision for JPX_MISSILE[JPXInt] On
                          • Special Effect - Destroy JPX_SFX[JPXInt]
                          • Game - Display to (All players) the text: END
                          • Custom script: call DestroyGroup( udg_JPX_GROUPUnit[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
                    • Else - Actions
              • 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
      • Custom script: call RemoveLocation(udg_TempLoc2)
 
Last edited:
Level 6
Joined
Oct 10, 2009
Messages
1,425
there are girls on this site as well :p

but anyways, back to the spell. i really do not want to scroll through all that GUI because the would take too long. convert those triggers to custom text and post them in another hidden tag, for people who don't want to read GUI. (just about everyone)
 
Your problem lies in the following actions:
  • Custom script: set udg_JPX_FHEIGHT[udg_JPXInt] = GetLocationZ(udg_TempLoc3 ) + GetUnitDefaultFlyHeight( udg_JPX_MISSILE[udg_JPXInt] )
  • Custom script: call SetUnitFlyHeight( GetEnumUnit(),GetLocationZ(udg_TempLoc)+udg_JPX_Formula[udg_JPXInt],0.)
You set the height of the beam to be dependant on the Z value of the terrain. This causes the beam to have its own height dependant on how low or high the terrain is.
In order to avoid that, make sure you don't count GetLocationZ(), e.g.:
  • Custom script: call SetUnitFlyHeight( GetEnumUnit(),udg_JPX_Formula[udg_JPXInt],0)
 
Level 10
Joined
Feb 20, 2008
Messages
448
yes HE GOT REPTILIAN EYES ...HE EYES SHIFT xD lol Thanks dude im gonna try this out.....

btw im not a girl >.> or homo.......... just english is very failed like a kid ? maybe even more XD....... but i had my girlfriend with me.....she love to write to poeple from nowhere .....XD does it count ? XD


where i live in french we say : salut les gars ....didnt knew words had this kind of meaning

gonna try it now gonna feedback

edit : i understand what your mean L but its still buggy

dont i have to make a comparaison between current start height and current height so its alway been same ? cuz if you see the system was made for a jump :/
 
Last edited:
Status
Not open for further replies.
Top