Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    2. News

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
    1. GTA Online

      1. After Hours
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Forum Support

    2. Site Suggestions

aldrinjohnom

TurretMode at Actor's Position

Recommended Posts

aldrinjohnom

I just started my first cleo script on san andreas about helicopter transport.

 

But I just got one big problem since my knowledge on cleo and mathematics are not that big, my case was:

- I have an helicopter with an enterable interior

- When CJ($PLAYER_ACTOR) is inside the interior(collided with the helicopter) and he presses key T + L,  CJ will go on turretmode ON THE SAME SPOT WHERE HE IS LOCATED.

 

My first Try was:

 

/// [email protected] = helicopter = bla bla
if and
	0AB0:   key_pressed 85 // T
	0AB0:   key_pressed 76 // L
	0547:  actor $PLAYER_ACTOR colliding_with_car [email protected]
then
	00a0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]
	0470: [email protected] = actor $PLAYER_ACTOR current_weapon
	0464: put_actor $PLAYER_ACTOR into_turret_on_car [email protected] at_car_offset 0.0 0.0 0.0 position 2 shooting_angle_limit 360.0 with_weapon [email protected] // actor will enter the turretmode stace.... The offset 0.0 0.0 0.0 was just a dummy offset that temporary put cj's position on that offset
	08C7: put_actor $PLAYER_ACTOR at [email protected] [email protected] [email protected] dont_warp_gang // reupdate the position of cj to his last position
end

 

But since "TURRETMODE" automatically updates the ACTOR's POSITION INTO THE OFFSET POSITION OF THE HELICOPTER, EVERYTIME HIS POSITION CHANGES. Neglecting the Command of opcode 08C7 to update CJ's position since CJ's position is locked at the specific offsets of the helicopter/car.

 

Any Work-around to do this? Please Help me! Thank you Guys.

Share this post


Link to post
Share on other sites
Sanmodder

you checked these opcodes
0465: remove_actor $ PLAYER_ACTOR from_turret_mode
0A32: actor 2 @ on_turret_of_car
8A32: not actor 2 @ on_turret_of_car

Share this post


Link to post
Share on other sites
aldrinjohnom
Posted (edited)
On 6/19/2018 at 3:27 AM, Sanmodder said:

you checked these opcodes
0465: remove_actor $ PLAYER_ACTOR from_turret_mode
0A32: actor 2 @ on_turret_of_car
8A32: not actor 2 @ on_turret_of_car

Yes, I know those opcodes.

 

0465:

removes the actor from turretmode,allowing the actor to Move freely,allowing the funtionality of teleporter opodes like 08C7(since teleporter opcodes will not work when on turretmode)

 

0A32 and 8A32 is a boolean opcode to tell whether the actor is on turretmode or not. Yes I know that.

 

If there is no work around, I think The case on my problem can be solved by “Vector Analysis”. But I am not that educated on that field, can anyone help me show their code?

Edited by aldrinjohnom

Share this post


Link to post
Share on other sites
Sanmodder
19 minutes ago, aldrinjohnom said:

Yes, I know those opcodes.

 

0465:

removes the actor from turretmode,allowing the actor to Move freely,allowing the funtionality of teleporter opodes like 08C7(since teleporter opcodes will not work when on turretmode)

 

0A32 and 8A32 is a boolean opcode to tell whether the actor is on turretmode or not. Yes I know that.

 

If there is no work around, I think The case on my problem can be solved by “Vector Analysis”. But I am not that educated on that field, can anyone help me show their code? 

I do not understand your post very much
maybe this script will help you
he is on a heli taxi

 

{$CLEO .cs}

//-------------MAIN---------------
thread 'TORHEL' 


:TORHEL_F
wait 0 
if 
   Player.Defined(0)
jf @TORHEL_3A 
jump @TORHEL_41 

:TORHEL_3A
jump @TORHEL_F 

