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

    1. Red Dead Redemption 2

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

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

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

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

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. 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. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
yair1221

sine and cosine

Recommended Posts

yair1221

how do i calculate sine and cosine?

since i wont be learning that at school i thought i'd better ask, so ill know...

here is what i got:

 

02F9: get_car [email protected] Z_angle_sine_to [email protected]: get_car [email protected] Z_angle_cosine_to [email protected] [email protected] *= -1.007D5: set_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] 0.0 rotation_velocitiesXY 0.0 -1.0 unk 0.0  

 

but the plane keeps spinning out of control

when i didnt use the velocity in direction it worked fine...only rotation velocity, so i guess thats not the reason

but when i added the damn velocity in direction, it got all messed up

 

here is what i want:

you press SHIFT+A

the plane moves left and makes one spin to the left(not Z angle spin, y angle)

so i want to know how to calculate the right XYZ velocities...

Share this post


Link to post
Share on other sites
Deji

Uhh... rotation velocity ROTATES the vehicle...

 

And there's no need to use sine and cosine here... You can simply get the velocity with another opcode.

 

And finally, you've got the sine/cosine opcodes mixed up. Download the latest sascm.ini and opcodes.txt file to fix this: http://gtag.gtagaming.com/opcode-database/

Share this post


Link to post
Share on other sites
yair1221

ok

but you got my question wrong:

i DO need sine and cosine

i dont wanna just ROTATE the car

i want to move it to the left, and get velocity isnt gonna help me accomplish that...thats why i need the sine and cosine

 

edit: i downloaded your opcode database

stays the same...

Edited by yair1221

Share this post


Link to post
Share on other sites
Deji

I hope you didn't download the whole database wow.gif

 

My mistake, try again wink.gif

 

 

This should be the new result (as well as the other two sin/cos opcodes switched).

 

02F8: get_car [email protected] Z_angle_sine_to [email protected]: get_car [email protected] Z_angle_cosine_to [email protected]

 

 

But I'm confused now.. if you don't actually want to use this to set velocities.. why are you trying to? No wonder the heli is spinning eratically.

Share this post


Link to post
Share on other sites
yair1221

a. its a plane, not a heli

b.i just downloaded the sa ini and opcodes

c.it still didnt change a damn thing

d.im trying to set the velocity, but not FORWARD, i want it to go left

Share this post


Link to post
Share on other sites
Deji

Plane, heli.. whatever.

 

It won't go left. And if you don't need to use these functions, don't use them. If you don't need to make this script, stop bothering us by asking how to make it... If you wanna learn about sine and cosine, go read a book, an online tutorial or one of the many other questions there are about this. And of course, there's always actually experimenting with it yourself!

 

 

For example, you wanna test an opcode, try creating a debug script:

 

{$CLEO}0000:while true   wait 0   if       00E1:   player 0 pressed_key 4   then       0811: [email protected] = actor $PLAYER_ACTOR car       07DA: set_car [email protected] rotation_velocity_XYZ 0.0 0.0 90.0 through_center_of_body   endend

 

Share this post


Link to post
Share on other sites
yair1221

this TURNS the car left

i want it to go left, while looking forward...

Share this post


Link to post
Share on other sites
Deji

Why were you setting the rotation then? Grr...

 

 

{$CLEO}0000:while true   wait 0   if       0ADC:   test_cheat "A"   then       0811: [email protected] = actor $PLAYER_ACTOR car       0174: [email protected] = car [email protected] Z_angle       000B: [email protected] += 90.0       02F6: [email protected] = sine [email protected]       02F7: [email protected] = cosine [email protected]       0013: [email protected] *= 10.0       0013: [email protected] *= 10.0       06A2: get_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] [email protected]       005B: [email protected] += [email protected]       005B: [email protected] += [email protected]       07D5: set_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] [email protected] rotation_velocitiesXY 0.0 0.0 unk 0.0   endend

 

 

Tested, but I hope it somehow doesn't work and your computer explodes.

Share this post


Link to post
Share on other sites
yair1221

keep dreaming dude

