• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] feedbacks pls :D

Status
Not open for further replies.
Level 5
Joined
Sep 22, 2012
Messages
90
I just want to check if my arrow key pseudo code was correct.
I wanted to come up with an arrow key system without the unit's movespeed.
What would you guys tell about its effectiveness in terms of triggering?


[trigger=init trigger]Initialize
Events
Map initialization
Conditions
Actions
Set pre_move_delay = 0.12
Set checkpath_aoe = 40.00
Set checkpath_distance = 40.00
Set MAP_TILE_OFFSET = 100.00
-------- dbs --------
Set db_unit_upgrader[0] = Academy
Set db_unit_upgrader[1] = Forge
Set db_unit_upgrader[2] = Laboratory
Set db_unit_pool[0] = Adept
Set db_unit_pool[1] = Enforcer
Set db_unit_pool[2] = Chemist
Set db_unit_speeds[0] = 8.00
Set db_unit_speeds[1] = 10.00
Set db_unit_speeds[2] = 9.00
-------- bullets --------
Set db_bullet_type[0] = _req_arrow
Set db_bullet_type[1] = _enf_arrow
Set db_bullet_type[2] = _van_arrow
Set db_bullet_speed[0] = 12.00
Set db_bullet_speed[1] = 25.00
Set db_bullet_speed[2] = 15.00
Set db_bullet_range[0] = 400.00
Set db_bullet_range[1] = 1340.00
Set db_bullet_range[2] = 600.00
Set db_bullet_coll_radius[0] = 100.00
Set db_bullet_coll_radius[1] = 80.00
Set db_bullet_coll_radius[2] = 120.00
Set db_bullet_init_parser[0] = /req_arrow
Set db_bullet_init_parser[1] = /enf_arrow
Set db_bullet_init_parser[2] = /van_arrow
-------- level_cap --------
Set level_caps[0] = 0
Set level_caps[1] = 120
Set level_caps[2] = 250
Set level_caps[3] = 380
-------- game_config --------
Game - Set ally color filtering to 0
Game - Set game speed to Fastest
Game - Lock the game speed
Game - Disable ally color button and Disable creep camp button
Game - Disable drag-selection functionality (Disable drag-selection box)
Game - Disable pre-selection functionality (Enable pre-selection circles, life bars, and object info)
Player Group - Make (All players) treat (All players) as an Enemy
Camera - Change camera smoothing factor to 3.00
Set INIT_callplayers = 1
Set active_player_max = 0
Set init_center = (Center of sanctuary <gen>)
Item - Create _aa_checker at init_center
Set AA_path_checker = (Last created item)
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked player) controller) Equal to User
Then - Actions
-------- iterator --------
Set active_player_max = (active_player_max + 1)
Set active_players[active_player_max] = (Player number of (Picked player))
Set skill_proc_counter[active_player_max] = 0
Set unit_main_level[(Player number of (Picked player))] = 1
-------- camera --------
Set init_cycle = (init_center offset by 90.00 towards ((Real(active_player_max)) x 30.00) degrees)
Unit - Create 1 Pick for (Picked player) at init_cycle facing Default building facing degrees
Selection - Select (Last created unit) for (Picked player)
Unit - Create 1 _vector for (Picked player) at init_center facing Default building facing degrees
Set vector_cam_unit[(Player number of (Picked player))] = (Last created unit)
Camera - Lock camera target for (Picked player) to (Last created unit), offset by (0.00, 0.00) using Default rotation
-------- addpress --------
Trigger - Add to arrowpressleft <gen> the event (Player - (Picked player) Presses the Left Arrow key)
Trigger - Add to arrowpressright <gen> the event (Player - (Picked player) Presses the Right Arrow key)
Trigger - Add to arrowpressup <gen> the event (Player - (Picked player) Presses the Up Arrow key)
Trigger - Add to arrowpressdown <gen> the event (Player - (Picked player) Presses the Down Arrow key)
-------- removepress --------
Trigger - Add to arrowreleasedown <gen> the event (Player - (Picked player) Releases the Down Arrow key)
Trigger - Add to arrowreleaseleft <gen> the event (Player - (Picked player) Releases the Left Arrow key)
Trigger - Add to arrowreleaseright <gen> the event (Player - (Picked player) Releases the Right Arrow key)
Trigger - Add to arrowreleaseup <gen> the event (Player - (Picked player) Releases the Up Arrow key)
-------- endcycle --------
Custom script: call RemoveLocation(udg_init_cycle)
Else - Actions
Set menu_tile_offset = 50.00
For each (Integer menu_cycle) from 1 to 8, do (Actions)
Loop - Actions
Set menu_cycle_angle = (45.00 x (Real(menu_cycle)))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
menu_cycle_angle Equal to 90.00
Then - Actions
Set menu_x = 0.00
Set menu_y = menu_tile_offset
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
menu_cycle_angle Equal to 180.00
Then - Actions
Set menu_x = (-1.00 x menu_tile_offset)
Set menu_y = 0.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
menu_cycle_angle Equal to 270.00
Then - Actions
Set menu_x = 0.00
Set menu_y = (-1.00 x menu_tile_offset)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
menu_cycle_angle Equal to 360.00
Then - Actions
Set menu_x = menu_tile_offset
Set menu_y = 0.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
menu_cycle_angle Greater than 0.00
menu_cycle_angle Less than 90.00
Then - Actions
Set menu_x = menu_tile_offset
Set menu_y = menu_tile_offset
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
menu_cycle_angle Greater than 90.00
menu_cycle_angle Less than 180.00
Then - Actions
Set menu_x = (-1.00 x menu_tile_offset)
Set menu_y = menu_tile_offset
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
menu_cycle_angle Greater than 180.00
menu_cycle_angle Less than 270.00
Then - Actions
Set menu_x = (-1.00 x menu_tile_offset)
Set menu_y = (-1.00 x menu_tile_offset)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
menu_cycle_angle Greater than 270.00
menu_cycle_angle Less than 360.00
Then - Actions
Set menu_x = menu_tile_offset
Set menu_y = (-1.00 x menu_tile_offset)
Else - Actions
Set menu_cycle_points = (init_center offset by (menu_x, menu_y))
Unit - Create 1 _knight_tile for Neutral Passive at menu_cycle_points facing Default building facing degrees
Set menu_tinle_units[menu_cycle] = (Last created unit)
Custom script: call RemoveLocation(udg_menu_cycle_points)
Unit - Create 1 _knight_cycler for Neutral Passive at init_center facing Default building facing degrees
Set menu_critter = (Last created unit)
Unit - Create 1 trash_can for Neutral Passive at init_center facing Default building facing degrees
Set trash_can = (Last created unit)
Set menu_graphics_cycle = 1
Set active_player_min = 1
Custom script: call RemoveLocation(udg_init_center)
Trigger - Remove (This trigger) from the trigger queue
Trigger - Turn off (This trigger)
[/trigger]

