Screen Camera Look at Position(Multi-Purpose)

This Snippet will instantly make your Camera Look on a specific 3D location. This Snippet actually has many uses like:
  • Make our Camera Follow/Lock-on a certain Actor by feeding this snippet with its Position.
  • Can be Used as an Aimbot, just feed this with a specified Camera XZ-Offsets for the Crosshair positions.
  • Can be used for Debugging purposes like "Offset Visualizer" Tool?

Code:
// 0AB1: @camatpos 5 _XYZ 0@ 1@ 2@ _withCamOffsetAngleX 3@ _andCamOffsetAngleZ 4@
:camatpos
    // ~~~~~~~~~~anti auto-vehicle cam movement
if and
    TIMERA>=400
    Actor.Driving($PLAYER_ACTOR)
then
    0A8C: write_memory 0xB70118 size 4 value 50.0 virtual_protect 0 // reset camera stabalizer timer, credit to Parazitas
    TIMERA = 0
end
    // ~~~~~~~~~~

068D: get_camera_position_to 31@ 30@ 29@

    // ~~~~~~~~~~Camera Z-Angle from our camera towards the target
0087: 28@ = 1@  // y2
0063: 28@ -= 30@  // y1
0087: 27@ = 0@  // x2
0063: 27@ -= 31@  // x1
0AA5: atan2 | 0x4207C0 2 2 | _X 27@ _Y 28@
0AE9: pop_float 28@ // store result from above operation
28@ += 3.1415926535897981710616733832795 // Camera Angle Leads 180 degrees respect to Z world coordinats
005B: 28@ += 4@  // use the defined camz offset to move the camera leftwards or rightwards
    // ~~~~~~~~~~

    // ~~~~~~~~~~Camera X-Angle from our camera towards the target
0087: 27@ = 2@ // z2
0063: 27@ -= 29@  // z1
0509: 26@ = distance_between_XY 31@ 30@ and_XY 0@ 1@ // adjacent side
0AA5: atan2 | 0x4207C0 2 2 | _X 26@ _Y 27@
0AE9: pop_float 27@ // store result from above operation
005B: 27@ += 3@  // use the defined camx offset to move the camera downwards or upwards
    // ~~~~~~~~~~

0A25: set_camera_on_players_X_angle 27@ Z_angle 28@
ret 0

Snippet Application Examples:

>>CamLock<<
Code:
00A0: store_actor $PLAYER_ACTOR position_to 0@ 1@ 2@
0AE1: 0@ = random_actor_near_point 0@ 1@ 2@ in_radius 1000.0 find_next 1 pass_deads 1
00A0: store_actor 0@ position_to 1@ 2@ 3@
0AB1: @camatpos 5 _XYZ 1@ 2@ 3@ _withCamOffsetAngleX 0.0 _andCamOffsetAngleZ 0.0

Code:
00A0: store_actor $PLAYER_ACTOR position_to 0@ 1@ 2@
0AE1: 0@ = random_actor_near_point 0@ 1@ 2@ in_radius 1000.0 find_next 1 pass_deads 1
0889: store_actor 0@ center_of_body_position_to 1@ 2@ 3@
   // configuration
30@ = 0.3
31@ = 0.3
   //
0AB1: @camatpos 5 _XYZ 1@ 2@ 3@ _withCamOffsetAngleX 30@ _andCamOffsetAngleZ 31@

Code:
00A0: store_actor $PLAYER_ACTOR position_to 0@ 1@ 2@
0AE1: 0@ = random_actor_near_point 0@ 1@ 2@ in_radius 1000.0 find_next 1 pass_deads 1
0889: store_actor 0@ center_of_body_position_to 1@ 2@ 3@

   // configuration
0470: 29@ = actor $PLAYER_ACTOR current_weapon
if and
         29@ >= 22
         29@ <= 38
         29@ <> 34 // not sniper
         29@ <> 35 // not RPG
         29@ <> 36 // not Heatseeker
then // for weapons with crosshair offset angles like handguns,shotguns,sub-machinceguns,machineguns,cowboy rifle
          30@ = -4.5 // X-Angle offset of Non-Sniper Crosshair degrees
          30@ /= 57.295779817106167876798171061675 // to radians
     
          31@ = 2.5 // Z-Angle offset of Non-Sniper Crosshair degrees
          31@ /= 57.295779817106167876798171061675 // to radians
else // for no  offset weapons like grenade ,fist , sniper, RPG, Heatseeker, etc... weapons
          30@ = 0.0
          31@ = 0.0
end
   //

0AB1: @camatpos 5 _XYZ 1@ 2@ 3@ _withCamOffsetAngleX 30@ _andCamOffsetAngleZ 31@
 
Last edited:

TwentyOne420

Member
Joined
Apr 15, 2022
Messages
6
Reaction score
0
how do i solve this

Incorrect expression TIMERA >= 400.
One of the variables has unknown type, or operands are incompatible
 

TwentyOne420

Member
Joined
Apr 15, 2022
Messages
6
Reaction score
0
TIMERA >= 400 to 32@ >= 400
:camatpos
// ~~~~~~~~~~anti auto-vehicle cam movement
if and
32@ >= 400
Actor.Driving($PLAYER_ACTOR)
then
0A8C: write_memory 0xB70118 size 4 value 50.0 virtual_protect 0 // reset camera stabalizer timer, credit to Parazitas
TIMERA = 0
end

ERROR:
Incorrect expression TIMERA = 0.
One of the variables has unknown type, or operands are incompatible.
 
Top