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

[Solved] [GUI] Height change after terrain problem.

Status
Not open for further replies.
Level 9
Joined
May 27, 2012
Messages
116
I was just playing around this morning making a 3d person shooter in wc3. (using arrow keys for movement and WASD for camera). But when i fire a projectile against terrain the height change will look clumsy and i cant seem to find a way to fix this. The system works fine, it does hit the terrain but it changes its height in a weird way.

Here is the projectile system loop. Attaching map so you can test it if you so wish.

Side note i am very well aware that ever 0.01 s loops are kinda overkill but it is needed for this trigger due to the high speed of the projectile, as it still needs good detection. (I usually use 0.03 or 0.02 s loops)

  • CPS Loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer CPS_Index) from 1 to CPS_Index_Max, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CPS_Range[CPS_Index] Greater than 0.00
              • CPS_Height[CPS_Index] Greater than 0.00
            • Then - Actions
              • Set CPS_Range[CPS_Index] = (CPS_Range[CPS_Index] - CPS_Speed[CPS_Index])
              • -------- Height --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                • Then - Actions
                  • Set TempReal[1] = 0.00
                  • Set TempReal[2] = 0.00
                  • Set TempPoint[1] = (Position of CPS_Dummy[CPS_Index])
                  • Set TempPoint[2] = (TempPoint[1] offset by CPS_Speed_Forward[CPS_Index] towards CPS_Angle[CPS_Index] degrees)
                  • Custom script: set udg_TempReal[1]=GetLocationZ(udg_TempPoint[1])
                  • Custom script: set udg_TempReal[2]=GetLocationZ(udg_TempPoint[2])
                  • Set TempReal[3] = (TempReal[1] - TempReal[2])
                  • Set CPS_Height[CPS_Index] = (CPS_Height[CPS_Index] + (CPS_Speed_Up[CPS_Index] + TempReal[3]))
                  • Animation - Change CPS_Dummy[CPS_Index] flying height to CPS_Height[CPS_Index] at 0.00
                • Else - Actions
              • -------- Position --------
              • Unit - Move CPS_Dummy[CPS_Index] instantly to TempPoint[2]
              • -------- Dmg --------
              • Set TempInt[1] = 0
              • Set TempUG[1] = (Units within 300.00 of TempPoint[CPS_Index])
              • Unit Group - Pick every unit in TempUG[1] and do (Actions)
                • Loop - Actions
                  • For each (Integer Col_Index) from 1 to Col_Index_Max, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Picked unit)) Equal to Col_UnitType[Col_Index]
                        • Then - Actions
                          • Set TempPoint[3] = (Position of (Picked unit))
                          • Custom script: set udg_TempReal[2]=GetLocationZ(udg_TempPoint[3])
                          • Set TempReal[3] = (TempReal[1] - TempReal[2])
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • And - All (Conditions) are true
                                • Conditions
                                  • (Distance between TempPoint[1] and TempPoint[3]) Less than Col_Size[Col_Index]
                                  • (CPS_Height[CPS_Index] + TempReal[3]) Less than Col_Height[Col_Index]
                                  • ((Picked unit) belongs to an enemy of (Owner of CPS_Caster[CPS_Index])) Equal to True
                                  • ((Picked unit) is alive) Equal to True
                            • Then - Actions
                              • Unit - Cause CPS_Caster[CPS_Index] to damage (Picked unit), dealing CPS_Dmg[CPS_Index] damage of attack type Chaos and damage type Unknown
                              • Set TempInt[1] = 1
                            • Else - Actions
                          • Custom script: call RemoveLocation (udg_TempPoint[3])
                        • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt[1] Equal to 1
                • Then - Actions
                  • Set CPS_Height[CPS_Index] = -5.00
                • Else - Actions
              • Custom script: call DestroyGroup (udg_TempUG[1])
              • Custom script: call RemoveLocation (udg_TempPoint[1])
              • Custom script: call RemoveLocation (udg_TempPoint[2])
              • Set TempReal[1] = 0.00
              • Set TempReal[2] = 0.00
              • Set TempReal[3] = 0.00
              • Set TempInt[1] = 0
            • Else - Actions
              • Unit - Kill CPS_Dummy[CPS_Index]
              • Set CPS_Angle[CPS_Index] = CPS_Angle[CPS_Index_Max]
              • Set CPS_Angle[CPS_Index_Max] = 0.00
              • Set CPS_Caster[CPS_Index] = CPS_Caster[CPS_Index_Max]
              • Set CPS_Caster[CPS_Index_Max] = No unit
              • Set CPS_Dummy[CPS_Index] = CPS_Dummy[CPS_Index_Max]
              • Set CPS_Dummy[CPS_Index_Max] = No unit
              • Set CPS_Dmg[CPS_Index] = CPS_Dmg[CPS_Index_Max]
              • Set CPS_Dmg[CPS_Index_Max] = 0.00
              • Set CPS_Height[CPS_Index] = CPS_Height[CPS_Index_Max]
              • Set CPS_Height[CPS_Index_Max] = 0.00
              • Set CPS_Range[CPS_Index] = CPS_Range[CPS_Index_Max]
              • Set CPS_Range[CPS_Index_Max] = 0.00
              • Set CPS_Speed[CPS_Index] = CPS_Speed[CPS_Index_Max]
              • Set CPS_Speed[CPS_Index_Max] = 0.00
              • Set CPS_Speed_Forward[CPS_Index] = CPS_Speed_Forward[CPS_Index_Max]
              • Set CPS_Speed_Forward[CPS_Index_Max] = 0.00
              • Set CPS_Speed_Up[CPS_Index] = CPS_Speed_Up[CPS_Index_Max]
              • Set CPS_Speed_Up[CPS_Index_Max] = 0.00
              • Set CPS_Index_Max = (CPS_Index_Max - 1)
              • Set CPS_Index = (CPS_Index - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CPS_Index_Max Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 

Attachments

  • Huntsmen FPS.w3x
    31.7 KB · Views: 77
Last edited:
Level 4
Joined
Jul 26, 2016
Messages
88
Im not replying to help, so sorry, but please, when you copy triggers from the world editor, use

TRIGGER /TRIGGER wrapper instead of CODE /CODE

It will make your trigger a lot more readable.

Wishing you luck!
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
ah I see sry, it is not easy to learn imo.

You can solve your problem by giving crow form to the projectile dummies in the oe and changing movement type to hover. Hover is always better than flying when it comes to hills and stuff.


edit: nice mechanic btw :)
 
Status
Not open for further replies.
Top