Quantcast

Jump to content

» «
Photo

I need a help to make it using 0AB1: call_scm_func Please Help

8 replies to this topic
David Thapa
  • David Thapa

    Player Hater

  • Members
  • Joined: 05 Jul 2017
  • India

#1

Posted 11 August 2017 - 03:47 PM

 
0AB1: call_scm_func @GetSQR 1 10 $result
 
:Rotate681
068D: get_camera_position_to 2@ 3@ 4@ 
068E: get_camera_target_point_to 5@ 6@ 7@ 
0400: store_coords_to 5@ 6@ 7@ from_object 20@ with_offset 0.0 0.0 0.0 
0063: 2@ -= 5@ // (float) 
0063: 3@ -= 6@ // (float) 
0063: 4@ -= 7@ // (float) 
0013: 2@ *= 0.25 
0013: 3@ *= 0.25 
0013: 4@ *= 0.25 
0063: 5@ -= 2@ // (float) 
0063: 6@ -= 3@ // (float) 
0063: 7@ -= 4@ // (float) 
04D5: create_corona_at 5@ 6@ 7@ radius 0.2 type 9 flare 0 RGB 255 255 0 
01BB: store_object 20@ position_to 2@ 3@ 4@ 
0509: 8@ = distance_between_XY 2@ 3@ and_XY 5@ 6@ 
0063: 5@ -= 2@ // (float) 
0063: 6@ -= 3@ // (float) 
0063: 7@ -= 4@ // (float) 
0013: 7@ *= -1.0 
0604: get_Z_angle_for_point 5@ 6@ store_to 9@ 
0604: get_Z_angle_for_point 8@ 7@ store_to 10@ 
0174: 11@ = car 0@ Z_angle 
06BE: 12@ = car 0@ y_angle 
01BB: store_object 20@ position_to 5@ 6@ 7@ 
01BB: store_object 21@ position_to 2@ 3@ 4@ 
0063: 7@ -= 4@ // (float) 
0509: 8@ = distance_between_XY 2@ 3@ and_XY 5@ 6@ 
0604: get_Z_angle_for_point 8@ 7@ store_to 13@ 
000F: 13@ -= 270.0 
0087: 14@ = 9@ // (float) 
0087: 19@ = 10@ // (float) 
0063: 9@ -= 11@ // (float) 
02F7: 15@ = cosine 9@ // (float) 
006B: 15@ *= 13@ // (float) 
02F6: 16@ = sine 9@ // (float) 
006B: 16@ *= 12@ // (float) 
005B: 10@ += 15@ // (float) 
0063: 10@ -= 16@ // (float) 
000B: 9@ += 93.0 
000B: 10@ += 115.0 
00D6: if 
8031:   not  10@ >= 394.0 
0AA0: gosub_if_false @Rotate3373 
0681: attach_object 20@ to_car 0@ with_offset 32@ 33@ 1@ rotation 0.0 10@ 9@ 
000F: 19@ -= 270.0 
0013: 19@ *= -1.0  
 
:Rotate3373
0007: 10@ = 394.0 
0087: 19@ = 10@ // (float) 
000F: 19@ -= 110.0 
005B: 19@ += 16@ // (float) 
0063: 19@ -= 15@ // (float) 
0051: return 

Veryzon
  • Veryzon

    Player Hater

  • Members
  • Joined: 15 Jun 2017
  • Brazil

#2

Posted 12 August 2017 - 06:57 AM

What is the original purpose of this code?


David Thapa
  • David Thapa

    Player Hater

  • Members
  • Joined: 05 Jul 2017
  • India

#3

Posted 12 August 2017 - 08:25 AM

This is for it moves minigun in car


Veryzon
  • Veryzon

    Player Hater

  • Members
  • Joined: 15 Jun 2017
  • Brazil

#4

Posted 12 August 2017 - 05:16 PM Edited by Veryzon, 13 August 2017 - 02:55 PM.

This code is not fully executable. It have four dependencies: one handle of vehicle, two handles of objects and a offset value vector to position.

 

At end is notable have a reason for something like a angle's calcul. Do you extracted this code from what mod? Explain the left of code here.


