How to create a zoom camera/binoculars for enemy tagging
In Far Cry 4 you have a camera which you can use to zoom in on your enemies or prey and tag them with a visible symbol so that they are easier to spot. In Ghost Recon you have binoculars that can tag enemies. This tutorial is to create something similar.
Controls for the player:
D pad up to turn camera on and off
Left and right triggers to zoom in and out
D pad to turn left and right
Enemies will be automatically tagged when in range.
Instructions
In your enemy brains
WHEN [boolvar: seen] DO [display][icon:Direction arrow][above]
You can use whatever tagging symbol you like – and can use different ones for different enemies.
Your player
Attach a camera gizmo in front of his head. This will be your starting point for the camera.
In the player brain
WHEN [Dpad][up direction][pressed] DO [toggle][boolvar:camera]
WHEN [boolvar:camera]
…WHEN DO [display][Peephole small][screen center][scale][35][color:0001 (black)]
…WHEN [started to] DO
…/…WHEN DO [objvar:cam][=][create][IWP:zoom camera][at position][IWP:camera gizmo][position]
WHEN [not][camera]
…WHEN [1st person][from socket][center] // optional (I changed this as fighting close up you could not see the enemy)
…WHEN DO [display meter][health][screen top left]
…as childlines add all your normal controls here so that the player cannot move or interact when the camera is active.
Create a logic cube or camera gizmo to house the camera brain, make it a template. Turn on the see sensor and adjust it to the size you require for the camera to detect enemies. Change the properties to make the camera Team 2 (this will prevent the enemies attacking the camera when you get close).
Zoom camera brain
Page 1 – This controls the zoom and the enemy targeting
WHEN [started to] DO [forward][=][IWP:your player][forward]
WHEN DO [call page][2]
This will mark the enemies in Team 2 when seen by the camera.
WHEN [for each of][allies] DO
…WHEN [see][it]
…/…WHEN [not][it][boolvar:seen] DO [it][boolvar:seen][=][true]
…/…/…WHEN [started to] DO [play sound][UI Basic Toggle]
This controls the zoom
WHEN [Right trigger][and][numvar:zoom][<][15]
…WHEN DO [move][object forward]
…WHEN DO [numvar:zoom][increment by][0.1]
WHEN [left trigger][and][numvar:zoom][>][1] DO [move][object backward]
…WHEN DO [numvar:zoom][decrement by][0.1]
This destroys the camera when the player turns it off
WHEN [dpad][up direction][pressed] DO [destroy][me]
page 2 – this controls the left and right turns of the camera
WHEN DO [1st person camera][without controls]
WHEN DO [numvar:look left][=][clamp][max][30][min][-30][numvar:look left]
WHEN DO [numvar:look right][=][clamp][max][30][min][-30][numvar:look right]
WHEN [Dpad][left direction]
…WHEN [numvar:look left][not equal to][30] DO [yaw][slowly][camera relative][(][right][)]
…WHEN DO [numvar:look left][increment by][1]
…WHEN DO [numvar:look right][decrement by][1]
WHEN [Dpad][right direction]
…WHEN [numvar:look right][not equal to][30] DO [yaw][slowly][camera relative][(][left][)]
…WHEN DO [numvar:look right][increment by][1]
…WHEN DO [numvar:look left][decrement by][1]
Awesome tutorial, however, there are two mistakes. In the part discussing camera zoom the 4th line must be set to object backward not forward. Also on the Zoom section, the 3rd line should be DO not WHEN. Other than that great.
LikeLike
Thank you for pointing out the typos. I have corrected this tutorial.
LikeLike