Draw box around bomb zone
Posted: Sat Mar 17, 2018 4:11 pm
Hey guys, I'm currently trying to draw a box around the bomb zones.
This is the code I use:
This works almost perfectly, but I have one problem. While one box is drawn perfectly the other one looks like this:

When I add 300 to the height it shows correctly and someone told me that it might be because the lines start inside the worldspawn.
Any ideas how to fix this?
Edit: On de_dust2 the box does only draw on A (with all lines) and not a single line on B
This is the code I use:
Syntax: Select all
from events import Event
from players.entity import Player
from filters.entities import EntityIter
from effects import beam
from filters.recipients import RecipientFilter
from mathlib import Vector
from engines.precache import Model
from effects import box
model = Model('sprites/tp_beam001.vmt')
@Event('player_say')
def say(ev):
cnt = 0
userid = int(ev['userid'])
player = Player.from_userid(userid)
for ent in EntityIter():
if ent.classname == 'func_bomb_target':
st = Vector(*ent.mins)
end = Vector(*ent.maxs)
st[2] += 50
end[2] = st[2]
do_box(st,end)
def do_box(start,end):
box(
RecipientFilter(),
start,
end,
alpha=255,
blue=255,
green=0,
red=255,
amplitude=0,
end_width=15,
life_time=7,
start_width=15,
fade_length=0,
flags=0,
frame_rate=255,
halo=model,
model=model,
start_frame=0
)
This works almost perfectly, but I have one problem. While one box is drawn perfectly the other one looks like this:

When I add 300 to the height it shows correctly and someone told me that it might be because the lines start inside the worldspawn.
Any ideas how to fix this?
Edit: On de_dust2 the box does only draw on A (with all lines) and not a single line on B