


Kami wrote:Should the colors be inside of one spawn effect or should you have a random chance to either get a red or a blue or a green spawn effect? Or is it ment for team play, where every team gets a different color?
Sounds greatKami wrote:Mhmm, how about random colors all together? Like every spawn you can get one random color for your spawn effect. Or are you set on the three colors?
Syntax: Select all
from colors import GREEN
from effects.base import TempEntity
from engines.precache import Model
from events import Event
from mathlib import Vector
from players.entity import Player
import random
model = Model("sprites/lgtning.vmt")
@Event('player_spawn')
def _player_spawn(ev):
player = Player.from_userid(ev['userid'])
x = 0
r = random.randrange(0, 255)
g = random.randrange(0, 255)
b = random.randrange(0, 255)
while x < 70:
create_ring(Vector(player.origin[0],player.origin[1],player.origin[2]+x),r,g,b)
x += 10
def create_ring(position,r,g,b):
te = TempEntity('BeamRingPoint')
te.model = model
te.halo = model
te.center = position
te.start_radius = 40
te.end_radius = 60
te.frame_rate = 100
te.life_time = 1
te.start_width = 10
te.end_width = 60
te.fade_length = 6
te.amplitude = 10
te.red = r
te.green = g
te.blue = b
te.alpha = 255
te.speed = 100
te.create()
Syntax: Select all
te.start_width = 10
This will change the size of the sprite. The lower you set this the more it looks like a lightning. The higher you set it the less you see a gap between the rings. Setting it too high will make it look like a blob, instead of rings.
Syntax: Select all
te.amplitude = 10
This will set how flat each ring is. The higher you set it the more fluctuation you get.
Syntax: Select all
te.start_radius = 40
te.end_radius = 60
The more the end_radius differs from the start_radius the faster it goes (it will go from start to end in its life time, so it has to cover more distance if the distance is higher)
Users browsing this forum: Bing [Bot] and 80 guests