Page 1 of 1

env_spritetrail fix for CS:GO

Posted: Mon Apr 03, 2017 3:29 pm
by myback
So I noticed you're using env_smokestacks instead of traditional sprite trails for some of the coin pickup rewards (not that there's anything wrong with that). In CS:GO there's a bug where if you try to give a player a trail using env_spritetrail, it will disappear in about half a second.

There's actually a fix that boils back down to entity scripting, kind of ironic right?
Spoiler
Show
Combine that with sourcepawn and you'll get something like this which checks if the entity created is a spritetrail then does its scripting magic on it:

Code: Select all

public void OnEntityCreated(int entity, char[] classname)
{
   if (StrEqual(classname, "env_spritetrail", false))
   {   
      FixSpriteTrail(entity);
   }
}

stock void FixSpriteTrail(int entity)
{
   SetVariantString("OnUser1 !self:SetScale:1:0.5:-1");
   AcceptEntityInput(entity, "AddOutput");
   AcceptEntityInput(entity, "FireUser1");
}
Result:
Image

Source
Uses:

1. Now any maps added after this fix can actually give spritetrails to the player who finds the secret in the map instead of just parenting a prop BECAUSE THAT'S BORING!!

2. Spritetrails could act as another reward option for the upcoming store & future coin pickups

Re: env_spritetrail fix for CS:GO

Posted: Mon Apr 03, 2017 6:16 pm
by nick_6893
Interesting. I'll give this a try when I do trails.