1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  5. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  6. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  7. The results are out! Check them out.
    Dismiss Notice
  8. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  9. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

3rd Person Camera + Smooth Arrow Key Movement 1.4

Submitted by DARKLORD24
This bundle is marked as substandard. It may contain bugs, not perform optimally or otherwise be in violation of the submission rules.
I didn't found any good movement system with smooth camera, so i decided to make one. This one will lock the camera to the selected unit, rotate the camera as the unit is rotating, while also it will move the unit and rotate it with the arrow keys.Basically it's a racing system for car games.

Features:
-3 custom stats that can be used in a game: Acceleration,Handling,Top speed (excellent for car games)
-Movement speed well beyond 522 as it moves with custom trigger (also FPS remains good no memory leaks)
-Animation added when unit moves, no sliding bug,its realistic
-Camera locks and rotates with unit
-Arrow keys used to move the unit, memory leak free and quick
-11 Player compatible (multiplayer, except player 12 which must be a computer)
-Car decelerates smoothly if its accelerated by pressing the DOWN key
-Easy to copy into your map

Changelog

[From 1.0 to 1.1]
-Fixed sliding bug (fractional division leftover could cause the car to not stop is fixed)
-Fixed acceleration/deceleration sync, now you can do both at a time and it will add/subtract from the current speed
-Added custom car model and horn effect
-Reworked the triggers and removed unnecesary variables
-Added speedometer, however it might memory leak, but it is not meant to use in the main system, it is just for misc/debug stuff for now, the main system is MOVEMENTSYSTEM folder, everything else is misc or init stuff

[From 1.1 to 1.2]
-Camera made smoother
-Made deceleration speed balanced, while the backwards speed is slower than the forward speed
-Added collision system (destructibles and units gets killed if hit by car)
-Also car decelerates if hits a destructible or doodoead
-Fixed a few misc bugs
-As deathismyfriend suggested, i added the loop into a player force to be more efficient while adding a variable for player_nr_of_picked_player

[From 1.2 to 1.3]
-Player group variable only declared once and never deleted

[From 1.3 to 1.4]
-Added temp variables for picked player and triggering player
-Resolved the wait issue, not by indexing but by an even better way to force the action into the event trigger instead of waiting until the periodic trigger gets triggered, so this way if a player presses the LEFT/RIGHT key and quickly releases it, the car still gets steered by STATS_HANDLING*1.5 amount
-Init is now at 0.00 elapsed time
-Renamed variables to be more easily readable
-Reconfigured some stuff


Things to be added in the future

-Car immediately stops after hitting a doodoad, but it only gets slowed down by normal units (it doesnt slide by as it is doing now , with top speed , after collision)
-Reworking camera to be more smooth
-General optimization of both aestethic and memory conservation fields
-Fixing unknown bugs


Parameters:
- STATS_ACCELERATION= sets the acceleration amount of the car
- STATS_TOPSPEED= the car accelerates until it reaches top speed
- STATS_HANDLING= the speed of rotation of the car

====================================================

>>>>>TRIGGERS<<<<<

Init

[trigger="Init"]
INIT
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Visibility - Disable fog of war
Visibility - Disable black mask
Set Group_Playing_Players = (All players controlled by a User player)
Player Group - Pick every player in Group_Playing_Players and do (Actions)
Loop - Actions
Set The_Picked_Player = (Picked player)
-------- =====================TESTIFPLAYERLEFTORNOT==================== --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(The_Picked_Player slot status) Equal to Is playing
Then - Actions
-------- ========================INIT VARIABLES============================ --------
Set Player_Number_of_Picked_Player = (Player number of The_Picked_Player)
-------- ========================CAMERA============================ --------
Set Point_of_Creation = (Random point in carz <gen>)
Unit - Create 1 Soviet Car for The_Picked_Player at Point_of_Creation facing Default building facing degrees
Custom script: call RemoveLocation (udg_Point_of_Creation)
Set My_Car[Player_Number_of_Picked_Player] = (Last created unit)
Selection - Select My_Car[Player_Number_of_Picked_Player] for The_Picked_Player
Camera - Lock camera target for The_Picked_Player to My_Car[Player_Number_of_Picked_Player], offset by (0.00, 0.00) using The unit's rotation
Camera - Set The_Picked_Player's camera Far Z to 25000.00 over 0.00 seconds
-------- 300-350 --------
Camera - Set The_Picked_Player's camera Angle of attack to 330.00 over 0.00 seconds
Camera - Set The_Picked_Player's camera Distance to target to 1200.00 over 0.00 seconds
Camera - Set The_Picked_Player's camera Height Offset to 350.00 over 0.00 seconds
Else - Actions
Trigger - Turn on PERIODICxxxMAINxxTRIGGER <gen>
Trigger - Turn off (This trigger)

