Raised This Month: $ Target: $400
 0% 

Search for wall between 2 origins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 11-22-2007 , 18:09   Search for wall between 2 origins
Reply With Quote #1

I made a grenade which deals splash damage. The problem is the grenade will do damage to you even if you are on the opposite side of a wall but still in distance.

Is there a way to check to see if a wall is in between a player and the grenade? I have the origins and the distance, but not sure how to scan for a wall.
hlstriker is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-22-2007 , 19:04   Re: Search for wall between 2 origins
Reply With Quote #2

do a traceline.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 11-24-2007 , 15:42   Re: Search for wall between 2 origins
Reply With Quote #3

Alright thanks. This doesn't seem to be working properly for me yet.

I'm trying to return the entity index the traceline is hitting but it seems to be incorrect.

PHP Code:
engfunc(EngFunc_TraceLineplayerOrggrenadeOrg020);
client_print(0print_chat"%i"get_tr2(0TR_pHit)); 
The above code will always either return the players index, or the grenades index. Is it supposed to be random like that? Shouldn't it only be displaying the grenade index since I'm tracing from the players origin to the grenades?

Also, it seems tracelines go through walls? When I run out of view of the grenade it will still display the player index or the grenade index.
hlstriker is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-24-2007 , 16:09   Re: Search for wall between 2 origins
Reply With Quote #4

Try :

Code:
engfunc(EngFunc_TraceLine, playerOrg, grenadeOrg, IGNORE_MONSTERS, id, 0)

where id is the index of player that have for origin playerOrg


Just thought you should have a look at avalanche's "no he through walls" plugin.

Last edited by ConnorMcLeod; 11-24-2007 at 16:11.
ConnorMcLeod is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 11-24-2007 , 16:37   Re: Search for wall between 2 origins
Reply With Quote #5

I'm now thinking that the 5th argument is the entity that the traceline is bypassing. Is this correct?

I tried setting it to the players id. Now it will return -1.

I also looked at Avalanche's plugin and it looked pretty much like I have my code now.

Here is what I now have that is returning -1
PHP Code:
engfunc(EngFunc_TraceLinegrenadeOrgplayerOrgDONT_IGNORE_MONSTERSid0); 
hlstriker is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-24-2007 , 16:46   Re: Search for wall between 2 origins
Reply With Quote #6

Quote:
Originally Posted by hlstriker View Post
I'm now thinking that the 5th argument is the entity that the traceline is bypassing. Is this correct?
I think that if the 5th argument is the entity index that can't be returned (ent to skip).


I also think that if you set 4th arg to DONT_IGNORE_MONSTERS, it can return another player that could be between the nade and the first player.


But a wall is not often an entity, so you have to make other checks.

May be compare nade origin and origin of what is returned
PHP Code:
get_tr2(0TR_vecEndPosdest


Wait for good advises of skilled coders
ConnorMcLeod is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 11-24-2007 , 16:51   Re: Search for wall between 2 origins
Reply With Quote #7

Quote:
Originally Posted by connorr View Post
May be compare nade origin and origin of what is returned
Well, I can't do that yet because it's either returning -1, the grenade index, or the player that threw the grenades index. lol
hlstriker is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-24-2007 , 19:58   Re: Search for wall between 2 origins
Reply With Quote #8

Code:
stock fm_trace_line(ignoreent, const Float:start[3], const Float:end[3], Float:ret[3]) {
	engfunc(EngFunc_TraceLine, start, end, ignoreent == -1 ? 1 : 0, ignoreent);

	new ent = global_get(glb_trace_ent);
	global_get(glb_trace_endpos, ret);

	return pev_valid(ent) ? ent : 0;
}
it returns the ent if there is one in the way.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 11-24-2007 , 21:41   Re: Search for wall between 2 origins
Reply With Quote #9

Thanks, working perfect now
hlstriker 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 01:16.


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