[Mods animation] How to add an animation of appearance when spawning monsters?

+
Hello!
I would like to visually increase the spawn of mobs by adding animation.
Spawn code:
PHP:
function spawnMods (nam : string, optional quantity : int, optional distance : float, optional friend : bool) {
        var ent : CEntity;
        var horse : CEntity;
        var pos, cameraDir, player, posFin, normal : Vector;
        var rot : EulerAngles;
        var i, sign : int;
        var s,r,x,y : float;
        var template : CEntityTemplate;
        var horseTemplate : CEntityTemplate;
        var horseTag : array<name>;
        
        quantity = Max(quantity, 1);
        
        rot = thePlayer.GetWorldRotation();   
        rot.Yaw += 180;       
        
        
        cameraDir = theCamera.GetCameraDirection();
        
        if( distance == 0 ) distance = 3;
        cameraDir.X *= distance;   
        cameraDir.Y *= distance;
        
        
        player = thePlayer.GetWorldPosition();
        
        
        pos = cameraDir + player;   
        pos.Z = player.Z;
        
        
        posFin.Z = pos.Z;           
        s = quantity / 0.2;           
        r = SqrtF(s/Pi());
        
        template = (CEntityTemplate)LoadResource(nam, true);
        
        for(i=0; i<quantity; i+=1) {       
            x = RandF() * r;           
            y = RandF() * (r - x);       
            
            if(RandRange(2))                   
                sign = 1;
            else
                sign = -1;
                
            posFin.X = pos.X + sign * x;   
            
            if(RandRange(2))                   
                sign = 1;
            else
                sign = -1;
                
            posFin.Y = pos.Y + sign * y;   
                    
            theGame.GetWorld().StaticTrace( posFin + 5, posFin - 5, posFin, normal );
            
            ent = theGame.CreateEntity(template, posFin, rot);

            ((CActor)ent).PlayEffect('magic_shield_hit');

            if ( horseTemplate ) {
                horseTag.PushBack('enemy_horse');
                horse = theGame.CreateEntity(horseTemplate, posFin, rot,true,false,false,PM_DontPersist,horseTag);
                
                ((CActor)ent).SignalGameplayEventParamInt( 'RidingManagerMountHorse', MT_instant | MT_fromScript );
            }
                
            ((CActor)ent).ForceVulnerable();
                
            if( friend ) {
                ((CActor)ent).SetTemporaryAttitudeGroup( 'player', AGP_Default );
            }
            else {
                ((CActor)ent).SetTemporaryAttitudeGroup( 'monsters', AGP_Default );
            }

            ((CActor)ent).ForceVulnerable();

            ((CNewNPC)ent).SetLevel( RandRange(thePlayer.GetLevel(),thePlayer.GetLevel() + 3) );
        }
    }

I tried to add animation through the PlayStreetAnimation Ason, as it is implemented in the fashion https://www.nexusmods.com/witcher3/mods/2597/

PHP:
animatedComponent = ( CAnimatedComponent )((CEntity)actors[0]).GetComponentByClassName( 'CAnimatedComponent' );   
                
        settings.blendIn = 1;
        settings.blendOut = 0;
                
        animatedComponent.PlaySlotAnimationAsync ( 'dettlaff_diving', 'NPC_ANIM_SLOT', settings);

This works, but only for detlaff_monster.w2ent

I would like to implement myself as the first level with Keira. Calling hounds from portals

ebe62_520na_ochup__479_.jpg


I will be very glad to any help! Thanks!
 
Top Bottom