Raised This Month: $12 Target: $400
 3% 

Entity go though wall and but still trigger when touch


Post New Thread Reply   
 
Thread Tools Display Modes
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-11-2022 , 14:11   Re: Entity go though wall and but still trigger when touch
Reply With Quote #11

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()
	}
}
__________________









Last edited by CrazY.; 01-11-2022 at 14:17.
CrazY. is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 01-11-2022 , 20:39   Re: Entity go though wall and but still trigger when touch
Reply With Quote #12

I got the general ideas on how to write it when I saw your first post since it quite detailed.
"Not totally correct" was a wrong words to use (Screw google translate )
I will try finish up the code and post it before marking as [Solved]
__________________
My plugin:

Last edited by Celena Luna; 01-11-2022 at 20:39.
Celena Luna is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode