Switching Weapons with Different Animations

Discuss all aspects related to modding Zandronum here.
User avatar
The_Spartan
Topic author
 
Offline
Posts: 72
Joined: Fri Oct 12, 2012 1:12 pm
Contact:

Switching Weapons with Different Animations

Post#1 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
Forum Staff
Offline
Posts: 497
Joined: Sat Nov 09, 2013 9:47 am
Contact:

Re: Switching Weapons with Different Animations

Post#2 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.
#zamapping
00:21:50 <@TheMisterCat> my name is
00:21:50 <@TheMisterCat> who
00:21:53 <@TheMisterCat> my name is
00:21:54 <@TheMisterCat> what
00:21:56 <@TheMisterCat> my name is
00:21:59 <@TheMisterCat> wiki wiki
00:22:03 <@TheMisterCat> read the fucking wiki


ZCC || ZH anti-RQ patch || MultiHud
Zombie Horde: the Extinction || DoomZ : Overpoch
Image

User avatar
The_Spartan
Topic author
 
Offline
Posts: 72
Joined: Fri Oct 12, 2012 1:12 pm
Contact:

Re: Switching Weapons with Different Animations

Post#3 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
Offline
Posts: 1754
Joined: Mon Jun 04, 2012 5:38 pm

Re: Switching Weapons with Different Animations

Post#4 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
Offline
Posts: 290
Joined: Fri Jun 01, 2012 9:04 pm

Re: Switching Weapons with Different Animations

Post#5 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
Offline
Posts: 1754
Joined: Mon Jun 04, 2012 5:38 pm

Re: Switching Weapons with Different Animations

Post#6 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
Topic author
 
Offline
Posts: 72
Joined: Fri Oct 12, 2012 1:12 pm
Contact:

Re: Switching Weapons with Different Animations

Post#7 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
Offline
Posts: 3043
Joined: Tue Jun 05, 2012 6:12 pm

Re: Switching Weapons with Different Animations

Post#8 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.
Image ­ ­
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: Doom64 and Diablo2 had a baby


ZandroSkins
: a pack made by our community
Squad Radio: a WASD-powered chat menu, add your own sounds
AeniPuffs: neat blood and puff effects

User avatar
The_Spartan
Topic author
 
Offline
Posts: 72
Joined: Fri Oct 12, 2012 1:12 pm
Contact:

Re: Switching Weapons with Different Animations

Post#9 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
Offline
Posts: 3043
Joined: Tue Jun 05, 2012 6:12 pm

Re: Switching Weapons with Different Animations

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

Damn. Sorry then. :/
Image ­ ­
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: Doom64 and Diablo2 had a baby


ZandroSkins
: a pack made by our community
Squad Radio: a WASD-powered chat menu, add your own sounds
AeniPuffs: neat blood and puff effects


Return to “Editing Help & Discussion”



Who is online

Users browsing this forum: No registered users and 4 guests