What is not working as you would like?
If you mean the gap between the red lines, decrease the interval of the next think call
Code:
entity_set_float(entity, EV_FL_nextthink, get_gametime() + 0.1)
If you mean lines are not showing up after flying for some time, there is a limit of visible temp entities. Decrease the life span of each line.
Code:
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMPOINTS)
write_coord_f(origin[0])
write_coord_f(origin[1])
write_coord_f(origin[2])
write_coord_f(origin[0])
write_coord_f(origin[1])
write_coord_f(origin[2] + 9999.0)
write_short(g_spriteIndexLaserBeam)
write_byte(0)
write_byte(0)
write_byte(100)
write_byte(20) // life in 0.1 seconds
write_byte(0)
write_byte(255)
write_byte(0)
write_byte(0)
write_byte(255)
write_byte(0)
message_end()
If you're referring to the problem of not exploding the entity if it is already within the object, I didn't implement that, it will be kept as an exercise for you.
Quote:
If you want to prevent it from exploding if it is already within the object, check if it is the first time that the trace returns true (for that particular entity if isn't -1), may fail in some conditions but I think you will be ok. Pseudo-code:
Code:
IAmThinking()
{
if (not IAmExplodable())
{
TraceALineForward()
if (not TraceHitAnything())
{
MarkMeAsExplodable()
}
}
TraceAHull()
if (TraceHitAnything() and (IAmExplodable() or TraceHitEntityIsNotTheOneIAmNow()))
{
ExplodeMePlease()
MarkMeAsNonExplodable()
}
}
|
__________________