[SNIPPET] CREATE_VELOCITY_IN_LOOKING_DIRECTION

Code:
//0AB1: @CREATE_VELOCITY_IN_LOOKING_DIRECTION 1 POWER 1.0 _STORE_TO 4@ 5@ 6@
:CREATE_VELOCITY_IN_LOOKING_DIRECTION
0087: 13@ = 0@ // (float)
Actor.StorePos($PLAYER_ACTOR, 20@, 21@, 22@)
068D: get_camera_position_to 24@ 25@ 26@ 
0063: 20@ -= 24@ // (float) 
0063: 21@ -= 25@ // (float) 
0063: 22@ -= 26@ // (float) 
Actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@)
006B: 20@ *= 13@ // (float) 
006B: 21@ *= 13@ // (float) 
006B: 22@ *= 13@ // (float) 
005B: 22@ += 13@ // (float) 
005B: 0@ += 20@ // (float) 
005B: 1@ += 21@ // (float) 
005B: 2@ += 22@ // (float) 
Actor.StorePos($PLAYER_ACTOR, 3@, 4@, 5@)
0063: 0@ -= 3@ // (float) 
0063: 1@ -= 4@ // (float) 
0063: 2@ -= 5@ // (float) 
0AB2: RET 3 0@ 1@ 2@

Heres an example of this:
( Veeery simple flying hack )

Code:
{$CLEO .cs}
0000:

WHILE TRUE
    WAIT 0
    IF
    0AB0: 87 // W
    THEN
        0AB1: @CREATE_VELOCITY_IN_LOOKING_DIRECTION 1 POWER 10.0 _STORE_TO 4@ 5@ 6@    
        083C: set_actor $PLAYER_ACTOR velocity_in_direction_XYZ 4@ 5@ 6@
    END
END

//0AB1: @CREATE_VELOCITY_IN_LOOKING_DIRECTION 1 POWER 1.0 _STORE_TO 4@ 5@ 6@
:CREATE_VELOCITY_IN_LOOKING_DIRECTION
0087: 13@ = 0@ // (float)
Actor.StorePos($PLAYER_ACTOR, 20@, 21@, 22@)
068D: get_camera_position_to 24@ 25@ 26@ 
0063: 20@ -= 24@ // (float) 
0063: 21@ -= 25@ // (float) 
0063: 22@ -= 26@ // (float) 
Actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@)
006B: 20@ *= 13@ // (float) 
006B: 21@ *= 13@ // (float) 
006B: 22@ *= 13@ // (float) 
005B: 22@ += 13@ // (float) 
005B: 0@ += 20@ // (float) 
005B: 1@ += 21@ // (float) 
005B: 2@ += 22@ // (float) 
Actor.StorePos($PLAYER_ACTOR, 3@, 4@, 5@)
0063: 0@ -= 3@ // (float) 
0063: 1@ -= 4@ // (float) 
0063: 2@ -= 5@ // (float) 
0AB2: RET 3 0@ 1@ 2@
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
Re: CREATE_VELOCITY_IN_LOOKING_DIRECTION

lel nice one  :stoned:

Where do you get these from  :surprised: Do you create them ?  :youdontsay:
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
Example of what you can do with it.

Here's an example what you can do with that snippet:
( Throw cars where ure looking at )

Code:
{$CLEO .cs}
0000:

WHILE TRUE
    WAIT 0
    if and
    0AB0: 2
    0AE2: 0@ = random_vehicle_near_point 0.0 0.0 0.0 in_radius 99999.0 find_next 0 pass_wrecked 0
    then
        repeat
        wait 0
        099A: set_car 0@ collision_detection 0
        0AB1: @CREATE_VELOCITY_IN_LOOKING_DIRECTION 1 POWER 1.0 _STORE_TO 1@ 2@ 3@
        04C4: store_coords_to 4@ 5@ 6@ from_actor $PLAYER_ACTOR with_offset 0.0 4.0 0.0
        Car.PutAt(0@, 4@, 5@, 6@)
        07D5: set_car 0@ velocity_in_direction_XYZ 1@ 2@ 3@ rotation_velocitiesXY 0.0 0.0 unk 0.0
        until 8AE2: 0@ = random_vehicle_near_point 0.0 0.0 0.0 in_radius 99999.0 find_next 1 pass_wrecked 0
    end    
END

//0AB1: @CREATE_VELOCITY_IN_LOOKING_DIRECTION 1 POWER 1.0 _STORE_TO 4@ 5@ 6@
:CREATE_VELOCITY_IN_LOOKING_DIRECTION
0087: 13@ = 0@ // (float)
Actor.StorePos($PLAYER_ACTOR, 20@, 21@, 22@)
068D: get_camera_position_to 24@ 25@ 26@ 
0063: 20@ -= 24@ // (float) 
0063: 21@ -= 25@ // (float) 
0063: 22@ -= 26@ // (float) 
Actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@)
006B: 20@ *= 13@ // (float) 
006B: 21@ *= 13@ // (float) 
006B: 22@ *= 13@ // (float) 
005B: 22@ += 13@ // (float) 
005B: 0@ += 20@ // (float) 
005B: 1@ += 21@ // (float) 
005B: 2@ += 22@ // (float) 
Actor.StorePos($PLAYER_ACTOR, 3@, 4@, 5@)
0063: 0@ -= 3@ // (float) 
0063: 1@ -= 4@ // (float) 
0063: 2@ -= 5@ // (float) 
0AB2: RET 3 0@ 1@ 2@
 

Spix

Well-known member
Joined
Sep 23, 2013
Messages
353
Reaction score
1
Re: CREATE_VELOCITY_IN_LOOKING_DIRECTION

Can i create velocity in looking direction on another player? [member=60]Opcode.eXe[/member]
 

Spix

Well-known member
Joined
Sep 23, 2013
Messages
353
Reaction score
1
Re: CREATE_VELOCITY_IN_LOOKING_DIRECTION

springfield link said:

0@ = bla bla bla

Just changing the snippet Actor.StorePos($PLAYER_ACTOR, 20@, 21@, 22@) to Actor.StorePos(@0, 20@, 21@, 22@) will work, or what should i do to get it work?

[member=111]springfield[/member]
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Re: CREATE_VELOCITY_IN_LOOKING_DIRECTION

Replace every $PLAYER_ACTOR with the handle of the actor, and the camera position you can get from the aim data that player sends.
 

Spix

Well-known member
Joined
Sep 23, 2013
Messages
353
Reaction score
1
Re: CREATE_VELOCITY_IN_LOOKING_DIRECTION

springfield link said:
Replace every $PLAYER_ACTOR with the handle of the actor, and the camera position you can get from the aim data that player sends.

Thanks Springfield  :not_bad:
 
Top