Page 1 of 1

Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 10:19 am
by The_Spartan
Hi guys,

I need serious help with something, because i'm out of ideas. I have a weapon that has multiple animations for deselection (unwielding) depending on the next weapon that is selected.

An example: if i'm using weapon A, and i'm switching to weapon B, I want another animation to be played instead of the regular one for the deselection/selection states.

This happens in Hexen 2, when using the necromancer and switching from weapon 2 to weapon 3 (having the player just turning page to the next spell). Any ideas on this? :rolleyes:

Re: Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 11:28 am
by Fused
Perhaps you can check if the next weapon on the weapon wheel exists by calling a script that knows the order of your weapons, and have it set your weapon state to the corresponding one.

Re: Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 11:48 am
by The_Spartan
"Exists"? That's not what I'm aiming at. I want to change the animation depending on the nextly selected weapon.

Re: Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 2:29 pm
by Ivan
You don't have information of the weapon being selected until the select state is entered on the said weapon. In order for that state to be entered your weapon should be done with it's deselect state. I don't think it's very possible to do.

Re: Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 2:42 pm
by Frits
Ivan wrote:You don't have information of the weapon being selected until the select state is entered on the said weapon. In order for that state to be entered your weapon should be done with it's deselect state. I don't think it's very possible to do.
Lot's of work but maybe you can use a A_giveinventory WeaponName for each gun when you select it. Have the select state check what item you have to jump to a custom raise, remove the previous WeaponnameINV and add a the current one.

Re: Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 3:07 pm
by Ivan
Frits wrote:
Ivan wrote:You don't have information of the weapon being selected until the select state is entered on the said weapon. In order for that state to be entered your weapon should be done with it's deselect state. I don't think it's very possible to do.
Lot's of work but maybe you can use a A_giveinventory WeaponName for each gun when you select it. Have the select state check what item you have to jump to a custom raise, remove the previous WeaponnameINV and add a the current one.
The weapon must have fully lowered before doing that, so you require the Deselect state lower the weapon fully.

Additionally implement your own weapon selection / deselection mechanism.

Re: Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 4:50 pm
by The_Spartan
Basically, I need a way of knowing which specific weapon a player has currently selected, as a "pending weapon". Unfortunately, DECORATE does not implement such a possibility nor an event handler. I don't really know how to do this.

Re: Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 4:52 pm
by Ænima
Give a checker item ("Actor LoweringKnife : CustomInventory") in the Deselect state of Weapon A.

Do something like "TNT1 AAAAAAAAAAAAAAAA 0 A_Lower" so that it disappears instantly. (But keep the "Loop" at the end of this state.)

in the Select state of Weapon B, have several "sub-states" like Select.FromShotgun or Select.FromPistol. jump to them using a A_JumpIfInventory and the checker item you made in step 1. These sub-states contain the actual lowering animations of Weapon A. Don't forget to do A_TakeInventory and take the checker item ("LoweringKnife", etc), followed by "TNT1 AAAAAAAAAAAAAAAA 0 A_Lower" at the beginning of that sub-state. Then you will have to manually animate the lowering animation of Weapon A followed by the raising animation of Weapon B, using duplicate versions of your weapon's sprites each with different sprite offsets (or you can even the "Offset" DECORATE frame property on your existing sprites but I hate doing that). when everything is done just do "Goto Ready".

that's what I would do if I was in your situation. the upside to my method is that you can animate your weapon switches however you want if you know how to position sprites, meaning you can sling weapons in from the side or top of the screen, instead of Doom's boring "scroll from bottom" animation. you can also make it as fast or slow as you like depending on which weapon you're switching to or from, and you can play sounds too for a nice effect.

Re: Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 7:30 pm
by The_Spartan
Unfortunately, i cannot do this, since i'm working with 3d models, and i cannot call an external frame outside the base model of the weapon. In other words, i cannot reproduce the movement of a weapon inside another weapon, i can't emulate Weapon A deselection phase into Weapon B...

Re: Switching Weapons with Different Animations

Posted: Mon Jul 17, 2017 8:00 pm
by Ænima
Damn. Sorry then. :/