Jump to content


Photo

[COMPLETE] Use Animation Percentages for Throwing Weapons


  • Please log in to reply
14 replies to this topic

#1 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 18 January 2011 - 04:39 AM

Original request and relevant info

In Bg1 (maeby in the bg2 too, but only with a bg1 avatars)when you throwing weapon (spear or axe) game start animation sequence choosed in weapon properties (backhand, overhand or thrust), But in bg2 it's always overhand sequence. It's ok with 1handed weapons (axe,dart...) but 2handed spear look awfull when throwned overhand (maeby that's why bioware not realised throwing ability for spear in game), thrusting sequence will look much better. Can it be done, as with bg1 avatars?


When item ability use ranged flag, engine looks what animation type should be played on atack (overhead or backslash or piercing), BUT
In BG2 only bg1's animations (Monk, skeleton, any bg1 character animation) has check for animation type, and all bg2 char & weapon animations hasn't. They always use overhead animation when "ranged" set for ability.

Many interesting things can be coded, if this can be fixed.
(Example: light weapons - dagger, rapier, short sword or even my custom animation "long spear" with very long reach, can logically use dexterity for thac0, as with 3ed feat)
I can fix this for 2handed weapon with my ugly code, but with 1handed one issue occur, some weapons need overhead, other piercing, and only one can be set for all sad.gif
Thanks for all Your work.


If I understand you correctly, the problem is that most BG2 animations ignore the percentages at item ability+0x2c when using a ranged ability?
However, there are some that do correctly evaluate these and you want me to add the check to the other animations.
By the way, try to give concrete examples of animations, so that I might look them up.


All bg2 characters [with prefix C, not NPCs with prefix N] do not check for anim type [npcs has own g24 animation for ranged weapon], maeby other character dedicated animations [shields, helms etc] need patching too, but I think that character animation couse this issue. So, I can leave without this patch, just thanks again.
p.s. I have a try to code my previous request (overweight speed percentage), but failed many times. So if you decide to code it, i'll be VERY thankfull.


This was an interesting one to look at, because the way the engine distinguishes ranged from non-ranged animations is extremely simple (noting that a ranged attack uses SEQ_SHOOT, while non-ranged uses SEQ_ATTACK):
void CCreatureObject::ValidateAttackSequence(char* pSeq) { //0x8D6D78
  if (*pSeq == SEQ_SHOOT) {
    CItem* pItm = m_Inventory.items[m_Inventory.nSlotSelected];
    if (pItm) {
      pItm->Demand();
      ItmFileAbility& pAbility = pItm->GetAbility(m_Inventory.nAbilitySelected);
      if (pAbility) {
        if (pAbility->attackType != TYPE_RANGED) *pSeq == SEQ_ATTACK;
      } else {
        *pSeq == SEQ_READY;
      }
      pItm->Release();
    } else {
      *pSeq == SEQ_READY;
    }
  } else
  if (*pSeq == SEQ_ATTACK) {
    CItem* pItm = m_Inventory.items[m_Inventory.nSlotSelected];
    if (pItm) {
      pItm->Demand();
      ItmFileAbility& pAbility = pItm->GetAbility(m_Inventory.nAbilitySelected);
      if (pAbility) {
        if (pAbility->attackType == TYPE_RANGED) *pSeq == SEQ_SHOOT;
      } else {
        *pSeq == SEQ_READY;
      }
      pItm->Release();
    } else {
      *pSeq == SEQ_READY;
    }
  }
  return;
}
This is followed by void CCreatureObject::SetAnimationSequence(wSeq), where a switch on wSeq determines that only a wSeq == SEQ_ATTACK will look at the relevant SLASH, BACKSLASH, and JAB animations.

You'll need to clarify this for me, but I think the reason why certain animations can use other attack animations on 'shooting' is because the animation frames are designed to look like that.

Yes, it is possible to modify this procedure a bit so far that non-launcher ranged weapons that get equipped in the weapon slots will use the appropriate percentages (i.e. SEQ_SHOOT would change to SEQ_ATTACK for these animations). There is a bit of code I haven't fully reversed for such a change, so it will have to be a beta hack until I sort out how this change might affect animations.

Update: Took a while, but should work OK now. It took ages for me to find out that the above procedure was using a char* instead of a short*, and I was scratching my head wondering why the creature would suddenly lapse back into the SEQ_SHOOT animation for no apparent reason.

Anyway, this is now completed.

-----Use Animation Percentages for Throwing Weapons [M]
Enables the use of item ability slash %, backslash %, and jab % fields for ranged weapons equipped in a weapon slot that do not require a launcher
Because this hack makes the creature use of the SEQ_ATTACK_[] animations instead of SEQ_SHOOT, attacks play the SEQ_ATTACK and SEQ_ATTACK_[] animation sounds instead of the SEQ_SHOOT animation sound

Options:
-0: disabled
-1: enabled


Edited by Ascension64, 19 January 2011 - 04:00 AM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#2 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 19 January 2011 - 04:02 AM

Updated. It appears that the vanilla BG2 throwing items all use 100% slashing, so this at least should not affect significantly affect the vanilla game when used (except the animation sounds). Please correct in this thread if I am mistaken or if any mods make use of alternate %s (deliberately or non-deliberately) for reference.

Edited by Ascension64, 19 January 2011 - 04:06 AM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#3 -@vGur-

-@vGur-
  • Guest

Posted 19 January 2011 - 05:08 AM

:crying: THANKS!!! :cheers:

#4 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 19 January 2011 - 03:14 PM

Hmm, one thing to note is that not all SEQ_SHOOTs are equivalent to SEQ_ATTACK_SLASH, so maybe some animations' throwing animations are not going to be consistent across the board for the vanilla items.

Can you advise what animations might normally use a non-slash animation when they throw darts are things like that?

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#5 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 20 January 2011 - 03:18 AM

OK, I did all the hard work for you. Looks like there is a lot of discrepancy between SEQ_SHOOT and SEQ_ATTACK_SLASH for most animation groups. However, I imagine that you are primarily interested in the playable and special humanoids groups (0x5XXX and 0x6XXX), which should mostly match. Unless someone objects, I will restrict this feature only to these two groups in order to prevent weird-looking animations and unexpected crashes (not that you would give a dragon or an ankheg a dart...)

Anim	Desc					SHOOT	SLASH	BACKSLASH	JAB
0	VisualFX				READY	READY	READY		READY
10	Wyvern + Tanarii			READY	G3.0	G3.1		G3.2/0
12	Dragons					G5.1	G3.0	G3.0		G3.0
13	Demogorgon				G2.3	G2.0	G2.1		G2.2
20	Sirine/Volo/Ogre Mage/Death Knight	G2.2	G2.0	G2.0		G2.0
30	Ankheg					READY	G3.0	G3.1		G3.0
40	Static + Sleeping			READY	READY	READY		READY
50/60	Playable Humanoids			A1.0	A1.0	A3.0		A5.0
64	Special Humanoids			A1.1/0	A1.0	A3.0		A5.0
70	Most Creatures				G2.2	G2.0	G2.1		G2.0
73	Elementals				G2.3/4	G2.0	G2.1		G2.2
80	Gnoll/Hobgoblin/Kobold			G2.2	G2.0/2	G2.1/2		G2.0/1/2
90	Ogre					READY	G2.0	G2.1		G2.0
A0	Wyvern + Carrion Crawler		READY	G3.0	G3.1		G3.2
B0	Static + Static Animals			READY	READY	READY		READY
C0	More Statics				READY	READY	READY		READY
D0	Flying Creatures			READY	READY	READY		READY
E0	IWD Creatures				A4	A1	A2		A3

Edited by Ascension64, 20 January 2011 - 03:21 AM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#6 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 20 January 2011 - 12:52 PM

Infinity Animations reorganises some animations by using the duplicated slots in the "50" series for non-humanoids (things like driders and chimerae I think). And obviously it implements additional animations beyond E0 etc. Also adds BG1 character animations in there somewhere. Not sure if this would affect that.

Why would you throw a spear anything but overhand? Or is it just that the actual "overhand" animation looks stupid when used for spears?

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#7 -Asc64_offline-

-Asc64_offline-
  • Guest

Posted 20 January 2011 - 02:37 PM

Because I don't have the tech specs for Infinity Animations, it makes it hard for me to work out exactly how it deals with each slot. Are the new animation BAMs constructed in the sameway as the vanilla 0x5XXX animations?

I think the reason was two-handed spears look dodgy using the slash (overhand) animation.

#8 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 20 January 2011 - 03:26 PM

The only specs I have are what I already posted here, which may not have helped much before, but I think it does actually list which types of animations go where. I think the reslotted 0x5XXX animations are IWD types, whereas the BG1 character animations are in the 0x64XX slots. The main way in which those differ from BG2 character animations is that they are not mirrored (they have full proper east-facing animation sequences which aren't just reversed west-facing ones). Not sure if "throwing" or "shooting" sequences differ.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#9 Dakk

Dakk
  • Member
  • 398 posts

Posted 20 January 2011 - 06:22 PM

Can you advise what animations might normally use a non-slash animation when they throw darts are things like that?

OK, I did all the hard work for you.


He posted, 4 minutes later :woot::lol:

#10 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 20 January 2011 - 07:14 PM

He posted, 4 minutes later

+12 hours :P. That's like ages by Ascension64 standards.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#11 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 20 January 2011 - 11:05 PM

Yeah, I got a similar result when I 're-reversed' the IA code. Damn, it's a mess! A good mess, since it works...
0	no change			
10/11	extended			
12	extended			
13	extended			
20	extended			
30	extended			
40	no change			

50/60	extended
5000-5478 becomes E0
5479-5AFF becomes 70
5B00-5FFF becomes 73

64	extended
6601-6AFF becomes 50/60
6B00-6FFF becomes 64	

70	no change			
73	no change			
80	no change			
90	no change			
A0	extended			
B0	no change			
C0	no change			
D0	no change			
E0	no change

This makes things tricky. The replaced _LOW animations (used by vanilla ToB) 'may' cause compatibility issues when replaced by IWD animations. Specifically, if an IWD animation used exclusively SEQ_SHOOT (kind of like Yuan-Ti archer) and this hack was turned on, then a missing SEQ_ATTACK_[] animation would either crash the game (if no BAM present), or cause the creature to disappear (empty frame BAM).

To avoid this, IA_low_fix must be installed, and no mods must use the 0x5XXX set of animations for humanoids. I think I can avoid this by applying the percentages only if the animation prefix starts with C and not a 'mu'.

Since all 0x6XXX are humanoid animations, this part is OK.

Update: Wonky, but...
BOOL __stdcall CCreatureObject_HasThrowingWeaponEquippedHumanoidOnly(CCreatureObject& cre) {
...
	//restrict to humanoid animation IDs only (this is Infinity Animations-friendly)
	CAnimation* pAnimation = cre.m_animation.pAnimation;
	if (pAnimation == NULL) {
...
	} else {
		if (
			(pAnimation->wAnimId >= 0x5000 &&
			pAnimation->wAnimId < 0x5400 &&
			((CAnimation5000*)pAnimation)->sPrefix1[0] == 'C' //avoid the mu (0xB5) symbol in Infinity Animations
			) ||
			pAnimation->wAnimId & 0x6000
			) {
			return TRUE;
		}
	}
...
};

Edited by Ascension64, 20 January 2011 - 11:38 PM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#12 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 21 January 2011 - 01:20 AM

I think I can avoid this by applying the percentages only if the animation prefix starts with C and not a 'mu'.

It should work I guess, as long as you're checking for it being a C as opposed to something else. The next release of IA should change from non-ANSI symbols like the mu symbol to unused ANSI symbols, to avoid the glitches with non-English OSes, so it won't be a 'mu' but it won't be a C either.

I'd still have to get my mind around how to use this hack (as a modder, since a player enabling it probably wouldn't see much unless a mod uses it somehow). I guess it'd be something as simple as patching all things like throwable spears to use a more appropriate animation sequence?

(P.S.: Your work as Icendoan's one-man cheer squad must be pretty sparse these days...)

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#13 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 21 January 2011 - 03:17 AM

I'd still have to get my mind around how to use this hack (as a modder, since a player enabling it probably wouldn't see much unless a mod uses it somehow). I guess it'd be something as simple as patching all things like throwable spears to use a more appropriate animation sequence?

It is a fairly restricted change. If anyone wants to make a Jackie Chan mod that throws all kinds of objeccts in weird ways, then maybe this has a use.

(P.S.: Your work as Icendoan's one-man cheer squad must be pretty sparse these days...)

Or that my efforts at updating my status are pretty slack...

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#14 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 21 January 2011 - 03:18 AM

Posted in wrong place.

Edited by Ascension64, 21 January 2011 - 03:19 AM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#15 Dakk

Dakk
  • Member
  • 398 posts

Posted 21 January 2011 - 07:05 AM

He posted, 4 minutes later

+12 hours :P. That's like ages by Ascension64 standards.

Hahaha! :doh: I live my life in the 24 hour world, the subtleties of AM/PM obviously slips me unnoticed by :P

Apologies for the OT Ascension64.

Edited by Dakk, 21 January 2011 - 07:30 AM.