thanks though...

 

edit: doesnt work, the plane does move left/right at my will

but it also makes crazy spins in the air(i didnt use the rotation velocity)

Edited by yair1221

Share this post


Link to post
Share on other sites
Deji

Use your imagination.. you can't just throw a plane sideways and expect there to be no "air resistance".

 

If you tested this on a plane that didn't have it's engine on, the effect would differ.

Share this post


Link to post
Share on other sites
yair1221

well...it IS just a game...right?

and besides, there must be some kind to move the plane...easily...right?

maybe if i attach it to an object, move the object, detach it, and destroy the object...should work, shouldnt it?

Share this post


Link to post
Share on other sites
Bennington

Deji, had a bad day? smile.gif

Well, I understood what he wanna do already at the beginning.

You want to make your plane dodge to left / right and make it a spin to that direction, like actors do when crouching?

Hmm, should work with that one:

 

03A4: name_thread 'PLANEDODGER' :PLANEDODGER_110001: wait 0 ms 00D6: if and0256:   player $PLAYER_CHAR defined04C8:   actor $PLAYER_ACTOR driving_flying_vehicle 84A9:   not actor $PLAYER_ACTOR driving_heli 0AB0:   key_pressed 16 0AB0:   key_pressed 65 004D: jump_if_false @PLANEDODGER_1103C0: [email protected] = actor $PLAYER_ACTOR car0007: [email protected] = [The velocity you want to dodge it left - I would recommend 0.20, but try it out] :PLANEDODGER_30 0001: wait 0 ms0174: [email protected] = car [email protected] Z_angle 000B: [email protected] += 90.0 02F6: [email protected] = sine [email protected] // (float)02F7: [email protected] = cosine [email protected] // (float)006B: [email protected] *= [email protected] // (float) 006B: [email protected] *= [email protected] // (float)07D5: set_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] 0.0 rotation_velocitiesXY 0.0 0.0 unk 0.00007: [email protected] = [Well, I don´t know about rotation velocities... try out a low value, then increase it until it´s right for you]07DB: set_car [email protected] rotation_velocity_XYZ 0.0 [email protected] 0.0 through_center_of_mass 0002: jump @PLANEDODGER_11

 

 

If you wanna have it also for the right-hand side, it has to be changed (Right to SHIFT+D):

 

03A4: name_thread 'PLANEDODGER' :PLANEDODGER_110001: wait 0 ms 00D6: if and0256:   player $PLAYER_CHAR defined04C8:   actor $PLAYER_ACTOR driving_flying_vehicle 84A9:   not actor $PLAYER_ACTOR driving_heli 0AB0:   key_pressed 16 004D: jump_if_false @PLANEDODGER_1103C0: [email protected] = actor $PLAYER_ACTOR car0007: [email protected] = [The velocity you want to dodge it left - I would recommend 0.20, but try it out]00D6: if0AB0:   not key_pressed 65 004D: jump_if_false @PLANEDODGER_3000D6: if0AB0:   not key_pressed 68 004D: jump_if_false @PLANEDODGER_500002: jump @PLANEDODGER_11:PLANEDODGER_30 0001: wait 0 ms0007: [email protected] = 90.00007: [email protected] = [Well, I don´t know about rotation velocities... try out a low value, then increase it until it´s right for you]0002: jump @PLANEDODGER_70:PLANEDODGER_50 0001: wait 0 ms0007: [email protected] = -90.00007: [email protected] = -[Well, I don´t know about rotation velocities... try out a low value, then increase it until it´s right for you]:PLANEDODGER_70 0001: wait 0 ms0174: [email protected] = car [email protected] Z_angle 000B: [email protected] += [email protected] 02F6: [email protected] = sine [email protected] // (float)02F7: [email protected] = cosine [email protected] // (float)006B: [email protected] *= [email protected] // (float) 006B: [email protected] *= [email protected] // (float)07D5: set_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] 0.0 rotation_velocitiesXY 0.0 0.0 unk 0.007DB: set_car [email protected] rotation_velocity_XYZ 0.0 [email protected] 0.0 through_center_of_mass 0002: jump @PLANEDODGER_11

 

 

