Skip to content

Instantly share code, notes, and snippets.

@uniboi
Last active July 28, 2022 17:48
Show Gist options
  • Save uniboi/84b6f52211b470bd7eae68160fe1463f to your computer and use it in GitHub Desktop.
Save uniboi/84b6f52211b470bd7eae68160fe1463f to your computer and use it in GitHub Desktop.
Titanfall 2 script to create a weapon tracer with an invisible weapon or none at all
// thanks to The peepeepoopoo man#3301
// basically ripped out of _arc_cannon.nut
void function CreateWeaponTracer( vector startPos, vector endPos, float lifeDuration, asset tracerAsset = $"P_wpn_tracer" )
{
entity cpEnd = CreateEntity( "info_placement_helper" )
cpEnd.SetOrigin( endPos )
SetTargetName( cpEnd, UniqueString( "arc_cannon_beam_cpEnd" ) )
DispatchSpawn( cpEnd )
entity tracer = CreateEntity( "info_particle_system" )
tracer.kv.cpoint1 = cpEnd.GetTargetName()
tracer.SetValueForEffectNameKey( tracerAsset )
tracer.kv.start_active = 0
tracer.SetOrigin( startPos )
DispatchSpawn( tracer )
tracer.Fire( "Start" )
tracer.Fire( "StopPlayEndCap", "", lifeDuration )
tracer.Kill_Deprecated_UseDestroyInstead( lifeDuration )
cpEnd.Kill_Deprecated_UseDestroyInstead( lifeDuration )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment