Jump to content

shopping and dressing in VC


Full33

Recommended Posts

Hello, I wrote a script for buying and dressing a player under a certain skin.

I've encountered a very strange problem that I don't know how to solve yet. The problem is that if you use the script in main.scm, the character is accelerated many times over.

in main.scm

004F: start_new_script @STBYCL

:STBYCL
03A4: script_name 'STBYCL' 

:STBYCL_12
0001: wait 0 ms 
00D6: if 
00FF:   actor $PLAYER_ACTOR 1 -259.64 -369.58 22.17 radius 0.5 0.5 0.5 
004D: jump_if_false @STBYCL_81 
03E5: text_box 'SHKAF1' 
0002: jump @STBYCL_81 

:STBYCL_81
0001: wait 0 ms 
00D6: if 
80FF:   not actor $PLAYER_ACTOR 0 -259.64 -369.58 22.17 radius 0.5 0.5 0.5 
004D: jump_if_false @STBYCL_140 
0002: jump @STBYCL_12 

:STBYCL_140
00D6: if 
00E1:   player 0 pressed_button 15 
004D: jump_if_false @STBYCL_81 
01B4: set_player $PLAYER_CHAR can_move 0 
016A: fade 0 250 ms 
0001: wait 250 ms 
00A1: put_actor $PLAYER_ACTOR at -259.64 -369.58 22.17 
0173: set_actor $PLAYER_ACTOR z_angle_to 270.0 
015F: set_camera_position -257.16 -369.83 23.17 rotation 0 0 0 
0159: camera_on_ped $PLAYER_ACTOR mode 15 switchstyle 2 
0001: wait 250 ms 
016A: fade 1 250 ms 
03E5: text_box 'SHKAF2'

0006: 1@ = 0 // @ = int This is necessary in order not to change the player’s clothes, but for some reason sometimes it interferes with scrolling through the list. Without this, the player can change clothes for free, unfortunately.

00D6: if 
0500:   player $PLAYER_CHAR skin == 'PLSTSH1' 
004D: jump_if_false @STBYCL_298 
0006: 0@ = 1 // @ = int 
0006: 1@ = 1 // @ = int 

:STBYCL_298
00D6: if 
0500:   player $PLAYER_CHAR skin == 'PLSTSH2' 
004D: jump_if_false @STBYCL_336 
0006: 0@ = 2 // @ = int 
0006: 1@ = 2 // @ = int 

:STBYCL_336
00D6: if 
0500:   player $PLAYER_CHAR skin == 'PLSTSH3' 
004D: jump_if_false @STBYCL_374 
0006: 0@ = 3 // @ = int 
0006: 1@ = 3 // @ = int 

:STBYCL_374

:STBYCL_716 //left and A
0001: wait 0 ms
0494: get_joystick 0 data_to $BUYCLLSTICKX $BUYCLLSTICKY $BUYCLRSTICKX $BUYCLRSTICKY 
00D6: if or
00E1:   player 0 pressed_button 10 
001A:   -100 > $BUYCLLSTICKX // int > $ 
004D: jump_if_false @STBYCL_806 
00BE: text_clear_all 
016A: fade 0 250 ms 
0001: wait 250 ms 
000E: 0@ -= 1 // @ -= int 
00D6: if 
0039:   0@ == 0 // @ == int 
004D: jump_if_false @STBYCL_785 
0006: 0@ = 3 // @ = int 

:STBYCL_785
0050: gosub @STBYCL_1108 
038B: load_requested_models 
0353: refresh_actor $PLAYER_ACTOR 
016A: fade 1 250 ms 

:STBYCL_806 //right and D
00D6: if or
00E1:   player 0 pressed_button 11 
0018:   $BUYCLLSTICKX > 100 // $ > int
004D: jump_if_false @STBYCL_892 
00BE: text_clear_all 
016A: fade 0 250 ms 
0001: wait 250 ms 
000A: 0@ += 1 // @ += int 
00D6: if 
0039:   0@ == 4 // @ == int 
004D: jump_if_false @STBYCL_871 
0006: 0@ = 1 // @ = int 

:STBYCL_871
0050: gosub @STBYCL_1108 
038B: load_requested_models 
0353: refresh_actor $PLAYER_ACTOR 
016A: fade 1 250 ms 

