by Major Cooke » Wed Dec 28, 2016 12:29 pm
Check out D4D's super shotgun. Only thing is, I had to do it a little differently. The firing mechanism is actually an overlay that uses GetPlayerInput instead.
You don't want to be mixing and matching fire states with overlay created states because that can quickly get out of control.
In this situation of DJ2K's, his best bet would be to have an overlay which just does the manual offsetting via measuring velocity rather than what happens below. Don't go mixing and matching simpler things with more complex ideas unless you want to risk tying your fingers in knots.
Code: Select all
Ready:
M666 A 0
{
A_Overlay(SwitchWatcher,"SwitchWatcher",true);
if (CountInv("SSGUpgrade4"))
{
A_Overlay(RGun,"SSR.Ready",true);
A_Overlay(LGun,"SSL.Ready",true);
A_Overlay(GunWatcher,"SSG.Listen");
return ResolveState("ReadyLoop");
}
return ResolveState(1);
}
DW4A A 0;
Goto ReadyLoop;
ReadyLoop:
"----" A 1
{
if (!CountInv("SSGUpgrade4"))
{ A_WeaponReady((!CountInv("BusyToken")) ? WRF_NOSECONDARY|WRF_ALLOWRELOAD|WRF_ALLOWUSER2 : WRF_NOSWITCH); }
else
{
// Follow the weapon.
A_OverlayFlags(LGun,WeapMove,true);
A_OverlayFlags(RGun,WeapMove,true);
A_Overlay(GunWatcher,"SSG.Listen",true);
if (CountInv("SSLSecondShotToken") > 1 && CountInv("SSRSecondShotToken") > 1)
{ // Both are reloading.
A_OverlayFlags(LGun,WeapBob,false);
A_OverlayFlags(RGun,WeapBob,false);
A_WeaponReady(WRF_NOFIRE);
}
else if (CountInv("SSLSecondShotToken") > 1)
{ // Left is reloading. Right is ready.
A_OverlayFlags(LGun,WeapBob,false);
A_OverlayFlags(RGun,WeapBob,true);
A_WeaponReady(WRF_NOFIRE);
}
else if (CountInv("SSRSecondShotToken") > 1)
{ // Right is reloading. Left is ready.
A_OverlayFlags(LGun,WeapBob,true);
A_OverlayFlags(RGun,WeapBob,false);
A_WeaponReady(WRF_NOFIRE);
}
else
{ // Both are ready.
A_OverlayFlags(LGun,WeapBob,true);
A_OverlayFlags(RGun,WeapBob,true);
A_WeaponReady((!CountInv("BusyToken")) ? WRF_NOFIRE|WRF_ALLOWRELOAD|WRF_ALLOWUSER2 : WRF_NOFIRE|WRF_NOSWITCH);
}
}
return ResolveState(null);
}
Goto Ready;
What I used for 'listening':
Code: Select all
SSG.Listen:
M666 A 1
{
// Have ammo?
if (!A_JumpIfNoAmmo("Null") && !CountInv("BusyToken"))
{
// Primary shoots left
if ((CountInv("SSLSecondShotToken") < 2) &&
(GetPlayerInput(MODINPUT_BUTTONS) & BT_ATTACK) &&
!(GetPlayerInput(MODINPUT_OLDBUTTONS) & BT_ATTACK))
{ A_Overlay(LGun,"SSL.Fire"); }
// Secondary shoots right
if ((CountInv("SSRSecondShotToken") < 2) &&
(GetPlayerInput(MODINPUT_BUTTONS) & BT_ALTATTACK) &&
!(GetPlayerInput(MODINPUT_OLDBUTTONS) & BT_ALTATTACK))
{ A_Overlay(RGun,"SSR.Fire"); }
}
}
Loop;
Check out D4D's super shotgun. Only thing is, I had to do it a little differently. The firing mechanism is actually an overlay that uses GetPlayerInput instead.
You don't want to be mixing and matching fire states with overlay created states because that can quickly get out of control.
In this situation of DJ2K's, his best bet would be to have an overlay which just does the manual offsetting via measuring velocity rather than what happens below. Don't go mixing and matching simpler things with more complex ideas unless you want to risk tying your fingers in knots.
[code] Ready:
M666 A 0
{
A_Overlay(SwitchWatcher,"SwitchWatcher",true);
if (CountInv("SSGUpgrade4"))
{
A_Overlay(RGun,"SSR.Ready",true);
A_Overlay(LGun,"SSL.Ready",true);
A_Overlay(GunWatcher,"SSG.Listen");
return ResolveState("ReadyLoop");
}
return ResolveState(1);
}
DW4A A 0;
Goto ReadyLoop;
ReadyLoop:
"----" A 1
{
if (!CountInv("SSGUpgrade4"))
{ A_WeaponReady((!CountInv("BusyToken")) ? WRF_NOSECONDARY|WRF_ALLOWRELOAD|WRF_ALLOWUSER2 : WRF_NOSWITCH); }
else
{
// Follow the weapon.
A_OverlayFlags(LGun,WeapMove,true);
A_OverlayFlags(RGun,WeapMove,true);
A_Overlay(GunWatcher,"SSG.Listen",true);
if (CountInv("SSLSecondShotToken") > 1 && CountInv("SSRSecondShotToken") > 1)
{ // Both are reloading.
A_OverlayFlags(LGun,WeapBob,false);
A_OverlayFlags(RGun,WeapBob,false);
A_WeaponReady(WRF_NOFIRE);
}
else if (CountInv("SSLSecondShotToken") > 1)
{ // Left is reloading. Right is ready.
A_OverlayFlags(LGun,WeapBob,false);
A_OverlayFlags(RGun,WeapBob,true);
A_WeaponReady(WRF_NOFIRE);
}
else if (CountInv("SSRSecondShotToken") > 1)
{ // Right is reloading. Left is ready.
A_OverlayFlags(LGun,WeapBob,true);
A_OverlayFlags(RGun,WeapBob,false);
A_WeaponReady(WRF_NOFIRE);
}
else
{ // Both are ready.
A_OverlayFlags(LGun,WeapBob,true);
A_OverlayFlags(RGun,WeapBob,true);
A_WeaponReady((!CountInv("BusyToken")) ? WRF_NOFIRE|WRF_ALLOWRELOAD|WRF_ALLOWUSER2 : WRF_NOFIRE|WRF_NOSWITCH);
}
}
return ResolveState(null);
}
Goto Ready;[/code]
What I used for 'listening':
[code] SSG.Listen:
M666 A 1
{
// Have ammo?
if (!A_JumpIfNoAmmo("Null") && !CountInv("BusyToken"))
{
// Primary shoots left
if ((CountInv("SSLSecondShotToken") < 2) &&
(GetPlayerInput(MODINPUT_BUTTONS) & BT_ATTACK) &&
!(GetPlayerInput(MODINPUT_OLDBUTTONS) & BT_ATTACK))
{ A_Overlay(LGun,"SSL.Fire"); }
// Secondary shoots right
if ((CountInv("SSRSecondShotToken") < 2) &&
(GetPlayerInput(MODINPUT_BUTTONS) & BT_ALTATTACK) &&
!(GetPlayerInput(MODINPUT_OLDBUTTONS) & BT_ALTATTACK))
{ A_Overlay(RGun,"SSR.Fire"); }
}
}
Loop;[/code]