[/trigger]


Periodic Main Refresh Trigger

[trigger="Periodic Main Refresh Trigger"]
PERIODICxxxMAINxxTRIGGER
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Player Group - Pick every player in Group_Playing_Players and do (Actions)
Loop - Actions
Set The_Picked_Player = (Picked player)
-------- =====================TESTIFPLAYERLEFTORNOT==================== --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(The_Picked_Player slot status) Equal to Is playing
Then - Actions
-------- ========================INIT VARIABLES============================ --------
Set Player_Number_of_Picked_Player = (Player number of The_Picked_Player)
-------- ========================ROTATION SECTION============================ --------
Camera - Set The_Picked_Player's camera Rotation to (Facing of My_Car[Player_Number_of_Picked_Player]) over 0.30 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Rotation_Left[Player_Number_of_Picked_Player] Equal to True
Then - Actions
Unit - Make My_Car[Player_Number_of_Picked_Player] face ((Facing of My_Car[Player_Number_of_Picked_Player]) + STATS_HANDLING[Player_Number_of_Picked_Player]) over 0.00 seconds
Animation - Play My_Car[Player_Number_of_Picked_Player]'s walk animation
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Rotation_Right[Player_Number_of_Picked_Player] Equal to True
Then - Actions
Unit - Make My_Car[Player_Number_of_Picked_Player] face ((Facing of My_Car[Player_Number_of_Picked_Player]) - STATS_HANDLING[Player_Number_of_Picked_Player]) over 0.00 seconds
Animation - Play My_Car[Player_Number_of_Picked_Player]'s walk animation
Else - Actions
-------- ========================MOVEMENT SECTION============================ --------
-------- ==[FORWARD ACCELERATION]== --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Ahead_Move[Player_Number_of_Picked_Player] Equal to True
Ahead_Decelerate[Player_Number_of_Picked_Player] Equal to False
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current_Speed_Variable[Player_Number_of_Picked_Player] + STATS_ACCELERATION[Player_Number_of_Picked_Player]) Less than or equal to STATS_TOPSPEED[Player_Number_of_Picked_Player]
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = (Current_Speed_Variable[Player_Number_of_Picked_Player] + STATS_ACCELERATION[Player_Number_of_Picked_Player])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Current_Speed_Variable[Player_Number_of_Picked_Player] Greater than (STATS_TOPSPEED[Player_Number_of_Picked_Player] - 1.00)
Current_Speed_Variable[Player_Number_of_Picked_Player] Less than STATS_TOPSPEED[Player_Number_of_Picked_Player]
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = STATS_TOPSPEED[Player_Number_of_Picked_Player]
Else - Actions
Set Point_of_Path[Player_Number_of_Picked_Player] = ((Position of My_Car[Player_Number_of_Picked_Player]) offset by Current_Speed_Variable[Player_Number_of_Picked_Player] towards (Facing of My_Car[Player_Number_of_Picked_Player]) degrees)
Unit - Move My_Car[Player_Number_of_Picked_Player] instantly to Point_of_Path[Player_Number_of_Picked_Player]
Custom script: call RemoveLocation (udg_Point_of_Path[udg_Player_Number_of_Picked_Player])
Animation - Play My_Car[Player_Number_of_Picked_Player]'s walk animation
Else - Actions
-------- ==[FORWARD DECELARATION]== --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Ahead_Move[Player_Number_of_Picked_Player] Equal to False
Ahead_Decelerate[Player_Number_of_Picked_Player] Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current_Speed_Variable[Player_Number_of_Picked_Player] - STATS_ACCELERATION[Player_Number_of_Picked_Player]) Greater than or equal to 0.00
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = (Current_Speed_Variable[Player_Number_of_Picked_Player] - STATS_ACCELERATION[Player_Number_of_Picked_Player])
Else - Actions
-------- IF THE REMAINING SPEED IS VERY SMALL THEN AUTOMATICALLY STOP AND NOT SLIDE --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Current_Speed_Variable[Player_Number_of_Picked_Player] Greater than 0.00
Current_Speed_Variable[Player_Number_of_Picked_Player] Less than 1.00
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = 0.00
Else - Actions
Set Point_of_Path[Player_Number_of_Picked_Player] = ((Position of My_Car[Player_Number_of_Picked_Player]) offset by Current_Speed_Variable[Player_Number_of_Picked_Player] towards (Facing of My_Car[Player_Number_of_Picked_Player]) degrees)
Unit - Move My_Car[Player_Number_of_Picked_Player] instantly to Point_of_Path[Player_Number_of_Picked_Player]
Custom script: call RemoveLocation (udg_Point_of_Path[udg_Player_Number_of_Picked_Player])
Animation - Play My_Car[Player_Number_of_Picked_Player]'s walk animation
Else - Actions
-------- ==[BACKWARD ACCELERATION]== --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Backwards_Move[Player_Number_of_Picked_Player] Equal to True
Backwards_Decelerate[Player_Number_of_Picked_Player] Equal to False
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current_Speed_Variable[Player_Number_of_Picked_Player] - (STATS_ACCELERATION[Player_Number_of_Picked_Player] / 3.00)) Greater than or equal to (0.00 - (STATS_TOPSPEED[Player_Number_of_Picked_Player] / 7.00))
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = (Current_Speed_Variable[Player_Number_of_Picked_Player] - (STATS_ACCELERATION[Player_Number_of_Picked_Player] / 3.00))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Current_Speed_Variable[Player_Number_of_Picked_Player] Less than ((0.00 - STATS_TOPSPEED[Player_Number_of_Picked_Player]) + 1.00)
Current_Speed_Variable[Player_Number_of_Picked_Player] Greater than (0.00 - STATS_TOPSPEED[Player_Number_of_Picked_Player])
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = (0.00 - STATS_TOPSPEED[Player_Number_of_Picked_Player])
Else - Actions
Set Point_of_Path[Player_Number_of_Picked_Player] = ((Position of My_Car[Player_Number_of_Picked_Player]) offset by Current_Speed_Variable[Player_Number_of_Picked_Player] towards (Facing of My_Car[Player_Number_of_Picked_Player]) degrees)
Unit - Move My_Car[Player_Number_of_Picked_Player] instantly to Point_of_Path[Player_Number_of_Picked_Player]
Custom script: call RemoveLocation (udg_Point_of_Path[udg_Player_Number_of_Picked_Player])
Animation - Play My_Car[Player_Number_of_Picked_Player]'s walk animation
Else - Actions
-------- ==[BACKWARD DECELERATION]== --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Backwards_Move[Player_Number_of_Picked_Player] Equal to False
Backwards_Decelerate[Player_Number_of_Picked_Player] Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current_Speed_Variable[Player_Number_of_Picked_Player] + (STATS_ACCELERATION[Player_Number_of_Picked_Player] / 2.00)) Less than or equal to 0.00
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = (Current_Speed_Variable[Player_Number_of_Picked_Player] + (STATS_ACCELERATION[Player_Number_of_Picked_Player] / 2.00))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Current_Speed_Variable[Player_Number_of_Picked_Player] Less than 0.00
Current_Speed_Variable[Player_Number_of_Picked_Player] Greater than -1.00
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = 0.00
Else - Actions
Set Point_of_Path[Player_Number_of_Picked_Player] = ((Position of My_Car[Player_Number_of_Picked_Player]) offset by Current_Speed_Variable[Player_Number_of_Picked_Player] towards (Facing of My_Car[Player_Number_of_Picked_Player]) degrees)
Unit - Move My_Car[Player_Number_of_Picked_Player] instantly to Point_of_Path[Player_Number_of_Picked_Player]
Custom script: call RemoveLocation (udg_Point_of_Path[udg_Player_Number_of_Picked_Player])
Animation - Play My_Car[Player_Number_of_Picked_Player]'s walk animation
Else - Actions
-------- ========================COLLISION TEST============================ --------
Set Point_of_Path[Player_Number_of_Picked_Player] = ((Position of My_Car[Player_Number_of_Picked_Player]) offset by 10.00 towards (Facing of My_Car[Player_Number_of_Picked_Player]) degrees)
Set Region_Collision[Player_Number_of_Picked_Player] = (Region centered at Point_of_Path[Player_Number_of_Picked_Player] with size (300.00, 300.00))
Custom script: call RemoveLocation (udg_Point_of_Path[udg_Player_Number_of_Picked_Player])
-------- -------here --------
Destructible - Pick every destructible in Region_Collision[Player_Number_of_Picked_Player] and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked destructible) is alive) Equal to True
Then - Actions
Destructible - Kill (Picked destructible)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Abs(Current_Speed_Variable[Player_Number_of_Picked_Player])) - (STATS_ACCELERATION[Player_Number_of_Picked_Player] x 3.00)) Greater than 0.00
Current_Speed_Variable[Player_Number_of_Picked_Player] Greater than 0.00
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = ((Abs(Current_Speed_Variable[Player_Number_of_Picked_Player])) - (STATS_ACCELERATION[Player_Number_of_Picked_Player] x 3.00))
Else - Actions
Else - Actions
Set Group_Collision_Units = (Units in Region_Collision[Player_Number_of_Picked_Player] matching ((Owner of (Matching unit)) Equal to Player 12 (Brown)))
Unit Group - Pick every unit in Group_Collision_Units and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is alive) Equal to True
((Abs(Current_Speed_Variable[Player_Number_of_Picked_Player])) - (STATS_ACCELERATION[Player_Number_of_Picked_Player] x 25.00)) Greater than 0.00
Current_Speed_Variable[Player_Number_of_Picked_Player] Greater than 0.00
Then - Actions
Set Current_Speed_Variable[Player_Number_of_Picked_Player] = ((Abs(Current_Speed_Variable[Player_Number_of_Picked_Player])) - (STATS_ACCELERATION[Player_Number_of_Picked_Player] x 25.00))
Else - Actions
Unit - Kill (Picked unit)
Custom script: call DestroyGroup (udg_Group_Collision_Units)
Custom script: call RemoveRect(udg_Region_Collision[udg_Player_Number_of_Picked_Player])
Else - Actions

