I made an account just to tell you there is a better way to do the whip code (in my opinion).
Code: Select all
class CowboyWeapon : Weapon
{
action void A_Whip(int bone)
{
if (bone = 1)
{
A_FireProjectile("BoneWhipAttack",0,0,0,0,0,0);
A_FireProjectile("WhipGuardReflective",-24,0,24,0,FPF_NOAUTOAIM);
A_FireProjectile("WhipGuardReflective",0,0,0,0,FPF_NOAUTOAIM);
A_FireProjectile("WhipGuardReflective",24,0,-24,0,FPF_NOAUTOAIM);
}
else
{
A_FireProjectile("WhipAttack",0,0,0,0,0,0);
A_FireProjectile("WhipGuard",-24,0,24,0,FPF_NOAUTOAIM);
A_FireProjectile("WhipGuard",0,0,0,0,FPF_NOAUTOAIM);
A_FireProjectile("WhipGuard",24,0,-24,0,FPF_NOAUTOAIM);
}
}
Default
{
+WEAPON.AMMO_OPTIONAL
+WEAPON.NOAUTOFIRE
+WEAPON.NOALERT
+INVENTORY.UNTOSSABLE
Weapon.Kickback 40;
Weapon.AmmoUse 1;
Weapon.BobRangeX 0.9;
Weapon.BobRangeY 0.45;
Weapon.BobSpeed 1.1;
Weapon.BobStyle "Alpha";
Scale 0.75;
}
States
{
WhipIt:
TNT1 A 0
{
A_TakeInventory("ImIdle",1);
A_TakeInventory("IsFanning",1);
if (CountInv("BoneWhipPower") == 0)
{
A_PlaySound("whip/swing",6);
if (CountInv("WhipSequence") == 0){A_Overlay(2,"WhipAnim1");}
if (CountInv("WhipSequence") == 1){A_Overlay(2,"WhipAnim2");}
}
if (CountInv("BoneWhipPower") == 1)
{
A_PlaySound("whipbone/swing",6);
if (CountInv("WhipSequence") == 0){A_Overlay(2,"WhipAnim3");}
if (CountInv("WhipSequence") == 1){A_Overlay(2,"WhipAnim4");}
}
}
TNT1 A 8 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH);
TNT1 A 20 A_WeaponReady(WRF_NOSWITCH | WRF_ALLOWRELOAD);
TNT1 A 0 A_TakeInventory("WhipSequence",1);
TNT1 A 0 A_TakeInventory("IsWhipping",1);
TNT1 A 1 A_Jump(255, "Steady");
Stop;
WhipAnim1:
WHPL AB 1 ;
WHPL C 1 A_Whip(0);
WHPL D 1 ;
WHPL E 1 A_GiveInventory("WhipSequence",1);
stop;
WhipAnim2:
WHPL FG 1 ;
WHPL H 1 A_Whip(0);
WHPL I 1 ;
WHPL J 1 A_TakeInventory("WhipSequence",1);
stop;
WhipAnim3:
WHPB AB 1 ;
WHPB C 1 A_Whip(0);
WHPB D 1 ;
WHPB E 1 A_GiveInventory("WhipSequence",1);
stop;
WhipAnim4:
WHPB FG 1 ;
WHPB H 1 A_Whip(0);
WHPB I 1 ;
WHPB J 1 A_TakeInventory("WhipSequence",1);
stop;
}
}
When it is done this way, weapons should inherit "CowboyWeapon" instead of "Weapon" and should have a state named "Steady" just before "Ready" that does the animation for bringing a weapon back onto the screen after the whipping. This code, if you choose to implement it, would remove mass redundancy in weapon code, allowing for more streamlined editing. All the whip states could be removed entirely, leaving just this:
AltFire:
TNT1 A 0 A_TakeInventory("ImIdle",1);
TNT1 A 0
{
A_Light(0);
if (CountInv("IsWhipping") == 1) { return ResolveState("WhipIt"); }
A_TakeInventory("IsFanning",1);
A_GiveInventory("IsWhipping",1);
return ResolveState(null);
}
REVL ABC 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH);
goto WhipIt;
If you want to use this, or any part of this, I would be honored.