:STBYCL_892
00D6: if 
00E1:   player 0 pressed_button 16 
004D: jump_if_false @STBYCL_1006 
00BE: text_clear_all
0109: player $PLAYER_CHAR money += 4@
04CF: add 3@ to_money_spent_on_fashion_stats 
016A: fade 0 250 ms 
0001: wait 250 ms 
00D6: if 
810F:   not player $PLAYER_CHAR wanted_level > 2 
004D: jump_if_false @STBYCL_946 
0110: clear_player $PLAYER_CHAR wanted_level

:STBYCL_946
00A1: put_actor $PLAYER_ACTOR at -254.524 -369.913 22.17 
0373: set_camera_directly_behind_player 
02EB: restore_camera_with_jumpcut 
01B4: set_player $PLAYER_CHAR can_move 1 
0001: wait 250 ms 
03E5: text_box 'CLOHELP'  // Clean Clothes!!
016A: fade 1 250 ms 
0002: jump @STBYCL_12 

:STBYCL_1006
00D6: if 
00E1:   player 0 pressed_button 15 
004D: jump_if_false @STBYCL_1101 
00BE: text_clear_all 
016A: fade 0 250 ms 
0001: wait 250 ms 
00A1: put_actor $PLAYER_ACTOR at -254.524 -369.913 22.17 
0373: set_camera_directly_behind_player 
02EB: restore_camera_with_jumpcut 
01B4: set_player $PLAYER_CHAR can_move 1 
0050: gosub @STBYCL_1738 
038B: load_requested_models 
0353: refresh_actor $PLAYER_ACTOR 
0001: wait 250 ms 
016A: fade 1 250 ms 
0002: jump @STBYCL_12 

:STBYCL_1101
0002: jump @STBYCL_716 

:STBYCL_1108
0001: wait 0 ms 
00D6: if and
0039:   0@ == 1 // @ == int 
010A:   player $PLAYER_CHAR money > 74
004D: jump_if_false @STBYCL_1164 
0352: set_actor $PLAYER_ACTOR skin_to 'PLSTSH1' 
03E5: text_box 'PLSTSH1' //name clothes
01E5: text_1number_highpriority 'G_COST' 75 time 120000 1  // Cost: $~1~
0006:   3@ = 75 // @ = int
0006:   4@ = -75 // @ = int

:STBYCL_1164
00D6: if and
0039:   0@ == 2 // @ == int
010A:   player $PLAYER_CHAR money > 144 
004D: jump_if_false @STBYCL_1216 
0352: set_actor $PLAYER_ACTOR skin_to 'PLSTSH2' 
03E5: text_box 'PLSTSH2'
01E5: text_1number_highpriority 'G_COST' 145 time 120000 1  // Cost: $~1~ 
0006:   3@ = 145 // @ = int
0006:   4@ = -145 // @ = int  

:STBYCL_1216
00D6: if and
0039:   0@ == 3 // @ == int
010A:   player $PLAYER_CHAR money > 209 
004D: jump_if_false @STBYCL_1268 
0352: set_actor $PLAYER_ACTOR skin_to 'PLSTSH3' 
03E5: text_box 'PLSTSH3'
01E5: text_1number_highpriority 'G_COST' 210 time 120000 1  // Cost: $~1~
0006:   3@ = 210 // @ = int
0006:   4@ = -210 // @ = int 

:STBYCL_1268
0051: return 

:STBYCL_1738
0001: wait 0 ms
00D6: if 
0039:   1@ == 0 // @ == int 
004D: jump_if_false @STBYCL_1775 
0002: jump @STBYCL_1847

:STBYCL_1775 
00D6: if 
0039:   1@ == 1 // @ == int 
004D: jump_if_false @STBYCL_1777 
0352: set_actor $PLAYER_ACTOR skin_to 'PLSTSH1'   

:STBYCL_1777
00D6: if 
0039:   1@ == 2 // @ == int 
004D: jump_if_false @STBYCL_1812 
0352: set_actor $PLAYER_ACTOR skin_to 'PLSTSH2'   

:STBYCL_1812
00D6: if 
0039:   1@ == 3 // @ == int 
004D: jump_if_false @STBYCL_1847 
0352: set_actor $PLAYER_ACTOR skin_to 'PLSTSH3' 

:STBYCL_1847
0051: return

//-------------Mission 0---------------
// Originally: Initial


 

Video demonstration:
https://disk.yandex.ru/d/C6QDnbqzXoSkwA

Link to comment
Share on other sites

What a terrible bug, i had to restart my pc to get the game working in a normally way.

