Raised This Month: $ Target: $400
 0% 

Make entity's model loop an animation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Desktop
AlliedModders Donor
Join Date: Sep 2009
Location: C:\Users\Default\
Old 06-09-2017 , 15:29   Make entity's model loop an animation
Reply With Quote #1

How to make my entity to loop any animation?
Tried setting it to randomanim but didn't work

PHP Code:
int entity CreateEntityByName("prop_dynamic");
    
    if (
IsValidEntity(entity))
    {
        
float vector[3];
        
GetAimCoords(clientvector);
        
        
DispatchKeyValue(entity"Classname""MyEnt"); // used to detect while users aim and press E
        
DispatchKeyValue(entity"model""models/player/ctm_gign.mdl");
        
DispatchKeyValue(entity"Solid""6");
        
        
TeleportEntity(entityvectorNULL_VECTORNULL_VECTOR); // move it to the coordinates
        
        
DispatchSpawn(entity);
        
ActivateEntity(entity); // After activating the entity, we may apply the animation
        
        
SetEntPropString(entityProp_Data"m_iszDefaultAnim""Idle");
        
AcceptEntityInput(entity"Enable");
        
AcceptEntityInput(entity"TurnOn");
        
    } 
The main idea is to make my entity to simulate its breathing and not standing rigid.
__________________
Massive Infection:: Piu-Games
Desktop is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 06-09-2017 , 15:45   Re: Make entity's model loop an animation
Reply With Quote #2

Try setting m_nSequence to the corresponding sequence index.
Kinsi is offline
Desktop
AlliedModders Donor
Join Date: Sep 2009
Location: C:\Users\Default\
Old 06-09-2017 , 16:06   Re: Make entity's model loop an animation
Reply With Quote #3

Yeah, tried but setting m_nSequence only changes the animation, it doesn't loop it.
PHP Code:
SetEntProp(iTargetProp_Send"m_nSequence"iSequence
__________________
Massive Infection:: Piu-Games
Desktop is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 06-09-2017 , 17:01   Re: Make entity's model loop an animation
Reply With Quote #4

Ohh i see. You could try to dispatch the default animation as a keyvalue before spawning the prop. They KV is called DefaultAnim, works for me, at least for models compiled into the map.
Kinsi is offline
Desktop
AlliedModders Donor
Join Date: Sep 2009
Location: C:\Users\Default\
Old 06-09-2017 , 18:18   Re: Make entity's model loop an animation
Reply With Quote #5

Thanks, that worked!
What should be called before and after spawning the prop to get it working like in this case?
__________________
Massive Infection:: Piu-Games
Desktop is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 06-09-2017 , 18:58   Re: Make entity's model loop an animation
Reply With Quote #6

DispatchKeyValue's should generally be called before spawning the prop, and since i've spawned props with default animations before when making maps, i just suggested you to do it this way. There probably is a way to define it afterwards w/ netprops but there is no need to do that in your case i guess.

Last edited by Kinsi; 06-09-2017 at 18:59.
Kinsi is offline
Desktop
AlliedModders Donor
Join Date: Sep 2009
Location: C:\Users\Default\
Old 06-10-2017 , 12:40   Re: Make entity's model loop an animation
Reply With Quote #7

Thank you very much!
I appreciate people that helps when they can.
__________________
Massive Infection:: Piu-Games
Desktop is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:20.


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