Metal Gear Solid 3 HD with KB/M

Titan One general support. Questions, firmware update, feature request.

Metal Gear Solid 3 HD with KB/M

Postby atarumoroboshi18 » Thu Sep 11, 2014 1:42 am

I may be a masochist...

Metal Gear Solid 3 has a notoriously complicated control scheme involve pressure sensitivity on a bunch of buttons such as light taps for not killing guards while CQCing them or releasing the trigger of your gun ever so gently so as to not fire it. I've decided to translate all of these complicated movements into a useable Keyboard and Mouse setup...and my script is getting LONG. I'm trying to make sure that everything works as good as possible and using only ONE SET OF MOVEMENT KEYS PERIOD! So you can use WSAD and mix it with the Caps lock key and the Left shift to go into Sneaking, Running, or Walking movements almost effortlessly. I'm also trying to figure out how to ease off the trigger of the gun so I don't fire it, this way you can get behind guards and hold them up without firing your weapon, but this is proving tricky. If anyone's interested in seeing what I've got so far, then by all means post on this thread. I'm probably going to also do Peace Walker HD as well. We'll see.
User avatar
atarumoroboshi18
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Sun Aug 31, 2014 9:55 pm

Re: Metal Gear Solid 3 HD with KB/M

Postby J2Kbr » Thu Sep 11, 2014 10:31 am

This sounds really awesome. Sure we are interested in see your progress on that!! :joia:
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 18134
Joined: Tue Mar 18, 2014 1:39 pm

Re: Metal Gear Solid 3 HD with KB/M

Postby atarumoroboshi18 » Fri Sep 12, 2014 2:33 am

Alright, I'm still heavily into tweaking it. The movement controls are working wonderfully. Just map the WSAD keys to the Left Analog stick and then you can use Caps Lock and Left Shift to shift your movement.

Double clicking either of those buttons keeps you in that movement state and pressing either of those buttons while already in a movement state will switch you to the higher or lower speed state. So, you hold W and double click Caps Lock and that let's you stay running, then hold Caps Lock down and that will set you to walking, conversely if you hold Left Shift, that will send you into sneaking. It will also happen in the reverse, double click Left Shift to stay walking and if you hold Left Shift again it will send you into Sneaking and holding Caps Lock will send you into running. Pretty complicated on paper, but it really does work quite intuitively.

Movements essentially done, but then comes the real problem...Sensitivity of the Weapon, CQC, and other buttons. Going to need to find a way to Lower and Raise the sensitivity of these buttons using a pair of keystrokes or even better, the mouse wheel. If you know of a method to shift sensitivity consistently, then I would love to hear it. Anyway, here is both my current Script and Layout at the bottom, enjoy.

Code: Select all
/* *
* GPC SCRIPT
*
*  GPC is a scripting language with C-like syntax.
*  To learn more access GPC Language Reference on Help menu.
* *********************************************************** */


define WALKBUTTON = PS3_ACCZ;
define RUNBUTTON = PS3_ACCY;
define GRIPBUTTON = PS3_GYRO;
define CQC = PS3_CIRCLE;
define FIRE = PS3_SQUARE;
define INTERROGATE = PS3_L3;
define XAXIS = PS3_LX;
define YAXIS = PS3_LY;
define UP = PS3_UP;
define DOWN = PS3_DOWN;
define LEFT = PS3_LEFT;
define RIGHT = PS3_RIGHT;
int LX = 0;
int LY = 0;
int WALKSTATE = FALSE;
int RUNSTATE = FALSE;
int GRIPSTATE = FALSE;
int walkdoubleclick_flag = 0;
int gripdoubleclick_flag = 0;
int rundoubleclick_flag = 0;

main {

   

moveToggle();

gripToggle();

}


function moveToggle(){
    //X and Y Axis for the Left Analog stick for the PS3.
    LX = get_val(PS3_LX);
    LY = get_val(PS3_LY);
    wasWalkDCed(WALKBUTTON);
    wasRunDCed(RUNBUTTON);


    if(!RUNSTATE && !WALKSTATE){
        if(get_val(WALKBUTTON) != 0)
            walk(LX,LY);
        else if(get_val(RUNBUTTON) != 0)
            run(LX,LY);
        else
            sneak(LX,LY);
    }
    else if (RUNSTATE && !WALKSTATE){
        if(get_val(WALKBUTTON) != 0)
            sneak(LX,LY);
        else if(get_val(RUNBUTTON) != 0)
            walk(LX,LY);
        else
            run(LX,LY);
    }
    else if (!RUNSTATE && WALKSTATE){
        if(get_val(WALKBUTTON) != 0)
            sneak(LX,LY);
        else if(get_val(RUNBUTTON) != 0)
            run(LX,LY);
        else
            walk(LX,LY);
    }



}

