Script confusion, how does it know?

GPC1 script programming for Titan One. Code examples, questions, requests.

Script confusion, how does it know?

Postby Ctuna2000 » Sat Jan 15, 2022 11:16 pm

This code here. Basically, if you remember Bo3 Zombies, when you load into the map, your character spawns in a random position each time. This script makes your character run to a spot, then shoot at specific things. Somehow this code does the script perfectly, even though it spawns differently every time?

How does it do this? What part of the code does this? I thought scripts can't see what's going on, on the screen?

Thanks.


Code: Select all
// GPC Online Library
// black_ops_3_zombies_-_boost_-_rapid_xp!.gpc
 
/*
 
 
Menu_Navigation/Men_Nav_With_HR_Trimes!:
 
Setup a dynamic combo using arrays. with hold and release times
 
Clock:
 
Adds the functions:
InSecs - Sets a varible too a time in the future
SecsPassed - Tells you if one of those set varible times has passed
Counts mili secs,secs,mins and hours
 
*/

 
 
                        //  [ NONE PS4 PLAYERS ]
// !!!!!!!!! HERE ARE THE SETTINGS TO AJUST YOUR AIM !!!!!!
 
int AIM_DOWN_AJUST=200; // How much to lower aim before the shooting cycle starts
int AIM_LEFT_AJUST=800; //recently changed from 900 // HOW LONG TO AIM LEFT FOR WHEN FINALISING AIM BEFORE STARTING THE SHOOT CYCLE
 
int shoot_aim_width_d=14; // How much to press right aim as we shoot ( as we pull left trigger ) ( edge right a little each shot )
int shoot_aim_height=15; //  How much to lower aim with each shot
 
int shoot_width=14; // How much to press right aim   (as we shoot) ( edge right a little each shot )
 
// !!!!!!!!! HERE ARE THE SETTINGS TO AJUST YOUR AIM !!!!!! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
 
int scoots_required=2; // How many scoots after the guy should be dead (after frags )
int fine_tune_mode=FALSE;
 
int ld_1,ld_2,ld_3,ld_4,ld_5;
 
//--- [ Clock ] - / - (  VARS )  ------! [BELOW]
int msecs=0;
int secs=0;
int mins=0;
int hours=0;
int days=0;
int math_var=0;
//--- [ Clock ] - / - (  VARS )  ------! [ABOVE]
 