[trigger=press trigger]arrowpressright
Events
Conditions
Actions
Game - Display to (All players) the text: pressed_right
Set AAA_player_temp = (Player number of (Triggering player))
-------- setplayer --------
Set arrows_pressed[((AAA_player_temp x 5) + 0)] = True
Set arrows_pressed[((AAA_player_temp x 5) + 4)] = True
Set key_pressed[AAA_player_temp] = (key_pressed[AAA_player_temp] + 1)
-------- clear --------
Set AAA_player_temp = 0
Trigger - Turn on moveloop <gen>
Trigger - Run moveloop <gen> (checking conditions)
[/trigger]

[trigger=release trigger]arrowreleaseright
Events
Conditions
Actions
Set AAA_player_temp = (Player number of (Triggering player))
Set arrows_pressed[((AAA_player_temp x 5) + 0)] = False
Set arrows_pressed[((AAA_player_temp x 5) + 4)] = False
Set key_pressed[AAA_player_temp] = (key_pressed[AAA_player_temp] - 1)
Set AAA_player_temp = 0
[/trigger]

[trigger=moveloop]moveloop
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
-------- checkallplayers --------
For each (Integer every_players) from active_player_min to active_player_max, do (Actions)
Loop - Actions
-------- this if allows death anims --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
unit_has_main[active_players[every_players]] Equal to True
Then - Actions
-------- this if prevents movement when unit_main isdoing something --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(unit_main[active_players[every_players]] has buff Stunned (Pause)) Equal to False
unit_move_valid[active_players[every_players]] Equal to True
Then - Actions
-------- this if checks is_moving or pre_moving --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
key_pressed[active_players[every_players]] Not equal to 0
Then - Actions
Set arrow_moving[active_players[every_players]] = True
Set pre_move_timer[active_players[every_players]] = 0.00
Set pre_moving[active_players[every_players]] = False
-------- find angle --------
Set arrows_move_has_diag = False
For each (Integer arrows_move_cycle_perp) from 0 to 3, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
arrows_move_has_diag Not equal to True
arrows_pressed[((active_players[every_players] x 5) + arrows_move_cycle_perp)] Equal to True
Then - Actions
Set unit_main_angle[active_players[every_players]] = (90.00 x (Real(arrows_move_cycle_perp)))
-------- if next key is pressed --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
arrows_pressed[(((active_players[every_players] x 5) + arrows_move_cycle_perp) + 1)] Equal to True
Then - Actions
Set unit_main_angle[active_players[every_players]] = ((90.00 x (Real(arrows_move_cycle_perp))) + 45.00)
Set arrows_move_has_diag = True
Else - Actions
Else - Actions
Else - Actions
-------- this if governs premoving rules --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
pre_move_timer[active_players[every_players]] Less than or equal to pre_move_delay
Then - Actions
Set pre_move_timer[active_players[every_players]] = (pre_move_timer[active_players[every_players]] + 0.04)
Set arrow_moving[active_players[every_players]] = False
Set pre_moving[active_players[every_players]] = True
Game - Display to (All players) the text: counting premover
Else - Actions
Game - Display to (All players) the text: premover OFF
Set pre_moving[active_players[every_players]] = False
Set pre_move_timer[active_players[every_players]] = 7.00
-------- this if does the move procedures --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
pre_moving[active_players[every_players]] Equal to True
arrow_moving[active_players[every_players]] Equal to True
Then - Actions
-------- this bool plays as switch to turn off moveloop --------
Set arrows_PLAYERS_done_moving[active_players[every_players]] = True
-------- anim_move_reseter --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
reset_anim[active_players[every_players]] Equal to True
Then - Actions
Animation - Reset unit_main[active_players[every_players]]'s animation
Animation - Play unit_main[active_players[every_players]]'s walk animation
Set reset_anim[active_players[every_players]] = False
Else - Actions
Animation - Queue unit_main[active_players[every_players]]'s walk animation
-------- set_locfrom --------
Set temp_loc_from = (Position of unit_main[active_players[every_players]])
-------- chkpath --------
Set path_check = (temp_loc_from offset by checkpath_distance towards unit_main_angle[active_players[every_players]] degrees)
-------- terrain --------
Item - Move AA_path_checker to path_check
Set arrows_path_checker_loc = (Position of AA_path_checker)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(X of arrows_path_checker_loc) Equal to (X of path_check)
(Y of arrows_path_checker_loc) Equal to (Y of path_check)
Then - Actions
Set arrows_path_valid_terra = True
Else - Actions
Set arrows_path_valid_terra = False
Custom script: call RemoveLocation(udg_arrows_path_checker_loc)
Set trash_loc = (Position of trash_can)
Item - Move AA_path_checker to trash_loc
Custom script: call RemoveLocation(udg_trash_loc)
-------- units --------
Set arrow_unit_counter = 0
Set arrow_path_chk_grp = (Units within checkpath_aoe of path_check)
Unit Group - Pick every unit in arrow_path_chk_grp and do (Actions)
Loop - Actions
Set arrow_path_chk_target = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(arrow_path_chk_target is alive) Equal to True
arrow_path_chk_target Equal to unit_main[active_players[every_players]]
Then - Actions
Else - Actions
Game - Display to (All players) the text: (invalid unit: + (Name of arrow_path_chk_target))
Set arrow_unit_counter = (arrow_unit_counter + 1)
Custom script: set udg_arrow_path_chk_target = null
Custom script: call DestroyGroup (udg_arrow_path_chk_grp)
Custom script: call RemoveLocation(udg_path_check)
-------- move unit if trick is true --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
arrow_unit_counter Equal to 0
arrows_path_valid_terra Equal to True
Then - Actions
Set temp_loc_to = (temp_loc_from offset by unit_current_speed[active_players[every_players]] towards unit_main_angle[active_players[every_players]] degrees)
Unit - Move unit_main[active_players[every_players]] instantly to temp_loc_to, facing unit_main_angle[active_players[every_players]] degrees
Set vector_plotcam = (temp_loc_from offset by 100.00 towards unit_main_angle[active_players[every_players]] degrees)
Unit - Move vector_cam_unit[active_players[every_players]] instantly to vector_plotcam
Set arrows_move_has_diag = False
Custom script: call RemoveLocation(udg_vector_plotcam)
Custom script: call RemoveLocation(udg_temp_loc_to)
Else - Actions
-------- nopathing --------
-------- clearstuff --------
Custom script: call RemoveLocation(udg_temp_loc_from)
Else - Actions
-------- this bool plays as switch to turn off moveloop --------
Set arrows_PLAYERS_done_moving[active_players[every_players]] = False
-------- anim_move_reseter --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
reset_anim[active_players[every_players]] Equal to False
Then - Actions
Animation - Reset unit_main[active_players[every_players]]'s animation
Animation - Play unit_main[active_players[every_players]]'s stand animation
Set reset_anim[active_players[every_players]] = True
Else - Actions
Animation - Queue unit_main[active_players[every_players]]'s stand animation
Else - Actions
Else - Actions
-------- sorry about this multiple conditions --------
-------- i've tried to use integers but --------
-------- every periodic time the integer --------
-------- used for stopping this loop still increses/decreases --------
-------- due to periodic event --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
arrows_PLAYERS_done_moving[1] Equal to False
arrows_PLAYERS_done_moving[2] Equal to False
arrows_PLAYERS_done_moving[3] Equal to False
arrows_PLAYERS_done_moving[4] Equal to False
arrows_PLAYERS_done_moving[5] Equal to False
arrows_PLAYERS_done_moving[6] Equal to False
arrows_PLAYERS_done_moving[7] Equal to False
arrows_PLAYERS_done_moving[8] Equal to False
arrows_PLAYERS_done_moving[9] Equal to False
arrows_PLAYERS_done_moving[10] Equal to False
Then - Actions
Game - Display to (All players) the text: moveLOOP OFF!!!!!!!...
Trigger - Turn off (This trigger)
Else - Actions
[/trigger]
 