function gripToggle(){

    wasGripDCed(GRIPBUTTON);

    if((get_val(GRIPBUTTON) != 0) || (GRIPSTATE)){
        if(get_val(CQC) != 0)
            set_val(CQC, 100);
        if(get_val(FIRE) != 0)
            set_val(FIRE, 100);
        if(get_val(INTERROGATE) != 0)
            set_val(INTERROGATE, 100);


    }
    else if((get_val(GRIPBUTTON) == 0) || (!GRIPSTATE)){

        if(get_val(CQC) != 0)
            set_val(CQC, 40);
        if(get_val(FIRE) != 0)
            set_val(FIRE, 40);
        if(get_val(INTERROGATE) != 0)
            set_val(INTERROGATE, 40);
    }

}


function wasWalkDCed(MOVE){

   if(walkdoubleclick_flag == 0) {
        // The first click should be less than 250ms
        if(event_release(MOVE) && get_ptime(MOVE) < 250) {
            // The time to the second click should be less than 125ms
            walkdoubleclick_flag = 125;
        }
    }
    // Detect the second click with in the limit time set in 'doubleclick_flag'
    else if(walkdoubleclick_flag > 0) {
        // Ok, second click detected
        if(event_press(MOVE)) {
            // Set the flag to -1, meaning double click happened
            walkdoubleclick_flag = -1;
        }
        // Decrement the timeout to the second click,
        // If reach 0, go back detect the first click above
        else {
            walkdoubleclick_flag = walkdoubleclick_flag - get_rtime();
            if(walkdoubleclick_flag < 0) walkdoubleclick_flag = 0;
        }
    }
    // Ok, double click detect
    else if(walkdoubleclick_flag == -1) {
       
        changeState(MOVE);
        // Go back detect the first click
        walkdoubleclick_flag = 0;
    }

}

function wasRunDCed(RUN){

   if(rundoubleclick_flag == 0) {
        // The first click should be less than 250ms
        if(event_release(RUN) && get_ptime(RUN) < 250) {
            // The time to the second click should be less than 125ms
            rundoubleclick_flag = 125;
        }
    }
    // Detect the second click with in the limit time set in 'doubleclick_flag'
    else if(rundoubleclick_flag > 0) {
        // Ok, second click detected
        if(event_press(RUN)) {
            // Set the flag to -1, meaning double click happened
            rundoubleclick_flag = -1;
        }
        // Decrement the timeout to the second click,
        // If reach 0, go back detect the first click above
        else {
            rundoubleclick_flag = rundoubleclick_flag - get_rtime();
            if(rundoubleclick_flag < 0) rundoubleclick_flag = 0;
        }
    }
    // Ok, double click detect
    else if(rundoubleclick_flag == -1) {
       
        changeState(RUN);
        // Go back detect the first click
        rundoubleclick_flag = 0;
    }

}

function wasGripDCed(GRIP){

   if(gripdoubleclick_flag == 0) {
        // The first click should be less than 250ms
        if(event_release(GRIP) && get_ptime(GRIP) < 250) {
            // The time to the second click should be less than 125ms
            gripdoubleclick_flag = 125;
        }
    }
    // Detect the second click with in the limit time set in 'doubleclick_flag'
    else if(gripdoubleclick_flag > 0) {
        // Ok, second click detected
        if(event_press(GRIP)) {
            // Set the flag to -1, meaning double click happened
            gripdoubleclick_flag = -1;
        }
        // Decrement the timeout to the second click,
        // If reach 0, go back detect the first click above
        else {
            gripdoubleclick_flag = gripdoubleclick_flag - get_rtime();
            if(gripdoubleclick_flag < 0) gripdoubleclick_flag = 0;
        }
    }
    // Ok, double click detect
    else if(gripdoubleclick_flag == -1) {
       
        changeState(GRIP);
        // Go back detect the first click
        gripdoubleclick_flag = 0;
    }

}

