Author Topic: env_spritetrail help  (Read 826 times)

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 497
    • View Profile
env_spritetrail help
« on: March 26, 2015, 04:19:24 PM »
Hi all,

So we've been using TE_SetupBeamFollow for a few of our races with fairly good results.  The biggest problem is that the attachment model seems to be right in front of the face on some models, meaning the player has a dot in their screen.

I'm looking at learning how to use env_spritetrails, which I believe are significantly more powerful.  However, I have no idea where to start.

Any pointers?

Revan

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: env_spritetrail help
« Reply #1 on: March 27, 2015, 07:34:50 AM »
I never used env_spritetrail but env_smokestack(you can do pretty much the same with them)
But keep in mind that this uses up a entity index(unlike temp ents).

Long trail:
Code: [Select]
public Action:Timer_GiveEffect( Handle:timer, any:client )
{
    if(ValidPlayer(client, true))
    {
        new particle = CreateEntityByName("env_smokestack");
        if(particle != -1)
        {
            decl String:Name[32], Float:fPos[3];
            Format(Name, sizeof(Name), "W3S_Trail#%i", client);
            GetEntPropVector(client, Prop_Send, "m_vecOrigin", fPos);
            fPos[2] += 20.0;

            DispatchKeyValueVector(particle, "Origin", fPos);
            DispatchKeyValueFloat(particle, "BaseSpread", 0.5);
            DispatchKeyValueFloat(particle, "StartSize", 5.0);
            DispatchKeyValueFloat(particle, "EndSize", 5.0);
            DispatchKeyValueFloat(particle, "Twist", 0.0);
           
            DispatchKeyValue(particle, "Name", Name);
            DispatchKeyValue(particle, "SmokeMaterial", "particle/fire.vmt");
            if(GetClientTeam(client)==3) {
                DispatchKeyValue(particle, "RenderColor", "100 100 255");
            } else {
                DispatchKeyValue(particle, "RenderColor", "230 100 100");
            }
            DispatchKeyValue(particle, "SpreadSpeed", "0");
            DispatchKeyValue(particle, "RenderAmt", "100");
            DispatchKeyValue(particle, "JetLength", "1");
            DispatchKeyValue(particle, "RenderMode", "0");
            DispatchKeyValue(particle, "Initial", "0");
            DispatchKeyValue(particle, "Speed", "1");
            DispatchKeyValue(particle, "Rate", "100");
            DispatchSpawn(particle);
            SetVariantString("!activator");
            AcceptEntityInput(particle, "SetParent", client, particle, 0);
            AcceptEntityInput(particle, "TurnOn");
           
            iTrailEntity[client] = particle;
        }
    }
}

public OnWar3EventSpawn(client)
{
    // RequestFrame should work too.. (this code is old :)
    CreateTimer(1.0, Timer_GiveEffect, client);
}

public OnWar3EventDeath(victim,attacker)
{
    new ent = iTrailEntity[victim];
    if(IsValidEntity(ent))
    {
        AcceptEntityInput(ent, "Kill");
    }
}
« Last Edit: March 28, 2015, 01:34:40 PM by Revan »
#war3source on gamesurge