- Joined
- Apr 24, 2008
- Messages
- 174
How to create an Keyboard Controlled Camera
Use your Keyboard arrows to change the camera
Made by MyHummeR (2009/05/25)
Copyright
Copyright
Click here to fast-download an Demo Map for this system (soon available).
Welcome! In this tutorial, I will teach you how to make an cool controllable camera in Warcraft, in the GUI (Trigger) language. If you follow this guide to 100%, I ensure you that you will have a cool camera that works MUI (Multiplayer) and is leakless and free from bugs!
You will be able to pan your cameras angle and rotation smoothly around a unit, using your UP, DOWN, LEFT and RIGHT keyboard arrows! Open your Trigger Editor (Hotkey: F4) and create a new trigger called "Camera Start". This trigger is made to set the Variables that we will need for this system.
Ok, in the Trigger we made (Camera Start), create this action:
Notice: You can set the variable to any unit you want, this was just an example. This set will work on a Hero unit only. So, set it to any unit you would like.
The "Player_Character[(Integer A)]" is required or else it wont work in MUI. The Integer A function will add the number 1 to 12 (Player 1 Red - Player 12 Brown). So, now you know what the Integer A does, right?
Ok, time for some more Variable sets. Now, create a new Variable named "Camera_Angle" of type "Real", also check "Array" on this variable. This Variable will work as our Camera Angle (the angle of how the camera should be viewed). Just like the Player_Character Variable, we will set this Variables Array to Integer A, and the Angle here should be 320.00 or kind of whatever you want, but let's do 320 now. So, set the Variable to that, the trigger should now look something like this:
Next, we will set the Camera Distance! So, make a new Variable of type "Real", named "Camera_Distance", and like the other Variables, the "Array" box should be checked. Set it to 1300.00, that should make a good Distance. Oh right, I shoudl explain what this does
Well, this Variable will work as our Camera Distance, it's the distance the camera will have to the unit. The higher number you have, the longer the distance will become.
Well, your trigger should now look like this:
This Variable is not set by Numbers, but by the Facing Angle of your unit.
Well, make an variable named "Camera_Rotation" of type "Real".
Set the Variable to work for as Unit Rotation, should look like this:
Next, we will need to create some new triggers, but first, make sure this is how your trigger looks like now:
Time to make the first (Singleplayer) camera! Don't worry, we will make this work MUI Let's make a new trigger and call it "Camera Work". This trigger will be used for setting the camera every 0.01 seconds (this is needed to disable the mouse-scroll). So, make a new event in the trigger, like this:
So, every 0.01 game seconds, the trigger will the all online players camera distance. Moving on...
Next, we will make a new action. We need the camera to set the Distance, Angle and Rotation. So now we will make the Angle action. Create a new action that looks like this:
Next up, is setting the Keyboard Arrow commands! These "commands" allows a player to press an keyboard arrow to change the camera!
First up is moving the camera angle Down. Make a new trigger and call it "Camera Down Press". Add this event:
[hidden="Only if Multiplayer function is wanted]
Welcome! In this tutorial, I will teach you how to make an cool controllable camera in Warcraft, in the GUI (Trigger) language. If you follow this guide to 100%, I ensure you that you will have a cool camera that works MUI (Multiplayer) and is leakless and free from bugs!
You will be able to pan your cameras angle and rotation smoothly around a unit, using your UP, DOWN, LEFT and RIGHT keyboard arrows!
Before we are done with this Guide, we should have done:
- Creating the first Trigger
- Setting the Variables and the base Actions
- Creating the first controllable Camera
- Copying and making it MUI
- Complete!
Part One - Creating the first Trigger
Part Two - Setting the Variables and the base Actions
-
Camera Start
-
Events
- Time - Elapsed game time is 0.02 seconds
-
Events
-
Camera Start
-
Actions
-
For each (Integer A) from 1 to 12, do (Actions)
- Loop - Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Actions
-
Camera Start
-
Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Loop - Actions
- Set Player_Character[(Integer A)] = (Random unit from (Units owned by (Player((Integer A))) matching (((Matching unit) is A Hero) Equal to True)))
-
Loop - Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Actions
Notice: You can set the variable to any unit you want, this was just an example. This set will work on a Hero unit only. So, set it to any unit you would like.
The "Player_Character[(Integer A)]" is required or else it wont work in MUI. The Integer A function will add the number 1 to 12 (Player 1 Red - Player 12 Brown). So, now you know what the Integer A does, right?
Ok, time for some more Variable sets. Now, create a new Variable named "Camera_Angle" of type "Real", also check "Array" on this variable. This Variable will work as our Camera Angle (the angle of how the camera should be viewed). Just like the Player_Character Variable, we will set this Variables Array to Integer A, and the Angle here should be 320.00 or kind of whatever you want, but let's do 320 now. So, set the Variable to that, the trigger should now look something like this:
-
Camera Start
-
Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Loop - Actions
- Set Player_Character[(Integer A)] = (Random unit from (Units owned by (Player((Integer A))) matching (((Matching unit) is A Hero) Equal to True)))
- Set Camera_Angle[(Integer A)] = 320.00
-
Loop - Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Actions
Next, we will set the Camera Distance! So, make a new Variable of type "Real", named "Camera_Distance", and like the other Variables, the "Array" box should be checked. Set it to 1300.00, that should make a good Distance. Oh right, I shoudl explain what this does
Well, this Variable will work as our Camera Distance, it's the distance the camera will have to the unit. The higher number you have, the longer the distance will become.
Well, your trigger should now look like this:
-
Camera Start
-
Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Loop - Actions
- Set Player_Character[(Integer A)] = (Random unit from (Units owned by (Player((Integer A))) matching (((Matching unit) is A Hero) Equal to True)))
- Set Camera_Angle[(Integer A)] = 320.00
- Set Camera_Distance[(Integer A)] = 1300.00
-
Loop - Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Actions
This Variable is not set by Numbers, but by the Facing Angle of your unit.
Well, make an variable named "Camera_Rotation" of type "Real".
Set the Variable to work for as Unit Rotation, should look like this:
-
Camera Start
-
Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Loop - Actions
- Set Player_Character[(Integer A)] = (Random unit from (Units owned by (Player((Integer A))) matching (((Matching unit) is A Hero) Equal to True)))
- Set Camera_Angle[(Integer A)] = 320.00
- Set Camera_Distance[(Integer A)] = 1300.00
- -------- You are here now: --------
- Set Camera_Rotation[(Integer A)] = (Facing of Player_Character[(Integer A)])
-
Loop - Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Actions
Next, we will need to create some new triggers, but first, make sure this is how your trigger looks like now:
-
Camera Start
-
Events
- Time - Elapsed game time is 0.01 seconds
- Conditions
-
Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Loop - Actions
- Set Player_Character[(Integer A)] = (Random unit from (Units owned by (Player((Integer A))) matching (((Matching unit) is A Hero) Equal to True)))
- Set Camera_Angle[(Integer A)] = 320.00
- Set Camera_Distance[(Integer A)] = 1300.00
- Set Camera_Rotation[(Integer A)] = (Facing of Player_Character[(Integer A)])
-
Loop - Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Events
Part three - Creating the first controllable camera
-
Camera Work
-
Events
- Time - Every 0.01 seconds of game time
-
Events
-
Camera Work
-
Actions
-
Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
- Loop - Actions
-
Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
-
Actions
-
Camera Work
-
Events
- Time - Every 0.01 seconds of game time
- Conditions
-
Actions
-
Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
-
Loop - Actions
- -------- You are here --------
- Camera - Set (Picked player)'s camera Distance to target to Camera_Distance[(Player number of (Picked player))] over 0.00 seconds
-
Loop - Actions
-
Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
-
Events
So, every 0.01 game seconds, the trigger will the all online players camera distance. Moving on...
Next, we will make a new action. We need the camera to set the Distance, Angle and Rotation. So now we will make the Angle action. Create a new action that looks like this:
-
Camera Work
-
Events
- Time - Every 0.01 seconds of game time
- Conditions
-
Actions
-
Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
-
Loop - Actions
- Camera - Set (Picked player)'s camera Distance to target to Camera_Distance[(Player number of (Picked player))] over 0.00 seconds
- -------- You are here: --------
- Camera - Set (Picked player)'s camera Angle of attack to Camera_Angle[(Player number of (Picked player))] over 0.00 seconds
-
Loop - Actions
-
Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
-
Events
-
Camera Work
-
Events
- Time - Every 0.01 seconds of game time
- Conditions
-
Actions
-
Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
-
Loop - Actions
- Camera - Set (Picked player)'s camera Distance to target to Camera_Distance[(Player number of (Picked player))] over 0.00 seconds
- Camera - Set (Picked player)'s camera Angle of attack to Camera_Angle[(Player number of (Picked player))] over 0.00 seconds
- -------- You are here: --------
- Camera - Set (Picked player)'s camera Rotation to Camera_Rotation[(Player number of (Picked player))] over 0.00 seconds
-
Loop - Actions
-
Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
-
Events
Next up, is setting the Keyboard Arrow commands! These "commands" allows a player to press an keyboard arrow to change the camera!
First up is moving the camera angle Down. Make a new trigger and call it "Camera Down Press". Add this event:
-
Camera Down Press
-
Events
- Player - Player 1 (Red) Presses the Down Arrow key
-
Events
[hidden="Only if Multiplayer function is wanted]
-
Camera Down Press
-
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
- Player - Player 12 (Brown) Presses the Down Arrow key
-
Events
UPDATE COMMING UP SOON!
Last edited: