fast reload script
9 posts
• Page 1 of 1
fast reload script
I'm new at writing GPC code and I'm trying to learn by making my own Mod pack for COD WW2
Does anyone have an adjustable fast reload script I can add to my pack? So far I have figured out how to drop shot, quick scope, auto run, rapid fire but I can not figure out how to do a programable YY after reloading.
Does anyone have an adjustable fast reload script I can add to my pack? So far I have figured out how to drop shot, quick scope, auto run, rapid fire but I can not figure out how to do a programable YY after reloading.
Trying to teach myself how to program these scripts even though I'm old
-
umpmanjoe - First Sergeant
- Posts: 45
- Joined: Mon May 25, 2015 1:23 am
Re: fast reload script
Very nice your are motivated in learning the scripting language for the Titan Two.
The fast reload on CoD games normally makes use of what is called "animation cancel", one way to achieve that is, after the reload command, quick swap weapons, force sprint, throw a grenade or a combination of those. I am not sure if this will work on WW2, as I didn't had time to participate of the beta. Perhaps a more experienced CoD user can give an input here.
The fast reload on CoD games normally makes use of what is called "animation cancel", one way to achieve that is, after the reload command, quick swap weapons, force sprint, throw a grenade or a combination of those. I am not sure if this will work on WW2, as I didn't had time to participate of the beta. Perhaps a more experienced CoD user can give an input here.
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: fast reload script
J2Kbr wrote:Very nice your are motivated in learning the scripting language for the Titan Two.
The fast reload on CoD games normally makes use of what is called "animation cancel", one way to achieve that is, after the reload command, quick swap weapons, force sprint, throw a grenade or a combination of those. I am not sure if this will work on WW2, as I didn't had time to participate of the beta. Perhaps a more experienced CoD user can give an input here.
The one in shooters Modzpack works for CoD WW2 so its possible. Even though I'm old (47), I like learning new things and I learn by taking things apart. I just can't find any instances of a fast reload where the code is visible. I would also like to be able to quickly change the value from a menu on the computer (similar to the way bonefisher does with the info buttons within gtuner)
Trying to teach myself how to program these scripts even though I'm old
-
umpmanjoe - First Sergeant
- Posts: 45
- Joined: Mon May 25, 2015 1:23 am
Re: fast reload script
umpmanjoe wrote:J2Kbr wrote:Very nice your are motivated in learning the scripting language for the Titan Two.
The fast reload on CoD games normally makes use of what is called "animation cancel", one way to achieve that is, after the reload command, quick swap weapons, force sprint, throw a grenade or a combination of those. I am not sure if this will work on WW2, as I didn't had time to participate of the beta. Perhaps a more experienced CoD user can give an input here.
The one in shooters Modzpack works for CoD WW2 so its possible. Even though I'm old (47), I like learning new things and I learn by taking things apart. I just can't find any instances of a fast reload where the code is visible. I would also like to be able to quickly change the value from a menu on the computer (similar to the way bonefisher does with the info buttons within gtuner)
Which one are you using in the SHOOTERS? The YY method or sprint cancel? Only thing is I would have to revisit some game to dial in because it is touchy sometimes.. My computer is down that I carry that MODzPACK to look at code and I would only be off by 10ms either way if I kicked it out is the reason I need to see in game how it plays. You can try it is wait time that it takes then Y press for wait(40) then release wait(30) and then Y press for wait(40) and just put this to run on reload press.
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: fast reload script
bonefisher wrote:Which one are you using in the SHOOTERS? The YY method or sprint cancel? Only thing is I would have to revisit some game to dial in because it is touchy sometimes.. My computer is down that I carry that MODzPACK to look at code and I would only be off by 10ms either way if I kicked it out is the reason I need to see in game how it plays. You can try it is wait time that it takes then Y press for wait(40) then release wait(30) and then Y press for wait(40) and just put this to run on reload press.
I used the YY method with time in milliseconds set to 1314 and it worked perfectly. So is this what you are talking about:
- Code: Select all
combo fast_reload
{
wait(1314);
set_val(BUTTON_14, 100.0);
wait(30);
set_val(BUTTON_14, 100.0);
wait(40);
}
what I can't figure out is how to have a menu on the info button in gtuner so I can adjust on the fly. How do I create this within the script and have the change in value reflect in the wait time
Trying to teach myself how to program these scripts even though I'm old
-
umpmanjoe - First Sergeant
- Posts: 45
- Joined: Mon May 25, 2015 1:23 am
Re: fast reload script
- Code: Select all
/*******************************************************************************
<cfgdesc>
[Click on Category for info or setting:]
color = #000060
control = info
[Quick Reload Mod]
color = #000060
shortdesc = <<<MULTILINE
Runtime Operation: Hold share/view [] + reload button [].
Activate by quick tap reload button.
Blue Led = Off
Aqua Led = On
MULTILINE
collapsible = 2
[Quick Reload MODz]
group = true
shortdesc = <font color="blue">Quick reload option.</font>
byteoffset = 23
bitsize = 1
bitoffset = 7
control = checkbox
default = 0
item = Enable quick reload
[Quick Reload Adjustable Setting]
group = true
shortdesc = <br><b><font color="blue">Quick Reload Adjustable Setting:</font></b>
byteoffset = 24
bitsize = 32
control = spinbox
default = 1200
minimum = 0
maximum = 5000
step = 1
</cfgdesc>
*******************************************************************************/
#define RELOAD_0 0
#define RELOAD_1 1
uint8 reload = 0;
uint32 fast_reload;
init
{
pmem_load();
reload = (pmem_read(23) >> 7) & 0b1;
pmem_read(24, &fast_reload);
set_reload(reload);
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
}
main {
// quick reload toggle
if(is_active(BUTTON_2)) {
set_val(BUTTON_17, 0.0);
if(event_active(BUTTON_17)) {
if(reload == RELOAD_0) set_reload(RELOAD_1);
else if(reload == RELOAD_1) set_reload(RELOAD_0);
}
}
// quick scope
switch(reload) {
case RELOAD_0: {
if(get_actual(BUTTON_17)) {
set_val(BUTTON_17, 100.0);
}
} break;
case RELOAD_1: {
if(event_release(BUTTON_17)) {
combo_run(QuickReload);
}
} break;
}
if(event_release(BUTTON_2) && time_active(BUTTON_2) < 300) {
combo_run(share_view);
}
if(event_release(BUTTON_2) && time_active(BUTTON_2) > 300) {
printf("FAST_RELOAD: %d", reload);
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
}
}
combo QuickReload
{
wait(fast_reload);
set_val(BUTTON_14, 100.0);
wait(40);
set_val(BUTTON_14, 0.0);
wait(30);
set_val(BUTTON_14, 100.0);
wait(40);
}
combo share_view
{
set_val(BUTTON_2, 100.0);
wait(200);
}
void set_reload(uint8 new_reload)
{
reload = new_reload;
// Set LED
switch(reload) {
case RELOAD_0: { // Blue LED
led_set(LED_1, 100.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
} break;
case RELOAD_1: { // AQUA LED
led_set(LED_1, 100.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 100.0, 0);
led_set(LED_4, 0.0, 0);
} break;
}
return;
}
here you go! Copy and paste everything........
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: fast reload script
bonefisher wrote:
- Code: Select all
/*******************************************************************************
<cfgdesc>
[Click on Category for info or setting:]
color = #000060
control = info
[Quick Reload Mod]
color = #000060
shortdesc = <<<MULTILINE
Runtime Operation: Hold share/view [] + reload button [].
Activate by quick tap reload button.
Blue Led = Off
Aqua Led = On
MULTILINE
collapsible = 2
[Quick Reload MODz]
group = true
shortdesc = <font color="blue">Quick reload option.</font>
byteoffset = 23
bitsize = 1
bitoffset = 7
control = checkbox
default = 0
item = Enable quick reload
[Quick Reload Adjustable Setting]
group = true
shortdesc = <br><b><font color="blue">Quick Reload Adjustable Setting:</font></b>
byteoffset = 24
bitsize = 32
control = spinbox
default = 1200
minimum = 0
maximum = 5000
step = 1
</cfgdesc>
*******************************************************************************/
#define RELOAD_0 0
#define RELOAD_1 1
uint8 reload = 0;
uint32 fast_reload;
init
{
pmem_load();
reload = (pmem_read(23) >> 7) & 0b1;
pmem_read(24, &fast_reload);
set_reload(reload);
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
}
main {
// quick reload toggle
if(is_active(BUTTON_2)) {
set_val(BUTTON_17, 0.0);
if(event_active(BUTTON_17)) {
if(reload == RELOAD_0) set_reload(RELOAD_1);
else if(reload == RELOAD_1) set_reload(RELOAD_0);
}
}
// quick scope
switch(reload) {
case RELOAD_0: {
if(get_actual(BUTTON_17)) {
set_val(BUTTON_17, 100.0);
}
} break;
case RELOAD_1: {
if(event_release(BUTTON_17)) {
combo_run(QuickReload);
}
} break;
}
if(event_release(BUTTON_2) && time_active(BUTTON_2) < 300) {
combo_run(share_view);
}
if(event_release(BUTTON_2) && time_active(BUTTON_2) > 300) {
printf("FAST_RELOAD: %d", reload);
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
}
}
combo QuickReload
{
wait(fast_reload);
set_val(BUTTON_14, 100.0);
wait(40);
set_val(BUTTON_14, 0.0);
wait(30);
set_val(BUTTON_14, 100.0);
wait(40);
}
combo share_view
{
set_val(BUTTON_2, 100.0);
wait(200);
}
void set_reload(uint8 new_reload)
{
reload = new_reload;
// Set LED
switch(reload) {
case RELOAD_0: { // Blue LED
led_set(LED_1, 100.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
} break;
case RELOAD_1: { // AQUA LED
led_set(LED_1, 100.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 100.0, 0);
led_set(LED_4, 0.0, 0);
} break;
}
return;
}
here you go! Copy and paste everything........
Thank you so much. This helps me understand a lot.
How do I remove your LED indicators so that I can use my own instead? The rest of my code has me running a combo for on and a combo for off. They are called "combo flash_on" and "combo flash_off"
Trying to teach myself how to program these scripts even though I'm old
-
umpmanjoe - First Sergeant
- Posts: 45
- Joined: Mon May 25, 2015 1:23 am
Re: fast reload script
- Code: Select all
/*******************************************************************************
<cfgdesc>
[Click on Category for info or setting:]
color = #000060
control = info
[Quick Reload Mod]
color = #000060
shortdesc = <<<MULTILINE
Runtime Operation: Hold share/view [] + reload button [].
Activate by quick tap reload button.
Blue Led = Off blinks once
Aqua Led = On blinks twice
MULTILINE
collapsible = 2
[Quick Reload MODz]
group = true
shortdesc = <font color="blue">Quick reload option.</font>
byteoffset = 65
bitsize = 1
bitoffset = 7
control = checkbox
default = 0
item = Enable quick reload
[Quick Reload Adjustable Setting]
group = true
shortdesc = <br><b><font color="blue">Quick Reload Adjustable Setting:</font></b>
byteoffset = 66
bitsize = 32
control = spinbox
default = 1200
minimum = 0
maximum = 5000
step = 1
</cfgdesc>
*******************************************************************************/
#define RELOAD_0 0
#define RELOAD_1 1
uint8 reload = 0;
uint32 fast_reload;
init
{
pmem_load();
reload = (pmem_read(65) >> 7) & 0b1;
pmem_read(66, &fast_reload);
set_reload(reload);
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
}
main {
// quick reload toggle
if(is_active(BUTTON_2)) {
set_val(BUTTON_17, 0.0);
if(event_active(BUTTON_17)) {
if(reload == RELOAD_0) set_reload(RELOAD_1);
else if(reload == RELOAD_1) set_reload(RELOAD_0);
}
}
// quick scope
switch(reload) {
case RELOAD_0: {
if(get_actual(BUTTON_17)) {
set_val(BUTTON_17, 100.0);
}
} break;
case RELOAD_1: {
if(event_release(BUTTON_17)) {
combo_run(QuickReload);
}
} break;
}
if(event_release(BUTTON_2) && time_active(BUTTON_2) < 300) {
combo_run(share_view);
}
if(event_release(BUTTON_2) && time_active(BUTTON_2) > 300) {
printf("FAST_RELOAD: %d", reload);
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
}
}
combo QuickReload
{
wait(fast_reload);
set_val(BUTTON_14, 100.0);
wait(40);
set_val(BUTTON_14, 0.0);
wait(30);
set_val(BUTTON_14, 100.0);
wait(40);
}
combo share_view
{
set_val(BUTTON_2, 100.0);
wait(200);
}
void set_reload(uint8 new_reload)
{
reload = new_reload;
// Set LED
switch(reload) {
case RELOAD_0: { // Blue LED blinks 1 time on
led_vmset(LED_1, 250, 250, 1);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
} break;
case RELOAD_1: { // Aqua LED blinks 2 times off
led_vmset(LED_1, 250, 250, 2);
led_set(LED_2, 0.0, 0);
led_vmset(LED_3, 250, 250, 2);
led_set(LED_4, 0.0, 0);
} break;
}
return;
}
Made changes at bottom for example....better off to use this way with the rest of code.
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: fast reload script
bonefisher wrote:
- Code: Select all
/*******************************************************************************
<cfgdesc>
[Click on Category for info or setting:]
color = #000060
control = info
[Quick Reload Mod]
color = #000060
shortdesc = <<<MULTILINE
Runtime Operation: Hold share/view [] + reload button [].
Activate by quick tap reload button.
Blue Led = Off blinks once
Aqua Led = On blinks twice
MULTILINE
collapsible = 2
[Quick Reload MODz]
group = true
shortdesc = <font color="blue">Quick reload option.</font>
byteoffset = 65
bitsize = 1
bitoffset = 7
control = checkbox
default = 0
item = Enable quick reload
[Quick Reload Adjustable Setting]
group = true
shortdesc = <br><b><font color="blue">Quick Reload Adjustable Setting:</font></b>
byteoffset = 66
bitsize = 32
control = spinbox
default = 1200
minimum = 0
maximum = 5000
step = 1
</cfgdesc>
*******************************************************************************/
#define RELOAD_0 0
#define RELOAD_1 1
uint8 reload = 0;
uint32 fast_reload;
init
{
pmem_load();
reload = (pmem_read(65) >> 7) & 0b1;
pmem_read(66, &fast_reload);
set_reload(reload);
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
}
main {
// quick reload toggle
if(is_active(BUTTON_2)) {
set_val(BUTTON_17, 0.0);
if(event_active(BUTTON_17)) {
if(reload == RELOAD_0) set_reload(RELOAD_1);
else if(reload == RELOAD_1) set_reload(RELOAD_0);
}
}
// quick scope
switch(reload) {
case RELOAD_0: {
if(get_actual(BUTTON_17)) {
set_val(BUTTON_17, 100.0);
}
} break;
case RELOAD_1: {
if(event_release(BUTTON_17)) {
combo_run(QuickReload);
}
} break;
}
if(event_release(BUTTON_2) && time_active(BUTTON_2) < 300) {
combo_run(share_view);
}
if(event_release(BUTTON_2) && time_active(BUTTON_2) > 300) {
printf("FAST_RELOAD: %d", reload);
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
}
}
combo QuickReload
{
wait(fast_reload);
set_val(BUTTON_14, 100.0);
wait(40);
set_val(BUTTON_14, 0.0);
wait(30);
set_val(BUTTON_14, 100.0);
wait(40);
}
combo share_view
{
set_val(BUTTON_2, 100.0);
wait(200);
}
void set_reload(uint8 new_reload)
{
reload = new_reload;
// Set LED
switch(reload) {
case RELOAD_0: { // Blue LED blinks 1 time on
led_vmset(LED_1, 250, 250, 1);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
} break;
case RELOAD_1: { // Aqua LED blinks 2 times off
led_vmset(LED_1, 250, 250, 2);
led_set(LED_2, 0.0, 0);
led_vmset(LED_3, 250, 250, 2);
led_set(LED_4, 0.0, 0);
} break;
}
return;
}
Made changes at bottom for example....better off to use this way with the rest of code.
Thank you. I guess I will just add it to my existing script. It just messes with my other mods because it effects the LEDs. My script sets the led to yellow when active and then flashes the leds when a mod is turned on or off.
Can you explain what "switch" , "break" and "case" do. I can't find explanations anywhere
Trying to teach myself how to program these scripts even though I'm old
-
umpmanjoe - First Sergeant
- Posts: 45
- Joined: Mon May 25, 2015 1:23 am
9 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 132 guests