David Thapa
  • David Thapa

    Player Hater

  • Members
  • Joined: 05 Jul 2017
  • India

#5

Posted 13 August 2017 - 08:03 AM Edited by David Thapa, 17 August 2017 - 01:24 AM.

Thanks :)

 


Veryzon
  • Veryzon

    Player Hater

  • Members
  • Joined: 15 Jun 2017
  • Brazil

#6

Posted 13 August 2017 - 06:32 PM Edited by Veryzon, 14 August 2017 - 12:17 AM.

The code needs of one vehicle's handle, two objects' handles and a vector 3D (three floats) to be used as position offset on vehicle.

 

[ ↓ ] In medium-level SCM code.

// Use this to call.
0AB1: call_scm_func @__proc__RotateMountedGunFromVehicle 6 {hVehicle} 0@ {hObject1} 20@ {hObject2} 21@ {fOffsetX} 0.0 {fOffsetY} 0.0 {fOffsetZ} 1.5

:__proc__RotateMountedGunFromVehicle
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
068D: get_camera_position_to 6@ 7@ 8@ 
0006: 9@ = 0 
0006: 10@ = 0 
0006: 11@ = 0 
068E: get_camera_target_point_to 9@ 10@ 11@ 
0400: store_coords_from_object 1@ with_offset 0.0 0.0 0.0 to 9@ 10@ 11@ 
0063: 6@ -= 9@ // (float) 
0063: 7@ -= 10@ // (float) 
0063: 8@ -= 11@ // (float) 
0013: 6@ *= 0.25 
0013: 7@ *= 0.25 
0013: 8@ *= 0.25 
0063: 9@ -= 6@ // (float) 
0063: 10@ -= 7@ // (float) 
0063: 11@ -= 8@ // (float) 
04D5: create_corona_at 9@ 10@ 11@ radius 0.2 type 8 flare 0 RGB 255 255 0 
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
01BB: store_object 1@ position_to 6@ 7@ 8@ 
0006: 12@ = 0 
0509: 12@ = distance_between_XY 6@ 7@ and_XY 9@ 10@ 
0063: 9@ -= 6@ // (float) 
0063: 10@ -= 7@ // (float) 
0063: 11@ -= 8@ // (float) 
0013: 11@ *= -1.0 
0006: 13@ = 0 
0604: 13@ = get_Z_angle_for_point 9@ 10@ 
0006: 14@ = 0 
0604: 14@ = get_Z_angle_for_point 12@ 11@ 
0006: 15@ = 0 
0174: 15@ = car 0@ Z_angle 
0006: 16@ = 0 
06BE: 16@ = car 0@ y_angle 
0006: 9@ = 0 
0006: 10@ = 0 
0006: 11@ = 0 
01BB: store_object 1@ position_to 9@ 10@ 11@ 
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
01BB: store_object 2@ position_to 6@ 7@ 8@ 
0063: 11@ -= 8@ // (float) 
0006: 12@ = 0 
0509: 12@ = distance_between_XY 6@ 7@ and_XY 9@ 10@ 
0006: 17@ = 0 
0604: 17@ = get_Z_angle_for_point 12@ 11@ 
000F: 17@ -= 270.0 
0087: 18@ = 13@ // (float) 
0087: 19@ = 14@ // (float) 
0063: 13@ -= 15@ // (float) 
0006: 20@ = 0 
02F7: 20@ = cosine 13@ // (float) 
006B: 20@ *= 17@ // (float) 
0006: 21@ = 0 
02F6: 21@ = sine 20@ // (float) 
006B: 21@ *= 16@ // (float) 
005B: 14@ += 20@ // (float) 
0063: 14@ -= 21@ // (float) 
000B: 13@ += 93.0 
000B: 14@ += 115.0 
00D6: if 
0031:   14@ >= 394.0 
004D: jump_if_false @testgun_11572 
0007: 14@ = 394.0 
0087: 19@ = 14@ // (float) 
000F: 19@ -= 110.0 
005B: 19@ += 21@ // (float) 
0063: 19@ -= 20@ // (float) 
:testgun_11572
0681: attach_object 1@ to_car 0@ with_offset 3@ 4@ 5@ rotation 0.0 14@ 13@ 
000F: 19@ -= 270.0 
0013: 19@ *= -1.0
0AB2: ret 0