Try it out, I didn´t moto_whistle.gif

Share this post


Link to post
Share on other sites
yair1221

really awesome!

works, except for the rotation part

and it moves more like forward/backward than right/left

maybe i should increase the value...

Share this post


Link to post
Share on other sites
Deji

No bad day.. but yair is enough to drive anyone to screaming. I'm able to shout and express anger at someone without actually being angry.

 

Wie wärs mit testen, ehh?

Share this post


Link to post
Share on other sites
yair1221

hey, aint my fault, i didnt even understand what you want from me the entire thread...

@Bennington: scratch the last one, the script works great now, just need to make it a little less forward, i guess ill settle at that...thanks!

Share this post


Link to post
Share on other sites
Bennington

@Deji Bad temper? Lol, sorry, please don´t take it personal biggrin.gif

 

@yair1221 You sais it move more forward / backward... How do you mean that? Does it refer to the direction your pointing? Then there´s a mistake by me...

Wait a minute, I´ll try it myself.

 

EDIT:

Lol? What is that sh*t I scripted there mercie_blink.gifbiggrin.gif

Let me change it a lil bit...

Edited by Bennington

Share this post


Link to post
Share on other sites
yair1221

when i press SHIFT+A

it works great

but then i press SHIFT+D

and it goes BACKWARDS

(i used [email protected] += 270.0)

until i stop pressing, then it makes about a 270.0 degrees turn, and continues the wrong way tounge2.gif

im beginning to think that its because i modified the hydra handling

i removed all the "stab" thingies to 0.0

but then i also added more power to the Pitch, Roll, and Yaw

maybe it will work if i install the original handling

Share this post


Link to post
Share on other sites
Bennington

OMG something went totally wrong at me...

The plane even rotates when only pressing SHIFT mercie_blink.gif

 

Share this post


Link to post
Share on other sites
yair1221

lol, i dont have that problem...i didnt use YOUR script, only the part with the sine and cosine and rotations and velocities, mine isnt even CLEO

 

and its probably because of that:

 

00D6: if and0256:   player $PLAYER_CHAR defined04C8:   actor $PLAYER_ACTOR driving_flying_vehicle84A9:   not actor $PLAYER_ACTOR driving_heli0AB0:   key_pressed 16004D: jump_if_false @PLANEDODGER_11

 

 

however, i used the first code as a base

Share this post


Link to post
Share on other sites
Bennington

I solved the problem now, I changed opcode number 8AB0 with 0AB0...

Share this post


Link to post
Share on other sites
yair1221

lol

but the plane still moves forward/backward tounge.gif

 

if and0ab0: 160ab0: 65then0174: [email protected] = car [email protected] Z_angle000B: [email protected] += 270.002F6: [email protected] = sine [email protected] // (float)02F7: [email protected] = cosine [email protected] // (float)07D5: set_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] 0.0 rotation_velocitiesXY 0.0 0.0 unk 0.007DB: set_car [email protected] rotation_velocity_XYZ 0.0 -0.5 0.0 through_center_of_massendif and0ab0: 160ab0: 68then0174: [email protected] = car [email protected] Z_angle000B: [email protected] += 90.002F6: [email protected] = sine [email protected] // (float)02F7: [email protected] = cosine [email protected] // (float)07D5: set_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] 0.0 rotation_velocitiesXY 0.0 0.0 unk 0.007DB: set_car [email protected] rotation_velocity_XYZ 0.0 0.5 0.0 through_center_of_massend

 

Share this post


Link to post
Share on other sites
Silent

 

07D5: set_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] 0.0 rotation_velocitiesXY 0.0 0.0 unk 0.0

 

 

You're setting both X and Y velocities, so plane will move backward/forward & left/right.

 

Wow, what a polite and patient reply, I'm really calm now.

 

And start using damn Tabs with high-level scripts, will save much of your (our?) nerves and make script WAY more readable, rly.

Share this post


Link to post
Share on other sites
Bennington

 