[/trigger]


Press Left

[trigger="Press Left"]
LEFTxxPRESS
Events
Player - Player 1 (Red) Presses the Left Arrow key
Player - Player 2 (Blue) Presses the Left Arrow key
Player - Player 3 (Teal) Presses the Left Arrow key
Player - Player 4 (Purple) Presses the Left Arrow key
Player - Player 5 (Yellow) Presses the Left Arrow key
Player - Player 6 (Orange) Presses the Left Arrow key
Player - Player 7 (Green) Presses the Left Arrow key
Player - Player 8 (Pink) Presses the Left Arrow key
Player - Player 9 (Gray) Presses the Left Arrow key
Player - Player 10 (Light Blue) Presses the Left Arrow key
Player - Player 11 (Dark Green) Presses the Left Arrow key
Conditions
Actions
Set Player_Number_of_Trig_Player = (Player number of (Triggering player))
-------- ==steering== --------
Set Rotation_Left[Player_Number_of_Trig_Player] = True
Unit - Make My_Car[Player_Number_of_Trig_Player] face ((Facing of My_Car[Player_Number_of_Trig_Player]) + (STATS_HANDLING[Player_Number_of_Trig_Player] x 1.50)) over 0.00 seconds
Animation - Play My_Car[Player_Number_of_Trig_Player]'s walk animation

