Page 1 of 1

how to draw a circle that stays on?

Posted: Tue Dec 16, 2014 4:47 am
by 8guawong

Syntax: Select all

temp_entities.beam_ring_point(RecipientFilter(index), 0, center, start_radius, end_radius, model_index, halo_index, startframe, framerate,
life, width, spread, amplitude,
red, green, blue, alpha, speed, flags
)


this draws a circle then expand then disappears
but i want a circle that just stays around the player

i tried changing start and end radius to same number but the circle dissappears

Posted: Tue Dec 16, 2014 5:13 am
by satoon101
The 'life' argument is the one that you need to change. That argument is the number of seconds for the effect to last.

Posted: Tue Dec 16, 2014 5:56 am
by 8guawong
satoon101 wrote:The 'life' argument is the one that you need to change. That argument is the number of seconds for the effect to last.


that only makes the circle expand slower

i just want a circle with the same radius not an expanding circle with difference radius

Syntax: Select all

startframe=255, framerate=255, life=5, width=5, spread=0, amplitude=0, red=255, green=0, blue=0, alpha=255, speed=1, flags=0


only way i can do it is set the start and end radius very close like 50 and 51 then you can hardly notice the circle expanding

Posted: Tue Dec 16, 2014 7:34 am
by satoon101
Since the start_radius and end_radius arguments are floats, you can actually set them even closer than 1 apart. You cannot set them equal to each other, as that will cause the effect to not show at all. And, while it might be true that the 'life' argument causes the ring to expand/contract slower, its main purpose is the amount of time the effect is shown. I have tested setting the life to 5.0 and then testing with life set to 20.0, and both times, the effect was shown for exactly that number of seconds.

Here is my test code:

Syntax: Select all

from colors import BLUE
from colors import RED
from effects import temp_entities
from engines.precache import Model
from events import Event
from filters.players import PlayerIter
from filters.recipients import RecipientFilter
from mathlib import Vector
from players.entity import PlayerEntity
from players.helpers import index_from_userid

colors = {
2: RED,
3: BLUE,
}

"""
Arguments
"""

# filter (RecipientFilter) - handled in function

# delay (float)
delay = 0.0

# center (Vector) - handled in function

# start_radius (float)
start_radius = 50.1

# end_radius (float)
end_radius = 50.0

# model_index and halo_index - handled in function
model = Model('sprites/laserbeam.vmt')

# startframe (int)
startframe = 255

# framerate (int)
framerate = 255

# life (float)
life = 20.0

# width (float)
width = 1.0

# spread (int)
spread = 1

# amplitude (float)
amplitude = 1.0

# red, green, blue, alpha - handled in function

# speed (int)
speed = 1

# flags (int)
flags = 0

"""
End of arguments
"""


@Event
def player_say(game_event):
player = PlayerEntity(index_from_userid(game_event.get_int('userid')))
other = player.get_view_player()
if other is None:
print('No player')
return
if other.team not in colors:
print('Not on team')
return
color = colors[other.team]
temp_entities.beam_ring_point(
RecipientFilter(player.index), delay,
other.origin + Vector(0.0, 0.0, 20.0),
start_radius, end_radius, model.index, model.index,
startframe, framerate, life, width, spread, amplitude,
color.r, color.g, color.b, color.a, speed, flags)

@Event
def round_freeze_end(game_event):
for player in PlayerIter('bot', return_types='player'):
player.freeze = True