Check active with KM
5 posts
• Page 1 of 1
Check active with KM
Hi all,
I have troubles with scripting check actives on keyboard/mouse Inputs.
I did it with binding the mouse Button to a unused Controller input, because check active on mouse directly didn't work.
What is a good way to make check actives with mouse/keyboard Keys?
Ingame Situation : I wanna create a Script for when I Hold a mouse Button, first it press right pad ps4 once, if I Continue to hold it for about 2 seconds (ingame time for switching to grenade), Script starts to hold down r2 (throw /Cook grenade) until I Release mouse Button (then Releases r2).
I could only achieve this until now by binding the mouse Button to an unused Controller Button and then srt check active to this one, but on the New Script there is no unused controller Button.
Best Regards
I have troubles with scripting check actives on keyboard/mouse Inputs.
I did it with binding the mouse Button to a unused Controller input, because check active on mouse directly didn't work.
What is a good way to make check actives with mouse/keyboard Keys?
Ingame Situation : I wanna create a Script for when I Hold a mouse Button, first it press right pad ps4 once, if I Continue to hold it for about 2 seconds (ingame time for switching to grenade), Script starts to hold down r2 (throw /Cook grenade) until I Release mouse Button (then Releases r2).
I could only achieve this until now by binding the mouse Button to an unused Controller Button and then srt check active to this one, but on the New Script there is no unused controller Button.
Best Regards
-
A1rookie - Staff Sergeant
- Posts: 13
- Joined: Mon Sep 10, 2018 5:26 pm
Re: Check active with KM
- Code: Select all
#include <mouse.gph>
#include <ps4.gph>
#define MOUSE_BUTTON MBUTTON_3 /* Middle Mouse Button */
bool bGrenade;
main {
bool mbutton_state;
if(mouse_status(MOUSE_BUTTON)){
if(!mbutton_state) mbutton_state = 1, combo_restart(cGrenade);
if(bGrenade) set_val(PS4_R2, 100);
} else mbutton_state = bGrenade = FALSE;
}
combo cGrenade {
set_val(PS4_RIGHT , 100);
wait(125);
wait(2000);
bGrenade = TRUE;
}
I guess this would work, Just define what mouse button your planning to use.
Its set to the Middle Mouse button in the script. You can change it to what ever mouse button you wish though.
-
Sillyasskid - Captain
- Posts: 574
- Joined: Sat May 14, 2016 3:07 am
Re: Check active with KM
Hi sillyasskid, thank you very much, that works perfectly.
Could you please add to press triangle once, after releasing R2, to switch back to Normal weapon? I tried to Do it but it's not working very well.
Best Regards
Could you please add to press triangle once, after releasing R2, to switch back to Normal weapon? I tried to Do it but it's not working very well.
Best Regards
-
A1rookie - Staff Sergeant
- Posts: 13
- Joined: Mon Sep 10, 2018 5:26 pm
Re: Check active with KM
- Code: Select all
#include <mouse.gph>
#include <ps4.gph>
#define MOUSE_BUTTON MBUTTON_3 /* Middle Mouse Button */
bool bGrenade;
main {
bool mbutton_state, bTriangle_state;
if(mouse_status(MOUSE_BUTTON)){
if(!mbutton_state) mbutton_state = 1, combo_restart(cGrenade);
if(bGrenade) bTriangle_state = 1, set_val(PS4_R2, 100);
} else mbutton_state = bGrenade = FALSE;
if(!bGrenade && bTriangle_state) {
combo_run(cTriangle);
bTriangle_state = FALSE;
}
}
combo cTriangle {
wait(200);
set_val(PS4_TRIANGLE, 100);
wait(100);
}
combo cGrenade {
set_val(PS4_RIGHT , 100);
wait(125);
wait(2000);
bGrenade = TRUE;
}
-
Sillyasskid - Captain
- Posts: 574
- Joined: Sat May 14, 2016 3:07 am
Re: Check active with KM
You are a Genius. Thank you mate, perfect
-
A1rookie - Staff Sergeant
- Posts: 13
- Joined: Mon Sep 10, 2018 5:26 pm
5 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 232 guests