int shoot_aim_width=14; // is set as shoot_aim_width_d for the start of each cycle
int stage=0;
int SKIP_SHOOTING=FALSE;
int cutscene_timer=-1;
int shots_called=0;
int restart_time=-1;
int cro_mods_disabled=FALSE;
int restart_pause_time=-1;
int CUT_PASSED=FALSE;
int tval=0;
int scoots=0// How may scoots have we done?
//int scoot_opens_doors=0; //100;
init {
 
 if(get_console() == PIO_PS4){
 
                 //  [ PS4 PLAYERS ]
// !!!!!!!!! HERE ARE THE SETTINGS TO AJUST YOUR AIM !!!!!!
 
//VALUES FROM: Satanicat
AIM_DOWN_AJUST=500; // How much to lower aim before the shooting cycle starts
AIM_LEFT_AJUST=725; //recently changed from 900 // HOW LONG TO AIM LEFT FOR WHEN FINALISING AIM BEFORE STARTING THE SHOOT CYCLE
 
shoot_aim_width_d=16; // How much to press right aim as we shoot ( edge right a little each shot )
shoot_aim_height=15; //  How much to lower aim with each shot
 
shoot_width=16; // How much to press right aim   (as we shoot) ( edge right a little each shot )
// !!!!!!!!! HERE ARE THE SETTINGS TO AJUST YOUR AIM !!!!!! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
    }
shoot_aim_width=shoot_aim_width_d;
 
ld_1=AIM_DOWN_AJUST; // these ld_ are used to set the values back to how they are in the script
ld_2=AIM_LEFT_AJUST;
ld_3=shoot_aim_width_d;
ld_4=shoot_aim_height;
ld_5=shoot_width;
LoadAimTune();
}
main {
set_val(TRACE_1,AIM_DOWN_AJUST / 10);
set_val(TRACE_2,AIM_LEFT_AJUST / 10);
set_val(TRACE_3,shoot_aim_width_d);
//set_val(TRACE_4,shoot_aim_height);
//set_val(TRACE_5,shoot_width);
//--- [ Clock ] - / - (  Main_NoDisable )  ------! [BELOW]
    msecs = msecs + get_rtime();
    if(msecs >= 1000) {
        msecs = msecs - 1000;
        secs = secs + 1;
        if(secs >= 60) {
            secs = secs - 60;
            mins = mins + 1;
            if(mins >= 60) {
                mins = mins - 60;
                hours = hours + 1;
                if(hours >= 24) {
                    hours = hours - 24;
                    days = days + 1;
                }
            }
        }
    }
//--- [ Clock ] - / - (  Main_NoDisable   )  ------! [ABOVE]
 
if(!cro_mods_disabled){
 
if(fine_tune_mode) {
if(!combo_running(heart)) {
combo_run(heart);
}
if(event_release(XB1_RB)) {
shoot_aim_width_d=shoot_aim_width_d + 1;
SaveAimTune();
} else if(event_release(XB1_LB)) {
shoot_aim_width_d=shoot_aim_width_d - 1;
SaveAimTune();
}
set_val(XB1_LB,0);
set_val(XB1_RB,0);
} else {
if(combo_running(heart)) {
combo_stop(heart);
}
 block_rumble();
}
 
if(get_val(XB1_XBOX) ) {
set_val(XB1_XBOX,0);
} else if (event_release(XB1_XBOX) ) {
if(get_ptime(XB1_XBOX) >= 700 ) {
set_pvar(SPVAR_1, ld_1); // <<< WE SAVED SOMETHING
set_pvar(SPVAR_2, ld_2); // <<< WE SAVED SOMETHING
set_pvar(SPVAR_3, ld_3); // <<< WE SAVED SOMETHING
set_pvar(SPVAR_4, ld_4); // <<< WE SAVED SOMETHING
set_pvar(SPVAR_5, ld_5); // <<< WE SAVED SOMETHING
set_pvar(SPVAR_6, 93); // <<< MARK AS NOT SAVED
combo_run(heart_stop);
ScriptReload();
} else {
fine_tune_mode=!fine_tune_mode;
if(fine_tune_mode) {
LoadAimTune();
}
}
}
if(event_release(XB1_DOWN) ) {
 
if(fine_tune_mode==FALSE) {
ScriptReload();
//combo_run(DO_AIM);
//stage=1;
restart_pause_time=InSecs(1);
stage=4;
} else {
AIM_DOWN_AJUST=AIM_DOWN_AJUST + 10;
SaveAimTune();
}
 
}
 
if(event_release(XB1_UP) && fine_tune_mode ) {
 
AIM_DOWN_AJUST=AIM_DOWN_AJUST - 10;
SaveAimTune();
} else  if ( event_release(XB1_UP) ){
LoadAimTune();
 
restart_pause_time=InSecs(1);
stage=4;
//combo_run(DO_AIM);
//stage=1;
}
 
 
if(event_release(XB1_RIGHT)  && fine_tune_mode ) {
AIM_LEFT_AJUST=AIM_LEFT_AJUST - 10;
SaveAimTune();
} else if(event_release(XB1_LEFT)  && fine_tune_mode ) {
AIM_LEFT_AJUST=AIM_LEFT_AJUST + 10;
SaveAimTune();
}
 
if(combo_running(scoot)) {
set_val(XB1_LY,-100);
}
 
if(stage==1 && !combo_running(DO_AIM) ) {
stage=2;
}
if(stage==2 && !combo_running(DO_SHOOT) ) {
stage=2;
if( shots_called >= 50) {
shoot_aim_width=0;
} else {
shoot_aim_width=shoot_aim_width_d;
}
combo_run(DO_SHOOT);
shots_called=shots_called + 1;
if(shots_called >= 85 || (SKIP_SHOOTING == TRUE && shots_called >= 10 )) {
stage=50;
shots_called=0;
}
}
if(stage==3) {
if(restart_time== -1) {
restart_time=InSecs(60);
} else {
if(SecsPassed(restart_time)) {
combo_run(restart);
stage=4;
restart_time= -1;
shots_called=0;
}
 
}
 
}
 
if(stage==4 && !combo_running(restart) && ! combo_running(open_door)) {
 
if(restart_pause_time==-1) {
 
restart_pause_time=InSecs(60);
shots_called=0;
} else if(SecsPassed(restart_pause_time)) {
combo_run(restart);
shots_called=shots_called + 1;
if(shots_called >= 15) {
stage=5;
restart_pause_time=-1;
shots_called=0;
combo_stop(restart);
}
 
}
}
 
if(stage==5) {
cutscene_timer=InSecs(60);
stage=51;
}
 
if(stage==6) {
combo_run(DO_AIM);
stage=1;
}
if(stage==51) {
if(SecsPassed(cutscene_timer)) {
if(!combo_running(PASS_CUTSCENE) && CUT_PASSED==FALSE) {
combo_run(PASS_CUTSCENE);
CUT_PASSED=TRUE;
} else if(!combo_running(PASS_CUTSCENE) && CUT_PASSED==TRUE) {
cutscene_timer=-1;
stage=6;
CUT_PASSED=FALSE;
}
 
}
}
if(stage==50) {
if(shots_called==0) {
combo_run(FRAG_AIM);
shots_called=1;
}
if(!combo_running(DO_FRAGS) && !combo_running(FRAG_AIM)) {
shots_called=shots_called + 1;
if(shots_called >= 6) { // was 6
//stage=4;
stage=60;
} else {
combo_run(DO_FRAGS);
}
}
}
if(stage==60) {
if(!combo_running(scoot) && scoots < scoots_required) {
combo_run(scoot);
scoots=scoots + 1;
} else if(scoots >= scoots_required) {
scoots=0;
combo_run(open_door);
stage=4;
}
}
 
 
}
 
set_val(XB1_DOWN,0);
set_val(XB1_UP,0);
}
 