//Generic function for what to do when the state has been changed, usually used for
//double-clicked buttons.
function changeState(IDENT){

    //What was the Identifier used that was double-clicked? Perform an action such
    //as setting values, change variables, etc. depending on the button.
    if (IDENT == WALKBUTTON){
        if(WALKSTATE == FALSE){
            WALKSTATE = TRUE;
            RUNSTATE = FALSE;
        }
        else if(WALKSTATE == TRUE)
            WALKSTATE = FALSE;
    }
    if (IDENT == RUNBUTTON){
        if(RUNSTATE == FALSE){
            RUNSTATE = TRUE;
            WALKSTATE = FALSE;
        }
        else if(RUNSTATE == TRUE)
            RUNSTATE = FALSE;
    }
    if (IDENT == GRIPBUTTON){
        if(GRIPSTATE == FALSE)
            GRIPSTATE = TRUE;
        else if(GRIPSTATE == TRUE)
            GRIPSTATE = FALSE;
    }
}

function sneak(LX, LY){

    if (LX > 0){
        set_val(RIGHT, 100);
        set_val(PS3_LX, 0);
    }
    else if (LX < 0){
        set_val(LEFT, 100);
        set_val(PS3_LX, 0);
    }
    if (LY > 0){
        set_val(DOWN, 100);
        set_val(PS3_LY, 0);
    }
    else if (LY < 0){
        set_val(UP, 100);
        set_val(PS3_LY, 0);
    }
}

function run(LX, LY){
        if ((LX != 0) || (LY != 0))
        {
            //Run
            set_val(PS3_LX, LX);
            set_val(PS3_LY, LY);
        }
}

function walk(LX, LY){
        if ((LX != 0) || (LY != 0))
        {
            //Run
            set_val(PS3_LX, LX/2);
            set_val(PS3_LY, LY/2);
        }
}
Attachments
Metal Gear Solid 3 PS3.glf
Metal Gear Solid 3 HD Control layout for KB/M.
(7.5 KiB) Downloaded 686 times
User avatar
atarumoroboshi18
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Sun Aug 31, 2014 9:55 pm

Re: Metal Gear Solid 3 HD with KB/M

Postby J2Kbr » Fri Sep 12, 2014 12:25 pm

That is a really cool script. congratulations!!! :joia: thanks for sharing.

atarumoroboshi18 wrote:Movements essentially done, but then comes the real problem...Sensitivity of the Weapon, CQC, and other buttons. Going to need to find a way to Lower and Raise the sensitivity of these buttons using a pair of keystrokes or even better, the mouse wheel. If you know of a method to shift sensitivity consistently, then I would love to hear it.

What came to my mind is have a variable that you increment/decrement as the mouse wheel goes up or down. Then use the variable as a parameter for the sensitivity adjustment.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 18134
Joined: Tue Mar 18, 2014 1:39 pm

Re: Metal Gear Solid 3 HD with KB/M

Postby atarumoroboshi18 » Sat Sep 13, 2014 5:44 am

Support J2K wrote:That is a really cool script. congratulations!!! :joia: thanks for sharing.

atarumoroboshi18 wrote:Movements essentially done, but then comes the real problem...Sensitivity of the Weapon, CQC, and other buttons. Going to need to find a way to Lower and Raise the sensitivity of these buttons using a pair of keystrokes or even better, the mouse wheel. If you know of a method to shift sensitivity consistently, then I would love to hear it.

What came to my mind is have a variable that you increment/decrement as the mouse wheel goes up or down. Then use the variable as a parameter for the sensitivity adjustment.


Alright, tried a bunch of different ways to do an increment and none of them worked, if I get this working I can do some big changes to the whole script. What would be the most efficient method to do decrement/increment a variable that will stay incremented/decremented?
User avatar
atarumoroboshi18
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Sun Aug 31, 2014 9:55 pm

Re: Metal Gear Solid 3 HD with KB/M

Postby atarumoroboshi18 » Sun Sep 14, 2014 3:55 am

Turns out the increment and decrement was a simple function:
Code: Select all
function changeSens(currNumber, addNumber){
    return currNumber + addNumber;
}


Whatever the original number is you put it into the currNumber, then put the number you want to add to it. Easy to add or subtract and it keeps your number throughout. Going to figure out how to tweak, since it appears that the gun trigger release doesn't work even with this new reliable version of Sensitivity adjustment.
User avatar
atarumoroboshi18
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Sun Aug 31, 2014 9:55 pm


Return to Titan One Device

Who is online

Users browsing this forum: No registered users and 5 guests