set_polar() - Script Documentation
30 posts
• Page 2 of 3 • 1, 2, 3
Re: set_polar() - Script Documentation
Gjin Yuko wrote:Any future plans on Xim Support?
You can use this with XIM
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4533
- Joined: Wed May 22, 2019 5:39 am
Re: set_polar() - Script Documentation
UK_Wildcats_Fans wrote:What are some applications for using this?
Mainly for Anti Recoil on Battlefield and Call of Duty series
YouTube /Gjin Yuko
Facebook /Gjin Yuko
Twitter /Gjin Yuko
Discord /Gjin Yuko
Xbox /Gjin Yuko
Playstation Dont have one, Xbox is the better Console
Facebook /Gjin Yuko
Twitter /Gjin Yuko
Discord /Gjin Yuko
Xbox /Gjin Yuko
Playstation Dont have one, Xbox is the better Console
-
Gjin Yuko - Sergeant Major
- Posts: 95
- Joined: Mon Aug 05, 2019 10:00 pm
- Location: Germany
Re: set_polar() - Script Documentation
Mad wrote:Gjin Yuko wrote:Any future plans on Xim Support?
You can use this with XIM
Yeah i tried it out with the Xim, but when you ADS youre Mouse movements gets really really stiff
YouTube /Gjin Yuko
Facebook /Gjin Yuko
Twitter /Gjin Yuko
Discord /Gjin Yuko
Xbox /Gjin Yuko
Playstation Dont have one, Xbox is the better Console
Facebook /Gjin Yuko
Twitter /Gjin Yuko
Discord /Gjin Yuko
Xbox /Gjin Yuko
Playstation Dont have one, Xbox is the better Console
-
Gjin Yuko - Sergeant Major
- Posts: 95
- Joined: Mon Aug 05, 2019 10:00 pm
- Location: Germany
Re: set_polar() - Script Documentation
How would this be used for Anti-Recoil?
-
cb57 - Sergeant First Class
- Posts: 21
- Joined: Wed Mar 13, 2019 1:14 pm
Re: set_polar() - Script Documentation
cb57 wrote:How would this be used for Anti-Recoil?
My understanding may be wrong, but here it is. I am assuming that set_polar is another alternative to set_val for the stick (x & Y).
For example, let's assume that a gun kicks up and to the right fairly consistent. Based upon the recoil pattern, you could plot an angle and use set_polar for the plotted angles.
Please let me know if my understanding is not correct or how else it would be used.
-
UK_Wildcats - Brigadier General
- Posts: 2243
- Joined: Thu Jan 08, 2015 6:53 pm
Re: set_polar() - Script Documentation
- Code: Select all
#pragma METAINFO("polar anti recoil", 1, 0, "bonefisher")
#define POLAR_RS STICK_1_X, STICK_1_Y
#define POLAR_LS STICK_2_X, STICK_2_Y
fix32 anti_recoil = 40.0; //--Anti_Recoil strength
fix32 polar_angle = 90.0; //--direction of anti_recoil
fix32 StickNoise = 8.0;
main {
if (abs(get_actual(STICK_1_X)) < StickNoise) set_val(STICK_1_X, 0.0);
if (abs(get_actual(STICK_1_Y)) < StickNoise) set_val(STICK_1_Y, 0.0);
if(get_val(BUTTON_5)) {
set_polar(POLAR_RS, polar_angle, anti_recoil + .01);
}
}
void set_polar(uint8 X, uint8 Y, fix32 ANGLE, fix32 RADIUS){
fix32 angle = rad2deg(mod(deg2rad(ANGLE) + PI * 2f, PI * 2f));
fix32 x_Out, y_Out;
if(angle > 45.10 && angle < 225.90) {
x_Out = -sin(deg2rad(angle) - deg2rad(90.02));
y_Out = -cos(deg2rad(angle) - deg2rad(270.00));
}
else {
x_Out = cos(deg2rad(angle));
y_Out = sin(deg2rad(angle));
}
set_val_offset(X, clamp(x_Out * RADIUS, -100.00, 100.00));
set_val_offset(Y, clamp(y_Out * RADIUS, -100.00, 100.00));
}
void set_val_offset(uint8 axis, fix32 offset_val)
{
set_val(axis, clamp(offset_val * (100.0 - abs(get_val(axis))) / 100.0 + get_val(axis), -100.0, 100.0));
return;
}
Here!!
90 is straight down 95 is down left 85 is down right example.....
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: set_polar() - Script Documentation
- Code: Select all
#pragma METAINFO("polar anti recoil", 1, 0, "bonefisher")
#define POLAR_RS STICK_1_X, STICK_1_Y
#define POLAR_LS STICK_2_X, STICK_2_Y
fix32 anti_recoil = 44.0; //--Anti_Recoil strength
fix32 polar_angle = 95.0; //--direction of anti_recoil
fix32 recoil_drop = anti_recoil - 12.0;
fix32 recoil = anti_recoil;
fix32 StickNoise = 8.0;
main {
if (abs(get_actual(STICK_1_X)) < StickNoise) set_val(STICK_1_X, 0.0);
if (abs(get_actual(STICK_1_Y)) < StickNoise) set_val(STICK_1_Y, 0.0);
if(get_val(BUTTON_5)) {
set_polar(POLAR_RS, polar_angle, anti_recoil + .01);
}
if(get_actual(BUTTON_5)) {
anti_recoil = anti_recoil - 0.01;
if(anti_recoil < recoil_drop)anti_recoil = recoil_drop;
}else if(event_release(BUTTON_5))anti_recoil = recoil;
}
void set_polar(uint8 X, uint8 Y, fix32 ANGLE, fix32 RADIUS){
fix32 angle = rad2deg(mod(deg2rad(ANGLE) + PI * 2f, PI * 2f));
fix32 x_Out, y_Out;
if(angle > 45.10 && angle < 225.90) {
x_Out = -sin(deg2rad(angle) - deg2rad(90.02));
y_Out = -cos(deg2rad(angle) - deg2rad(270.00));
}
else {
x_Out = cos(deg2rad(angle));
y_Out = sin(deg2rad(angle));
}
set_val_offset(X, clamp(x_Out * RADIUS, -100.00, 100.00));
set_val_offset(Y, clamp(y_Out * RADIUS, -100.00, 100.00));
}
void set_val_offset(uint8 axis, fix32 offset_val)
{
set_val(axis, clamp(offset_val * (100.0 - abs(get_val(axis))) / 100.0 + get_val(axis), -100.0, 100.0));
return;
}
This is best for MW2019
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: set_polar() - Script Documentation
Hi,
just asking myself:
The recoil angles/values of the Battlefield weapons are known. (you can look them up at sym.gg, see below picture yellow marked)
Is there anyway to translate these values in a script like this here? That would be very interesting! (I know that sometimes random recoil comes up, thats excluded from my question)
just asking myself:
The recoil angles/values of the Battlefield weapons are known. (you can look them up at sym.gg, see below picture yellow marked)
Is there anyway to translate these values in a script like this here? That would be very interesting! (I know that sometimes random recoil comes up, thats excluded from my question)
-
Pianist - Sergeant First Class
- Posts: 20
- Joined: Sun Jan 12, 2020 11:28 am
Re: set_polar() - Script Documentation
Use the second one I posted!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: set_polar() - Script Documentation
Thanks for your reply.
But which value of my screenshot do I have to insert where?
Or do you mean just copy your second code and play with it in BFV?
Sorry when its a dumb question, I am not a pro when it comes to scripts.
BR
But which value of my screenshot do I have to insert where?
Or do you mean just copy your second code and play with it in BFV?
Sorry when its a dumb question, I am not a pro when it comes to scripts.
BR
-
Pianist - Sergeant First Class
- Posts: 20
- Joined: Sun Jan 12, 2020 11:28 am
30 posts
• Page 2 of 3 • 1, 2, 3
Return to User's Script Documentation
Who is online
Users browsing this forum: No registered users and 119 guests