Page MenuHomeFeedback Tracker

[Request] Officially supported method of properly setting animations/ik instances.
Closed, ResolvedPublic

Description

Currently, there is no 'right' way to register an animation setup for your modded items. Many of us are doing this currently, but it has a chance to crash the server when it runs:

modded class PlayerBase
{
    override void Init()
    {            
        DayzPlayerItemBehaviorCfg     fireArmsItemBehaviour = new DayzPlayerItemBehaviorCfg;        
        fireArmsItemBehaviour.SetFirearms();
        
        GetDayZPlayerType().AddItemInHandsProfileIK("MyModdedWeapon", "dz/anims/workspaces/player/player_main/weapons/player_main_cz527.asi", fireArmsItemBehaviour, "dz/anims/anm/player/ik/weapons/cz527.anm", "dz/anims/anm/player/reloads/cz527/w_CZ527_states.anm");        
        super.Init();     
    }
}

We are 99% sure this is the cause for the crashes reported to happen on player respawn/creation on modded servers. We've tried to only set it once and not set again if already set, but it still seems to crash. Hopefully if an official way to set our animations up was in 1.08 it would eliminate a *lot* of server crashes for modded servers. I know something like this is probably coming when custom animation support arrives, but hopefully now we know this is causing crashes we can get the support to set .asi/ik early even if animation support is not ready.

Details

Severity
Feature
Resolution
Open
Reproducibility
Sometimes
Operating System
Windows 7
Category
General

Event Timeline

Jest added a subscriber: Jest.Apr 14 2020, 12:39 AM
Unknown Object (User) added a subscriber: Unknown Object (User).Apr 14 2020, 12:49 AM
Tyson added a subscriber: Tyson.Apr 14 2020, 1:10 AM
TheGL added a subscriber: TheGL.Apr 14 2020, 1:30 AM
Geez changed the task status from New to Assigned.Apr 15 2020, 12:14 PM

The current function of the game for registering items IK: DayZPlayerTypeRegisterItems(DayZPlayerType Type) is a global function.

And we can't mod this function, that's why modders can't easily add new IK animation. If this function would be inside a class, we could easily mod it.
So you just need to create a new class and move this function into it.
Don't forget we can't mod static function, so it's should not be a static function.

Thanks for the assignment.

As said in https://feedback.bistudio.com/T149787, went from over 24 crashes a day to one and after 18,5 hours of uptime, this is definitely what causes the crashes on player spawns events.

Jacob_Mango added a subscriber: Jacob_Mango.EditedApr 16 2020, 12:54 PM

Added a temporary feature into Community Framework, in 4_World use this for now. This should hopefully resolve issues until a proper and crash free solution is implemented.

Methods (don't forget to call super): https://github.com/Jacob-Mango/DayZ-Community-Framework/blob/steam/JM/CF/Scripts/4_World/Classes/JMAnimRegister.c#L56-L110

How to use:

modded class JMAnimRegister
{
  override void OnRegisterFireArms( DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior )
  {
    super.OnRegisterFireArms( pType, pBehavior );
    pType..AddItemInHandsProfileIK("MyModdedWeapon", "dz/anims/workspaces/player/player_main/weapons/player_main_cz527.asi", pBehavior, "dz/anims/anm/player/ik/weapons/cz527.anm", "dz/anims/anm/player/reloads/cz527/w_CZ527_states.anm");    
  }
};

This hasn't been tested to see if it does fix the crashes but we have used a similar solution in the Expansion mod with no problems yet.

Xairo added a subscriber: Xairo.May 4 2020, 10:15 PM
Geez closed this task as Resolved.May 5 2020, 11:13 AM
Geez claimed this task.
Geez added a subscriber: Geez.

Hello Ficarra1002.
In 1.08 it is going to be possible to do this with the following class:

class ModItemRegisterCallbacksclass ModItemRegisterCallbacks
{

void RegisterEmptyHanded(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterOneHanded(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterTwoHanded(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterRestrained(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterSurrender(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterHeavy(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterPistol(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterFireArms(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterArcheryItem(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterLauncher(DayZPlayerType pType, DayzPlayerItemBehaviorCfg pBehavior);
void RegisterCustom(DayZPlayerType pType);
void CustomBoneRemapping(DayZPlayerType pType);

}

Regards,
Geez

This is amazing news, thank's to everyone that probably worked hard and fast to get this in this fast !

Regards.