I have no idea why, maybe because these key checks together with skin change

 

In my first test nothing happened by keypress left/right

so i added key checks for 0 and 1, don't ask me why

:STBYCL_716 //left and A
0494: get_joystick 0 data_to $BUYCLLSTICKX $BUYCLLSTICKY $BUYCLRSTICKX $BUYCLRSTICKY 
if or
00E1:   player 0 pressed_button 10
00E1:   key_pressed 0 0 
001A:   -100 > $BUYCLLSTICKX // int > $ 
jf @STBYCL_806

//------------------------


:STBYCL_806 //right and D
if or
00E1:   player 0 pressed_button 11
00E1:   key_pressed 0 1 
0018:   $BUYCLLSTICKX > 100 // $ > int
jf @STBYCL_892

 

And it worked fine. I thought i post here "what's the problem"

Then I thought, wait, I must test other key checks

So i tested by key numpad 7 and 9 and then i got the bug

Now i got always the bug

I tried without fade, without wait codes, without text codes and without 01B4:

but I always got the bug again

Sorry, but I don't wanna touch this stuff again.

Try other key presses, maybe it helps

 

 

Edited by ZAZ
Link to comment
Share on other sites

2 hours ago, ZAZ said:

What a terrible bug, i had to restart my pc to get the game working in a normally way.

I have no idea why, maybe because these key checks together with skin change

 

In my first test nothing happened by keypress left/right

so i added key checks for 0 and 1, don't ask me why

:STBYCL_716 //left and A
0494: get_joystick 0 data_to $BUYCLLSTICKX $BUYCLLSTICKY $BUYCLRSTICKX $BUYCLRSTICKY 
if or
00E1:   player 0 pressed_button 10
00E1:   key_pressed 0 0 
001A:   -100 > $BUYCLLSTICKX // int > $ 
jf @STBYCL_806

//------------------------


:STBYCL_806 //right and D
if or
00E1:   player 0 pressed_button 11
00E1:   key_pressed 0 1 
0018:   $BUYCLLSTICKX > 100 // $ > int
jf @STBYCL_892

 

And it worked fine. I thought i post here "what's the problem"

Then I thought, wait, I must test other key checks

So i tested by key numpad 7 and 9 and then i got the bug

Now i got always the bug

I tried without fade, without wait codes, without text codes and without 01B4:

but I always got the bug again

Sorry, but I don't wanna touch this stuff again.

Try other key presses, maybe it helps

 

 

 

I was able to fix the player's acceleration, but I had to remove the function to exit the purchase mode, which in some unknown way allowed me to change the player's clothes for free.

This is my most recent version of the script. I wanted to return the rewinding of clothes to the left, but for some reason unknown to me, this also speeds up the player, not the gameplay, and therefore the player turns out to be very twitchy.

And in the end, I decided to leave only swiping to the right.


 

Spoiler
:STBYCL
03A4: script_name 'STBYCL' 

:STBYCL_10
0001: wait 0 ms 
00D6: if 
00FF:   actor $PLAYER_ACTOR 0 -259.64 -369.58 22.17 radius 1.0 1.0 1.0 
004D: jump_if_false @STBYCL_79 
03E5: text_box 'STBYCL1' 
0002: jump @STBYCL_79 

:STBYCL_79
0001: wait 0 ms 
00D6: if 
80FF:   not actor $PLAYER_ACTOR 1 -259.64 -369.58 22.17 radius 1.0 1.0 1.0 
004D: jump_if_false @STBYCL_138 
0002: jump @STBYCL_10 

:STBYCL_138
00D6: if 
00E1:   player 0 pressed_button 15 
004D: jump_if_false @STBYCL_79 
01B4: set_player $PLAYER_CHAR can_move 0 
016A: fade 0 250 ms 
0001: wait 250 ms 
00A1: put_actor $PLAYER_ACTOR at -259.64 -369.58 22.17 
0173: set_actor $PLAYER_ACTOR z_angle_to 270.0 
015F: set_camera_position -257.16 -369.83 23.17 rotation 0 0 0 
0159: camera_on_ped $PLAYER_ACTOR mode 15 switchstyle 2 
0001: wait 250 ms 
016A: fade 1 250 ms 
03E5: text_box 'STBYCL2' 
00D6: if 
0500:   player $PLAYER_CHAR skin == 'PLSTSH1' 
004D: jump_if_false @STBYCL_296 
0006: 0@ = 1 // @ = int 
0006: 1@ = 1 // @ = int 

