Red Dead Redemption fishing
16 posts
• Page 1 of 2 • 1, 2
Red Dead Redemption fishing
I got the T2 so I could use my Xbox Elite Controller on the PS4. Oh, boy... I had no idea it could do so much more.
Today I pieced together this script for easier fishing in RDR2. It has a couple of extra shortcuts for L3 and R3 (feel free to disable). I use the paddles to reel the lure and reel the fish. I tried to make it easy to modify the buttons so they can be remapped to whatever.
One thing that I don't know how to do (but I know it can be done) is to make an anti-line break.
When you're reeling in the fish, it struggles. If you keep reeling, line will break. The thing is: when the fish struggles, the controller rumbles. So, is there a way I can add an IF RUMBLE stop reeling in?
Today I pieced together this script for easier fishing in RDR2. It has a couple of extra shortcuts for L3 and R3 (feel free to disable). I use the paddles to reel the lure and reel the fish. I tried to make it easy to modify the buttons so they can be remapped to whatever.
- Code: Select all
#pragma METAINFO("Red Dead Redemption Xbox Elite", 1, 02, "leonardofelin")
// Fishing reel based off bonefisher's code
// viewtopic.php?f=26&t=7743&wpureload=1#p56931
#include <xb1.gph>
#include <ps4.gph>
// RL: Reel Lure (Attract fish)
// RI: Reel In (Catch fish)
#define RL_BUTTON XB1_P4
#define RI_BUTTON XB1_P2
// Xbox Elite Shortcuts
#define R3_SHORTCUT XB1_P1
#define L3_SHORTCUT XB1_P3
// Rotation Adjustments
#define CIRCLE_RADIUS 100.0
#define CIRCLE_STEP .08
#define CIRCLE_SPEED_RL 40
#define CIRCLE_SPEED_RI 1
fix32 angle;
main {
if(get_val(RL_BUTTON)) {
set_val(RL_BUTTON, 0.0);
set_val(BUTTON_8, 100.0);
set_val(STICK_1_X, CIRCLE_RADIUS * cos(angle));
set_val(STICK_1_Y, CIRCLE_RADIUS * sin(angle));
combo_run(AutoCircle_RL);
}
if(get_val(RI_BUTTON)) {
set_val(RI_BUTTON, 0.0);
set_val(STICK_1_X, CIRCLE_RADIUS * cos(angle));
set_val(STICK_1_Y, CIRCLE_RADIUS * sin(angle));
combo_run(AutoCircle_RI);
}
if(get_val(R3_SHORTCUT)) {
set_val(R3_SHORTCUT, 0.0);
set_val(BUTTON_6, 100.0); //R3
}
if(get_val(L3_SHORTCUT)) {
set_val(L3_SHORTCUT, 0.0);
set_val(BUTTON_9, 100.0); //L3
}
}
combo AutoCircle_RI {
wait(CIRCLE_SPEED_RI);
angle = mod(angle + CIRCLE_STEP, 2.0 * PI);
}
combo AutoCircle_RL {
wait(CIRCLE_SPEED_RL);
angle = mod(angle + CIRCLE_STEP, 2.0 * PI);
}
One thing that I don't know how to do (but I know it can be done) is to make an anti-line break.
When you're reeling in the fish, it struggles. If you keep reeling, line will break. The thing is: when the fish struggles, the controller rumbles. So, is there a way I can add an IF RUMBLE stop reeling in?
-
leonardofelin - Sergeant
- Posts: 7
- Joined: Wed Nov 14, 2018 11:12 am
Re: Red Dead Redemption fishing
Maybe this ?
- Code: Select all
main{
bool hooked;
//Combo will auto reel when there is no controller rumble and a fish is hooked.
if(hooked){
combo_run(reel);
}
// The left stick must be active for the fishing duration.
if(is_active(BUTTON_8)) {
if (ffb_get_actual(FFB_1, 0) != 0.0 || ffb_get_actual(FFB_2, 0)) {
// Make sure you are holding the right trigger when you cast the fishing line
// After the bait has been in the water for 3 seconds,
// Let go of the right trigger, don't hold/press the trigger again.
// The script will auto hold the right trigger if a fish has bitten the line.
if(is_release(BUTTON_5)){
combo_stop(reel);
hooked = TRUE;
}
}
}
//fish has bitten
if(hooked) {
// if the controller rumbles, The Right trigger gets held, and the fishing
// rod will be yannk up.
set_val(BUTTON_5, 100);
set_val(STICK_2_Y, -100.00);
if(!reel) {
// The combo pulls left stick to the right for a set time,
// and then pulls thes stick to the left for a set time,
// This Should usually managage to fight the fish for you.
combo_run(fight_fish);
}
// You can still manually use the stick to fight/guide the
// fish towards you at any time.
if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
combo_stop(fight_fish);
set_val(STICK_2_Y, get_actual(STICK_2_Y) );
}
}
// Letting go of the left trigger for at least 3 seconds will stop
// will halt fishing combos.
if(check_release(BUTTON_8, 3000)) hooked = FALSE;
}
combo reel {
fix32 rad;
rad+=.025;
set_val(STICK_1_Y, get_val(STICK_1_Y)+sin(rad)*1e2);
set_val(STICK_1_X, get_val(STICK_1_X)+cos(rad)*1e2);
}
combo fight_fish {
set_val(STICK_2_X, 100);
wait(1500);
set_val(STICK_2_X, -100);
wait(1500);
}
-
Sillyasskid - Captain
- Posts: 574
- Joined: Sat May 14, 2016 3:07 am
Re: Red Dead Redemption fishing
Sillyasskid wrote:Maybe this ?
- Code: Select all
main{
bool hooked;
//Combo will auto reel when there is no controller rumble and a fish is hooked.
if(hooked){
combo_run(reel);
}
// The left stick must be active for the fishing duration.
if(is_active(BUTTON_8)) {
if (ffb_get_actual(FFB_1, 0) != 0.0 || ffb_get_actual(FFB_2, 0)) {
// Make sure you are holding the right trigger when you cast the fishing line
// After the bait has been in the water for 3 seconds,
// Let go of the right trigger, don't hold/press the trigger again.
// The script will auto hold the right trigger if a fish has bitten the line.
if(is_release(BUTTON_5)){
combo_stop(reel);
hooked = TRUE;
}
}
}
//fish has bitten
if(hooked) {
// if the controller rumbles, The Right trigger gets held, and the fishing
// rod will be yannk up.
set_val(BUTTON_5, 100);
set_val(STICK_2_Y, -100.00);
if(!reel) {
// The combo pulls left stick to the right for a set time,
// and then pulls thes stick to the left for a set time,
// This Should usually managage to fight the fish for you.
combo_run(fight_fish);
}
// You can still manually use the stick to fight/guide the
// fish towards you at any time.
if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
combo_stop(fight_fish);
set_val(STICK_2_Y, get_actual(STICK_2_Y) );
}
}
// Letting go of the left trigger for at least 3 seconds will stop
// will halt fishing combos.
if(check_release(BUTTON_8, 3000)) hooked = FALSE;
}
combo reel {
fix32 rad;
rad+=.025;
set_val(STICK_1_Y, get_val(STICK_1_Y)+sin(rad)*1e2);
set_val(STICK_1_X, get_val(STICK_1_X)+cos(rad)*1e2);
}
combo fight_fish {
set_val(STICK_2_X, 100);
wait(1500);
set_val(STICK_2_X, -100);
wait(1500);
}
nice work
-
bmpt guard - Command Sergeant Major
- Posts: 142
- Joined: Thu May 12, 2016 9:33 pm
Re: Red Dead Redemption fishing
I tried the script but didn't work for me. Even then, thank you so much for the code and all the comments on it.
I've modified my script with a lot of ideas and code from yours. I'll test it when my kid stops playing Minecraft and post it later.
I've modified my script with a lot of ideas and code from yours. I'll test it when my kid stops playing Minecraft and post it later.
-
leonardofelin - Sergeant
- Posts: 7
- Joined: Wed Nov 14, 2018 11:12 am
Re: Red Dead Redemption fishing
Improved version. Thanks Sillyasskid for the code above which gave me several ideas.
There are probably more elegant ways to code some of the stuff, but I'm not really good at coding.
What it does:
- Detects when the player equips the fishing rod;
- Player only needs to cast (you need to aim at where the fishes are);
- Script does all the work: reels the lure, hooks the fish, reel in when fish is not fighting, move the rod when it is fighting.
- Keep or throw the fish back. Rinse and repeat;
- Detects when the player puts the fishing rod away;
- Player can manually reset the script by double-tapping LB/L1.
EDIT1: I had to comment out the FFB for activating/deactivating because it was messing with my Xbox Elite. It would stop working altogether and I had to repair it with the wireless dongle to get it back.
EDIT2: Added a small trigger tap while reeling the lure. Nets quicker catches this way.
There are probably more elegant ways to code some of the stuff, but I'm not really good at coding.
What it does:
- Detects when the player equips the fishing rod;
- Player only needs to cast (you need to aim at where the fishes are);
- Script does all the work: reels the lure, hooks the fish, reel in when fish is not fighting, move the rod when it is fighting.
- Keep or throw the fish back. Rinse and repeat;
- Detects when the player puts the fishing rod away;
- Player can manually reset the script by double-tapping LB/L1.
- Code: Select all
#pragma METAINFO("Red Dead Redemption AutoFish", 1, 09, "leonardofelin")
// Fishing reel based off bonefisher's code
// viewtopic.php?f=26&t=7743&wpureload=1#p56931
// Several ideas from Sillyasskid
// Rotation Adjustments
#define CIRCLE_RADIUS 100.0
#define CIRCLE_STEP .05
#define CIRCLE_SPEED_RL 15
#define CIRCLE_SPEED_RI 1
fix32 angle;
main {
bool fishing;
bool cast;
bool reeling;
bool hooked;
// Check if the player equipped the fishing rod for fishing - START FISHING
if( (get_val(STICK_1_X) > 45.0) &&
(get_val(STICK_1_Y) > 45.0) &&
(get_val(STICK_1_X) < 95.0) &&
(get_val(STICK_1_Y) < 95.0) &&
(time_active(BUTTON_4) > 500) &&
(time_active(BUTTON_4) < 3000) &&
(time_active(BUTTON_7) > 500) &&
(event_release(BUTTON_7))) {
// ffb_set(FFB_1, 100.0, 800);
fishing = TRUE;
}
// If the player taps LB/L1, fishing rod is stored back - END FISHING
if(fishing && event_release(BUTTON_7) && time_active(BUTTON_7) < 150 ||
// If for any reason you need to reset, double tap LB/L1
event_active(BUTTON_7) && time_release(BUTTON_7) < 100) {
// ffb_set(FFB_1, 50.0, 400);
fishing = FALSE;
cast = FALSE;
reeling = FALSE;
hooked = FALSE;
combo_stop(LureFish);
combo_stop(PullRod);
combo_stop(FightFish);
}
// If the player is fishing, check for cast
if(fishing) {
// Check if the player has cast the line
if(!cast && is_active(BUTTON_8) && event_release(BUTTON_5)) {
cast = TRUE;
}
// Now the script takes over
// Slowly reel the lure until a fish bites
if((time_release(BUTTON_5) > 4000) && cast && !hooked && (ffb_get_actual(FFB_1, 0) == 0.0)) {
set_val(BUTTON_8, 100.0);
set_val(STICK_1_X, CIRCLE_RADIUS * cos(angle));
set_val(STICK_1_Y, CIRCLE_RADIUS * sin(angle));
combo_run(AutoCircle_RL);
combo_run(LureFish);
reeling = TRUE;
}
// Checks for a fish bite and hooks it
if(reeling && (ffb_get_actual(FFB_1, 0) > 25.0)) {
combo_stop(LureFish);
combo_run(HookFish);
hooked = TRUE;
reeling = FALSE;
}
// If the fish isn't fighting, reel in
if(hooked && (ffb_get_actual(FFB_1, 0) == 0.0)) {
set_val(BUTTON_8, 100.0);
set_val(STICK_1_X, CIRCLE_RADIUS * cos(angle));
set_val(STICK_1_Y, CIRCLE_RADIUS * sin(angle));
combo_stop(FightFish);
combo_run(AutoCircle_RI);
combo_run(PullRod);
}
// If fish is fighting, move the rod to fight back
if(hooked && (ffb_get_actual(FFB_1, 0) > 50.0)) {
combo_stop(PullRod);
combo_run(FightFish);
}
// You can still manually use the stick to fight/guide the
// fish towards you at any time.
if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
combo_stop(FightFish);
set_val(STICK_2_X, get_actual(STICK_2_X));
set_val(STICK_2_Y, get_actual(STICK_2_Y));
}
// If the player resets the cast, stores the fish, or throws it back,
// reset variables to restart fishing
if(event_active(BUTTON_15) || event_active(BUTTON_16)) {
cast = FALSE;
reeling = FALSE;
hooked = FALSE;
combo_stop(LureFish);
combo_stop(PullRod);
combo_stop(FightFish);
}
}
}
combo AutoCircle_RI {
wait(CIRCLE_SPEED_RI);
angle = mod(angle + CIRCLE_STEP, 2.0 * PI);
}
combo AutoCircle_RL {
wait(CIRCLE_SPEED_RL);
angle = mod(angle + CIRCLE_STEP, 2.0 * PI);
}
combo PullRod {
set_val(STICK_2_Y, -100.00);
wait(1000);
set_val(STICK_2_Y, 100.00);
wait(1000);
}
combo FightFish {
set_val(STICK_2_X, 100);
wait(1500);
set_val(STICK_2_X, -100);
wait(1500);
}
combo HookFish {
set_val(BUTTON_5, 100.0);
wait(300);
set_val(BUTTON_5, 0.0);
}
combo LureFish {
wait(10000);
set_val(BUTTON_5, 100.0);
wait(100);
set_val(BUTTON_5, 0.0);
}
EDIT1: I had to comment out the FFB for activating/deactivating because it was messing with my Xbox Elite. It would stop working altogether and I had to repair it with the wireless dongle to get it back.
EDIT2: Added a small trigger tap while reeling the lure. Nets quicker catches this way.
-
leonardofelin - Sergeant
- Posts: 7
- Joined: Wed Nov 14, 2018 11:12 am
Re: Red Dead Redemption fishing
Awesome job guys!.
Can't wait to test it :D
Can't wait to test it :D
-
alanmcgregor - Major
- Posts: 981
- Joined: Tue Mar 27, 2018 8:38 am
Re: Red Dead Redemption fishing
leonardofelin wrote:Improved version. Thanks Sillyasskid for the code above which gave me several ideas.
There are probably more elegant ways to code some of the stuff, but I'm not really good at coding.
What it does:
- Detects when the player equips the fishing rod;
- Player only needs to cast (you need to aim at where the fishes are);
- Script does all the work: reels the lure, hooks the fish, reel in when fish is not fighting, move the rod when it is fighting.
- Keep or throw the fish back. Rinse and repeat;
- Detects when the player puts the fishing rod away;
- Player can manually reset the script by double-tapping LB/L1.
- Code: Select all
#pragma METAINFO("Red Dead Redemption AutoFish", 1, 09, "leonardofelin")
// Fishing reel based off bonefisher's code
// viewtopic.php?f=26&t=7743&wpureload=1#p56931
// Several ideas from Sillyasskid
// Rotation Adjustments
#define CIRCLE_RADIUS 100.0
#define CIRCLE_STEP .05
#define CIRCLE_SPEED_RL 15
#define CIRCLE_SPEED_RI 1
fix32 angle;
main {
bool fishing;
bool cast;
bool reeling;
bool hooked;
// Check if the player equipped the fishing rod for fishing - START FISHING
if( (get_val(STICK_1_X) > 45.0) &&
(get_val(STICK_1_Y) > 45.0) &&
(get_val(STICK_1_X) < 95.0) &&
(get_val(STICK_1_Y) < 95.0) &&
(time_active(BUTTON_4) > 500) &&
(time_active(BUTTON_4) < 3000) &&
(time_active(BUTTON_7) > 500) &&
(event_release(BUTTON_7))) {
// ffb_set(FFB_1, 100.0, 800);
fishing = TRUE;
}
// If the player taps LB/L1, fishing rod is stored back - END FISHING
if(fishing && event_release(BUTTON_7) && time_active(BUTTON_7) < 150 ||
// If for any reason you need to reset, double tap LB/L1
event_active(BUTTON_7) && time_release(BUTTON_7) < 100) {
// ffb_set(FFB_1, 50.0, 400);
fishing = FALSE;
cast = FALSE;
reeling = FALSE;
hooked = FALSE;
combo_stop(LureFish);
combo_stop(PullRod);
combo_stop(FightFish);
}
// If the player is fishing, check for cast
if(fishing) {
// Check if the player has cast the line
if(!cast && is_active(BUTTON_8) && event_release(BUTTON_5)) {
cast = TRUE;
}
// Now the script takes over
// Slowly reel the lure until a fish bites
if((time_release(BUTTON_5) > 4000) && cast && !hooked && (ffb_get_actual(FFB_1, 0) == 0.0)) {
set_val(BUTTON_8, 100.0);
set_val(STICK_1_X, CIRCLE_RADIUS * cos(angle));
set_val(STICK_1_Y, CIRCLE_RADIUS * sin(angle));
combo_run(AutoCircle_RL);
combo_run(LureFish);
reeling = TRUE;
}
// Checks for a fish bite and hooks it
if(reeling && (ffb_get_actual(FFB_1, 0) > 25.0)) {
combo_stop(LureFish);
combo_run(HookFish);
hooked = TRUE;
reeling = FALSE;
}
// If the fish isn't fighting, reel in
if(hooked && (ffb_get_actual(FFB_1, 0) == 0.0)) {
set_val(BUTTON_8, 100.0);
set_val(STICK_1_X, CIRCLE_RADIUS * cos(angle));
set_val(STICK_1_Y, CIRCLE_RADIUS * sin(angle));
combo_stop(FightFish);
combo_run(AutoCircle_RI);
combo_run(PullRod);
}
// If fish is fighting, move the rod to fight back
if(hooked && (ffb_get_actual(FFB_1, 0) > 50.0)) {
combo_stop(PullRod);
combo_run(FightFish);
}
// You can still manually use the stick to fight/guide the
// fish towards you at any time.
if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
combo_stop(FightFish);
set_val(STICK_2_X, get_actual(STICK_2_X));
set_val(STICK_2_Y, get_actual(STICK_2_Y));
}
// If the player resets the cast, stores the fish, or throws it back,
// reset variables to restart fishing
if(event_active(BUTTON_15) || event_active(BUTTON_16)) {
cast = FALSE;
reeling = FALSE;
hooked = FALSE;
combo_stop(LureFish);
combo_stop(PullRod);
combo_stop(FightFish);
}
}
}
combo AutoCircle_RI {
wait(CIRCLE_SPEED_RI);
angle = mod(angle + CIRCLE_STEP, 2.0 * PI);
}
combo AutoCircle_RL {
wait(CIRCLE_SPEED_RL);
angle = mod(angle + CIRCLE_STEP, 2.0 * PI);
}
combo PullRod {
set_val(STICK_2_Y, -100.00);
wait(1000);
set_val(STICK_2_Y, 100.00);
wait(1000);
}
combo FightFish {
set_val(STICK_2_X, 100);
wait(1500);
set_val(STICK_2_X, -100);
wait(1500);
}
combo HookFish {
set_val(BUTTON_5, 100.0);
wait(300);
set_val(BUTTON_5, 0.0);
}
combo LureFish {
wait(10000);
set_val(BUTTON_5, 100.0);
wait(100);
set_val(BUTTON_5, 0.0);
}
EDIT1: I had to comment out the FFB for activating/deactivating because it was messing with my Xbox Elite. It would stop working altogether and I had to repair it with the wireless dongle to get it back.
EDIT2: Added a small trigger tap while reeling the lure. Nets quicker catches this way.
Would this work on the nacon revolution pro on ps4?
-
Dimakra666 - Sergeant Major of the Army
- Posts: 231
- Joined: Fri Feb 17, 2017 3:34 am
Re: Red Dead Redemption fishing
leonardofelin wrote:EDIT1: I had to comment out the FFB for activating/deactivating because it was messing with my Xbox Elite. It would stop working altogether and I had to repair it with the wireless dongle to get it back.
To disable the force feed back on the controller, use this
- Code: Select all
init{
port_inhibit_ffb(PORT_USB_A);
port_inhibit_ffb(PORT_USB_B);
}
-
Sillyasskid - Captain
- Posts: 574
- Joined: Sat May 14, 2016 3:07 am
Re: Red Dead Redemption fishing
Dimakra666 wrote:Would this work on the nacon revolution pro on ps4?
It should - I tested on both my Xbox Elite and the DS4.
-
leonardofelin - Sergeant
- Posts: 7
- Joined: Wed Nov 14, 2018 11:12 am
Re: Red Dead Redemption fishing
leonardofelin wrote:Dimakra666 wrote:Would this work on the nacon revolution pro on ps4?
It should - I tested on both my Xbox Elite and the DS4.
What i did is just loaded this script on my titan two and iv tried it nothing works can u plz xplain how do i make it work? Thnx in advance
-
Dimakra666 - Sergeant Major of the Army
- Posts: 231
- Joined: Fri Feb 17, 2017 3:34 am
16 posts
• Page 1 of 2 • 1, 2
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 129 guests