Raised This Month: $ Target: $400
 0% 

[CSGO] Create entity with model and animate it


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vasto_Lorde
Junior Member
Join Date: Oct 2016
Old 09-13-2017 , 05:39   [CSGO] Create entity with model and animate it
Reply With Quote #1

Im trying to create an entity and animate it, i googled and found "SetAnimation" (that doesnt work), also searched for anwsers on this forum. Anyone here knows how to do it properly? (maybe my code is invalid). The model spawns properly.

Code:
int ent = CreateEntityByName("prop_dynamic");
if(ent != -1 && IsValidEntity(ent)){
	DispatchKeyValue(ent, "model", mGhoul);
	DispatchKeyValue(ent, "targetname", "ghoul");
	
	float angle[3];
	angle[1] = GetRandomInt(1, 360)+0.0;
	DispatchKeyValue(ent, "ClassName", "ghoul");
	DispatchKeyValueVector(ent, "Origin", gMonstersGhoulsSpawns[i]);
	DispatchKeyValueVector(ent, "Angles", angle);
	DispatchSpawn(ent);
	
	
	switch(GetRandomInt(0, 2)){ // 1 of 3 anims
		case 0:{
			SetVariantString("ragdoll");
			AcceptEntityInput(ent, "SetAnimation");
		}
		case 1:{
			SetVariantString("testWalkN");
			AcceptEntityInput(ent, "SetAnimation");
		}
		case 2:{
			SetVariantString("Hop");
			AcceptEntityInput(ent, "SetAnimation");
		}
	}
	
}
Code:
int ent = CreateEntityByName("prop_dynamic_override");
if(ent != -1 && IsValidEntity(ent)){
	DispatchKeyValue(ent, "model", mGhoul);
	DispatchKeyValue(ent, "targetname", "ghoul");
	
	float angle[3];
	angle[1] = GetRandomInt(1, 360)+0.0;
	DispatchKeyValue(ent, "ClassName", "ghoul");
	DispatchKeyValueVector(ent, "Origin", gMonstersGhoulsSpawns[i]);
	DispatchKeyValueVector(ent, "Angles", angle);
	
	ActivateEntity(ent);
	DispatchSpawn(ent);
	
	switch(GetRandomInt(0, 2)){
		case 0:{
			SetVariantString("ragdoll");
		}
		case 1:{
			SetVariantString("testWalkN");
		}
		case 2:{
			SetVariantString("Hop");
		}
	}
	AcceptEntityInput(ent, "SetAnimation", -1, -1, 0);  
	AcceptEntityInput(ent, "Enable");
	AcceptEntityInput(ent, "TurnOn", ent, ent, 0);
}
Attached Thumbnails
Click image for larger version

Name:	screen_of_animations.png
Views:	133
Size:	60.9 KB
ID:	165517  

Last edited by Vasto_Lorde; 09-13-2017 at 05:40.
Vasto_Lorde is offline
Vasto_Lorde
Junior Member
Join Date: Oct 2016
Old 09-13-2017 , 08:41   Re: [CSGO] Create entity with model and animate it
Reply With Quote #2

Again i found my anwser XD i just used
Code:
SetEntProp(ent, Prop_Send, "m_nSequence", number_of_animation);
Vasto_Lorde 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 22:25.


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