• 🏆 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] Arrow key movement

Status
Not open for further replies.
Hello, its been a while since I worked with WE now I installed wc3 again and I found one unfinished map on my PC, I had this nice idea for a map but I stopped working on it because of its arrow key movement which works but it becomes really laggy when tested with more than 3 players. Now I'm hoping someone could try to figure out why.

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Camera - Lock camera target for Player 1 (Red) to Arthas 0001 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 2 (Blue) to Arthas 0037 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 3 (Teal) to Arthas 0039 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 4 (Purple) to Arthas 0040 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 5 (Yellow) to Arthas 0043 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 6 (Orange) to Arthas 0044 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across (Playable map area)
          • Set Move_Press_Up[(Integer A)] = False
          • Trigger - Add to Move UP <gen> the event (Player - (Player((Integer A))) Presses the Up Arrow key)
          • Trigger - Add to Move UP stop <gen> the event (Player - (Player((Integer A))) Releases the Up Arrow key)
          • -------- - --------
          • Set Move_Press_Left[(Integer A)] = False
          • Trigger - Add to Move Left <gen> the event (Player - (Player((Integer A))) Presses the Left Arrow key)
          • Trigger - Add to Move Left stop <gen> the event (Player - (Player((Integer A))) Releases the Left Arrow key)
          • -------- - --------
          • Set Move_Press_Right[(Integer A)] = False
          • Trigger - Add to Move Right <gen> the event (Player - (Player((Integer A))) Presses the Right Arrow key)
          • Trigger - Add to Move Right stop <gen> the event (Player - (Player((Integer A))) Releases the Right Arrow key)
          • -------- - --------
          • Trigger - Add to Move DOWN <gen> the event (Player - (Player((Integer A))) Presses the Down Arrow key)
          • -------- - --------
  • Move UP
    • Events
    • Conditions
    • Actions
      • Set Move_Press_Up[(Player number of (Triggering player))] = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Move UP Execution <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Move UP Execution <gen>
        • Else - Actions
  • Move UP stop
    • Events
    • Conditions
    • Actions
      • Set Move_Press_Up[(Player number of (Triggering player))] = False
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Move_Press_Up[(Integer A)] Equal to True
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
      • Trigger - Turn off Move UP Execution <gen>
  • Move UP Execution
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Move_Press_Up[(Integer A)] Equal to True
            • Then - Actions
              • Set Move_Group_Up = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is selected by (Player((Integer A)))) Equal to True) and ((Owner of (Matching unit)) Equal to (Player((Integer A)))))))
              • Unit Group - Pick every unit in Move_Group_Up and do (Actions)
                • Loop - Actions
                  • Set Move_Up_Location_Unit = (Position of (Picked unit))
                  • Set Move_Up_Location = (Move_Up_Location_Unit offset by 50.00 towards (Facing of (Picked unit)) degrees)
                  • Unit - Order (Picked unit) to Move To Move_Up_Location
                  • Custom script: call RemoveLocation(udg_Move_Up_Location_Unit)
                  • Custom script: call RemoveLocation(udg_Move_Up_Location)
              • Custom script: call DestroyGroup(udg_Move_Group_Up)
            • Else - Actions
Other moves left right... are the same just different actions for movement.
I think the problem begins with event every 0.03 seconds, because there must be like 500 events 0.03 running every second, but I can't think of anything else to make this system work.

Map:
 

Attachments

  • Arrow Movement by Ber1.w3x
    22.2 KB · Views: 98
Last edited:
how about every 0.10 seconds making the unit move 3.3333333333333333333333333333333 times more? (Used caculator.)

tried, but the movement was "stucking" like hero made 2 steps then he stopped and so on... even if i increased order from 50 to 150 or something.

I really wish I could help you, but unfortunely I don't see any problems with the whole thing, except the periodic trigger running constantly.
Maybe you could add units to a global group and check if it's empty, then turn off the periodic trigger and vice versa.

Otherwise, here are some suggestions.

I have tested those all out, none suits my style of map. :< And are way to tricky to edit.
 