For the concept (default releases of Sanny Builder does not can compile it), the high-level SCM code.

eDf9nMe.png

 

xqrijA6.png

BFaWs8m.png


David Thapa
  • David Thapa

    Player Hater

  • Members
  • Joined: 05 Jul 2017
  • India

#7

Posted 14 August 2017 - 06:29 PM Edited by David Thapa, 14 August 2017 - 06:37 PM.

Which part i am missing here sir need a help  :facedesk:

 

 

 

{$CLEO .cs}

0000: NOP 
 
:Noname_2
0001: wait 0 ms 
00D6: if 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false @Noname_2 
00D6: if 
00DF:   actor $PLAYER_ACTOR driving 
004D: jump_if_false @Noname_2 
03C0: 9@ = actor $PLAYER_ACTOR car 
0006: 33@ = 0 
0006: 23@ = 1 
00D6: if and
0AB0:   key_pressed 2 
0AB0:   key_pressed 74 
004D: jump_if_false @Noname_2 
00D6: if 
03CA:   object 20@ exists 
004D: jump_if_false @Noname_10a 
0108: destroy_object 20@ 
 
:Noname_10a 
00D6: if 
03CA:   object 20@ exists 
004D: jump_if_false @Noname_100 
0108: destroy_object 20@ 
 
:Noname_100
0247: load_model #MINIGUN 
038B: load_requested_models 
 
:Noname_107
0001: wait 0 ms 
00D6: if 
0248:   model #MINIGUN available 
004D: jump_if_false @Noname_107 
03C0: 9@ = actor $PLAYER_ACTOR car 
0441: 19@ = car 9@ model 
07E4: get_model 19@ dimensions_cornerA_to 2@ 3@ 4@ dimensions_cornerB_to 25@ 26@ 27@ 
0087: 28@ = 27@ // (float) 
0013: 28@ *= 1.43 
0107: 20@ = create_object #MINIGUN at 0.0 0.0 -200.0 
0107: 21@ = create_object #MINIGUN at 0.0 0.0 -200.0 
0001: wait 100 ms 
0681: attach_object 20@ to_car 9@ with_offset 1.0 0.9 28@ rotation 0.0 30.0 94.0 
0681: attach_object 21@ to_car 9@ with_offset -1.0 0.9 28@ rotation 0.0 30.0 94.0 
02AC: set_car 9@ immunities BP 1 FP 1 EP 1 CP 1 MP 1 
053F: set_car 9@ tires_vulnerability 0 
0001: wait 100 ms 
0249: release_model #MINIGUN 
0006: 23@ = 0 
 
:Noname_285
0001: wait 0 ms 
00D6: if 
00DF:   actor $PLAYER_ACTOR driving 
004D: jump_if_false @Noname_1375 
00D6: if 
80E1:   not player 0 pressed_key 10 
004D: jump_if_false @Noname_1375  
 
:Noname_438
00D6: if and
03CA:   object 20@ exists 
03CA:   object 21@ exists 
004D: jump_if_false @Noname_1000 
0AB1: call_scm_func @__proc__RotateMountedGunFromVehicle 6 {hVehicle} 9@ {hObject1} 20@ {hObject2} 21@ {fOffsetX} 0.0 {fOffsetY} 0.0 {fOffsetZ} 1.5
0002: jump @Noname_285 
 
:Noname_1375
00D6: if 
03CA:   object 20@ exists 
004D: jump_if_false @Noname_1395
0108: destroy_object 20@ 
 
:Noname_1395
00D6: if 
03CA:   object 21@ exists 
004D: jump_if_false @Noname_1396 
0108: destroy_object 21@ 
 
:Noname_1396
020A: set_car 9@ door_status_to 0 
00D6: if or
8202:   not actor $PLAYER_ACTOR near_car 9@ radius 50.0 50.0 sphere 0 
02BF:   car 9@ sunk 
004D: jump_if_false @Noname_2 
01C3: remove_references_to_car 9@ 
0002: jump @Noname_2 
 
