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

[L4D2] Finding entity name by TraceRay?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XDglory
Member
Join Date: May 2012
Old 07-06-2020 , 10:20   [L4D2] Finding entity name by TraceRay?
Reply With Quote #1

I'm modifying a plugin that spawns special infected by picking several random spot near survivors, then fires TraceRay to check if there is a wall or obstacle between that spot and survivors.
However, when it comes to iron fence like those are near c2m1's motel or those surround c2m2's ticket booth, TraceRay still can't penetrate those fence, which lead to zombie spawning in sight.
Hence, if there any solution to get the entity's name that TraceRay hit so that iron fence could be an exception of none-line-of-sight?

PS 1. I've tried using
Code:
TR_GetEntityIndex()
and
Code:
GetEdictClassname()
, it only returns player(when TraceRay hit player) and worldspawn(hit any kind of wall or something).

PS 2. Method
Code:
GetEntProp(client, Prop_Send, "m_hasVisibleThreats")
seems impractical because it needs about 0.5~1 second to return the correct spawn state, which is not a reasonable solution in finding valid spot rapidly.

PS 3. I found this post talking almost exactly the same thing I encountered, so maybe TraceRay is kind of useless on this situation?
https://forums.alliedmods.net/showpo...15&postcount=6



Last edited by XDglory; 07-06-2020 at 10:25.
XDglory is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 07-06-2020 , 11:15   Re: [L4D2] Finding entity name by TraceRay?
Reply With Quote #2

There are more functions see here:
http://www.sourcemod.net/new-api/sdktools_trace

In your case you could try TR_GetSurfaceName
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
XDglory
Member
Join Date: May 2012
Old 07-06-2020 , 21:39   Re: [L4D2] Finding entity name by TraceRay?
Reply With Quote #3

Thanks for your reply, will try after upgrading to Sourcemod 1.10
XDglory is offline
XDglory
Member
Join Date: May 2012
Old 07-08-2020 , 11:57   Re: [L4D2] Finding entity name by TraceRay?
Reply With Quote #4

Quote:
Originally Posted by andi67 View Post
There are more functions see here:
http://www.sourcemod.net/new-api/sdktools_trace

In your case you could try TR_GetSurfaceName
After several testing, function "TR_GetSurfaceName" returns similar result to "GetEdictClassname" does, which means both functions consider the wire mesh as a part of the map.

However, I found the following function which is able to return a unique prop number(43) of wire meshes, even though they might be in different size.

Code:
/**
 * Returns the surface properties index of the surface that was hit.
 *
 * @param hndl          A trace Handle, or INVALID_HANDLE to use a global trace result.
 * @return              Surface props.
 * @error               Invalid Handle.
 */
native int TR_GetSurfaceProps(Handle hndl=INVALID_HANDLE);
Thanks for your hint!
XDglory is offline
Reply



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 12:44.


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