Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SCRIPT_START
{
LVAR_INT scplayer local rotateCam disableWanted
LVAR_FLOAT des_x des_y cur_x cur_y z dif_x dif_y distance speed camSpeed
GET_PLAYER_CHAR 0 scplayer
READ_INT_FROM_INI_FILE "cleo\Stress Test.ini" "Settings" "Local" (local)
READ_FLOAT_FROM_INI_FILE "cleo\Stress Test.ini" "Settings" "Speed" (speed)
speed *= -1.0
READ_INT_FROM_INI_FILE "cleo\Stress Test.ini" "Settings" "RotateCamera" (rotateCam)
READ_FLOAT_FROM_INI_FILE "cleo\Stress Test.ini" "Settings" "CameraSpeed" (camSpeed)
READ_INT_FROM_INI_FILE "cleo\Stress Test.ini" "Settings" "DisableWanted" (disableWanted)
WHILE TRUE
WAIT 0
IF TEST_CHEAT "STRESS"
IF disableWanted = TRUE
SET_MAX_WANTED_LEVEL 0
ENDIF
GET_CHAR_COORDINATES scplayer cur_x cur_y z
GOSUB GetNewDestination
WHILE TRUE
WAIT 0
IF LOCATE_CHAR_ANY_MEANS_2D scplayer (des_x des_y) (10.0 10.0 FALSE)
GOSUB GetNewDestination
ENDIF
GOSUB MoveToDestination
IF IS_BUTTON_PRESSED PAD1 TRIANGLE
BREAK
ENDIF
IF rotateCam = TRUE
WRITE_MEMORY 0xB73424 4 camSpeed FALSE
ENDIF
ENDWHILE
IF disableWanted = TRUE
SET_MAX_WANTED_LEVEL 6
ENDIF
ENDIF
ENDWHILE
MoveToDestination:
dif_x = cur_x - des_x
dif_y = cur_y - des_y
GET_DISTANCE_BETWEEN_COORDS_2D des_x des_y cur_x cur_y (distance)
dif_x /= distance
dif_y /= distance
dif_x *= speed
dif_y *= speed
cur_x += dif_x
cur_y += dif_y
GET_GROUND_Z_FOR_3D_COORD cur_x cur_y 500.0 (z)
IF z < 0.0
z = 0.0
ENDIF
z += 10.0
SET_CHAR_COORDINATES scplayer cur_x cur_y z
PRINT_FORMATTED_NOW "Dest %.3f %.3f~n~Cur %.3f %.3f" 100 (des_x des_y cur_x cur_y)
WRITE_FLOAT_TO_INI_FILE cur_x "cleo\Stress Test.ini" "SimpleLog" "LastCoordX"
WRITE_FLOAT_TO_INI_FILE cur_y "cleo\Stress Test.ini" "SimpleLog" "LastCoordY"
RETURN
GetNewDestination:
SWITCH local
CASE 1
GOSUB GetNewDestination_WORLD
BREAK
CASE 2
GOSUB GetNewDestination_LS
BREAK
CASE 3
GOSUB GetNewDestination_SF
BREAK
CASE 4
GOSUB GetNewDestination_LV
BREAK
ENDSWITCH
RETURN
GetNewDestination_WORLD:
GENERATE_RANDOM_FLOAT_IN_RANGE -3000.0 3000.0 (des_x)
GENERATE_RANDOM_FLOAT_IN_RANGE -3000.0 3000.0 (des_y)
RETURN
GetNewDestination_LS:
GENERATE_RANDOM_FLOAT_IN_RANGE -33.0 2960.0 (des_x)
GENERATE_RANDOM_FLOAT_IN_RANGE -2850.0 -885.0 (des_y)
GET_GROUND_Z_FOR_3D_COORD des_x des_y 500.0 (z)
IF z < 0.0 // avoid ocean part
GOTO GetNewDestination_LS
ENDIF
RETURN
GetNewDestination_SF:
GENERATE_RANDOM_FLOAT_IN_RANGE -2900.0 -1220.0 (des_x)
GENERATE_RANDOM_FLOAT_IN_RANGE -2850.0 -550.0 (des_y)
RETURN
GetNewDestination_LV:
GENERATE_RANDOM_FLOAT_IN_RANGE 774.0 3000.0 (des_x)
GENERATE_RANDOM_FLOAT_IN_RANGE 550.0 3000.0 (des_y)
RETURN
}
SCRIPT_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.