[/trigger]


Release Left

[trigger="Release Left"]
LEFTxxRELEASE
Events
Player - Player 1 (Red) Releases the Left Arrow key
Player - Player 2 (Blue) Releases the Left Arrow key
Player - Player 3 (Teal) Releases the Left Arrow key
Player - Player 4 (Purple) Releases the Left Arrow key
Player - Player 5 (Yellow) Releases the Left Arrow key
Player - Player 6 (Orange) Releases the Left Arrow key
Player - Player 7 (Green) Releases the Left Arrow key
Player - Player 8 (Pink) Releases the Left Arrow key
Player - Player 9 (Gray) Releases the Left Arrow key
Player - Player 10 (Light Blue) Releases the Left Arrow key
Player - Player 11 (Dark Green) Releases the Left Arrow key
Conditions
Actions
Set Rotation_Left[(Player number of (Triggering player))] = False

[/trigger]


Press Right

[trigger="Press Right"]
RIGHTxxPRESS
Events
Player - Player 1 (Red) Presses the Right Arrow key
Player - Player 2 (Blue) Presses the Right Arrow key
Player - Player 3 (Teal) Presses the Right Arrow key
Player - Player 4 (Purple) Presses the Right Arrow key
Player - Player 5 (Yellow) Presses the Right Arrow key
Player - Player 6 (Orange) Presses the Right Arrow key
Player - Player 7 (Green) Presses the Right Arrow key
Player - Player 8 (Pink) Presses the Right Arrow key
Player - Player 9 (Gray) Presses the Right Arrow key
Player - Player 10 (Light Blue) Presses the Right Arrow key
Player - Player 11 (Dark Green) Presses the Right Arrow key
Conditions
Actions
Set Player_Number_of_Trig_Player = (Player number of (Triggering player))
-------- ==steering== --------
Set Rotation_Right[Player_Number_of_Trig_Player] = True
Unit - Make My_Car[Player_Number_of_Trig_Player] face ((Facing of My_Car[Player_Number_of_Trig_Player]) - (STATS_HANDLING[Player_Number_of_Trig_Player] x 1.50)) over 0.00 seconds
Animation - Play My_Car[Player_Number_of_Trig_Player]'s walk animation

[/trigger]


Release Right

