Page 1 of 1

Beam Effects

Posted: Fri Sep 13, 2019 2:24 pm
by Painkiller
The test in my script unfortunately doesn't look like the original in event scripts.

Could someone help me with the customization please?

(it is only a part of a larger script)


This is the original code from Eventsripts:

Syntax: Select all

# dessine un beam
def beamEffect(self, userid, radius, c1, loop = 0):
if loop >= 10: return
x,y,z = es.getplayerlocation(userid)
effectlib.drawCircle( (x,y,z + 15),
radius, steps = 10,
width = 5, endwidth = 5,
seconds = .1,
red = c1[0], green = c1[1], blue = c1[2],
model = "sprites/laserbeam.vmt",
halo = "sprites/laserbeam.vmt")

radius += 13
loop += 1
gamethread.delayed(.05, self.beamEffect, (userid, radius, c1, loop))



Test Script:

Syntax: Select all

def blitz(index):
player = playerinfo_from_index(index)
vec1 = player.origin
vec2 = player.origin
vec1.z += 500
vec2.z += 5
functions.emitsound(index, 'npc/strider/fire.wav', 1.0, 0.6)

blitz_model_index = engine_server.precache_model('sprites/laserbeam.vmt')
blitz_halo_index = engine_server.precache_model('sprites/laserbeam.vmt')

for player in PlayerIter('human'):
index = player.index
steamid = player.steamid
if steamid not in settings or settings[steamid]['effects'] == 1:
#TempEntity('BeamPoints', (0, vec2, vec1, blitz_model_index, blitz_halo_index, 0, 1, 1, 3, 3, 3, 100, 113, 208, 255, 255, 0)).create()
eff = TempEntity('BeamPoints')
eff.alpha = 255
eff.blue = 255
eff.green = 208
eff.red = 113
eff.start_point = vec1
eff.amplitude = 3
eff.end_with = 3
eff.start_width = 3
eff.life_time = 3
eff.speed = 1
eff.end_point = vec2
eff.halo_index = blitz_halo_index
eff.model_index = blitz_model_index
eff.frame_rate = 1
eff.create()
sparks(index, player, vec2)
Delay(0.1, sparks, (index, player, vec2))
Delay(0.2, sparks, (index, player, vec2))
Delay(0.3, sparks, (index, player, vec2))
Delay(0.4, sparks, (index, player, vec2))
Delay(0.5, sparks, (index, player, vec2))
Delay(0.6, sparks, (index, player, vec2))
Delay(0.7, sparks, (index, player, vec2))
Delay(0.8, sparks, (index, player, vec2))
Delay(0.9, sparks, (index, player, vec2))
Delay(1.0, sparks, (index, player, vec2))



Thanks in Advance

Re: Beam Effects

Posted: Wed Sep 18, 2019 11:31 am
by Painkiller
Nobody can help ?

Re: Beam Effects

Posted: Sat Dec 28, 2019 3:39 pm
by InvisibleSoldiers
Noticed that the TempEntity.create takes a delay before creating the effect and maybe you can simply do this and behavior will be different:

Syntax: Select all

sparks = TempEntity('BeamPoints')
sparks.alpha = 255
sparks.blue = 255
sparks.green = 208
sparks.red = 113
#...
for i in range(1, 11):
sparks.create(delay=0.1 * i)

I don't know what exactly inside sparks function, but if there the same BeamPoints, probably it will work.
http://wiki.sourcepython.com/developing ... ity.create
Also you pass the same reference to Vector origin, but maybe it's value changes in 0.1 0.2, etc
I really don't know what you wanted to do and you didn't say what to expect and what you got.