:__proc__RotateMountedGunFromVehicle
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
068D: get_camera_position_to 6@ 7@ 8@ 
0006: 9@ = 0 
0006: 10@ = 0 
0006: 11@ = 0 
068E: get_camera_target_point_to 9@ 10@ 11@ 
0400: store_coords_from_object 1@ with_offset 0.0 0.0 0.0 to 9@ 10@ 11@ 
0063: 6@ -= 9@ // (float) 
0063: 7@ -= 10@ // (float) 
0063: 8@ -= 11@ // (float) 
0013: 6@ *= 0.25 
0013: 7@ *= 0.25 
0013: 8@ *= 0.25 
0063: 9@ -= 6@ // (float) 
0063: 10@ -= 7@ // (float) 
0063: 11@ -= 8@ // (float) 
04D5: create_corona_at 9@ 10@ 11@ radius 0.2 type 8 flare 0 RGB 255 255 0 
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
01BB: store_object 1@ position_to 6@ 7@ 8@ 
0006: 12@ = 0 
0509: 12@ = distance_between_XY 6@ 7@ and_XY 9@ 10@ 
0063: 9@ -= 6@ // (float) 
0063: 10@ -= 7@ // (float) 
0063: 11@ -= 8@ // (float) 
0013: 11@ *= -1.0 
0006: 13@ = 0 
0604: 13@ = get_Z_angle_for_point 9@ 10@ 
0006: 14@ = 0 
0604: 14@ = get_Z_angle_for_point 12@ 11@ 
0006: 15@ = 0 
0174: 15@ = car 0@ Z_angle 
0006: 16@ = 0 
06BE: 16@ = car 0@ y_angle 
0006: 9@ = 0 
0006: 10@ = 0 
0006: 11@ = 0 
01BB: store_object 1@ position_to 9@ 10@ 11@ 
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
01BB: store_object 2@ position_to 6@ 7@ 8@ 
0063: 11@ -= 8@ // (float) 
0006: 12@ = 0 
0509: 12@ = distance_between_XY 6@ 7@ and_XY 9@ 10@ 
0006: 17@ = 0 
0604: 17@ = get_Z_angle_for_point 12@ 11@ 
000F: 17@ -= 270.0 
0087: 18@ = 13@ // (float) 
0087: 19@ = 14@ // (float) 
0063: 13@ -= 15@ // (float) 
0006: 20@ = 0 
02F7: 20@ = cosine 13@ // (float) 
006B: 20@ *= 17@ // (float) 
0006: 21@ = 0 
02F6: 21@ = sine 20@ // (float) 
006B: 21@ *= 16@ // (float) 
005B: 14@ += 20@ // (float) 
0063: 14@ -= 21@ // (float) 
000B: 13@ += 93.0 
000B: 14@ += 115.0 
00D6: if 
0031:   14@ >= 394.0 
004D: jump_if_false @testgun_11572 
0007: 14@ = 394.0 
0087: 19@ = 14@ // (float) 
000F: 19@ -= 110.0 
005B: 19@ += 21@ // (float) 
0063: 19@ -= 20@ // (float) 
 
:testgun_11572
0681: attach_object 1@ to_car 0@ with_offset 3@ 4@ 5@ rotation 0.0 14@ 13@ 
000F: 19@ -= 270.0 
0013: 19@ *= -1.0
0AB2: ret 0
 
Sorry to Bother you again and again but i am null to 0AB1: call_scm_func i have try to learn it all makes me confused
 
this
0AB2: ret 0
 
and this 
0AB2: ret 3 1@ 2@ 3@ i don't get it   :/

Veryzon
  • Veryzon

    Player Hater

  • Members
  • Joined: 15 Jun 2017
  • Brazil

#8

Posted 15 August 2017 - 01:56 AM Edited by Veryzon, 15 August 2017 - 03:31 AM.

I did a mistake. Some opcodes from this code can not be compiled by default SB releases. Use the following code.