[trigger="Release Right"]
RIGHTxxRELEASE
Events
Player - Player 1 (Red) Releases the Right Arrow key
Player - Player 2 (Blue) Releases the Right Arrow key
Player - Player 3 (Teal) Releases the Right Arrow key
Player - Player 4 (Purple) Releases the Right Arrow key
Player - Player 5 (Yellow) Releases the Right Arrow key
Player - Player 6 (Orange) Releases the Right Arrow key
Player - Player 7 (Green) Releases the Right Arrow key
Player - Player 8 (Pink) Releases the Right Arrow key
Player - Player 9 (Gray) Releases the Right Arrow key
Player - Player 10 (Light Blue) Releases the Right Arrow key
Player - Player 11 (Dark Green) Releases the Right Arrow key
Conditions
Actions
Set Rotation_Right[(Player number of (Triggering player))] = False

[/trigger]


Press Up

[trigger="Press Up"]
FORWARDxxPRESSxxGAS
Events
Player - Player 1 (Red) Presses the Up Arrow key
Player - Player 2 (Blue) Presses the Up Arrow key
Player - Player 3 (Teal) Presses the Up Arrow key
Player - Player 4 (Purple) Presses the Up Arrow key
Player - Player 5 (Yellow) Presses the Up Arrow key
Player - Player 6 (Orange) Presses the Up Arrow key
Player - Player 7 (Green) Presses the Up Arrow key
Player - Player 8 (Pink) Presses the Up Arrow key
Player - Player 9 (Gray) Presses the Up Arrow key
Player - Player 10 (Light Blue) Presses the Up Arrow key
Player - Player 11 (Dark Green) Presses the Up Arrow key
Conditions
Actions
Set Player_Number_of_Trig_Player = (Player number of (Triggering player))
-------- ==moving== --------
Set Ahead_Move[Player_Number_of_Trig_Player] = True
Set Ahead_Decelerate[Player_Number_of_Trig_Player] = False
Animation - Play My_Car[Player_Number_of_Trig_Player]'s walk animation

[/trigger]


Release Up

[trigger="Release Up"]
FORWARDxxRELEASE
Events
Player - Player 1 (Red) Releases the Up Arrow key
Player - Player 2 (Blue) Releases the Up Arrow key
Player - Player 3 (Teal) Releases the Up Arrow key
Player - Player 4 (Purple) Releases the Up Arrow key
Player - Player 5 (Yellow) Releases the Up Arrow key
Player - Player 6 (Orange) Releases the Up Arrow key
Player - Player 7 (Green) Releases the Up Arrow key
Player - Player 8 (Pink) Releases the Up Arrow key
Player - Player 9 (Gray) Releases the Up Arrow key
Player - Player 10 (Light Blue) Releases the Up Arrow key
Player - Player 11 (Dark Green) Releases the Up Arrow key
Conditions
Actions
Set Player_Number_of_Trig_Player = (Player number of (Triggering player))
-------- ==moving== --------
Set Ahead_Move[Player_Number_of_Trig_Player] = False
Set Ahead_Decelerate[Player_Number_of_Trig_Player] = True

[/trigger]


Press Down

[trigger="Press Down"]
BACKWARDSxxPRESSxxBREAK
Events
Player - Player 1 (Red) Presses the Down Arrow key
Player - Player 2 (Blue) Presses the Down Arrow key
Player - Player 3 (Teal) Presses the Down Arrow key
Player - Player 4 (Purple) Presses the Down Arrow key
Player - Player 5 (Yellow) Presses the Down Arrow key
Player - Player 6 (Orange) Presses the Down Arrow key
Player - Player 7 (Green) Presses the Down Arrow key
Player - Player 8 (Pink) Presses the Down Arrow key
Player - Player 9 (Gray) Presses the Down Arrow key
Player - Player 10 (Light Blue) Presses the Down Arrow key
Player - Player 11 (Dark Green) Presses the Down Arrow key
Conditions
Actions
Set Player_Number_of_Trig_Player = (Player number of (Triggering player))
-------- ==moving== --------
Set Backwards_Move[Player_Number_of_Trig_Player] = True
Set Backwards_Decelerate[Player_Number_of_Trig_Player] = False
Animation - Play My_Car[Player_Number_of_Trig_Player]'s walk animation

[/trigger]


Release Down