Level 4
Joined
Jul 27, 2009
Messages
70
Hello, its been a while since I worked with WE now I installed wc3 again and I found one unfinished map on my PC, I had this nice idea for a map but I stopped working on it because of its arrow key movement which works but it becomes really laggy when tested with more than 3 players. Now I'm hoping someone could try to figure out why.

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Camera - Lock camera target for Player 1 (Red) to Arthas 0001 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 2 (Blue) to Arthas 0037 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 3 (Teal) to Arthas 0039 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 4 (Purple) to Arthas 0040 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 5 (Yellow) to Arthas 0043 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Lock camera target for Player 6 (Orange) to Arthas 0044 <gen>, offset by (0.00, 0.00) using The unit's rotation
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across (Playable map area)
          • Set Move_Press_Up[(Integer A)] = False
          • Trigger - Add to Move UP <gen> the event (Player - (Player((Integer A))) Presses the Up Arrow key)
          • Trigger - Add to Move UP stop <gen> the event (Player - (Player((Integer A))) Releases the Up Arrow key)
          • -------- - --------
          • Set Move_Press_Left[(Integer A)] = False
          • Trigger - Add to Move Left <gen> the event (Player - (Player((Integer A))) Presses the Left Arrow key)
          • Trigger - Add to Move Left stop <gen> the event (Player - (Player((Integer A))) Releases the Left Arrow key)
          • -------- - --------
          • Set Move_Press_Right[(Integer A)] = False
          • Trigger - Add to Move Right <gen> the event (Player - (Player((Integer A))) Presses the Right Arrow key)
          • Trigger - Add to Move Right stop <gen> the event (Player - (Player((Integer A))) Releases the Right Arrow key)
          • -------- - --------
          • Trigger - Add to Move DOWN <gen> the event (Player - (Player((Integer A))) Presses the Down Arrow key)
          • -------- - --------
  • Move UP
    • Events
    • Conditions
    • Actions
      • Set Move_Press_Up[(Player number of (Triggering player))] = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Move UP Execution <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Move UP Execution <gen>
        • Else - Actions
  • Move UP stop
    • Events
    • Conditions
    • Actions
      • Set Move_Press_Up[(Player number of (Triggering player))] = False
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Move_Press_Up[(Integer A)] Equal to True
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
      • Trigger - Turn off Move UP Execution <gen>
  • Move UP Execution
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Move_Press_Up[(Integer A)] Equal to True
            • Then - Actions
              • Set Move_Group_Up = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is selected by (Player((Integer A)))) Equal to True) and ((Owner of (Matching unit)) Equal to (Player((Integer A)))))))
              • Unit Group - Pick every unit in Move_Group_Up and do (Actions)
                • Loop - Actions
                  • Set Move_Up_Location_Unit = (Position of (Picked unit))
                  • Set Move_Up_Location = (Move_Up_Location_Unit offset by 50.00 towards (Facing of (Picked unit)) degrees)
                  • Unit - Order (Picked unit) to Move To Move_Up_Location
                  • Custom script: call RemoveLocation(udg_Move_Up_Location_Unit)
                  • Custom script: call RemoveLocation(udg_Move_Up_Location)
              • Custom script: call DestroyGroup(udg_Move_Group_Up)
            • Else - Actions
Other moves left right... are the same just different actions for movement.
I think the problem begins with event every 0.03 seconds, because there must be like 500 events 0.03 running every second, but I can't think of anything else to make this system work.

*I can attach a map if needed
But Its better to set it on a map for test and simple install!:vw_wtf:
Please attach a map!
 
Ok, map added to the first post.

GhostThruster, I don't see how that would help, since the trigger gets turned off after releasing key.

Anachron, that would work, but I need other spells, and I'd lost 4 spell slots then, even now I'll need to make a spell book to put some minor spells in.

koosha, looking at your map now. *Edit: I don't see what's wrong, it works correctly even if you scroll the camera or hit delete or insert. And that system was approved and i think with a rating 4/5 so it should work without problems.

Hmm... I'll try to run my system trough timers, bu then I'll need a separate trigger for every player, since you can't define event using array "player number of triggering player"
 
Status
Not open for further replies.
Top