Jump to content

Need Help with This!


12jango

Recommended Posts

 

068D: get_camera_position_to 1@ 2@ 3@068E: get_camera_target_point_to 1@ 2@ 3@

 

 

I tried these opcodes in order to create a coordinate based on to where the camera pointing at.... whatsthat.gif

But, it seems like these opcodes are like this :

 

user posted image

 

Since these opcodes are like that, I can't create any coordinates, 'cause the 068D pointing to the player's head, and the 068E pointing to player's back! dontgetit.gif

 

Link to comment
Share on other sites

068E: get_camera_target_point_to 1@ 2@ 3@068D: get_camera_position_to 4@ 5@ 6@0087: 7@ = 1@0087: 8@ = 2@0087: 9@ = 3@0063: 7@ -= 4@0063: 8@ -= 5@0063: 9@ -= 6@for 11@ = 4=3.0 to 70.0 step 1.0  005B: 4@ += 7@  005B: 5@ += 8@  005B: 6@ += 9@  if      86BD:   not no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 1 actor 1 object 1 particle 0  then      break  endend

 

Link to comment
Share on other sites

Generally, the camera is attached to an entity and mostly to the player, so the camera's matrix is relative to that entity. Positions are picked from where the camera is pointing to (point->positions or viceversa, either while aiming or in free mode).

 

Using those opcodes, you can trace a vector passer-by two points, so that you can get another vector pointing to a third point on the same line with a fixed distance. Take a look at this code:

 

068E: get_camera_target_point_to 1@ 2@ 3@ 068D: get_camera_position_to 4@ 5@ 6@ 0087: 7@ = 1@ 0087: 8@ = 2@ 0087: 9@ = 3@ 0063: 7@ -= 4@ 0063: 8@ -= 5@ 0063: 9@ -= 6@ 10@ = 5.0 // distance multiplier006B: 7@ *= 10@ 006B: 8@ *= 10@ 006B: 9@ *= 10@ 005B: 4@ += 7@ 005B: 5@ += 8@ 005B: 6@ += 9@ 

 

Link to comment
Share on other sites

Thanks for your suggestions, people! icon14.gif

I'll try 'em later. inlove.gif

Link to comment
Share on other sites

@BnB :

 

 

for 11@ = 4=3.0 to 70.0 step 1.0

 

 

This line couldn't be compiled. confused.gif

Link to comment
Share on other sites

@BnB :

 

 

for 11@ = 4=3.0 to 70.0 step 1.0

 

 

This line couldn't be compiled. confused.gif

 

for 11@ = 3.0 to 70.0 step 1.0

 

suicidal.gif sry blush.gif

Link to comment
Share on other sites

  • 2 weeks later...

Nah, sorry. It still not work. turn.gif

 

@ZAZ : Hey, ZAZ. I realized that ur grenade launcher instead of flower mod is enable to throw the grenade object to where the camera facing! icon14.gif

I been trying to rig your script to look which ones that make it happen, but I still can't do it! blush.gif

It seems like you know how to create coordinates using the camera, if you won't mind would you show me the simple example for it please? smile.gif

Thanks! icon14.gif

Link to comment
Share on other sites

 

20@ = 4.000A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@while true   wait 0   0AC7: 5@ = var 5@ offset   0AC7: 6@ = var 8@ offset   0AA6: call_method 0x514970 0xB6F028 num_params 6 pop 0 6@ 5@ 3@ 2@ 1@ 20@     if 0   06BD:   no_obstacles_between 1@ 2@ 3@ and 8@ 9@ 10@ solid 1 car 1 actor 1 object 1 particle 0    then       inc(20@,3.0)   else       break   endend

 

Try this.

Link to comment
Share on other sites

 

@ZAZ : Hey, ZAZ. I realized that ur grenade launcher instead of flower mod is enable to throw the grenade object to where the camera facing! icon14.gif