:STBYCL_296
00D6: if 
0500:   player $PLAYER_CHAR skin == 'PLSTSH2' 
004D: jump_if_false @STBYCL_334 
0006: 0@ = 2 // @ = int 
0006: 1@ = 2 // @ = int 

:STBYCL_334
00D6: if 
0500:   player $PLAYER_CHAR skin == 'PLSTSH3' 
004D: jump_if_false @STBYCL_372 
0006: 0@ = 3 // @ = int 
0006: 1@ = 3 // @ = int 

:STBYCL_372
0001: wait 0 ms 
0494: get_joystick 0 data_to $BUYCLLSTICKX $BUYCLLSTICKY $BUYCLRSTICKX $BUYCLRSTICKY 
00D6: if or
00E1:   player 0 pressed_button 11 
0018:   $BUYCLLSTICKX > 100 // $ > int 
004D: jump_if_false @STBYCL_476 
00BE: text_clear_all 
016A: fade 0 250 ms 
0001: wait 250 ms 
000A: 0@ += 1 // @ += int 
00D6: if 
0039:   0@ == 4 // @ == int 
004D: jump_if_false @STBYCL_462 
0006: 0@ = 1 // @ = int 

:STBYCL_462
0050: gosub @STBYCL_610 
016A: fade 1 250 ms 

:STBYCL_476
00D6: if 
00E1:   player 0 pressed_button 16 
004D: jump_if_false @STBYCL_603 
00BE: text_clear_all 
0109: player $PLAYER_CHAR money += 4@ 
04CF: add 3@ to_money_spent_on_fashion_stats 
016A: fade 0 250 ms 
0001: wait 250 ms 
00D6: if 
810F:   not player $PLAYER_CHAR wanted_level > 1 
004D: jump_if_false @STBYCL_543 
0110: clear_player $PLAYER_CHAR wanted_level 

:STBYCL_543
00A1: put_actor $PLAYER_ACTOR at -254.524 -369.913 22.17 
0373: set_camera_directly_behind_player 
02EB: restore_camera_with_jumpcut 
01B4: set_player $PLAYER_CHAR can_move 1 
0001: wait 250 ms 
03E5: text_box 'CLOHELP'  // Clean Clothes!!
016A: fade 1 250 ms 
0002: jump @STBYCL_10 

:STBYCL_603
0002: jump @STBYCL_372 

:STBYCL_610
0001: wait 0 ms 
00D6: if and
0039:   0@ == 1 // @ == int 
010A:   player $PLAYER_CHAR money > 119 
004D: jump_if_false @STBYCL_695 
0352: set_actor $PLAYER_ACTOR skin_to 'PLSTSH1' 
03E5: text_box 'PLSTSH1' 
01E5: text_1number_highpriority 'G_COST' 120 time 120000 1  // Cost: $~1~
0006: 3@ = 120 // @ = int 
0006: 4@ = -120 // @ = int 

:STBYCL_695
00D6: if and
0039:   0@ == 2 // @ == int 
010A:   player $PLAYER_CHAR money > 179 
004D: jump_if_false @STBYCL_780 
0352: set_actor $PLAYER_ACTOR skin_to 'PLSTSH2' 
03E5: text_box 'PLSTSH2' 
01E5: text_1number_highpriority 'G_COST' 180 time 120000 1  // Cost: $~1~
0006: 3@ = 180 // @ = int 
0006: 4@ = -180 // @ = int 

:STBYCL_780
00D6: if and
0039:   0@ == 3 // @ == int 
010A:   player $PLAYER_CHAR money > 239 
004D: jump_if_false @STBYCL_865 
0352: set_actor $PLAYER_ACTOR skin_to 'PLSTSH3' 
03E5: text_box 'PLSTSH3' 
01E5: text_1number_highpriority 'G_COST' 240 time 120000 1  // Cost: $~1~
0006: 3@ = 240 // @ = int 
0006: 4@ = -240 // @ = int 

:STBYCL_865
038B: load_requested_models 
0353: refresh_actor $PLAYER_ACTOR 
0051: return 

 


During my observations, I noticed that the player speeds up if the opcode is used many times
0353: refresh_actor $PLAYER_ACTOR

And the part of scrolling left and right was also conceived and taken from the ammunition script when you select something by scrolling left or right before purchasing.

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.