[trigger="Release Down"]
BACKWARDSxxRELEASE
Events
Player - Player 1 (Red) Releases the Down Arrow key
Player - Player 2 (Blue) Releases the Down Arrow key
Player - Player 3 (Teal) Releases the Down Arrow key
Player - Player 4 (Purple) Releases the Down Arrow key
Player - Player 5 (Yellow) Releases the Down Arrow key
Player - Player 6 (Orange) Releases the Down Arrow key
Player - Player 7 (Green) Releases the Down Arrow key
Player - Player 8 (Pink) Releases the Down Arrow key
Player - Player 9 (Gray) Releases the Down Arrow key
Player - Player 10 (Light Blue) Releases the Down Arrow key
Player - Player 11 (Dark Green) Releases the Down Arrow key
Conditions
Actions
Set Player_Number_of_Trig_Player = (Player number of (Triggering player))
-------- ==moving== --------
Set Backwards_Move[Player_Number_of_Trig_Player] = False
Set Backwards_Decelerate[Player_Number_of_Trig_Player] = True

[/trigger]


====================================================
Credits:
Made by: Me and my brother Lightlord24x (from Garena)
Resources:
-Soviet Car by Ket (Hive workshop)
-Honk sound effect from SoundBible.com

Keywords:
movement system,arrow key, arrow, key,camera, 3rd person,third person,first person,spell,acceleration,system,GUI,trigger,car,race,custom,racing system
Contents

Smooth Camera+Arrow Key movement 1.4 (Map)

