Re: The Last Of Us

GPC2 script programming for Titan Two. Code examples, questions, requests.

Re: The Last Of Us

Postby Jonathan Campos » Wed Apr 17, 2019 10:21 pm

Oi tem como corrigir esse script pra mim, porfavor?

Code: Select all
// GPC Online Library
// thelastofus.gpc
//                                        Made by JewFire aka JewishLuck
//                     Thanks to Baby Cham for helping me put this together and fixing a few things.
//                                   Tested With TLOU-Remastered and PS4 Controller// colorled(0,0,0,0); // Off / No LED light
// colorled(1,0,0,0); // Dim Blue
// colorled(0,1,0,0); // Dim Red
// colorled(0,0,1,0); // Dim Lime/Green
// colorled(0,0,0,1); // Dim Fuchsia/Pink
// colorled(1,0,1,0); // Dim SkyBlue
// colorled(0,1,1,0); // Dim Yellow
// colorled(1,1,1,1); // Dim White
// colorled(2,0,0,0); // Blue 
// colorled(0,2,0,0); // Red
// colorled(0,0,2,0); // Lime/Green
// colorled(0,0,0,2); // Fuchsia/Pink
// colorled(2,0,2,0); // SkyBlue
// colorled(0,2,2,0); // Yellow
// colorled(2,2,2,2); // White
// colorled(3,0,0,0); // Bright Blue
// colorled(0,3,0,0); // Bright Red
// colorled(0,0,3,0); // Bright Lime/Green
// colorled(0,0,0,3); // Bright Fuchsia/Pink
// colorled(3,0,3,0); // Bright SkyBlue
// colorled(0,3,3,0); // Bright Yellow
// colorled(3,3,3,3); // Bright white
// ColorLed (1) Dim light
// ColorLed (2) Normal/Medium
// ColorLed (3) Bright light
 
//DECLARARATIONS
// Script based completely on "CM Tutorial 1" by KittyDawn - many thanks.
 
 
remap PS4_L2 -> PS4_L1;
remap PS4_L1 -> PS4_L2;
remap PS4_R2 -> PS4_R1;
remap PS4_R1 -> PS4_R2;
 
 //
define ANTI_RECOIL = 30;       //change "0" to compensate vertical recoil (0 - 100)---------------------------------------------------------------------------------------------------------------------------------------------
define SHOOT_BUTTON      = PS4_R2;
define RAPIDFIRE_BUTTON = PS4_L2;
define RATE_OF_FIRE       = 25; // Range: 1 to 25 RPS (Round/s)
define AUTOSPOT_BUTTON  = PS4_L2;
define SPOT_BUTTON      =PS4_R3;
define turbofirespeed=60;   //Value in milliseconds; higher value = slower fire, slower value = faster fire.
 
define turbobutton=3;       //Rapid Fire on R2 only.
 
//VARIABLES
//--------------------------------------------------------------
//             *DO NOT EDIT/DELETE THIS SECTION*
int hold_time;
int rest_time;
int Attack                   = FALSE;
 
int Timeout_Melee            = 0;
int DbleClick_Square         = 0;
 
//INITIALIZATION - init
//--------------------------------------------------------------
init {
     hold_time = 20 / RATE_OF_FIRE;
     rest_time = hold_time - 20;
     if(rest_time < 0) rest_time = 0;
}
 
//MAIN BLOCK RUTINES
//--------------------------------------------------------------
 
main {
 
    // COLOR INDICATION FOR the RAPID FIRE ON / OFF
    if(get_val(RAPIDFIRE_BUTTON) && get_val(SHOOT_BUTTON)) {
        colorled(0,0,1,0)// OFF (Dim Lime/Green) *you can edit here*
        colorled(3,3,3,3); // (White) *you can edit here*
        combo_run(RapidFire);
    } else if(combo_running(RapidFire)) {
        combo_stop(RapidFire);
        reset_leds(); }
 
    // COLOR INDICATION FOR the RAPID SPOT ON / OFF
    if(get_val(RAPIDFIRE_BUTTON)) {
        combo_run(RapidSpot);
    } else if(combo_running(RapidSpot)) {
        combo_stop(RapidSpot);
        reset_leds(); }
 
  // Double click Square to turn off/on Melee.
    if(DbleClick_Square > 0) DbleClick_Square = DbleClick_Square - get_rtime();
    if(event_press(PS4_SQUARE) && DbleClick_Square <= 0) {
        DbleClick_Square = 160; }
        else if(event_press(PS4_SQUARE) && DbleClick_Square > 0) {
        Attack = !Attack;
        Timeout_Melee = 0;
    }
    if(Attack) {
        set_val(TRACE_1, Timeout_Melee);
        Timeout_Melee = Timeout_Melee + get_rtime();
        if(Timeout_Melee <= 160) combo_run(Brawl);
        else combo_run(StrongAttack);
    } else if(combo_running(Brawl)) {
        combo_stop(Brawl);
        reset_leds(); }
 
   // Rapid fire on Square button.
    if(get_val(PS4_SQUARE)) { combo_run(Action); }
    else if(combo_running(Action)) { combo_stop(Action); }
}
//COMBO BLOCKS
//--------------------------------------------------------------
combo RapidFire {
    set_val(SHOOT_BUTTON, 100);
    wait(hold_time);
    set_val(SHOOT_BUTTON, 0);
    wait(rest_time);
    set_val(SHOOT_BUTTON, 0);
}
 
