Character leaving a trail?

As the title suggests, is there a simple way to make it so that a players character leaves a trail be it even a simple line? And for it to be visible for everyone else playing also.

The kind of effect I am looking for is either:

  1. leaving like a paint trail on the floor
  2. leaving a trail quite like the light cycles in Tron

Cheers in advance for any helpful suggestions people come up with. :slight_smile:

Use the wiki., Or did you?

Basically, on spawn make it Util a particletrail on the player who just spawned, or hook it in somewhere else.

Thanks a lot, I don’t know how I missed that on the Wiki! Works perfectly :slight_smile:

another two questions now though!

  1. How would I go about turning the trail off, when a command is entered?
  2. Is there anyway I can test if the player is colliding with the trail? Or will I have to use a different method altogether for this?

The code I have so far is:

[lua]function Trail_On(ply,command,args)
//Entity, AttachmentID, Color , additive, Start Width, End Width, LifeTime, TextureRes, Texture
Trail = util.SpriteTrail(ply, 0, Color(255,0,0), false, 50, 0, 20, 1/(150+1)*0.5,“trails/smoke.vmt”)
end
concommand.Add(“trail_on”,Trail_On) [/lua]

Try this.
[lua]function Trail_On(ply,command,args)
//Entity, AttachmentID, Color , additive, Start Width, End Width, LifeTime, TextureRes, Texture
ply.Trail = util.SpriteTrail(ply, 0, Color(255,0,0), false, 50, 0, 20, 1/(150+1)*0.5,“trails/smoke.vmt”)
end
concommand.Add(“trail_on”,Trail_On)
function Trail_Off(ply,command,args)
if IsValid(ply.Trail) then
ply.Trail:Remove()
end
end
concommand.Add(“trail_off”,Trail_Off)[/lua]
Untested, just a guess.
As for colliding with the trail, that’ll be something you’ll have to work out yourself, it won’t support it by default.
However, I think I might have a go at doing that myself. Hmm.

Sounds like someone’s making Light Cycles.

Cheers! That sort of does what I want, but I want the trail to still be there once the player turns it off, I shall have to work on it a bit more later I guess, along with the colliding…

I know a simple solution which I have used in one of my other projects, but that using using my own engine in C++… is it possible to say create an entity/model and specify their start position and end position so they will be stretched along the game world? If that makes anyway sense what so ever but if it does I think it’s fairly obvious to what I am getting at here.