Switching Weapons with Different Animations

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

Switching Weapons with Different Animations

#1

Post by The_Spartan » Mon Jul 17, 2017 10:19 am

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:

User avatar
Fused
Contributor
Posts: 658
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

Re: Switching Weapons with Different Animations

#2

Post by Fused » Mon Jul 17, 2017 11:28 am

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.
My mods
Image Image

My socials
Image Image

User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

Re: Switching Weapons with Different Animations

#3

Post by The_Spartan » Mon Jul 17, 2017 11:48 am

"Exists"? That's not what I'm aiming at. I want to change the animation depending on the nextly selected weapon.

User avatar
Ivan
Addicted to Zandronum
Posts: 2219
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

Re: Switching Weapons with Different Animations

#4

Post by Ivan » Mon Jul 17, 2017 2:29 pm

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.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

User avatar
Frits
Forum Regular
Posts: 298
Joined: Fri Jun 01, 2012 9:04 pm

Re: Switching Weapons with Different Animations

#5

Post by Frits » Mon Jul 17, 2017 2:42 pm

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.

User avatar
Ivan
Addicted to Zandronum
Posts: 2219
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

Re: Switching Weapons with Different Animations

#6

Post by Ivan » Mon Jul 17, 2017 3:07 pm

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.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

Re: Switching Weapons with Different Animations

#7

Post by The_Spartan » Mon Jul 17, 2017 4:50 pm

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.

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

Re: Switching Weapons with Different Animations

#8

Post by Ænima » Mon Jul 17, 2017 4:52 pm

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.
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

Re: Switching Weapons with Different Animations

#9

Post by The_Spartan » Mon Jul 17, 2017 7:30 pm

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...

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

Re: Switching Weapons with Different Animations

#10

Post by Ænima » Mon Jul 17, 2017 8:00 pm

Damn. Sorry then. :/
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

Post Reply