combo heart_stop{
set_rumble(RUMBLE_LT,0);
set_rumble(RUMBLE_RT,0);
set_rumble(RUMBLE_A,20)
 wait(200);
set_rumble(RUMBLE_A,0);
 wait(100);
}
combo heart{
set_rumble(RUMBLE_RT,0);
set_rumble(RUMBLE_LT,10);
 wait(1400);
set_rumble(RUMBLE_LT,0);
set_rumble(RUMBLE_RT,10);
 wait(1400);
set_rumble(RUMBLE_LT,0);
set_rumble(RUMBLE_RT,0);
 wait(400);
}
 combo scoot{
     set_val(XB1_LS, 0);
     set_val(XB1_LY, -100);
     wait(20);
     set_val(XB1_LY, -100);
     set_val(XB1_LS, 100);
     wait(40);
     set_val(XB1_LS, 100);
     wait(300);
     set_val(XB1_LS, 100)
     set_val(XB1_B, 100);
     wait(300);
     set_val(XB1_LS, 0);
     set_val(XB1_X,0);
     wait(360);
     set_val(XB1_A, 100);
     wait(100);
 }
 
 combo open_door{
set_val(XB1_LY,-100);
wait(1500);
set_val(XB1_LY,-100);
set_val(XB1_X,100);
wait(1500)
set_val(XB1_LX,-100);
wait(1500);
set_val(XB1_RX,-100);
set_val(XB1_LY,-25);
set_val(XB1_LX,-100);
wait(400);
set_val(XB1_X,100);
set_val(XB1_LY,-100);
set_val(XB1_LS,100);
set_val(XB1_LX,100);
wait(4000);
set_val(XB1_X,100);
set_val(XB1_LY,-100);
set_val(XB1_LX,-100);
wait(3000);
set_val(XB1_RX,100);
wait(200);
set_val(XB1_X,100);
set_val(XB1_LY,-100);
set_val(XB1_LX,100);
wait(3000);
set_val(XB1_X,100);
set_val(XB1_LY,-100);
set_val(XB1_LX,-100);
wait(500);
set_val(XB1_X,100);
set_val(XB1_LY,-100);
set_val(XB1_LX,100);
wait(500);
set_val(XB1_X,100);
set_val(XB1_LY,-100);
wait(1000);
set_val(XB1_LY,-100);
set_val(XB1_LX,-100);
set_val(XB1_RB,100);
wait(4000);
/*
set_val(TRACE_4,4);
set_val(XB1_LY,-100);
set_val(XB1_RY,30);
set_val(XB1_LS,0);
set_val(XB1_X,100);
wait(3500)
set_val(TRACE_4,5);
set_val(XB1_X,0);
set_val(XB1_LS,100);
set_val(XB1_RY,50)
wait(200)
set_val(TRACE_4,6);
set_val(XB1_X,100);
wait(300)
set_val(XB1_X,0);
wait(200)
set_val(TRACE_4,7);
set_val(XB1_X,0);
set_val(XB1_RX,-25);
set_val(XB1_LX,-25);
set_val(XB1_RY,50)
wait(200)
set_val(TRACE_4,8);
set_val(XB1_X,100);
set_val(XB1_LY,-100);
set_val(XB1_RX,-50);
wait(1500)
set_val(TRACE_4,9);
set_val(XB1_LX,-100);
set_val(XB1_LY,-100)
wait(4000)
set_val(TRACE_4,10);
set_val(XB1_RX,-100);
set_val(XB1_X,100);
wait(300)
set_val(XB1_LX,100);
set_val(XB1_LY,-100);
set_val(XB1_X,100);
wait(1000);
set_val(XB1_LX,0);
set_val(XB1_RX,-60);
wait(60);
set_val(TRACE_4,11);
set_val(XB1_LY,-100);
set_val(XB1_LX,100);
set_val(XB1_RB,100);
set_val(XB1_X,100);
wait(1000)
set_val(XB1_LY,100);
set_val(XB1_LX,100);
set_val(TRACE_4,12);
wait(1000)
set_val(TRACE_4,13);
set_val(XB1_X,100);
set_val(XB1_LY,-100);
set_val(XB1_LY,100);
set_val(XB1_LX,100);
wait(4000)
*/

}
 combo A_Click{
set_val(XB1_A,100);
wait(300)
}
 combo restart{
set_val(XB1_A,100);
wait(300);
set_val(XB1_A,0);
wait(300);
 
}
 
 combo PASS_CUTSCENE{
set_val(XB1_A,100);
wait(400);
set_val(XB1_A,0);
wait(4000);
set_val(XB1_A,0);
wait(2000); // Lowerd frm 4000 in day
set_val(XB1_A,0);
wait(400);
}
 combo DO_SHOOT{
set_val(XB1_LT,100);
set_val(XB1_RX,shoot_aim_width);
set_val(XB1_RY,shoot_aim_height);
wait(20);
set_val(XB1_LT,100);
set_val(XB1_RT,100);
set_val(XB1_RX,shoot_width);
wait(30);
set_val(XB1_RT,0);
wait(100);
set_val(XB1_LT,0);
wait(70);
}
 
