Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Jun 2017
J
journeyman
OP Offline
journeyman
J
Joined: Jun 2017
There's a great mod from JRaven, called "JRavens GMToolkit II New Status Effects and Emotes":
https://steamcommunity.com/sharedfiles/filedetails/?id=1171786943
The idea is that it added a lot of statuses, including animations which could be toggleable as statuses. For continuous animations, you could set status length -1 and it would loop all over again. That made this mod invaluable for GM sessions. Roleplaying became more lively.
Unfortunately, after the game received some patch about 6 months ago, animation looping stopped working. You could still use them though, even without looping. But then after few more weeks, there was another patch which completely broke all the animation statuses. Interesting though, that old "emotes" that were placed before the patch are still working, until you cancel them.
Anyway, since JRaven doesn't support his mod anymore, I've decided to check myself how this mod works and if there any way to fix it. So this is how it works on the example of the bow emotion.
First he added this part to goals.div, goals.raw and story.div
Code
Goal(47).Title("EMOTEBOW");
Goal(47)
{
	INIT
	{
		
	}
	KB
	{
		IF
		CharacterStatusApplied(_Char,"GMTK_EMOTE_BOW",_)
		THEN
		CharacterSetAnimationOverride(_Char,"Bow_01");
		
		IF
		CharacterStatusRemoved(_Char,"GMTK_EMOTE_BOW",_)
		THEN
		CharacterSetAnimationOverride(_Char,"");
		
	}
	EXIT
	{
		
	}
}

Then he added this part to GMTK_EMOTES.txt
Code
IF
CharacterStatusApplied(_Char,"GMTK_EMOTE_BOW",_)
THEN
CharacterSetAnimationOverride(_Char,"Bow_01");

IF
CharacterStatusRemoved(_Char,"GMTK_EMOTE_BOW",_)
THEN
CharacterSetAnimationOverride(_Char,"");

And last he created file named EMOTEBOW.txt with the following code:
Code
Version 1
SubGoalCombiner SGC_AND
INITSECTION

KBSECTION
IF
CharacterStatusApplied(_Char,"GMTK_EMOTE_BOW",_)
THEN
CharacterSetAnimationOverride(_Char,"Bow_01");

IF
CharacterStatusRemoved(_Char,"GMTK_EMOTE_BOW",_)
THEN
CharacterSetAnimationOverride(_Char,"");
EXITSECTION

ENDEXITSECTION

I'm not sure why the same code needs to be executed in multiple places at once, but what I see, the script is simple, when a character receives status, execute the expected animation using CharacterSetAnimationOverride. I've checked the documentation and as far as I understand it, all the commands are correct. And I couldn't find any changes in API that might stop these scripts from working. Maybe somebody here might give me a hint, what could break them?

Last edited by JetNLoad; 30/06/18 07:17 AM.
Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
goals.div/raw and story.div simply contain the combination of all individual story goals, such as GMTK_EMOTES.txt and EMOTEBOW.txt. I can't say why both exist; maybe one gets activated in GM mode and one in campaign/story mode.

The reason it does not work, is that CharacterSetAnimationOverride only works for looping animations. Looping animations either end in "_Loop", or are explicitly marked as "looping animation" in the animation list.

Bow_01 is not a looping animation, which is why CharacterSetAnimationOverride does not work with it. The fact that it did, was a bug in the API.

To understand where this change comes from, some background:
* Scripters that just start out (and that included me) usually have a tendency to just try something out and when it works, they run with it. Looping a non-looping animation is one of those things. In the mean time we have better review processes in place, but reviews still can't catch everything.
* A looping animation has a lead-in animation, then a looping part that seamlessly connects from end to start and to both the lead-in and lead-out, and finally a lead-out. A non-looping animation does not have this, and can look jarring if it is looped anyway.

The result is that when the animators played/looked at the game to see how their various animations were used, they sometimes saw that non-looping animations were set to loop. This made their work look bad, because random people playing the game would blame any visual imperfections stemming from this on them, rather on the scripter that took a shortcut (the scripter should have requested a looping version from the animation department). Hence, the API was changed to no longer play non-looping animations, so that this shortcut would no longer work and the animators' work would only be used in the way intended.

Now, as to how to solve the issue with that mod:
* You can play non-looping animations with the PlayAnimation call
* This call will play the animation, and once it's finished it will throw an event
* You can then catch this event, check whether the character still has the status, and if so, play the animation again.

Joined: Jun 2017
J
journeyman
OP Offline
journeyman
J
Joined: Jun 2017
Thank you, that makes sense. Still, some of the statuses are using loop animations like Execution_01_Loop and they stopped working as well.
However, the idea to use PlayAnimation instead of CharacterSetAnimationOverride is pretty interesting too. I'll give it shot, hope it will help.
Thank you for a quick feedback!

Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
Animations in DOS2 have different priorities, and animation overrides are at, or at least near, the lowest priority. So if a character has the DefaultCharacter behaviour script assigned, then in its idle state it will occasionally play the idle1/idle2/idle3 animations, which would probably cancel the animation override. Not sure why it would have worked before though.

On the other hand, a PlayAnimation call from Osiris is pretty much the highest priority you can have for animations, so those are very unlikely to be cancelled.

I also forgot to mention that PlayAnimation also works with looping animations. It simply will play the looping part only once.


Moderated by  Larian_KVN 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5