Raised This Month: $ Target: $400
 0% 

[CS:GO] Stopping sprite animation on a frame


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vasto_Lorde
Junior Member
Join Date: Oct 2016
Old 03-06-2019 , 07:56   [CS:GO] Stopping sprite animation on a frame
Reply With Quote #1

Can you stop sprite animation on a certian frame in SourceMod? If i remember correctly there was something like this in AMX
Or just to set the starting frame to some value, so i can just destroy previous env_sprite on frame X and create new one that has framerate=0 and is starting on frame X

My code:
Code:
	int iEntitySprite = CreateEntityByName("env_sprite");
	if (iEntitySprite && IsValidEntity(iEntitySprite))
	{
		DispatchKeyValue(iEntitySprite, "model", "materials/healthbarsprites/health_green.vmt");
		DispatchKeyValue(iEntitySprite, "classname", "health_bar");
		DispatchKeyValue(iEntitySprite, "framerate", "10");
		DispatchKeyValue(iEntitySprite, "spawnflags", "1");
		DispatchKeyValue(iEntitySprite, "scale", "1.0");
		DispatchKeyValue(iEntitySprite, "rendermode", "1");
		DispatchSpawn(iEntitySprite);
		
		TeleportEntity(iEntitySprite, fClientOrigin, NULL_VECTOR, NULL_VECTOR);
		
		SetVariantString(iEntityTarget);
		
		AcceptEntityInput(iEntitySprite, "SetParent", iEntitySprite, iEntitySprite, 0);
		AcceptEntityInput(iEntitySprite, "ShowSprite");
	}
And the vmt:

Code:
"UnlitGeneric"
{
	"$receiveflashlight" 0
	"$singlepassflashlight" 0
	"$basetexture" "health_green"
	"$alphatest" 1
	"$translucent" 1
	"$vertexalpha" 1
	"$vertexcolor" 1
	"$framerate"   60.0
}
In here https://developer.valvesoftware.com/wiki/Env_sprite There are some KeyValues like "Starting Frame" but that does not seem to work

Any tips how can i solve my problem?
Vasto_Lorde is offline
adma
Senior Member
Join Date: Oct 2015
Old 03-07-2019 , 19:46   Re: [CS:GO] Stopping sprite animation on a frame
Reply With Quote #2

Try setting the Prop_Data (datamap) property m_flMaxFrame to something. According to https://github.com/ValveSoftware/sou...prite.cpp#L492, if m_flMaxFrame is not 0 and the sprite isnt on Play Once mode, the sprite frame will get set to the max frame when it animates. If the sprite is Play Once mode, then the sprite will disappear when it hits m_flMaxFrame
adma 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 07:11.


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