combo FRAG_AIM{
set_val(XB1_RY,-40);
set_val(XB1_RX,-20);
wait(700);
set_val(XB1_RY,-40);
set_val(XB1_RX,17);
wait(500);
set_val(XB1_RY,-40);
wait(1100);
}
combo DO_FRAGS{
set_val(XB1_RB,100);
set_val(XB1_LY,-40);
set_val(XB1_LX,40);
wait(3000);
set_val(XB1_RB,0);
set_val(XB1_LY,-40);
set_val(XB1_LX,-40);
//set_val(XB1_RX,-20);
wait(1000);
//set_val(XB1_RX,-30);
set_val(XB1_LX,-70);
wait(1000);
}
 combo DO_AIM{
set_val(XB1_LX,-100);
wait(500);
set_val(XB1_LX,100);
wait(160);
set_val(XB1_LT,100);
set_val(XB1_RX,20);
set_val(XB1_RY,-50);
wait(1000);
set_val(XB1_LT,100);
set_val(XB1_RX,0);
set_val(XB1_RY,-50);
wait(750);
set_val(XB1_RY,35);
tval=250 + AIM_DOWN_AJUST;
if(tval<=10){
tval=10;
}
wait(tval);
set_val(XB1_RY,0);
set_val(XB1_RX,0);
wait(60);
set_val(XB1_RX,-21);
tval=10 + AIM_LEFT_AJUST;
if(tval<=10){
tval=10;
}
wait(tval);
}
 
  function ScriptReload()
 {
AIM_DOWN_AJUST=ld_1;
AIM_LEFT_AJUST=ld_2;
shoot_aim_width_d=ld_3;
shoot_aim_height=ld_4;
shoot_width=ld_5;
 
/*
 tval = get_slot();
if(tval!=10)
{
 load_slot(tval);
}
*/

 }
 
 function SaveAimTune()
{
combo_run(heart_stop);
combo_stop(heart);
fine_tune_mode=FALSE;
 
/*
if(AIM_DOWN_AJUST <= 10) {
AIM_DOWN_AJUST=10;
}*/

 
set_pvar(SPVAR_1, AIM_DOWN_AJUST);
set_pvar(SPVAR_2, AIM_LEFT_AJUST);
 
set_pvar(SPVAR_3, shoot_aim_width_d);
set_pvar(SPVAR_4, shoot_aim_height);
 
set_pvar(SPVAR_5, shoot_width);
 
set_pvar(SPVAR_6, 38); // <<< WE SAVED SOMETHING
}
 