I been trying to rig your script to look which ones that make it happen, but I still can't do it! blush.gif

It seems like you know how to create coordinates using the camera, if you won't mind would you show me the simple example for it please? smile.gif

Thanks! icon14.gif

Yes, but I used these 3 opcodes to calculate the orientation of the camera view

 

04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0

068D: get_camera_position_to 4@ 5@ 6@

0604: get_Z_angle_for_point 4@ 5@ store_to 30@

 

 

In Flying Carpet to set the player to the camview-angle and move him then in this direction

In GrenadeLauncher to calculate throw-values from camview-angle by using sin- and cosin calculations

In Pimp_my_Car - Missile gun to calculate X- and Z- rotation for attaching to car

In Walkstyle to set the player to the camview-angle and let him walk in several walkstyle

Ok, i think the walkstylemod is the best example because it's a tiny simple script

 

{$CLEO .cs}:walk_0003A4: name_thread 'CAR'0001: wait  2000 ms:walk_10001: wait 50 ms 00D6: if 0256:   player $PLAYER_CHAR defined 004D: jump_if_false @walk_1if  and80E1:   not key_pressed  0  1600E1:   key_pressed  0  1004D: jump_if_false @walk_10494: get_joystick_data  0 26@ 27@ 28@ 29@00D6: if 00039:   27@ ==  0  // integer values004D: jump_if_false @walk_120002: jump @walk_1:walk_1200D6: if 0 001B:    0 > 27@  // integer values004D: jump_if_false @walk_104C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 068D: get_camera_position_to 4@ 5@ 6@ 0087: 11@ = 4@ // copy cam x into a new var 0087: 12@ = 5@ // copy cam y into a new var 0063: 11@ -= 1@ // substract player_pos. x from cam x 0063: 12@ -= 2@ // substract player_pos. y from cam y 0013: 11@ *= -2.0 // multiplicate the result from above with a negativ value0013: 12@ *= -2.0 //  to enlarge the player_pos.-cam_pos.-line in direction of the cam target005B: 4@ += 11@ // add the x-result from above to the cam_pos. x 005B: 5@ += 12@ // add the y-result from above to the cam_pos. y0063: 4@ -= 1@ // substract player_pos. x from  x-result from above0063: 5@ -= 2@ // substract player_pos. y from  y-result from above 0013: 4@ *= 5.0 // enlarge it again (not neccesary)0013: 5@ *= 5.0 // enlarge it again (not neccesary)0604: get_Z_angle_for_point 4@ 5@ store_to 30@ 0173: set_actor $PLAYER_ACTOR Z_angle_to 30@0002: jump @walk_14:walk_140605: actor $PLAYER_ACTOR perform_animation_sequence "WOMAN_walksexy" from_file "PED"  4.0  0  1  1  0 -1 ms0002: jump @walk_1

 

 

If you then have the z-angle of the camview and you wanna throw an object, you need to do sin- and cosin calculations

for that read here:

Object - COLLISION - check

 

 

 

 

 

 

calculate world coords in direction of the camview angle:

 

It needs to define distance

in example below the multiplication with -0.5 calculate it near the camera_position

multiplicate it with -15.0 to calculate a point behind the cam

multiplicate it with 15.0 to calculate a point infront of the cam

 

04C4: create_coordinate 24@ 25@ 26@ from_actor $PLAYER_ACTOR offset  0.0  0.0 0.0068D: get_camera_position_to 16@ 17@ 18@0087: 18@ = 16@  // floating-point values only0087: 19@ = 17@  // floating-point values only0063: 18@ -= 24@  // floating-point values0063: 19@ -= 25@  // floating-point values0013: 18@ *=  -0.5  // floating-point values0013: 19@ *=  -0.5  // floating-point values005B: 16@ += 18@  // floating-point values 005B: 17@ += 19@  // floating-point values

 

the multiplicator defines the distance

 

 

Edited by ZAZ
Link to comment
Share on other sites

 

