Okay. So everyone wants to know how to make a first person camera and movement system, and keeps asking the same questions. So I will make this tutorial as simple and as easy as possible so as to help all the WE n00bs.
Lets start out with movement.
1: Create four boolean array variables: Up, Down, Left, Right
2: Make respective triggers for each like this:
Up:
3: Create a Unit Array variable named Hero
4: Create a Timer variable named Do_Stuff
Make these triggers:
Initialization:
5: Create a real, non-array variable called LocZ
6: Create a point, non-array variable called Hero_Position
Add on to the Movement and Camera trigger afterwards:
Difficult, but with 1st person cameras, that's the easiest it gets. For help on making scopes, shooting systems, and looking up and down, send me a private message.
Hope this helped!
- satient
Lets start out with movement.
1: Create four boolean array variables: Up, Down, Left, Right
2: Make respective triggers for each like this:
Up:
-
Events - Player - Player 1 Presses the Up arrow key
-
Player - Player 2 Presses the Up arrow key
-
Player - Player 3 Presses the Up arrow key
-
Conditions -
-
Actions - Set Up[(Player number of (Triggering player))] = True
-
Events - Player - Player 1 Releases the Up arrow key
-
Player - Player 2 Releases the Up arrow key
-
Player - Player 3 Releases the Up arrow key
-
Conditions -
-
Actions - Set Up[(Player number of (Triggering player))] = False
3: Create a Unit Array variable named Hero
4: Create a Timer variable named Do_Stuff
Make these triggers:
Initialization:
-
Events - Map Initialization
-
Conditions -
-
Actions - Set Hero[(Player number of (Player Group (Player 1 Red)))] to (Your Dude)
-
Set Hero[(Player number of (Player Group (Player 2 Blue)))] to (His Dude)
-
Set Hero[(Player number of (Player Group (Player 3 Green)))] to (His Dude)
-
Countdown Timer - Start (Do_Stuff) as a Repeating timer that will expire in 0.10 seconds
-
Events - Time - Do_Stuff expires
-
Conditions -
-
Actions - Player Group - pick all players in (All Players) and do actions:
-
Loop - actions
-
If (All conditions are True) then do (Then actions) else do (Else Actions):
-
If - Conditions
-
Hero[(Player number of (Picked player))] is alive = True
-
Then - Actions
-
-----moving-----
-
If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Up[Player number of (Picked player))] = True
-
Left[Player number of (Picked player))] = False
-
Right[Player number of (Picked player))] = False
-
Down[Player number of (Picked player))] = False
-
Then - Unit - order Hero[Player number of (Picked player))] move to [(Position of Hero[Player number of (Picked player))])] offset by 70 towards (Facing of Hero[Player number of (Picked player))]
-
Else - If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Up[Player number of (Picked player))] = True
-
Left[Player number of (Picked player))] = False
-
Right[Player number of (Picked player))] = True
-
Down[Player number of (Picked player))] = False
-
Then - Unit - order Hero[Player number of (Picked player))] move to [(Position of Hero[Player number of (Picked player))])] offset by 70 towards (Facing of Hero[Player number of (Picked player))] + -5 degrees
-
Else - If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Up[Player number of (Picked player))] = True
-
Left[Player number of (Picked player))] = True
-
Right[Player number of (Picked player))] = False
-
Down[Player number of (Picked player))] = False
-
Then - Unit - order Hero[Player number of (Picked player))] move to [(Position of Hero[Player number of (Picked player))])] offset by 70 towards (Facing of Hero[Player number of (Picked player))] + 5 degrees
-
Else - If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Up[Player number of (Picked player))] = False
-
Left[Player number of (Picked player))] = False
-
Right[Player number of (Picked player))] = True
-
Down[Player number of (Picked player))] = False
-
Then - Unit - Make Hero[Player number of (Picked player))] face [(Facing angle of Hero[Player number of (Picked player))] + -5 degrees)] over 0.00 seconds
-
Else - If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Up[Player number of (Picked player))] = False
-
Left[Player number of (Picked player))] = True
-
Right[Player number of (Picked player))] = False
-
Down[Player number of (Picked player))] = False
-
Then - Unit - Make Hero[Player number of (Picked player))] face [(Facing angle of Hero[Player number of (Picked player))] + 5 degrees)] over 0.00 seconds
-
Else - If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Up[Player number of (Picked player))] = False
-
Left[Player number of (Picked player))] = False
-
Right[Player number of (Picked player))] = False
-
Down[Player number of (Picked player))] = True
-
Then - Unit - Move Hero[Player number of (Picked player))] instantly to [(Position of Hero[Player number of (Picked player))] offset by 5 towards [(Facing of Hero[Player number of (Picked player))] + 180 degrees)])]
-
Animation - Play Hero[Player number of (Picked player))]'s walk animation
-
Else - If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Up[Player number of (Picked player))] = False
-
Left[Player number of (Picked player))] = False
-
Right[Player number of (Picked player))] = True
-
Down[Player number of (Picked player))] = True
-
Then - Unit - Move Hero[Player number of (Picked player))] instantly to [(Position of Hero[Player number of (Picked player))] offset by 5 towards [(Facing of Hero[Player number of (Picked player))] + 180 degrees)])]
-
Unit - Make Hero[Player number of (Picked player))] face [(Facing angle of Hero[Player number of (Picked player))] + -5 degrees)] over 0.00 seconds
-
Animation - Play Hero[Player number of (Picked player))]'s walk animation
-
Else - If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Up[Player number of (Picked player))] = False
-
Left[Player number of (Picked player))] = True
-
Right[Player number of (Picked player))] = False
-
Down[Player number of (Picked player))] = True
-
Then - Unit - Move Hero[Player number of (Picked player))] instantly to [(Position of Hero[Player number of (Picked player))] offset by 5 towards [(Facing of Hero[Player number of (Picked player))] + 180 degrees)])]
-
Unit - Make Hero[Player number of (Picked player))] face [(Facing angle of Hero[Player number of (Picked player))] + 5 degrees)] over 0.00 seconds
-
Animation - Play Hero[Player number of (Picked player))]'s walk animation
-
Else -
-
Else -
5: Create a real, non-array variable called LocZ
6: Create a point, non-array variable called Hero_Position
Add on to the Movement and Camera trigger afterwards:
-
Actions - -----camera-----
-
Player Group - Pick All players in (All players) and do actions:
-
Loop - Actions -
-
If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Hero[(Player number of (Picked player))] is alive = True
-
Then - Set Hero_Position[(Player number of (Picked player))] = Position of Hero[(Player number of (Picked player))]
-
Custom script: set udg_LocZ=GetLocationZ(udg_Hero_Position)
-
Camera - Lock camera target for (Picked player) to Hero[(Player number of (Picked player))] offset by ((25 x ((Cos(Facing of Hero[(Player number of (Picked player))], ((25 x ((Sin(Facing of Hero[(Player number of (Picked player))])))) using the unit's rotation
-
Camera - Set (Picked player)'s camera rotation to (Facing of Hero[(Player number of (Picked player))]) over 0.25 seconds
-
Camera - Set (Picked player)'s Height Offset to 85 + LocZ
-
Camera - Set (Picked player)'s Angle of attack to 340 (for now, we will change this later) over 0.50 seconds
-
Camera - Set (Picked player)'s Distance to target to 0 over 0.50 seconds
-
Camera - Set (Picked player)'s Far Z to 10000000 over 0.10 seconds
-
Custom script: call RemoveLocation (udg_Hero_Position)
-
Actions - -----auto-stop aka no cheating!-----
-
Player Group - Pick All Players in (All Players) and do actions:
-
Loop - Actions -
-
If (All conditions are True) then do (Then actions) else do (Else actions):
-
If - Up[(Player number of (Picked Player))] = False
-
Down[(Player number of (Picked Player))] = False
-
Then - Unit - order Hero[(Player number of (Picked Player))] to stop
Difficult, but with 1st person cameras, that's the easiest it gets. For help on making scopes, shooting systems, and looking up and down, send me a private message.
Hope this helped!
- satient