AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Entity animation bugged frames. (https://forums.alliedmods.net/showthread.php?t=335594)

redivcram 12-16-2021 18:00

Entity animation bugged frames.
 
I am trying to spawn an entity and play its animation to the end right when it spawns. What happens is that upon spawning, the animations starts playing up to certain frames, resets to the first frame then continues after a few moments. This could be best shown with a video example: https://youtu.be/XiXJi3-640o. You can clearly see how it is bugged out.

PHP Code:

public CmdCorpse(iPlayer) {
    
    new 
iOrigin[3], Float:fOrigin[3];
    
get_user_origin(iPlayeriOrigin2);
    
    
IVecFVec(iOriginfOrigin);
    
    new 
entCorpse create_entity("info_target");
    
    if (!
entCorpse) {
        
        
log_amx("Could not create custom corpse entity.");
        return 
FMRES_IGNORED;
    }
    
    
entity_set_string(entCorpseEV_SZ_classname"custom_corpse");
    
    
entity_set_model(entCorpse"models/player/terror/terror.mdl");
    
    
entity_set_int(entCorpseEV_INT_solidSOLID_TRIGGER);
    
entity_set_int(entCorpseEV_INT_movetypeMOVETYPE_TOSS);
    
    
fOrigin[2] += 50.0;
    
entity_set_origin(entCorpsefOrigin);
    new 
Float:maxs[3] = {16.016.036.0};
    new 
Float:mins[3] = {-16.0, -16.0, -36.0};
    
entity_set_size(entCorpseminsmaxs);
    
    
entity_set_int(entCorpseEV_INT_sequence107);
    
entity_set_float(entCorpseEV_FL_frame1.0);
    
entity_set_float(entCorpseEV_FL_animtimeget_gametime());
    
entity_set_float(entCorpseEV_FL_framerate1.0);

    return 
FMRES_IGNORED;


This code is how I managed to spawn an entity and set its animation. Suggestions for better methods (that work, obviously) are open!

I don't know what animtime does actually, but setting it to 100.0 like seen in many threads related to animations delays the animation for a few seconds. Clueless.

DJEarthQuake 12-16-2021 18:44

Re: Entity animation bugged frames.
 
Monster_scientist_dead_(GoldSource_Engine)
These appear as hostages sitting on the ground on CS/CZ and can be spawned via Amxx. There are no bugged frames. Lots of potential.

redivcram 12-16-2021 19:43

Re: Entity animation bugged frames.
 
I'm getting an [ENGINE] Invalid entity 42 error. Specifically, here:
PHP Code:

entity_set_string(entCorpseEV_SZ_classname"brutalcs_corpse");
// And anywhere entCorpse is being used as a pointer to the entity within the engine funcs. 

My goal is spawning an entity and playing an animation to the end upon spawn. The corpse was an example. Did you mean that monster_scientist_dead is supposed to be used instead of info_target for the animations to properly work?

Natsheh 12-17-2021 06:56

Re: Entity animation bugged frames.
 
Quote:

Originally Posted by redivcram (Post 2766263)

My goal is spawning an entity and playing an animation to the end upon spawn.

Isn't that what is actually happening?

redivcram 12-17-2021 08:01

Re: Entity animation bugged frames.
 
Quote:

Originally Posted by Natsheh (Post 2766302)
Isn't that what is actually happening?

Have you checked the video and even read the thread?

HamletEagle 12-17-2021 09:04

Re: Entity animation bugged frames.
 
Try setting pev_frame to 0.0, not 1.0

Natsheh 12-17-2021 15:19

Re: Entity animation bugged frames.
 
Quote:

Originally Posted by redivcram (Post 2766307)
Have you checked the video and even read the thread?

You want to remove the idle animation from death sequence?

redivcram 12-17-2021 15:38

Re: Entity animation bugged frames.
 
Quote:

Originally Posted by HamletEagle (Post 2766309)
Try setting pev_frame to 0.0, not 1.0

No difference. Tried that one already.


Quote:

Originally Posted by Natsheh (Post 2766331)
You want to remove the idle animation from death sequence?

:arrow:
Quote:

Originally Posted by redivcram (Post 2766256)
I am trying to spawn an entity and play its animation to the end right when it spawns. What happens is that upon spawning, the animations starts playing up to certain frames, resets to the first frame then continues after a few moments. This could be best shown with a video example: https://youtu.be/XiXJi3-640o. You can clearly see how it is bugged out.

:arrow:
Quote:

Originally Posted by redivcram (Post 2766263)
My goal is spawning an entity and playing an animation to the end upon spawn.

---------------------------------------------------------------------------

Summary: I am spawning an entity with set model (player/terror.mdl), sequence 107, normal framerate of value 1.0. The 107th sequence is the death animation. This animation is not set to loop like the idle animation for instance, which is why I chose that one particular. (To mimic a corpse, but my goal here is not getting a corpse exclusively, my goal is to successfully play the animation from start to end on my own custom entity). The problem is the "twitch" it does as seen in the video. I want to get rid of it and play the animation normally, from start to end and leave the model lying down.

Natsheh 12-18-2021 09:29

Re: Entity animation bugged frames.
 
Try reordering you entity creation code properly?

this might work?

PHP Code:

public CmdCorpse(iPlayer) {
    
    new 
iOrigin[3], Float:fOrigin[3];
    
get_user_origin(iPlayeriOrigin2);
    
    
IVecFVec(iOriginfOrigin);
    
    new 
entCorpse create_entity("info_target");
    
    if (!
entCorpse) {
        
        
log_amx("Could not create custom corpse entity.");
        return 
FMRES_IGNORED;
    }
    
    
entity_set_string(entCorpseEV_SZ_classname"custom_corpse");
    
    
entity_set_int(entCorpseEV_INT_solidSOLID_TRIGGER);
    
entity_set_int(entCorpseEV_INT_movetypeMOVETYPE_TOSS);
    
    
fOrigin[2] += 50.0;
    
entity_set_origin(entCorpsefOrigin);

    
entity_set_model(entCorpse"models/player/terror/terror.mdl");
    new 
Float:maxs[3] = {16.016.036.0};
    new 
Float:mins[3] = {-16.0, -16.0, -36.0};
    
entity_set_size(entCorpseminsmaxs);

    
entity_set_float(entCorpseEV_FL_frame1.0);
    
entity_set_float(entCorpseEV_FL_framerate1.0);
    
entity_set_int(entCorpseEV_INT_sequence107);
    
//entity_set_float(entCorpse, EV_FL_animtime, get_gametime()); maybe the anime time is glitching the thing?

    
return FMRES_IGNORED;




All times are GMT -4. The time now is 01:28.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.