03A4: name_thread 'PLANEDODGER' :PLANEDODGER_190001: wait 0 ms 00D6: if and0256:   player $PLAYER_CHAR defined 04C8:   actor $PLAYER_ACTOR driving_flying_vehicle 84A9:   not actor $PLAYER_ACTOR driving_heli 0AB0:   key_pressed 16 004D: jump_if_false @PLANEDODGER_19 00D6: if 8AB0:   not key_pressed 65 004D: jump_if_false @PLANEDODGER_108 00D6: if 8AB0:   not key_pressed 68 004D: jump_if_false @PLANEDODGER_139 0002: jump @PLANEDODGER_19 :PLANEDODGER_1080001: wait 0 ms 0007: [email protected] = 90.0 0007: [email protected] = 100.0 0002: jump @PLANEDODGER_163 :PLANEDODGER_1390001: wait 0 ms 0007: [email protected] = 270.0 0007: [email protected] = -100.0 :PLANEDODGER_1630001: wait 0 ms 03C0: [email protected] = actor $PLAYER_ACTOR car 0174: [email protected] = car [email protected] Z_angle 000B: [email protected] += [email protected] 02F6: [email protected] = sine [email protected] // (float) 02F7: [email protected] = cosine [email protected] // (float) 0013: [email protected] *= -0.2 // (float) 0013: [email protected] *= 0.2 // (float) 07D5: set_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] 0.0 rotation_velocitiesXY 0.0 0.0 unk 0.0 07DB: set_car [email protected] rotation_velocity_XYZ 0.0 [email protected] 0.0 through_center_of_mass 0001: wait 1000 ms 0002: jump @PLANEDODGER_19 

 

That´s the script now!

We had to negate [email protected], cause it moved in the opposite X direction.

Well, but it´s a damn thing with that rotation velocity [email protected] I already have increased it to 100.0, but I still can only do a half spin.

However, on this point I´ll stop, and you can go on, yair1221 wink.gif

Share this post


Link to post
Share on other sites
yair1221
07D5: set_car [email protected] velocity_in_direction_XYZ [email protected] [email protected] 0.0 rotation_velocitiesXY 0.0 0.0 unk 0.0

 

 

You're setting both X and Y velocities, so plane will move backward/forward & left/right.

 

Wow, what a polite and patient reply, I'm really calm now.

 

And start using damn Tabs with high-level scripts, will save much of your (our?) nerves and make script WAY more readable, rly.

thanks dude

@Sessemi street:

what tabs?

you mean, labels?

i cant, it will make the script unreadable

im working with this structure:

 

:plane

thread 'plane'

wait 0

if and

0ab0: 16

0ab0: 65

then

...

end

jump @plane

end_thread

 

there are many other functions, its the "scripted handling" thread...

Share this post


Link to post
Share on other sites
TheSiggi

facedesk.gif

 

1x TAB = 3 spaces + new tabulator position! I thought you know C++??!?

 

 

while true   wait 20   if   0256:   player $PLAYER_CHAR defined    then       if       03EE:   player $PLAYER_CHAR controllable        then           if           80DF:   not actor $PLAYER_ACTOR driving            then               wait 2000               show_text_box 'YAIRSUCKS' // oh, too long entry :S               break           end       end   endend0000:0A93: end_custom_thread

 

 

you think we press SPACE all the time??? suicidal.gif

Share this post


Link to post
Share on other sites
yair1221

what on earth do YOU want?

and no, i never got to the C++

just a simple loops, variables, strings, and input/output

all within command prompt scripts...

Share this post


Link to post
Share on other sites
Bennington

Dude keep cool he´s a moderator moto_whistle.giftounge2.gif

Share this post


Link to post
Share on other sites
TheSiggi
what on earth do YOU want?

and no, i never got to the C++

just a simple loops, variables, strings, and input/output

all within command prompt scripts...

If you worked with loops, there'd be no doubt on getting a 'oh, thanks, that makes the syntax more clear' from you tounge.gif

 

@Bennington: I'm what? Where the hell did you get that from lol.gif (dev. not an offence)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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