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
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(){
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) {
if(event_release(MOVE) && get_ptime(MOVE) < 250) {
walkdoubleclick_flag = 125;
}
}
else if(walkdoubleclick_flag > 0) {
if(event_press(MOVE)) {
walkdoubleclick_flag = -1;
}
else {
walkdoubleclick_flag = walkdoubleclick_flag - get_rtime();
if(walkdoubleclick_flag < 0) walkdoubleclick_flag = 0;
}
}
else if(walkdoubleclick_flag == -1) {
changeState(MOVE);
walkdoubleclick_flag = 0;
}
}
function wasRunDCed(RUN){
if(rundoubleclick_flag == 0) {
if(event_release(RUN) && get_ptime(RUN) < 250) {
rundoubleclick_flag = 125;
}
}
else if(rundoubleclick_flag > 0) {
if(event_press(RUN)) {
rundoubleclick_flag = -1;
}
else {
rundoubleclick_flag = rundoubleclick_flag - get_rtime();
if(rundoubleclick_flag < 0) rundoubleclick_flag = 0;
}
}
else if(rundoubleclick_flag == -1) {
changeState(RUN);
rundoubleclick_flag = 0;
}
}
function wasGripDCed(GRIP){
if(gripdoubleclick_flag == 0) {
if(event_release(GRIP) && get_ptime(GRIP) < 250) {
gripdoubleclick_flag = 125;
}
}
else if(gripdoubleclick_flag > 0) {
if(event_press(GRIP)) {
gripdoubleclick_flag = -1;
}
else {
gripdoubleclick_flag = gripdoubleclick_flag - get_rtime();
if(gripdoubleclick_flag < 0) gripdoubleclick_flag = 0;
}
}
else if(gripdoubleclick_flag == -1) {
changeState(GRIP);
gripdoubleclick_flag = 0;
}
}
function changeState(IDENT){
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))
{
set_val(PS3_LX, LX);
set_val(PS3_LY, LY);
}
}
function walk(LX, LY){
if ((LX != 0) || (LY != 0))
{
set_val(PS3_LX, LX/2);
set_val(PS3_LY, LY/2);
}
}