Re: Animated weapon Raise

Mon Feb 07, 2022 12:49 pm

The problem is you're trying to play a raise animation before calling A_Raise, thefore the animation is playing while the weapon's sprite is still below the the screen. A_Raise raises the weapon sprite and when it reaches a certain height, I don't remember exactly, 32 I think, it puts the weapon into the Ready state. If you don't have A_Raise in the Select state, then the weapon won't work properly.

I think the easiest way to have a custom Select state would be to have a blank sprite such as TNT1 in the select state and just let A_Raise do its thing, then when it puts your weapon in the Ready state, play your custom raise animation. At the end of your custom animation, have the weapon go to a new alternate ready state such as Ready.Done, you can name it whatever you want really, the important thing is to redirect every state that would normally go to ready to go to the new alt ready state.

Here is a simple mockup demonstrating a custom raise and lower animation.
Code:
States
{
     Spawn:
          WEAP P -1
          Stop
     Select:
          TNT1 A 1 A_Raise    //Use a blank sprite or frame for the regular raise sequence
          Wait
     Deselect:
          WEAP WXYZ 3    //Play your custom lower sequence before you call A_Lower
          TNT1 A 1 A_Lower    //Use a blank sprite or frame while calling A_Lower
          Wait
     Ready:
          WEAP ABCD 3    //Play you custom raise animation here
          Goto Ready.Done    //Goto the state you will actually be using as a Ready state
     Ready.Done:
          WEAP E 1 A_WeaponReady    //This will be your actual ready state
          Wait
     Fire:
          WEAP F 3 A_FireCGun
          WEAP GHI 3
          WEAP A 0 A_Refire
          Goto Ready.Done    //Goto the state you will actually be using as a Ready state
     Hold:
          WEAP F 3 A_FireCGun
          WEAP GHI 3
          WEAP A 0 A_Refire
          WEAP A 0 A_ClearRefire
          Goto Ready.Done    //Goto the state you will actually be using as a Ready state
     Flash:
          WEAP JK 3 Bright
          Stop
}

Re: Animated weapon Raise

Mon Feb 07, 2022 1:15 pm

Sir Robin wrote:First issue with my weapons is that the sprites look perfect when I view them in Slade with HUD offsets, but in game they are much lower. I've found that if I put Weapon.YAdjust -32 in the defaults block then they look right in fullscreen but still way too low with a status bar. How to fix that?


Weapon sprites start below the screen when the weapon is selected. If your animation requires that they're fully raised, what you need to do is raise them manually:

Code:
Select:
   TNT1 A 0 A_WeaponOffset(0, 32); //raise instantly
   UWAA ONA 4 A_WeaponReady(WRF_NOFIRE|WRF_NOBOB);
   TNT1 A 0 A_Raise;
   wait;
Deselect:
   UWAA ANO 4 A_WeaponReady(WRF_NOFIRE|WRF_NOBOB);
   TNT1 A 0 A_Lower;
   wait;


Strictly speaking, in my expereience calling A_Raise is not absolutely required if your weapon is already raised to 32 units, but I'd rather keep in in any case.

Re: Animated weapon Raise

Mon Feb 07, 2022 2:21 pm

22alpha22 wrote:I think the easiest way to have a custom Select state would be to have a blank sprite such as TNT1 in the select state and just let A_Raise do its thing, then when it puts your weapon in the Ready state, play your custom raise animation. At the end of your custom animation, have the weapon go to a new alternate ready state such as Ready.Done, you can name it whatever you want really, the important thing is to redirect every state that would normally go to ready to go to the new alt ready state.

That was what Jarewill mentioned earlier in this thread. If it works that's good but I wanted to know about Jekyll Grim Payne's ideas to get everything working in the "proper" states.

Jekyll Grim Payne wrote:Weapon sprites start below the screen when the weapon is selected. If your animation requires that they're fully raised, what you need to do is raise them manually:
Strictly speaking, in my expereience calling A_Raise is not absolutely required if your weapon is already raised to 32 units, but I'd rather keep in in any case.

For some reason the 0,32 offset doesn't work for me, weapon is still too low. Putting it at 0,0 works perfectly. But after raise runs it's back to being too low, so I set it back to 0,0 again at ready. This works for me:
Code:
   Ready:
      UWAA A 1 A_WeaponOffset(0,0);
      TNT1 ] 0 A_WeaponReady;
      Loop;
   Deselect:
      UWAA ANO 4;
      TNT1 ] 0 A_Lower;
      wait;
   Select:
      TNT1 ] 0 A_WeaponOffset(0,0);
      UWAA ONA 4 A_WeaponReady(WRF_NOFIRE|WRF_NOBOB);
      TNT1 ] 0 A_Raise;
      wait;


Since you know weapon animations, could I get you to look at my thread here? I'm trying to come up with a way to run the charge animation backwards when the weapon charge fails.

Re: Animated weapon Raise

Tue Feb 08, 2022 1:45 pm

I do it like:
Code:
 Select:
    SHTG A 1 A_Raise
    SHTG ABCDCB 4
    Goto Ready
  Ready: //The actual Ready state, make all your other states (such as Fire) go here instead
    SHTG A 1 A_WeaponReady
    Loop
basically calling a raise, than playing the animation.