env_spritetrail fix for CS:GO

User avatar
myback
Server Admin
Posts: 1051
Joined: Sat Mar 26, 2011 6:42 am
Location: United States

env_spritetrail fix for CS:GO

Post 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
Image
Peter B.: half counter fortress team portal life 2
User avatar
nick_6893
Site Admin
Posts: 668
Joined: Fri Apr 09, 2010 4:09 pm

Re: env_spritetrail fix for CS:GO

Post by nick_6893 »

Interesting. I'll give this a try when I do trails.