Jump to content

Drift Points


aStiffSausage

Recommended Posts

aStiffSausage

Yeah, Drift points counter. I've done small test-version, and I think I know the method how to make it better, but I'm not sure how to do it...

 

 

{$CLEO .cs}Thread 'DRIFT':DRIFT_1wait 0 msif and0256:   player $PLAYER_CHAR defined 00DF:   actor $PLAYER_ACTOR driving 00DD:   actor $PLAYER_ACTOR driving_car_with_model #EUROSelse_jump @DRIFT_1if0AB0:  key_pressed 49else_jump @DRIFT_1jump @DRIFT_2:DRIFT_2wait 0 msif0AB0:  key_pressed 49else_jump @DRIFT_3jump @DRIFT_2:DRIFT_3wait 0 msif and0256:   player $PLAYER_CHAR defined 00DF:   actor $PLAYER_ACTOR driving 00DD:   actor $PLAYER_ACTOR driving_car_with_model #EUROSelse_jump @DRIFT_103C0: 0@ = actor $PLAYER_ACTOR car 0174: 1@ = car 0@ Z_angle02E3: 3@ = car 0@ speed wait 200 ms0174: 2@ = car 0@ Z_angle0063: 2@ -= 1@ // (float) 006B: 3@ *= 2@ // (float)   0092: 3@ = float 3@ to_integer  03F0: enable_text_draw 1 01E4: show_text_1number_lowpriority GXT 'NUMBER' number 3@ time 400 flag 1  // INSANE STUNT BONUS: $~1~jump @DRIFT_3

 

 

So far it's only for Euros, but I've thought of something more like this:

 

Script would count the movement angle, then substract car's current angle, then get car's current speed, take square root of speed*, multiple those 2 values and display it as total points and current points (That are gained in latest drift).

 

* Only reason I want to take square root of speed is that the speed won't have that huge effect, so you can't just speed up, do a quick turn and get hundreds of points.

 

But, the problem is, that how I can get current movement angle? Could it be possible to get it from going from place A to place B, then count angle between those?

 

Help is appreciated smile.gif

Link to comment
Share on other sites

 

{$CLEO}0000:var   $PLAYER_ACTOR : Actorend0006:  5@ = 0while true   wait 0   if      $PLAYER_ACTOR.Driving   then        03C0: 0@ = actor $PLAYER_ACTOR car          1@ = Car.Angle(0@)       32@ = 0       while   not 32@ > 700           wait 0           03F0: enable_text_draw 1            045A: draw_text_1number 10.0 10.0 GXT 'NUMBER' number 5@       end       2@ = Car.Angle(0@)        02E3: 3@ = car 0@ speed       0096: make 1@ absolute_float        0096: make 2@ absolute_float        1@ += 10.0       if          0025:  2@ > 1@        then           0013: 3@ *= 0.25           0092: 3@ = float 3@ to_integer            000B: 5@ += 3@       end       03F0: enable_text_draw 1        045A: draw_text_1number 10.0 10.0 GXT 'NUMBER' number 5@   endend

 

 

Just a sample script.

 

Link to comment
Share on other sites

aStiffSausage

Almost, but not enough smile.gif

 