Reviews
Moderator
12th Dec 2015 IcemanBo: For long time as NeedsFix. Rejected. 15:38, 5th Jan 2015 Maker: You have memory leaks. Additionally this is just another arrow movement system and it offers nothing new or interesting. You could try to make it more...
  1. 12th Dec 2015
    IcemanBo: For long time as NeedsFix. Rejected.

    15:38, 5th Jan 2015
    Maker: You have memory leaks.
    Additionally this is just another arrow movement system
    and it offers nothing new or interesting.
    You could try to make it more original and interesting.
     
  2. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    770
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    Post the code/triggers in the description and change the name to something suitable - atm, people will have no idea what this is.
     
  3. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
  4. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,736
    Resources:
    103
    Models:
    87
    Icons:
    5
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    103
    Why is the title 1.00 Alpha? Give it a nice name. :p

    Posting the code also helps people who

    a.) Don't have Wc3 because of old age
    b.) Are on mobile
    c.) Are lazy
     
  5. DARKLORD24

    DARKLORD24

    Joined:
    Mar 14, 2011
    Messages:
    16
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Alright guys, i`ve added a title to it, and posted the triggers, hopefully if there is some bug it will get noticed this way.

    I`m kinda new here so, i had no clue how to post here but i figured it out.

    Anyway please test my system and give me feedback, i`m curious how you find it to be.
     
  6. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    Anything used twice or more should be stored in a variable and the variable should be used.
    Example: (Player number of (Triggering player))
    Variables are faster and more efficient than multiple function calls.

    You should not use waits in spells / systems. They are inaccurate among other things. See my tutorial Things you should know when using triggers / gui. Link is in my sig below.

    Never use integer A / B. They are inefficient and slow. Make your own custom integer to do the looping.

    Only use And all conditions inside an or condition block.
    please read the first ITE to find out the reason.
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • And - All (Conditions) are true


    Every 0.01 seconds is to fast. You should use every 0.03

    You should use a list or player force to make looping more efficient rather than looping through all 11 indexes.

    This currently has bugs as you can exit from the camera locking.

    This is currently more of a template as it does not allow for configuration.

    You should check out my camera system http://www.hiveworkshop.com/forums/spells-569/camera-lock-system-v2-5-0-1-a-239423/. It does tons of more stuff than this one. If you want to add the useability to yours and try to update it it may be approved but it is far from being approved in its current state.
     
  7. stan0033

    stan0033

    Joined:
    Jun 27, 2010
    Messages:
    1,623
    Resources:
    14
    Models:
    4
    Packs:
    1
    Skins:
    2
    Maps:
    6
    Spells:
    1
    Resources:
    14
    It's nice, man. But the acceleration is too much. Can't you make it move/accelerate with/to normal speed?
     
  8. Vincent_Freeman

    Vincent_Freeman

    Joined:
    Apr 26, 2014
    Messages:
    35
    Resources:
    0
    Resources:
    0
    My car stops and don't move for some reason after a few seconds of actual driving. It turns round, but it doesn't move forward or backwards for some reason.
    What could it be?
     
  9. Trigger.edge

    Trigger.edge

    Joined:
    Jun 21, 2012
    Messages:
    424
    Resources:
    0
    Resources:
    0
    looks good but... why after a while I can not speed?
     
  10. DARKLORD24

    DARKLORD24

    Joined:
    Mar 14, 2011
    Messages:
    16
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Alright i will modify this, but now i`m concentrating on bug elimination first, then after no bugs are left i will optimize.
    Unless you suggest an alternative, i have no idea what you want me to do, i must have that wait in it, otherwise if you press the LEFT,RIGHT keys and dont hold it for atleast 1 second, it wont steer the car, and it will look choppy.
    Should I use Pick every player... is that faster?

    I do use it like this, there was 1 case where I didn't, so i fixed that, thanks.

    I`ve set it to 0.03 but now it feels choppy, i have to change some setting to the camera to make it look better, but you are right 0.01 with 11 players might cause some lagg.However testing it all by myself it was very smooth.
    So Pick every player... is better than the for loop or not?

    Please specify i have no idea what you are talking about

    It might get rejected at first but i`m woking on it to be approved later, i really really want to fix this as later i might make a car racing map.

    Of course you can, in the init trigger you can set the PL_STATS_TOPSPEED[playerindex] array, as you wish to be the top speed, the car will accelerate until it hits the top speed.

    Also the PL_STATS_ACCELERATION[1] = 0.25 for player 1 might be smaller. Set it to 0.05 for smaller acceleration.

    Remember there are 3 variables that are important, which can be used for car game:

    Set PL_STATS_HANDLING[] = steering speed
    Set PL_STATS_TOPSPEED[] = max speed (accelerates until it hits this)
    Set PL_STATS_ACCELERATION[] = the acceleration increment size (better cars accelerate faster than bad cars)

    I`ve observed that, it is because the acceleration and deceleration is not properly synchronized, so far i can not figure out how to do that, maybe somebody can help me please :grin:
     
    Last edited by a moderator: Nov 28, 2014
  11. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,736
    Resources:
    103
    Models:
    87
    Icons:
    5
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    103
    Instead of adding the players manually, you can loop from 1 to 12 at map init and add Events to corresponding trigger.

    Also why is Player 12 exempted? :eek:
     
  12. DARKLORD24

    DARKLORD24

    Joined:
    Mar 14, 2011
    Messages:
    16
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Wait hold on, the Init trigger is not finished, is only for demonstration to test it on player 1. I will work on that on my next version.

    Player 12 is exempted because there must be a computer player in a game to be able to play, and even if you somehow with jass or something go around this, i`ve never seen a map where you dont have atleast 1 NPC player, especially for a car game (where i suppose you can use my trigger) you need a tournament NPC player or something like that, Neutral Passive is just not good enough.

    ----------------------------------------------------------------------

    Ok at the moment i`m woking on the spell, wait 30 maybe 45 minutes and i will post the new version where i will definitely correct that movement bug ASAP, i have a very good idea how to synchronize the acceleration/deceleration, i will use the rotation scheme to do it, because there even if you hold the RIGHT/LEFT arrow simultaneously it works perfectly, the same way i will do with UP/DOWN arrows. While the deceleration will be an absolute value always, so that it will always go to 0 speed when substracted, while the BACKWARDS move will be negative speed with a mirror NEGATIVE TOP SPEED at its cap, so that if you push the UP/DOWN simultaneously it will either substract/add a speed to it, and because the Reverse move is slower than the forward acceleration, it will go ahead, but it will slow down the car, as if its only the ACCELERATION pushed, then the car will accelerate at TOP SPEED.

    Version 1.1

    Changelog:
    -Fixed sliding bug (fractional division leftover could cause the car to not stop is fixed)
    -Fixed acceleration/deceleration sync, now you can do both at a time and it will add/subtract from the current speed
    -Added custom car model and horn effect
    -Reworked the triggers and removed unnecesary variables
    -Added speedometer, however it might memory leak, but it is not meant to use in the main system, it is just for misc/debug stuff for now, the main system is MOVEMENTSYSTEM folder, everything else is misc or init stuff

    I`ve fixed the car stopping/ and or going wild like a boomerang if keys are pressed in bad order, it was a crucial bug so im glad that its fixed, i had to rework the triggers a bit, and it was easy to fix.

    Past version used unit facing (Car facing) for forward and (Car Facing-180*) for backwards which caused the bug as if you cant add or subtract speed to different angled variables, so i`m not only using Car facing, but the reverse direction is now using negative speed and negative top speed.So if i decide to work on a speedometer too then i will have to use absolute value of that, but otherwise its perfect now.

    On the other hand the camera system is still a bit too crude and choppy but i will work on that, maybe i will use a custom camera system for that, as suggested by deathismyfriend

    I will also try to add a collision system, and a car health system if it collides it loses health, maybe some nice animations for the car to get on fire if it collides with something.
     
    Last edited by a moderator: Nov 28, 2014
  13. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    Using an integer loop is faster than a player force loop. But you need to use an indexing type when players leave they need to be removed. When the game starts only the playing players should be put into the player force.
    Player force will be better and easier to use here.

    There were many cases where you used an and all condition block inside the ITE.

    You lock you camera to a unit to prevent a player from moving the camera. This locking can be stopped by the keyboard (I forget the button/s).

    About waits use timers / triggers with a time elapsed event to get rid of the use of the waits. Look at my tutorial for more information. Things You Should Know When Using Triggers / GUI
     
  14. DARKLORD24

    DARKLORD24

    Joined:
    Mar 14, 2011
    Messages:
    16
    Resources:
    1
    Maps:
    1
    Resources:
    1
    What if i leave the integer loop but right at the beginning i test if the player is playing and or is a human player.
    Will that be efficient and fast, faster than player loop?
    I`m sure i fixed them all

    I will look into this
    Please give link, the only thing i found there is that you say that a 0.75 sec wait is more efficient, yet i have 0.1 second and the timing itself is not that important, its only for rotation effect if it delays 0.1-0.3 then its ok, the player will experience a bit of rotation sliding but i think its acceptable at that level.
     
  15. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    Putting players in a permanent player force will be faster than always searching through a loop each iteration.

    The link is in my sig.

    Also post triggers in map description.
     
  16. DARKLORD24

    DARKLORD24

    Joined:
    Mar 14, 2011
    Messages:
    16
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Alright i will do that, and test for player if its human, or of its in game in case of somebody leaves to be faster.

    However, i will disable these tests, since until i finish this system i would like to experience how it feels if all 11 are in.Because if i test it in 1st person alone, i would only experience how it feels with 1 person playing, but i want to experience how it feels with 11 person playing, to see if its lagging too much or what.

    Anyway i really appreciate your feedback and help man, please continue to feedback, i need it.
     
  17. GywGod133

    GywGod133

    Joined:
    Jul 16, 2012
    Messages:
    646
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3

    • The name of the trigger must be read properly. (Optional)
    Ex: SP Int, SP Loop, etc

    • 0.01 using periodic time , some computers will become laggy . so use 0.03 instead or above.

    • Do not use Integer A or B , use an integer variable instead

    • Dont use Wait

    • You can also do it like this
    Example
    • Example
      • Events
        • Map initialization
      • Conditions
      • Actions
        • For each (Integer SP_TempInt) from 1 to 11, do (Actions)
          • Loop - Actions
            • Trigger - Add to LEFTxxPRESS <gen> the event (Player - (Player(SP_TempInt)) Presses the Left Arrow key)
            • Trigger - Add to LEFTxxRELEASE <gen> the event (Player - (Player(SP_TempInt)) Releases the Left Arrow key)
            • Trigger - Add to RIGHTxxPRESS <gen> the event (Player - (Player(SP_TempInt)) Presses the Right Arrow key)
            • Trigger - Add to RIGHTxxRELEASE <gen> the event (Player - (Player(SP_TempInt)) Releases the Right Arrow key)
            • Trigger - Add to FORWARDxxPRESSxxGAS <gen> the event (Player - (Player(SP_TempInt)) Presses the Up Arrow key)
            • Trigger - Add to FORWARDxxRELEASE <gen> the event (Player - (Player(SP_TempInt)) Releases the Up Arrow key)
            • Trigger - Add to BACKWARDSxxPRESSxxBREAK <gen> the event (Player - (Player(SP_TempInt)) Presses the Down Arrow key)
            • Trigger - Add to BACKWARDSxxRELEASE <gen> the event (Player - (Player(SP_TempInt)) Releases the Down Arrow key)
        • Custom script: call DestroyTrigger( GetTriggeringTrigger())

     
  18. DARKLORD24

    DARKLORD24

    Joined:
    Mar 14, 2011
    Messages:
    16
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Note that i`ve updated the map, fixed many stuff so please review it again.

    Also i`m using now Pick every player ... , because deathismyfriend told that its faster than the integer, (not that it changes anything in the framepersecond, but probably its better with more players)

    • Can you prove that your trigger inside the integer is faster than the one mentioned by deathismyfriend?
      If not then i will use the Pick every player ...
    • Also if i were to use 0.03 then the camera gets too choppy i will test them map this afternoon with more players but i dont guarantee anything.
    • Also give me an alternative to wait, all of you said that i should not use it, but none of you gave any alternative to it... :vw_wtf:


    Alright i`ve updated the map fixed many stuff, and did as you suggested, now i got a player group and a variable for player number of picked player and also its memory leak free.

    However i didnt experienced any change between this method and the for loop integer method, the FPS is the same with both methods, are you sure this one is faster?? :ogre_haosis:
     
  19. GywGod133

    GywGod133

    Joined:
    Jul 16, 2012
    Messages:
    646
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Indexing Function. this is the most important in making spell

    so that you can make alternative wait