Page 1 of 1

Fading TempEntity

Posted: Sun Apr 22, 2018 8:30 am
by canibozz
Hello,

i was trying to make my laser effect fading.

This is my current code without fading:

Syntax: Select all

hitEffect = TempEntity('BeamPoints', alpha=player.beamOpacity, red=player.beamColor[0], green=player.beamColor[1], blue=player.beamColor[2], life_time=3, fade_length=1, start_width=5, end_width=5, frame_rate=200, start_point=playerOrigin, end_point=shootDirection, model=laser_model, amplitude=1, flags=0, speed=1, halo=laser_model, start_frame=0)
hitEffect.create()


The only solution i came up with was destroying the effect, recreating it in a while loop and setting the opacity value to a lower or higher number in the loop.

Do you have any other idea how to accomplish it?
I tried to set the alpha value in a while loop aswell but the entity didn't "update" the opacity.

Cheers!

Re: Fading TempEntity

Posted: Mon Apr 23, 2018 7:09 pm
by Ayuto
You can't change temporary entities once they are sent. The server will send the entity information to the clients and forgets everything about it.

You can play around with "fade_length", but I think that only affects the start and end points of the beam. A loop should actually work. However, you might also be able to create your own animated material.

Re: Fading TempEntity

Posted: Tue Apr 24, 2018 11:25 am
by canibozz
Okay, did it with an animted texture.
The Problem is that something (Client or Server) is caching the TempEntity making it impossible to start from frame 0 every time so the animation "fades it out".

Vid of what i mean:
https://gyazo.com/41a2b130a81147249af50a67060dcd65

Syntax: Select all

hitEffect = TempEntity('BeamPoints',
alpha=player.beamOpacity,
red=player.beamColor[0],
green=player.beamColor[1],
blue=player.beamColor[2],
life_time=2,
fade_length=1,
start_width=2,
end_width=2,
frame_rate=30,
start_point=playerOrigin,
end_point=shootDirection,
model=laser_model,
amplitude=0,
flags=0,
speed=1,
halo=laser_model,
start_frame=0
)
hitEffect.create()


I See theres not only BEAMPOINTS, theres a SPRITE Temp Entity aswell.
Do you think that would fix my prob.?
Edit: SPRITE Temp Entity has no start_point, end_point.


Cheers,
CANi

Re: Fading TempEntity

Posted: Tue Apr 24, 2018 3:28 pm
by Ayuto
To me it looks like the beam duration takes longer than the animation duration. So, after the animation finished, it's restarted.

Re: Fading TempEntity

Posted: Tue Apr 24, 2018 3:32 pm
by canibozz
Nope,
animation is 2 seconds at 30 fps, TempEntity lifetime is 2 seconds as well.

Re: Fading TempEntity

Posted: Tue Apr 24, 2018 4:16 pm
by Ayuto
I would still try to reduce the beam duration. Just to test it.

Re: Fading TempEntity

Posted: Thu May 03, 2018 3:49 pm
by 12jdlovins
Would you be able to post how you determined the vector they were aiming at?

edit: nevermind found it right after posting http://wiki.sourcepython.com/developing ... view_angle