combo RapidSpot {
    set_val(SPOT_BUTTON, 100);
    wait(hold_time);
    set_val(SPOT_BUTTON, 0);
    wait(rest_time);
    set_val(SPOT_BUTTON, 0);
}
 
combo Brawl {
    set_val(PS4_SQUARE, 100);
    set_led(LED_4, 2);
    wait(80);
    set_val(PS4_SQUARE, 0);
    set_led(LED_2, 0);
    wait(60);
    set_val(PS4_SQUARE, 0);
    set_led(LED_4, 0);
}   
 
combo StrongAttack {
    set_val(PS4_TRIANGLE, 100);
    wait(100);
    set_val(PS4_TRIANGLE,0);
    Timeout_Melee = 0;
}
 
combo Action {
    set_val(PS4_SQUARE, 100);
    wait(40);
    set_val(PS4_SQUARE, 0);
    wait(20);
    set_val(PS4_SQUARE, 0);
}
 
// COLOR LED INDICATION for PS4 *NO NEED TO EDIT BELOW*
//--------------------------------------------------------------
function colorled(a,b,c,d) {
set_led(LED_1,a);
set_led(LED_2,b);
set_led(LED_3,c);
set_led(LED_4,d);
{
User avatar
Jonathan Campos
Corporal
Corporal
 
Posts: 4
Joined: Tue Feb 19, 2019 10:09 pm

Re: Re: The Last Of Us

Postby Buffy » Fri Apr 19, 2019 7:23 pm

Code: Select all
 
#pragma METAINFO("thelastofus.gpc", 1, 0, "Buffy's GPC Converter v0.24")
#include <titanone.gph>
 
 
// GPC Online Library
// thelastofus.gpc
// Made by JewFire aka JewishLuck
// Thanks to Baby Cham for helping me put this together and fixing a few things.
// Tested With TLOU-Remastered and PS4 Controller// colorled(0,0,0,0); // Off / No LED light
// colorled(1,0,0,0); // Dim Blue
// colorled(0,1,0,0); // Dim Red
// colorled(0,0,1,0); // Dim Lime/Green
// colorled(0,0,0,1); // Dim Fuchsia/Pink
// colorled(1,0,1,0); // Dim SkyBlue
// colorled(0,1,1,0); // Dim Yellow
// colorled(1,1,1,1); // Dim White
// colorled(2,0,0,0); // Blue
// colorled(0,2,0,0); // Red
// colorled(0,0,2,0); // Lime/Green
// colorled(0,0,0,2); // Fuchsia/Pink
// colorled(2,0,2,0); // SkyBlue
// colorled(0,2,2,0); // Yellow
// colorled(2,2,2,2); // White
// colorled(3,0,0,0); // Bright Blue
// colorled(0,3,0,0); // Bright Red
// colorled(0,0,3,0); // Bright Lime/Green
// colorled(0,0,0,3); // Bright Fuchsia/Pink
// colorled(3,0,3,0); // Bright SkyBlue
// colorled(0,3,3,0); // Bright Yellow
// colorled(3,3,3,3); // Bright white
// ColorLed (1) Dim light
// ColorLed (2) Normal/Medium
// ColorLed (3) Bright light
//DECLARARATIONS
// Script based completely on "CM Tutorial 1" by KittyDawn - many thanks.
//
//change "0" to compensate vertical recoil (0 - 100)---------------------------------------------------------------------------------------------------------------------------------------------
// Range: 1 to 25 RPS (Round/s)
//Value in milliseconds; higher value = slower fire, slower value = faster fire.
//Rapid Fire on R2 only.
//VARIABLES
//--------------------------------------------------------------
// *DO NOT EDIT/DELETE THIS SECTION*
//INITIALIZATION - init
//--------------------------------------------------------------
//MAIN BLOCK RUTINES
//--------------------------------------------------------------
// COLOR INDICATION FOR the RAPID FIRE ON / OFF
// OFF (Dim Lime/Green) *you can edit here*
// (White) *you can edit here*
// COLOR INDICATION FOR the RAPID SPOT ON / OFF
// Double click Square to turn off/on Melee.
// Rapid fire on Square button.
//COMBO BLOCKS
//--------------------------------------------------------------
// COLOR LED INDICATION for PS4 *NO NEED TO EDIT BELOW*
//--------------------------------------------------------------
 
 
 
 
define ANTI_RECOIL = 30;
define SHOOT_BUTTON = PS4_R2;
define RAPIDFIRE_BUTTON = PS4_L2;
define RATE_OF_FIRE = 25;
define AUTOSPOT_BUTTON = PS4_L2;
define SPOT_BUTTON = PS4_R3;
define turbofirespeed = 60;
define turbobutton = 3;
 
remap PS4_L2 -> PS4_L1;
remap PS4_L1 -> PS4_L2;
remap PS4_R2 -> PS4_R1;
remap PS4_R1 -> PS4_R2;
 
int hold_time;
int rest_time;
int Attack = FALSE;
int Timeout_Melee = 0;
int DbleClick_Square = 0;
 
init {
    hold_time = 20 / RATE_OF_FIRE;
    rest_time = hold_time - 20;
    if (rest_time < 0) rest_time = 0;
}
 
 
main {
    if (get_val(RAPIDFIRE_BUTTON) && get_val(SHOOT_BUTTON)) {
        f_colorled(0, 0, 1, 0);
        f_colorled(3, 3, 3, 3);
        combo_run(c_RapidFire);
    }
    else if (combo_running(c_RapidFire)) {
        combo_stop(c_RapidFire);
        reset_leds();
    }
    if (get_val(RAPIDFIRE_BUTTON)) {
        combo_run(c_RapidSpot);
    }
    else if (combo_running(c_RapidSpot)) {
        combo_stop(c_RapidSpot);
        reset_leds();
    }
    if (DbleClick_Square > 0) DbleClick_Square = DbleClick_Square - get_rtime();
    if (event_press(PS4_SQUARE) && DbleClick_Square <= 0) {
        DbleClick_Square = 160;
    }
    else if (event_press(PS4_SQUARE) && DbleClick_Square > 0) {
        Attack =! Attack;
        Timeout_Melee = 0;
    }
    if (Attack) {
        set_val(TRACE_1, Timeout_Melee);
        Timeout_Melee = Timeout_Melee + get_rtime();
        if (Timeout_Melee <= 160) combo_run(c_Brawl);
        else  combo_run(c_StrongAttack);
    }
    else if (combo_running(c_Brawl)) {
        combo_stop(c_Brawl);
        reset_leds();
    }
    if (get_val(PS4_SQUARE)) {
        combo_run(c_Action);
    }
    else if (combo_running(c_Action)) {
        combo_stop(c_Action);
    }
}
 
 
combo c_RapidFire {
    set_val(SHOOT_BUTTON, 100);
    wait(hold_time);
    set_val(SHOOT_BUTTON, 0);
    wait(rest_time);
    set_val(SHOOT_BUTTON, 0);
}
 
combo c_RapidSpot {
    set_val(SPOT_BUTTON, 100);
    wait(hold_time);
    set_val(SPOT_BUTTON, 0);
    wait(rest_time);
    set_val(SPOT_BUTTON, 0);
}
 
combo c_Brawl {
    set_val(PS4_SQUARE, 100);
    set_led(LED_4, 2);
    wait(80);
    set_val(PS4_SQUARE, 0);
    set_led(LED_2, 0);
    wait(60);
    set_val(PS4_SQUARE, 0);
    set_led(LED_4, 0);
}
 
combo c_StrongAttack {
    set_val(PS4_TRIANGLE, 100);
    wait(100);
    set_val(PS4_TRIANGLE, 0);
    Timeout_Melee = 0;
}
 
combo c_Action {
    set_val(PS4_SQUARE, 100);
    wait(40);
    set_val(PS4_SQUARE, 0);
    wait(20);
    set_val(PS4_SQUARE, 0);
}
 
 
function f_colorled(a, b, c, d) {
    set_led(LED_1, a);
    set_led(LED_2, b);
    set_led(LED_3, c);
    set_led(LED_4, d);
}
 
ConsoleTuner Support Team || Discord || Custom Scripts
User avatar
Buffy
Lieutenant
Lieutenant
 
Posts: 422
Joined: Wed Jul 20, 2016 5:23 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 97 guests