{$CLEO .cs}thread 'JAV':AIMwait 0if and   Player.Defined($PLAYER_CHAR)   0AB0:  key_pressed 2jf @AIM20@ = 100.000A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@while true  wait 0  0AC7: 5@ = var 5@ offset  0AC7: 6@ = var 8@ offset  0AA6: call_method 0x514970 0xB6F028 num_params 6 pop 0 6@ 5@ 3@ 2@ 1@ 20@     if       Player.Defined($PLAYER_CHAR)   then   00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@   04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.0    06BC: create_M4_shoot_from 11@ 12@ 13@ target 8@ 9@ 10@ energy 0    if       86BD:   not no_obstacles_between 1@ 2@ 3@ and 8@ 9@ 10@ solid 0 car 0 actor 1 object 0 particle 0    jf @AIM   inc(20@,3.0)   gosub @GET   else      break  endendjump @AIM:GETwait 00AB1: call_scm_func @RAFSTEP_func 4 8@ 9@ 10@ 1.5 30@if not 30@ == -1jf @RET0321: kill_actor 30@ Actor.RemoveReferences(30@)jump @RET:RAFSTEP_func5@ = 04@ = 0:RAFSTEP_countLoopif Actor.Defined(4@)jf @RAFSTEP_11if and803B:   not  $PLAYER_ACTOR == 4@ // (int)00FE:   actor 4@ sphere 0 in_sphere 0@ 1@ 2@ radius 3@ 3@ 3@jf @RAFSTEP_115@ = 1jump @RAFSTEP_12:RAFSTEP_114@ += 1if4@ > 30000jf @RAFSTEP_countLoop:RAFSTEP_12if5@ == 0jf @RAFSTEP_Result4@ = -1:RAFSTEP_Result0AB2: ret 1 4@:RETreturn

 

 

@BnB : Man, ur script is working! Thanks! icon14.gif

This code is a small try about catch an actor to kill him using the camera coordinates.... inlove.gif

But, it seems only working for short distance, and less chance of catching the actor (aiming an actor then pressing rightclick won't kill him immediately!).... turn.gif

 

Anyway I wanted to make this working for far distance too and enable to catch an actor immediately, help me will ya? blush.gif

Edited by 12jango
Link to comment
Share on other sites

  • 2 months later...

 

00A0: store_actor $player_actor position_to 10@ 11@ 12@0AC7: 23@ = var 25@ offset0AC7: 4@ = var 7@ offset0AC7: 14@ = var 1@ offset                                                           0AA6: call_method 0x514970 struct 0xB6F028 6 0 4@ 23@ 12@ 11@ 10@ 50.00AA6: call_method 0x514970 struct 0xB6F028 6 0 14@ 23@ 12@ 11@ 10@ 1.0if   86BD: not no_obstacles_between 1@ 2@ 3@ and 7@ 8@ 9@ 0 0 1 0 0then   for 0@ = 1 to 12       0087: 4@ = 1@       005B: 4@ += 7@       4@ /= 2.0       0087: 5@ = 2@       005B: 5@ += 8@       5@ /= 2.0       0087: 6@ = 3@       005B: 6@ += 9@       6@ /= 2.0         if           86BD: not no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 0 0 1 0 0       then           0087: 7@ = 4@           0087: 8@ = 5@           0087: 9@ = 6@       else           0087: 1@ = 4@           0087: 2@ = 5@           0087: 3@ = 6@             end               end   if       0AE1: 30@ = random_actor_near_point 4@ 5@ 6@ in_radius 2.0 find_next 0 pass_deads 1   then       0321: kill_actor 30@   endend

 

 

Edit: Sorry, didn;t look to the last post date.

Link to comment
Share on other sites

Well, actually I want to have a script that could catch an actor using the camera, same as aiming using guns. blush.gif

 

Link to comment
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

×
×
  • Create New...

Important Information

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