Attachments

  • arrow_no_ms.w3x
    66.4 KB · Views: 68
Last edited:
Level 5
Joined
Sep 22, 2012
Messages
90
it's not delayed dood, its just the turn rate that makes it delayed because of war3 engine.

I deleted my own resource o_O
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
I wonder, Even though <turn on 'trigger'> and <run 'trigger'> are next to each other? I'll try to fix that.

No, the problem is in the game engine, and it cannot be fixed.

I suppose it's okay to use arrow keys for single player maps; many players can deal with the delay. But the point remains: this system has been made before!
 
Level 5
Joined
Sep 22, 2012
Messages
90
i see sir, i know THIS system has been made over the ancients. i guess so the war3 engine does not support arrow keys for multiplayeror my triggering is in fact of noob level. But what's wrong in making my own version of this system? I do plan to use it for my own gig :D. well thanks for dropping by, +rep
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
Yes it's indeed "pointless" BUT if you want to understand what you got in your map it could be better to code it yourself. Atm I am trying to convert as much jass systems as possible into GUI just because I want to understand and controll over any system in my map without getting to torture my brain with jass which is unreadable in some cases -.-
 
Level 5
Joined
Sep 22, 2012
Messages
90
Thats the thing dood, I wanted to maximize the 3x4 command pane without the move,attack,patrol,stop and holdground war3 commands, That's why I have tuck in the "pseudo code" word there. In addition. my custom units does not have movespeed :D.
 
Status
Not open for further replies.
Top