function LoadAimTune()
{
if( get_pvar(SPVAR_6,0, 3500, 0) == 38 ) {
 AIM_DOWN_AJUST=get_pvar(SPVAR_1,10, 3500, AIM_DOWN_AJUST);
 AIM_LEFT_AJUST=get_pvar(SPVAR_2,10, 3500, AIM_LEFT_AJUST);
 
 shoot_aim_width_d=get_pvar(SPVAR_3,0, 100, shoot_aim_width_d);
 shoot_aim_height=get_pvar(SPVAR_4,0, 100, shoot_aim_height);
 
 shoot_width=get_pvar(SPVAR_5,0, 100, shoot_aim_height);
combo_run(heart_stop);
}
}
//--- [ Clock ] - / - (  Functions )  ------! [BELOW]
 function InSecs(DesiredSecs)
 {
math_var=hours * 60;
math_var=math_var + mins;
math_var=math_var * 60;
math_var=math_var + secs;
math_var=math_var + DesiredSecs;
return math_var;
}
 function SecsPassed(DesiredSecs)
 {
math_var=hours * 60;
math_var=math_var + mins;
math_var=math_var * 60;
math_var=math_var + secs;
math_var=math_var - DesiredSecs;
if(math_var <= 0 ) {
return 0;
} else {
return 1;
}
}
//--- [ Clock ] - / - (  Functions   )  ------! [ABOVE]
 
User avatar
Ctuna2000
Sergeant Major
Sergeant Major
 
Posts: 84
Joined: Tue Mar 09, 2021 10:09 pm

Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 84 guests