:TORHEL_41
wait 0 
Model.Load(#MAVERICK)
Model.Load(#FAM1)
038B: load_requested_models 
wait 100 

:TORHEL_54
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 100.0 100.0 100.0 
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -100.0 -100.0 0.0 
0208: [email protected] = random_float_in_ranges [email protected] [email protected] 
0208: [email protected] = random_float_in_ranges [email protected] [email protected] 
0087: 19@ = [email protected] // (float) 
if 
00C2:   sphere_onscreen [email protected] [email protected] [email protected] radius 5.0 
jf @TORHEL_D2 
wait 0 
jump @TORHEL_54 

:TORHEL_D2
[email protected] = Car.Create(#MAVERICK, [email protected], [email protected], [email protected])
Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected])
Car.SetImmunities([email protected], 1, 1, 1, 1, 1)
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 1.0 1.0 1.0 
04A2: set_heli [email protected] fly_to [email protected] [email protected] [email protected] altitude_between 70.0 and 70.0 
039F: set_car [email protected] race_to [email protected] [email protected] 
0825: set_helicopter [email protected] instant_rotor_start 
[email protected] = Actor.CreateAsDriver(Gang2, #FAM1, [email protected])
Actor.RemoveFromMissionCleanupList([email protected])
Actor.Health([email protected]) = 100000
Actor.SetImmunities([email protected], 1, 1, 1, 1, 1)
[email protected] = Marker.CreateAboveCar([email protected])

:TORHEL_177
wait 0 
if 
0202:   actor $PLAYER_ACTOR near_car [email protected] radius 15.0 15.0 sphere 0 
jf @TORHEL_217 
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 2.0 1.0 
04D3: get_nearest_car_path_coords_from [email protected] [email protected] [email protected] type 2 store_to [email protected] [email protected] [email protected] 
04A2: set_heli [email protected] fly_to [email protected] [email protected] [email protected] altitude_between 0.0 and 0.0 
Car.PutAt([email protected], [email protected], [email protected], [email protected])
0ACA: show_text_box "PRESS R1 TO ENTER TO HELI" 
jump @TORHEL_21E 

:TORHEL_217
jump @TORHEL_177 

:TORHEL_21E
wait 0 
if 
00F4:   actor [email protected] near_actor $PLAYER_ACTOR radius 6.0 6.0 0 in_car 
jf @TORHEL_280 
0ACA: show_text_box "PRESS R1 TO ENTER TO HELI" 
if 
00E1:   player 0 pressed_key 7 
jf @TORHEL_280 
wait 10 
05CA: AS_actor $PLAYER_ACTOR enter_car [email protected] passenger_seat 0 time 10000 

:TORHEL_280
if 
   Actor.InCar($PLAYER_ACTOR, [email protected])
jf @TORHEL_2E5 
067C: put_camera_on_actor $PLAYER_ACTOR offset 0.1 -0.1 0.65 rotation 0.1 0.0 0.65 tilt 0.0 switchstyle 1 
0ACA: show_text_box "SET MARKER ON MAP AND PRESS X OR SPACE" 
jump @TORHEL_2EC 

:TORHEL_2E5
jump @TORHEL_21E 

:TORHEL_2EC
0ACD: show_text_box "SET MARKER ON MAP AND PRESS X OR SPACE" time 5000 

04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.0 
0509: [email protected] = distance_between_XY [email protected] [email protected] and_XY [email protected] [email protected] 
0092: [email protected] = float [email protected] to_integer 
0513: show_text_box_1number 'NUMBER' number [email protected]  // ~1~
0AB6: store_target_marker_coords_to [email protected] [email protected] [email protected] // IF and SET 
wait 0 
if 
00E1:   player 0 pressed_key 16 
jf @TORHEL_39C 
04DF: set_heli [email protected] lean_and_thrust_limiter 0 
0564: heli [email protected] simulate_crash_landing 
07BB: set_heli [email protected] horizontal_thrust_power 10 
Car.SetMaxSpeed([email protected], 70.0)
07BB: set_heli [email protected] horizontal_thrust_power 6 
04A2: set_heli [email protected] fly_to [email protected] [email protected] [email protected] altitude_between 70.0 and 70.0 
00BC: show_text_highpriority GXT 'PILO' time 1000 flag 1 

:TORHEL_39C
if 
02BF:   car [email protected] sunk 
jf @TORHEL_3CF 
if 
   not Car.Wrecked([email protected])
jf @TORHEL_3C1 
0633: AS_actor $PLAYER_ACTOR exit_car 

:TORHEL_3C1
Camera.Restore_WithJumpCut
Car.RemoveReferences([email protected])
Actor.RemoveReferences([email protected])
end_thread 

:TORHEL_3CF
if 
00EE:   actor $PLAYER_ACTOR sphere 0 near_point [email protected] [email protected] radius 10.0 10.0 in_car 
jf @TORHEL_409 
04A2: set_heli [email protected] fly_to [email protected] [email protected] [email protected] altitude_between 0.0 and 0.0 

:TORHEL_409
if 
00E1:   player 0 pressed_key 15 
jf @TORHEL_43E 
0633: AS_actor $PLAYER_ACTOR exit_car 
Camera.Restore_WithJumpCut
Car.RemoveReferences([email protected])
Actor.RemoveReferences([email protected])
03E6: remove_text_box 
0062: [email protected] -= [email protected] // (int) 
Player.Money(0) += [email protected]
end_thread 

:TORHEL_43E
jump @TORHEL_2EC 

 

Share this post


Link to post
Share on other sites
aldrinjohnom
2 hours ago, Sanmodder said:

I do not understand your post very much
maybe this script will help you
he is on a heli taxi

 

{$CLEO .cs}

//-------------MAIN---------------
thread 'TORHEL' 


:TORHEL_F
wait 0 
if 
   Player.Defined(0)
jf @TORHEL_3A 
jump @TORHEL_41 

:TORHEL_3A
jump @TORHEL_F 

:TORHEL_41
wait 0 
Model.Load(#MAVERICK)
Model.Load(#FAM1)
038B: load_requested_models 
wait 100 

:TORHEL_54
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 100.0 100.0 100.0 
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -100.0 -100.0 0.0 
0208: [email protected] = random_float_in_ranges [email protected] [email protected] 
0208: [email protected] = random_float_in_ranges [email protected] [email protected] 
0087: [email protected] = [email protected] // (float) 
if 
00C2:   sphere_onscreen [email protected] [email protected] [email protected] radius 5.0 
jf @TORHEL_D2 
wait 0 
jump @TORHEL_54 

:TORHEL_D2
[email protected] = Car.Create(#MAVERICK, [email protected], [email protected], [email protected])
Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected])
Car.SetImmunities([email protected], 1, 1, 1, 1, 1)
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 1.0 1.0 1.0 
04A2: set_heli [email protected] fly_to [email protected] [email protected] [email protected] altitude_between 70.0 and 70.0 
039F: set_car [email protected] race_to [email protected] [email protected] 
0825: set_helicopter [email protected] instant_rotor_start 
[email protected] = Actor.CreateAsDriver(Gang2, #FAM1, [email protected])
Actor.RemoveFromMissionCleanupList([email protected])
Actor.Health([email protected]) = 100000
Actor.SetImmunities([email protected], 1, 1, 1, 1, 1)
[email protected] = Marker.CreateAboveCar([email protected])

:TORHEL_177
wait 0 
if 
0202:   actor $PLAYER_ACTOR near_car [email protected] radius 15.0 15.0 sphere 0 
jf @TORHEL_217 
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 2.0 1.0 
04D3: get_nearest_car_path_coords_from [email protected] [email protected] [email protected] type 2 store_to [email protected] [email protected] [email protected] 
04A2: set_heli [email protected] fly_to [email protected] [email protected] [email protected] altitude_between 0.0 and 0.0 
Car.PutAt([email protected], [email protected], [email protected], [email protected])
0ACA: show_text_box "PRESS R1 TO ENTER TO HELI" 
jump @TORHEL_21E 

:TORHEL_217
jump @TORHEL_177 

:TORHEL_21E
wait 0 
if 
00F4:   actor [email protected] near_actor $PLAYER_ACTOR radius 6.0 6.0 0 in_car 
jf @TORHEL_280 
0ACA: show_text_box "PRESS R1 TO ENTER TO HELI" 
if 
00E1:   player 0 pressed_key 7 
jf @TORHEL_280 
wait 10 
05CA: AS_actor $PLAYER_ACTOR enter_car [email protected] passenger_seat 0 time 10000 

:TORHEL_280
if 
   Actor.InCar($PLAYER_ACTOR, [email protected])
jf @TORHEL_2E5 
067C: put_camera_on_actor $PLAYER_ACTOR offset 0.1 -0.1 0.65 rotation 0.1 0.0 0.65 tilt 0.0 switchstyle 1 
0ACA: show_text_box "SET MARKER ON MAP AND PRESS X OR SPACE" 
jump @TORHEL_2EC 

:TORHEL_2E5
jump @TORHEL_21E 

:TORHEL_2EC
0ACD: show_text_box "SET MARKER ON MAP AND PRESS X OR SPACE" time 5000 

04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.0 
0509: [email protected] = distance_between_XY [email protected] [email protected] and_XY [email protected] [email protected] 
0092: [email protected] = float [email protected] to_integer 
0513: show_text_box_1number 'NUMBER' number [email protected]  // ~1~
0AB6: store_target_marker_coords_to [email protected] [email protected] [email protected] // IF and SET 
wait 0 
if 
00E1:   player 0 pressed_key 16 
jf @TORHEL_39C 
04DF: set_heli [email protected] lean_and_thrust_limiter 0 
0564: heli [email protected] simulate_crash_landing 
07BB: set_heli [email protected] horizontal_thrust_power 10 
Car.SetMaxSpeed([email protected], 70.0)
07BB: set_heli [email protected] horizontal_thrust_power 6 
04A2: set_heli [email protected] fly_to [email protected] [email protected] [email protected] altitude_between 70.0 and 70.0 
00BC: show_text_highpriority GXT 'PILO' time 1000 flag 1 

:TORHEL_39C
if 
02BF:   car [email protected] sunk 
jf @TORHEL_3CF 
if 
   not Car.Wrecked([email protected])
jf @TORHEL_3C1 
0633: AS_actor $PLAYER_ACTOR exit_car 

:TORHEL_3C1
Camera.Restore_WithJumpCut
Car.RemoveReferences([email protected])
Actor.RemoveReferences([email protected])
end_thread 

:TORHEL_3CF
if 
00EE:   actor $PLAYER_ACTOR sphere 0 near_point [email protected] [email protected] radius 10.0 10.0 in_car 
jf @TORHEL_409 
04A2: set_heli [email protected] fly_to [email protected] [email protected] [email protected] altitude_between 0.0 and 0.0 

:TORHEL_409
if 
00E1:   player 0 pressed_key 15 
jf @TORHEL_43E 
0633: AS_actor $PLAYER_ACTOR exit_car 
Camera.Restore_WithJumpCut
Car.RemoveReferences([email protected])
Actor.RemoveReferences([email protected])
03E6: remove_text_box 
0062: [email protected] -= [email protected] // (int) 
Player.Money(0) += [email protected]
end_thread 

:TORHEL_43E
jump @TORHEL_2EC 

 

Thank you for your Code, but that is not what Im looking for.

 

The problem was very simple. Imagine there is a plane. a plane has two wings,has a tail, and has a head. Imagine CJ Mounted ON TOP of the plane, and he managed to walk on the RIGHT WING. After CJ walked on the RIGHT wing of the plane, then he stopped and maintaned his position.

 

The player pressed "L + T". By Pressing key "L + T" , CJ will be on turretmode state... CJ's will be located at the right wing of the plane while in turret mode(since CJ is currently located at the right wing position BEFORE the player pressed "L + T")...

 

 

Take note: CJ POSITIONED at the Right wing of the plane was JUST AN EXAMPLE... If he CJ is located on the left wing of the plane and the player pressed the turretmode key... then CJ will be on turretmode state located on the LEFT WING... If located on  the head,turretmode located at the head... tail, turretmode located at the tail... pressed turretmode anywhere as soon as CJ is collided on the plane. then go on TURRETMODE on his same spot,same place.

 

Im having a hard time creating that script, I hope that you all understand why its hard.

 

Share this post


Link to post
Share on other sites
Sanmodder
Posted (edited)

I understand that you want to put Carl on the wing of the plane
then you have to set the appropriate offset
without visual tests, it will not work                                              

left-        forward+           up+

-1.0         -1.0                1.0    

right+     backward-       down-
06A7: put_actor [email protected] into_turret_on_car [email protected] at_car_offset -1.0 -1.0 1.0 position 1 shooting_angle 360.0 360.0 with_weapon 35
0638: AS_actor [email protected] stay_put 1

 

Edited by Sanmodder

Share this post


Link to post
Share on other sites
aldrinjohnom
19 minutes ago, Sanmodder said:

I understand that you want to put Carl on the wing of the plane
then you have to set the appropriate offset
without visual tests, it will not work                                              

left-        forward+           up+

-1.0         -1.0                1.0    

right+     backward-       down-
06A7: put_actor [email protected] into_turret_on_car [email protected] at_car_offset -1.0 -1.0 1.0 position 1 shooting_angle 360.0 360.0 with_weapon 35
0638: AS_actor [email protected] stay_put 1

 

Setting a "DEFINED" offset coordinate will limit CJ from choosing his desired turretmode location. EG. your example is offset -1.0 -1.0 1.0 respect to the helicopter. CJ will always be located at offset -1.0 -1.0 1.0. Even though he is located at the head of the plane, he will be teleported at offset -1.0 -1.0 1.0, that is not coordinate friendly... What we need I think is "an offset" from the helicopter where that offset will be the location of CJ. But how can we find that offset? Can you create one and show me your workaround I guess?

 

since gta is a 3d space with different local perspectives. That is where vector analysis might be needed to do world coordinates into vehicle offsets translation..

Share this post


Link to post
Share on other sites
aldrinjohnom

Ok, so nothing helped me here, I decided to go back studying algebra and trigonometry to understand 3-dimensional cartesian plane and the different rules of triangles. So I created a Prototype representation of my imagination that solves my own problem... It is a little-bit hard because opcodes that can be provided by sanny builder is not that many, that is why The workaround on the code was too complicated and the process was too long because of those limitations.Here is the code:

 

:mountposition
0001: wait 0 ms
if
	0AB0:   key_pressed 85 // T
	0AB0:   key_pressed 76 // L
jmf @mountposition
if and
	80DB:   not actor $PLAYER_ACTOR in_car [email protected]
	80DF:   not actor $PLAYER_ACTOR driving
	0547:  actor $PLAYER_ACTOR colliding_with_car [email protected]
	8A32:  not actor $PLAYER_ACTOR on_turret_of_car
then
	// ~~~~Trigonometric System~~~~
	// we will construct two triangles(has no 90 degrees corner):
	// 1st Triangle is non-right triangle:
	// *Corner1(Helicopter) - Can be defined by global world coordinates
	// *Corner2(Actor) - Can be defined by global world coordinates
	// *Corner3(WORLD ORIGIN[Global Coordinate means 0.0 0.0 0.0 of the world])
	
	// 2nd Triangle is a right triangle(the corner between "X" and "Y" axis is 90 degrees):
	// *Corner1(Helicopter X-Axis)- Since each Object in the world has their OWN 3-Dimensions(Local 3-Dimensions) that is independent on the WORLD 3-Dimension(Global 3-Dimension that is the used by the coodinates computations of opcodes), This X-Axis will be the Right and Left facing of the Helicopter. TAKE NOTE THAT THIS X-AXIS WILL BE THE "OPPOSITE" SIDE
	// *Corner2(Helicopter Y-Axis)- Since each Object in the world has their OWN 3-Dimensions(Local 3-Dimensions) that is independent on the WORLD 3-Dimension(Global 3-Dimension that is the used by the coodinates computations of opcodes), This Y-Axis will be the Front and Back facing of the Helicopter. TAKE NOTE THAT THIS Y-AXIS WILL BE THE "ADJACENT" SIDE
	// *Corner3(Distance between the Actor and the Helicopter in 2D Space) - Which will be the Hypothenuse
	
	// what is our goal and why are we doing this?
	// the opcodes only compute WORLD Coordinates, but not object offsets, our goal is to translate the world coordinate into the helicopter's offset to CJ(ACTOR)
	
	// construct two vectors
 	00a0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected] // vector 2
 	00AA: store_car [email protected] position_to [email protected] [email protected] [email protected] // vector 1
	//
	
 	0063: [email protected] -= [email protected]  // (float) // difference between height of actor and height of helicopter "with respect to ground". Since "Z"-Axis(Height) is a one dimension perspective that is splitted from "X"-Axis and "Y"-Axis. We can just get the difference between two Z-axis to get the "Z-Offset"... Pretty Easy for the Height
	
	0509: [email protected] = distance_between_XY [email protected] [email protected] and_XY [email protected] [email protected] // Finding the "Hypothenuse Side" of the "2nd Triangle", this is also the distance between the helicopter and the actor in 2d space using world coordinates.
	0087: [email protected] = [email protected] // (float) // im just going to save this value on another variable so that I can use [email protected] on another operations
	
	// mission:
	// find the angle between the "Corner2" and "Corner3" of the "2nd Triangle"
	0174: [email protected] = car [email protected] Z_angle // facing angle of the helicopter
	// the z-angle that is computed by opcode 0174 is the z-angle between the WORLD ORIGIN and facing angle of the helicopter, this has excess value present...
	039f: set_car [email protected] race_to [email protected] [email protected] // momentarily make helicopter face actor's world coordinate([email protected] as X, [email protected] as Y)
	0174: [email protected] = car [email protected] Z_angle // this is the "Excess" value on our "Z-Angle" at [email protected] we need to subract this angle value on the z-angle to find our target angle
 	0175: set_car [email protected] Z_angle_to [email protected] // Revert to the original face angle of the helicopter
	0063: [email protected] -= [email protected] // subtract the excess angle value to helicopter's facing angle... The answer will be the angle between "corner2" and "corner3" of the "2nd triagle"... Mission accomplished
	//
	
	// copy the distance between helicopter and actor in 2d space using world coords format
	0087: [email protected] = [email protected] // (float) // This will Represent "Ho" as Duplicate
	0087: [email protected] = [email protected] // (float) // This will Represent "Ho" as Duplicate
	//
	
	// ~~~Pythagorean Theorem at 2nd Triangle in 2D Space(neglected the Z-Axis since the z-axis can move alone on itself)~~~
	// We can now find the X-Offset and Y-Offset from Helicopter's Origin going Actor's Origin using our "Artificial 3D Cartesian Plane"(which is the helicopter's local dimension without using the global dimension(WORLD))
	// Variables:
	// Xo = Opposite Side or the Helicopter's X-Axis Offset(Needed to be calculated)
	// Yo = Adjacent Side or the Helicopter's Y-Axis Offset(Needed to be calculated)
	// Ho = Hypothenuse Side or the Distance between the Helicopter and the Actor in 2D space using world coords format
	
	// Formula:
	
	// Sin([email protected]) = Xo / Ho
	02F6: [email protected] = sine [email protected]
	006B: [email protected] *= [email protected]  // (float)
	//
	
	// Cos([email protected]) = Yo / Ho
	02F7: [email protected] = cosine [email protected]
	006B: [email protected] *= [email protected]  // (float)
	//
	
	0470: [email protected] = actor $PLAYER_ACTOR current_weapon
	0464: put_actor $PLAYER_ACTOR into_turret_on_car [email protected] at_car_offset [email protected] [email protected] [email protected] position 2 shooting_angle_limit 360.0 with_weapon [email protected]
	0ACE: show_formatted_text_box "You are currently in Turret Mode, use this command again to free yourself"	
else
	if
		0A32:  actor $PLAYER_ACTOR on_turret_of_car
	then
		// 0619: enable_actor $PLAYER_ACTOR collision_detection 1
		0465: remove_actor $PLAYER_ACTOR from_turret_mode
		0ACE: show_formatted_text_box "You can now Move Freely"	
	end
end
0001: wait 1000 ms
0002: jump @mountposition

 

I Hope I will help those people who would like to understand "how to translate world coordinates into object offsets".

 

Problem Solved!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 1 User Currently Viewing
    0 Members, 0 Anonymous, 1 Guest

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.