Fading TempEntity

Please post any questions about developing your plugin here. Please use the search function before posting!
canibozz
Member
Posts: 32
Joined: Wed Apr 11, 2018 7:55 am

Fading TempEntity

Postby canibozz » Sun Apr 22, 2018 8:30 am

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!
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Fading TempEntity

Postby Ayuto » Mon Apr 23, 2018 7:09 pm

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.
canibozz
Member
Posts: 32
Joined: Wed Apr 11, 2018 7:55 am

Re: Fading TempEntity

Postby canibozz » Tue Apr 24, 2018 11:25 am

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
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Fading TempEntity

Postby Ayuto » Tue Apr 24, 2018 3:28 pm

To me it looks like the beam duration takes longer than the animation duration. So, after the animation finished, it's restarted.
canibozz
Member
Posts: 32
Joined: Wed Apr 11, 2018 7:55 am

Re: Fading TempEntity

Postby canibozz » Tue Apr 24, 2018 3:32 pm

Nope,
animation is 2 seconds at 30 fps, TempEntity lifetime is 2 seconds as well.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Fading TempEntity

Postby Ayuto » Tue Apr 24, 2018 4:16 pm

I would still try to reduce the beam duration. Just to test it.
12jdlovins
Junior Member
Posts: 17
Joined: Mon Apr 16, 2018 5:11 am

Re: Fading TempEntity

Postby 12jdlovins » Thu May 03, 2018 3:49 pm

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

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 34 guests