View Issue Details

IDProjectCategoryView StatusLast Update
0009910Multi Theft Auto : San AndreasScriptingpublic2018-09-05 22:31
Reportereinheit-101Assigned ToSaml1er 
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionsuspended 
Product Version1.5.6 
Target VersionFixed in Version 
Summary0009910: engineReplaceAnimation does not apply the replaced animation if it is currently used
Description

By using engineReplaceAnimation it is possible to replace the "idle standing" animation. However, if this function is used to replace that animation, it will not get applied immediately. The player has to perform another action and the new animation gets applied afterwards.

Steps To Reproduce

-replace the idle stand animation of your local player
-Notice that your animation does not change
-press any movement key: The animation gets applied as soon as the player model returns to "idle"

Additional Information

I recommend modifying "engineReplaceAnimation" in such a way that it applies replaced animations to ped models if the replaced animation is currently in use - if that is possible.
I wrote a script that lets the player go into a prone position instead of crouch, but everytime the "prone" animation replaces the "crouching", the player has to stand up and re-crouch because the replaced animation will never be applied otherwise.

Now i COULD use "setPedAnimation" to play the "idle_prone" animation - however there is another MTA bug that removes the "crouch state" everytime an animation is being applied with setPedAnimation. So when the player presses "crouch", the "prone" animation plays and as soon as its finished he will stand up...

TagsNo tags attached.

Activities

qaisjp

2018-07-16 18:40

administrator   ~~0026712

Yes, I agree that the animation should immediately take effect. I assume this happens because the animation is still kept in memory and isn't truly being replaced. What happens if you:

  • replace IdleAnim with Anim1 (some animation you provide)
  • check if Anim1 plays properly in idle state
  • replace Anim1 with Anim2 (i.e, replace IdleAnim again)

If my hunch is true it should work as you expect (so the issue is just going from SA's IdleAnim to a new anim, and not between replaced anims.. if that makes sense?)

Assigning to @Saml1er.

Saml1er

2018-07-17 01:01

updater   ~~0026741

Last edited: 2018-07-17 01:02

View 2 revisions

Thanks for the report. I'm aware of this problem. I know how to fix it, but it's possible that there might be side effects. Currently, when you replace an animation, and press a key on your keyboard or press LMB, the CAnimBlendAssocGroup::CopyAnimation hook is triggered, that's when the replaced animation is played.

If you take a look at how setPedAnimation works, it will first remove any task or animation that is currently being played for the ped, and then play the animation, so it strictly allows you to play only 1 animation at a time, so it's not possible to play the replaced animation immediately after calling engineReplaceAnimation via setPedAnimation. This is something really sensitive to touch, I would first reverse the entire animation system before modifying anything further, so if a bug appears, we will know how to fix it. The project can be found here: https://gitlab.com/gtahackers/gta-reversed/
Me and Octaltype a.k.a Necktrox are working on it.

qaisjp

2018-07-17 01:06

administrator   ~~0026742

@saml1er can we report this make a big warning note on the wiki so users are aware that they should not rely on the current behaviour?

Saml1er

2018-07-17 01:10

updater   ~~0026743

@qaisjp Sure, do you mean setPedAnimation or engineReplaceAnimation? or should we update wiki for both?

qaisjp

2018-07-17 01:43

administrator   ~~0026744

Please:

  • "it's not possible to play the replaced animation immediately after calling engineReplaceAnimation via setPedAnimation" - please document this on setPedAnimation
  • "engineReplaceAnimation does not apply the replaced animation if it is currently used" (idle animation) - please document this on engineReplaceAnimation

if that makes sense?

Saml1er

2018-07-17 02:07

updater   ~~0026745

Yes. Done:
https://wiki.multitheftauto.com/wiki/EngineReplaceAnimation
https://wiki.multitheftauto.com/wiki/SetPedAnimation

einheit-101

2018-07-18 00:39

reporter   ~~0026747

When i replace the crouch animation while the player is ducked, it doesnt even help to press any movement key to make it work. The player HAS TO stand up and re-crouch in order to get the replaced animation. I dont know if this is yet another issue or not. So i mention it here.

Saml1er

2018-07-18 03:56

updater   ~~0026748

It's related to this report. If the replaced animation is currently in use, when you switch to some other animation (in your case, standing up) and finally switch back to the replaced animation (crouch), then the new animation is played.

The right way to switch is to use setPedControlState or setControlState because it triggers CAnimBlendAssocGroup::CopyAnimation hook which checks for replaced animation. You can set random control state for ped except for the replaced animation and immediately switch back to the replaced animation by setting the appropriate control state for ped, since you want to play the new crouch animation, you'll need to switch back to the "crouch" control state.

qaisjp

2018-09-05 22:31

administrator   ~~0026978

Moved to https://github.com/multitheftauto/mtasa-blue/issues/371

Issue History

Date Modified Username Field Change