For example, with your script, you basically get your points from turning, as it just checks if the angle is changed, which isn't really practical if you're doing long drift... As your angle is almost the same for the whole drift, it'll just give you points for beginning the drift. That's why I asked if it would be possible to get movement angle and substract car's angle from that, and check if it's in belieavable boundaries. (In drifting angle between movement and car isn't higher than 180 degrees, right? smile.gif)

Edited by oksa8
Link to comment
Share on other sites

Almost, but not enough smile.gif

 

For example, with your script, you basically get your points from turning, as it just checks if the angle is changed, which isn't really practical if you're doing long drift... As your angle is almost the same for the whole drift, it'll just give you points for beginning the drift. That's why I asked if it would be possible to get movement angle and substract car's angle from that, and check if it's in belieavable boundaries. (In drifting angle between moment and car isn't higher than 180 degrees, right? smile.gif)

Actually this kind of drift isn't possible in SA.

Link to comment
Share on other sites

Nothing is impossible if knowledges are too much to make good things. I prepared this script for an unreleased and unfinished project I stopped working on:

 

{ FUNCTIONS INCLUDED:-   getVehRotVelocity     Type: GET       Description: Get vehicle's XYZ rotation velocity (approximate).-   getRelativeAngle     Type: GET       Description: Get angle relative to another angle.-   getClockwiseAngle     Type: GET       Description: Get counter clockwise angle by a given angle.}{$CLEO}0000: NOP9@ = 0 10@ = 1 12@ = 0.0 30@ = 0 31@ = 0 32@ = 3000 while true wait 0  if and 03EE:  player $PLAYER_CHAR controllable 00DF:  actor $PLAYER_ACTOR driving then   03C0: 0@ = actor $PLAYER_ACTOR car   if and   020D:  car 0@ flipped   81F3:  not car 0@ in_air   82BF:  not car 0@ sunk   then     02E3: 8@ = car 0@ speed     if        8@ > 15.0      then       06A2: get_car 0@ velocity_in_direction_XYZ 1@ 2@ 3@        0604: get_Z_angle_for_point 1@ 2@ store_to 4@        0174: 5@ = car 0@ Z_angle       0AB1: call_scm_func @getRelativeAngle 2 angle 5@ to_angle 4@ store_to 6@        0087: 7@ = 6@        0097: make 7@ absolute_float       if and         7@ >= 15.0          7@ <= 90.0        then         7@ /= 5.0          005B: 9@ += 7@          8@ /= 5.0          005B: 9@ += 8@          if            6@ > 0.0          then           if and             30@ == 1 // left             31@ == 0            then             10@ += 1              30@ = 2            else             if                30@ == 0              then               30@ = 2              end           end         end         if            6@ < 0.0          then           if and             30@ == 2 // right             31@ == 0            then             10@ += 1              30@ = 1            else             if                30@ == 0              then               30@ = 1              end           end         end         31@ = 1          32@ = 0        else         31@ = 0        end     else       // Bournout +360°       if          8@ < 2.0        then         0AB1: call_scm_func @getVehRotVelocity 1 vehicle 0@ store_to 1@ 2@ 3@          0087: 11@ = 3@          0097: make 11@ absolute_float         if            11@ > 1.0          then           if              3@ > 1.0            then             if                30@ == 0              then               30@ = 1 // left               31@ = 1              else               if                  30@ == 2                then                 31@ = 0                else                 31@ = 1                end             end           end           if              3@ < -1.0            then             if                30@ == 0              then               30@ = 2 // right               31@ = 1              else               if                  30@ == 1                then                 31@ = 0                else                 31@ = 1                end             end           end           if              31@ == 1            then             if                12@ > 360.0              then               10@ += 1                12@ = 0.0              else               005B: 9@ += 11@                005B: 12@ += 11@              end             32@ = 0            end         else           31@ = 0          end       else         31@ = 0        end     end   else     31@ = 0    end   03F0: enable_text_draw 1    if      32@ < 3000    then     0341: unknown_text_draw_flag 0      0342: enable_text_draw_centered 1      033F: set_text_draw_letter_size 0.6 2.4      081C: draw_text_outline 1 RGBA 0 0 0 255      if        31@ == 0      then       0340: set_text_draw_RGBA 175 0 0 255      else       0340: set_text_draw_RGBA 255 200 0 255      end     0092: 14@ = float 9@ to_integer     045A: draw_text_1number 320.0 100.0 GXT 'NUMBER' number 14@ // ~1~     0341: unknown_text_draw_flag 0      0342: enable_text_draw_centered 1      033F: set_text_draw_letter_size 0.6 2.4      081C: draw_text_outline 1 RGBA 0 0 0 255      if        31@ == 0      then       0340: set_text_draw_RGBA 175 0 0 255      else       0340: set_text_draw_RGBA 255 200 0 255      end     045A: draw_text_1number 320.0 130.0 GXT 'MULTIPL' number 10@ // ~1~   else     if        30@ > 0      then       0093: 10@ = integer 10@ to_float       006B: 9@ *= 10@        005B: 13@ += 9@        9@ = 0.0        10@ = 1        12@ = 0.0        30@ = 0      end   end   0092: 15@ = float 13@ to_integer   0341: unknown_text_draw_flag 0    0342: enable_text_draw_centered 1    045A: draw_text_1number 320.0 300.0 GXT 'NUMBER' number 15@ // ~1~ endend:getVehRotVelocity{ Parameters:   Passed:     0@ - vehicle (handle)   Result:     1@ - rotation velocity X     2@ - rotation velocity Y     3@ - rotation vecolity Z Example:   0AB1: call_scm_func @getVehRotVelocity 1 vehicle 0@ store_to 1@ 2@ 3@ }0A97: 0@ = car 0@ struct0@ += 0x50 0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 0@ += 0x4 0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0 0@ += 0x4 0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0 1@ /= 0.008625 2@ /= 0.008625 3@ /= 0.008625 0AB2: ret 3 1@ 2@ 3@ :getRelativeAngle{ Parameters:   Passed:     0@ - angle     1@ - related angle   Result:     0@ - relative angle Example:   0AB1: call_scm_func @getRelativeAngle 2 angle 90.0 to_angle 180.0 store_to 1@ }0063: 0@ -= 1@ if  0@ < 0.0 then 0@ += 360.0 endif 0@ > 180.0 then 0@ -= 360.0 end0AB2: ret 1 0@ :getClockwiseAngle{ Parameters:   Passed:     0@ - angle   Result:     0@ - clockwise angle Example:   0AB1: call_scm_func @getClockwiseAngle 1 angle 360.0 store_to 1@ }0@ *= -1.0 0@ += 360.0 0AB2: ret 1 0@ 

 

Use it for personal purposes only. wink.gif

 

//Edit: script restored.

Edited by Wesser
  • Like 1
Link to comment
Share on other sites

aStiffSausage

Wesser

 

 

Impressive... Well alright, best mod you've done so far! monocle.gif

 

Works great, and it's exactly what I want smile.gif

Link to comment
Share on other sites

I don't like making mods: I just give inspirations and tips for improving them. wink.gif

Link to comment
Share on other sites

aStiffSausage
I don't like making mods: I just give inspirations and tips for improving them. wink.gif

True, as I noticed few things that should be fixed...

 

Ehh... Drift-points with bikes?

Trying to add there enable/disable-key, so it won't pop up all the time tounge.gif

And I thought of trying to make there second value, so when the one that pops-up and does real-time-counting on points, when it's dissappearing, it would sum it up with the other value, which would be total points.

 

 

And you sure about private use? Many people would love this kind of mod.

Link to comment
Share on other sites

Because it takes part of an unreleased project similar to DYOM, which helps creating races ingame.

Link to comment
Share on other sites

aStiffSausage

Oh, okay.

 

I'll try to make my own, while taking some references from your script, and maybe make it a little better (and for personal use only). smile.gif

Link to comment
Share on other sites

Wesser, I tried this, and I came here and I thought of saying "OMG"... NO, i gotta say: "UR-MG" biggrin.gifbiggrin.gifbiggrin.gif

 

This is AMAZING !!!

 

Put the drift combo ending everytime we crash or oversteer, a button to reset the counting, a button to turn on/off, and it becomes PERFECT!!!!

 

Seriously, GOOD work smile.gif

Edited by Edward_FFS
Link to comment
Share on other sites

aStiffSausage

Please, don't quote pics/codes...

 

And it depends what I can do and will Wesser allow me to put it in public (After some changes, textures, and permissions) smile.gif

Link to comment
Share on other sites

It should be a crime not releasing this... You have no IDEA how much I searched for something like this LOL...

Link to comment
Share on other sites

aStiffSausage

Yes, I know, and so have many others, but Wesser has his own reasons to limit this to personal use only.

 

For example, if I would upload that mod somewhere, for example on GTAInside, and Wesser would finish his DYOM-race-mission some time after I've uploaded drift-mod on GTAInside, he would be called stealer...

 

(Didn't take GTAGarage as example, it would be too easily checked and this situtation just couldn't happen tounge.gif)

 

 

But, as I said before, I'll try to make it more simplified, and try to add there on/off functions and so on, and I'll release if Wesser gives permission and releases his mod.

Link to comment
Share on other sites

Indeed, the mod is done. It needs to be tweaked a bit and it becomes fully playable.

 

Basically, the mod is finished, so I can't give you permissions for releasing it. I'm able to improve it by myself and yours would be a little help I do not need.

 

Mine are just debugging scripts to test my scm-functions. This is the meaning of my unreleased mods. Some day I'll post my SA SDK (based with scm-functions) after I finish my Native SCM Builder. smile.gif

Link to comment
Share on other sites

Well... I guess I'll wait... Thanks anyway...

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.