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

8way dpad help

Status
Not open for further replies.
Level 5
Joined
Sep 22, 2012
Messages
90
I'm blit a noob programmer, I wanted to know more about triggers and apply my idea about 8 way arrow key movement. yes i know that this is my very first trigger in war3 and contains leaks and epic noobility but i want to know if my logic would be acceptable.
  • LOOPS
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- every periodic time, all players are affected. --------
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • -------- ------------------------------------------------->Update_variables --------
          • Set unit_pos[(Integer A)] = (Position of unit_main[(Integer A)])
          • -------- walkability --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at (unit_pos[(Integer A)] offset by 60.00 towards 0.00 degrees) of type Walkability is off) Equal to True
            • Then - Actions
              • Set rect_ee[(Integer A)] = False
            • Else - Actions
              • Set rect_ee[(Integer A)] = True
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at (unit_pos[(Integer A)] offset by 60.00 towards 90.00 degrees) of type Walkability is off) Equal to True
            • Then - Actions
              • Set rect_nn[(Integer A)] = False
            • Else - Actions
              • Set rect_nn[(Integer A)] = True
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at (unit_pos[(Integer A)] offset by 60.00 towards 180.00 degrees) of type Walkability is off) Equal to True
            • Then - Actions
              • Set rect_ww[(Integer A)] = False
            • Else - Actions
              • Set rect_ww[(Integer A)] = True
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at (unit_pos[(Integer A)] offset by 60.00 towards 270.00 degrees) of type Walkability is off) Equal to True
            • Then - Actions
              • Set rect_ss[(Integer A)] = False
            • Else - Actions
              • Set rect_ss[(Integer A)] = True
          • -------- walkability********** --------
          • -------- speed/slowbuff --------
          • -------- Check-Buff --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (unit_main[(Integer A)] has buff Stunned (Pause)) Equal to True
            • Then - Actions
              • Set unit_move_NObuff[(Integer A)] = False
            • Else - Actions
              • Set unit_move_NObuff[(Integer A)] = True
          • -------- ------------------------------------------------------------------------------------------------>MOVE_LOOP --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • unit_move_valid[(Integer A)] Equal to True
                  • unit_move_NObuff[(Integer A)] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (unit_main[(Integer A)] is dead) Equal to False
                  • Or - Any (Conditions) are true
                    • Conditions
                      • arrow_east[(Integer A)] Equal to True
                      • arrow_west[(Integer A)] Equal to True
                      • arrow_north[(Integer A)] Equal to True
                      • arrow_south[(Integer A)] Equal to True
                • Then - Actions
                  • -------- reset animation --------
                  • Set reset_anim[(Integer A)] = False
                  • Animation - Play unit_main[(Integer A)]'s walk animation
                  • -------- switchselect the direction******************************** --------
                  • -------- north --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • arrow_north[(Integer A)] Equal to True
                          • rect_nn[(Integer A)] Equal to True
                    • Then - Actions
                      • Unit - Move unit_main[(Integer A)] instantly to (unit_pos[(Integer A)] offset by unit_current_speed[(Integer A)] towards 90.00 degrees), facing 90.00 degrees
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • And - All (Conditions) are true
                            • Conditions
                              • And - All (Conditions) are true
                                • Conditions
                                  • arrow_north[(Integer A)] Equal to True
                                  • arrow_west[(Integer A)] Equal to True
                              • And - All (Conditions) are true
                                • Conditions
                                  • rect_nn[(Integer A)] Equal to True
                                  • rect_ww[(Integer A)] Equal to True
                        • Then - Actions
                          • Unit - Move unit_main[(Integer A)] instantly to (unit_pos[(Integer A)] offset by unit_current_speed[(Integer A)] towards 135.00 degrees), facing 135.00 degrees
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • And - All (Conditions) are true
                                • Conditions
                                  • And - All (Conditions) are true
                                    • Conditions
                                      • arrow_north[(Integer A)] Equal to True
                                      • arrow_east[(Integer A)] Equal to True
                                  • And - All (Conditions) are true
                                    • Conditions
                                      • rect_nn[(Integer A)] Equal to True
                                      • rect_ee[(Integer A)] Equal to True
                            • Then - Actions
                              • Unit - Move unit_main[(Integer A)] instantly to (unit_pos[(Integer A)] offset by unit_current_speed[(Integer A)] towards 45.00 degrees), facing 45.00 degrees
                            • Else - Actions
                    • Else - Actions
                      • -------- South --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • And - All (Conditions) are true
                            • Conditions
                              • arrow_south[(Integer A)] Equal to True
                              • rect_ss[(Integer A)] Equal to True
                        • Then - Actions
                          • Unit - Move unit_main[(Integer A)] instantly to (unit_pos[(Integer A)] offset by unit_current_speed[(Integer A)] towards 270.00 degrees), facing 270.00 degrees
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • And - All (Conditions) are true
                                • Conditions
                                  • And - All (Conditions) are true
                                    • Conditions
                                      • arrow_south[(Integer A)] Equal to True
                                      • arrow_east[(Integer A)] Equal to True
                                  • And - All (Conditions) are true
                                    • Conditions
                                      • rect_ss[(Integer A)] Equal to True
                                      • rect_ee[(Integer A)] Equal to True
                            • Then - Actions
                              • Unit - Move unit_main[(Integer A)] instantly to (unit_pos[(Integer A)] offset by unit_current_speed[(Integer A)] towards 315.00 degrees), facing 315.00 degrees
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • And - All (Conditions) are true
                                    • Conditions
                                      • And - All (Conditions) are true
                                        • Conditions
                                          • arrow_south[(Integer A)] Equal to True
                                          • arrow_west[(Integer A)] Equal to True
                                      • And - All (Conditions) are true
                                        • Conditions
                                          • rect_ss[(Integer A)] Equal to True
                                          • rect_ww[(Integer A)] Equal to True
                                • Then - Actions
                                  • Unit - Move unit_main[(Integer A)] instantly to (unit_pos[(Integer A)] offset by unit_current_speed[(Integer A)] towards 225.00 degrees), facing 225.00 degrees
                                • Else - Actions
                        • Else - Actions
                          • -------- East --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • And - All (Conditions) are true
                                • Conditions
                                  • arrow_east[(Integer A)] Equal to True
                                  • rect_ee[(Integer A)] Equal to True
                            • Then - Actions
                              • Unit - Move unit_main[(Integer A)] instantly to (unit_pos[(Integer A)] offset by unit_current_speed[(Integer A)] towards 0.00 degrees), facing 0.00 degrees
                            • Else - Actions
                              • -------- west --------
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • And - All (Conditions) are true
                                    • Conditions
                                      • arrow_west[(Integer A)] Equal to True
                                      • rect_ww[(Integer A)] Equal to True
                                • Then - Actions
                                  • Unit - Move unit_main[(Integer A)] instantly to (unit_pos[(Integer A)] offset by unit_current_speed[(Integer A)] towards 180.00 degrees), facing 180.00 degrees
                                • Else - Actions
                • Else - Actions
                  • -------- and stop movement --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • reset_anim[(Integer A)] Equal to False
                    • Then - Actions
                      • Set reset_anim[(Integer A)] = True
                      • Animation - Reset unit_main[(Integer A)]'s animation
                    • Else - Actions
                  • Animation - Queue unit_main[(Integer A)]'s stand animation
            • Else - Actions
          • -------- ---------------------------------------------------------------------------------------->CAMERA_LOOP --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (unit_main[(Integer A)] is dead) Equal to False
              • (Life of unit_main[(Integer A)]) Less than (0.40 x (Max life of unit_main[(Integer A)]))
            • Then - Actions
              • Camera - Shake the camera for (Player((Integer A))) with magnitude 8.00
              • Camera - Sway the camera target for (Player((Integer A))) with magnitude 20.00 and velocity 1500.00
              • Cinematic - Apply a filter over 0.30 seconds using Normal blending on texture Dream, starting with color (100.00%, 20.00%, 20.00%) and 30.00% transparency and ending with color (0.00%, 0.00%, 0.00%) and 100.00% transparency
            • Else - Actions
              • Camera - Stop swaying/shaking the camera for (Player((Integer A)))
          • -------- goldsoins_loop --------
          • Unit Group - Pick every unit in (Units within 50.00 of (Position of unit_main[(Integer A)])) and 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 Coins
                • Then - Actions
                  • Unit - Remove (Picked unit) from the game
                  • Player - Add 2 to (Owner of unit_main[(Integer A)]) Current gold
                • Else - Actions
      • -------- All their variables,function must be updated from player 1 to player 12 --------
 
Status
Not open for further replies.
Top