Env_beam sparks not appearing on func_train Created 2 years ago2022-04-18 11:21:04 UTC by Foxo Foxo

Created 2 years ago2022-04-18 11:21:04 UTC by Foxo Foxo

Posted 2 years ago2022-04-18 11:21:04 UTC Post #346449
Hello, I'm having an issue in my map, I'm trying to make an effect where a spark moves across a wire. Everything works fine except that the spark is not showing up in game. The end entity of the env_beam is a func_train with an orgin brush that moves across a series of path_corners, the "EndSparks" flag is also checked but still nothing shows up.

Here's what it looks like in game

If anyone knows a solution, please let me know.
Posted 2 years ago2022-04-18 13:22:53 UTC Post #346450
Chances are, the train's origin is inside the wires themselves as it's moving, so the sparks don't appear at all. Have you tried making a beam where it sparks in the air?

If you have and it didn't work, then take into consideration that the rate of sparking depends on the "Life" and "Strike again time" properties. This is how it works according to the code in the Half-Life SDK:
if ( m_life != 0 )
{
    if ( pev->spawnflags & SF_BEAM_RANDOM )
        pev->nextthink = gpGlobals->time + m_life + RANDOM_FLOAT( 0, m_restrike );
    else
        pev->nextthink = gpGlobals->time + m_life + m_restrike;
}
(m_life = "Life", m_restrike = "Strike again time")
Meaning if you set Life to 0 (or not set it at all), it'll never automatically spark.

If you set "Life" to some positive value, that means the beam will be turned on for a while, then off. When it gets back on again, depends on the "Strike again time".

If you wanna avoid the flickering that'd happen because of that, my guess is that you could set "Life" to some negative value, like -0.1 and "Strike again time" to something like 0.2. That way, you'll get 0.1 seconds between each spark.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-04-18 14:25:11 UTC Post #346451
It worked, thank you so much
Posted 2 years ago2022-04-18 17:59:13 UTC Post #346452
You're welcome :3
Admer456 Admer456If it ain't broken, don't fox it!
You must be logged in to post a response.