how to draw a circle that stays on?

Please post any questions about developing your plugin here. Please use the search function before posting!
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

how to draw a circle that stays on?

Postby 8guawong » Tue Dec 16, 2014 4:47 am

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
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Dec 16, 2014 5:13 am

The 'life' argument is the one that you need to change. That argument is the number of seconds for the effect to last.
Image
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Tue Dec 16, 2014 5:56 am

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
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Dec 16, 2014 7:34 am

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
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 19 guests