:__proc__RotateMountedGunFromVehicle
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
068D: get_camera_position_to 6@ 7@ 8@ 
0006: 9@ = 0 
0006: 10@ = 0 
0006: 11@ = 0 
068E: get_camera_target_point_to 9@ 10@ 11@ 
0400: store_coords_to 9@ 10@ 11@ from_object 1@ with_offset 0.0 0.0 0.0 
0063: 6@ -= 9@ // (float) 
0063: 7@ -= 10@ // (float) 
0063: 8@ -= 11@ // (float) 
0013: 6@ *= 0.25 
0013: 7@ *= 0.25 
0013: 8@ *= 0.25 
0063: 9@ -= 6@ // (float) 
0063: 10@ -= 7@ // (float) 
0063: 11@ -= 8@ // (float) 
04D5: create_corona_at 9@ 10@ 11@ radius 0.2 type 8 flare 0 RGB 255 255 0 
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
01BB: store_object 1@ position_to 6@ 7@ 8@ 
0006: 12@ = 0 
0509: 12@ = distance_between_XY 6@ 7@ and_XY 9@ 10@ 
0063: 9@ -= 6@ // (float) 
0063: 10@ -= 7@ // (float) 
0063: 11@ -= 8@ // (float) 
0013: 11@ *= -1.0 
0006: 13@ = 0 
0604: get_Z_angle_for_point 9@ 10@ store_to 13@ 
0006: 14@ = 0 
0604: get_Z_angle_for_point 12@ 11@ store_to 14@ 
0006: 15@ = 0 
0174: 15@ = car 0@ Z_angle 
0006: 16@ = 0 
06BE: 16@ = car 0@ y_angle 
0006: 9@ = 0 
0006: 10@ = 0 
0006: 11@ = 0 
01BB: store_object 1@ position_to 9@ 10@ 11@ 
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
01BB: store_object 2@ position_to 6@ 7@ 8@ 
0063: 11@ -= 8@ // (float) 
0006: 12@ = 0 
0509: 12@ = distance_between_XY 6@ 7@ and_XY 9@ 10@ 
0006: 17@ = 0 
0604: get_Z_angle_for_point 12@ 11@ store_to 17@ 
000F: 17@ -= 270.0 
0087: 18@ = 13@ // (float) 
0087: 19@ = 14@ // (float) 
0063: 13@ -= 15@ // (float) 
0006: 20@ = 0 
02F7: 20@ = cosine 13@ // (float) 
006B: 20@ *= 17@ // (float) 
0006: 21@ = 0 
02F6: 21@ = sine 20@ // (float) 
006B: 21@ *= 16@ // (float) 
005B: 14@ += 20@ // (float) 
0063: 14@ -= 21@ // (float) 
000B: 13@ += 93.0 
000B: 14@ += 115.0 
00D6: if 
0031:   14@ >= 394.0 
004D: jump_if_false @TESTGUN_11572 
0007: 14@ = 394.0 
0087: 19@ = 14@ // (float) 
000F: 19@ -= 110.0 
005B: 19@ += 21@ // (float) 
0063: 19@ -= 20@ // (float) 
:TESTGUN_11572
0681: attach_object 1@ to_car 0@ with_offset 3@ 4@ 5@ rotation 0.0 14@ 13@ 
000F: 19@ -= 270.0 
0013: 19@ *= -1.0 
0AB2: ret 0

This function does not return any value. All the parameters of 0x0AB1 are read-only by function.

 

The opcode 0x0AB1 expect for two parameters: the first is a label reference from function's entry-point and the second is the number of arguments to be pushed to the function's TLS.

 

In case of __proc__RotateMountedGunFromVehicle, we pushes six arguments, wich are hVehicle, hObject1, hObject2, fOffsetX, fOffsetY and fOffsetZ.

 

The opcode 0x0AB2 expect for one parameter: the number of arguments to be returned. In case of __proc__RotateMountedGunFromVehicle, we do not push back any argument.


David Thapa
  • David Thapa

    Player Hater

  • Members
  • Joined: 05 Jul 2017
  • India

#9

Posted 15 August 2017 - 03:15 AM

Thank you sir its working :^: something is missing but i'll find out..it looks funny :lol: when i aim straight down both minigun moves different direction but when aim straight works perfect but at least i learn something from it thank you so much God Bless You  :colgate: its was very very helpful you are awesome very kind person





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users