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

[L4D2] Prevent Gnome from noclipping through obstacles


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Visual77
Veteran Member
Join Date: Jan 2009
Old 06-26-2017 , 08:28   [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #1

Hi, how would I block the weapon_gnome in L4D2 from noclipping itself through obstacles when player drops/throws it?

I have tried setting different values on the gnome but with no success.
Code:
m_nSolidType
m_usSolidFlags
m_spawnflags
m_CollisionGroup
m_MoveCollide
m_MoveType, same as Set/GetEntityMoveType.
(The map in the screenshot is c5m3_cemetery)

Holding gnome in front of a locked door


Dropping Gnome through the locked door (BUG)


Gnome location outside the door:


Holding gnome in front of a wire fence


Dropping gnome through the wire fence (BUG - Huge problem, outside the map. Ruins rounds in "last gnome on earth" game mode )

Last edited by Visual77; 06-27-2017 at 08:40.
Visual77 is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 06-26-2017 , 22:39   Re: [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #2

I'm sure it's teleported infront of you before velocity is applied when throwing.

Try teleporting to Client eye origin.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 06-27-2017 , 04:54   Re: [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #3

Quote:
Originally Posted by Lux View Post
I'm sure it's teleported infront of you before velocity is applied when throwing.

Try teleporting to Client eye origin.
And how do I override game mechanism then?

Blocking throw on OnPlayerRunCmd and teleporting it to client eye origin, is that what you mean?

Last edited by Visual77; 06-27-2017 at 04:55.
Visual77 is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 06-27-2017 , 05:46   Re: [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #4

Quote:
Originally Posted by Visual77 View Post
And how do I override game mechanism then?
I don't know figure it out..

Quote:
Originally Posted by Visual77 View Post
Blocking throw on OnPlayerRunCmd and teleporting it to client eye origin, is that what you mean?
And on get client eye origin use this
GetClientEyePosition(client, Float:pos[3])
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 06-27-2017 , 06:43   Re: [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #5

Nothing happens. It continues blocking the throw so I think it's not possible to "release" the gnome from a player this way.
Edit: Using sdkhooks weapondrop and it seems to work perfectly. Why is that?

Code:
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
{
	if (!IsClientInGame(client)) return Plugin_Continue; 
	if (IsFakeClient(client)) return Plugin_Continue;
	if (GetClientTeam(client) != 2) return Plugin_Continue;
	if (!IsPlayerAlive(client)) return Plugin_Continue;
	if (GetEntProp(client, Prop_Send, "m_isIncapacitated") == 1) return Plugin_Continue;

	int ActiveWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
	if (ActiveWeapon <= 0) return Plugin_Continue;

	char sWeapon[32];
	GetEdictClassname(ActiveWeapon, sWeapon, sizeof(sWeapon));
	if (!isGnome(sWeapon)) return Plugin_Continue;

	if (buttons & IN_ATTACK)
	{
		buttons ^= IN_ATTACK;

		float pos[3], ang[3];

		GetClientEyePosition(client, pos);
		GetClientEyeAngles(client, ang);

		SDKHooks_DropWeapon(client, ActiveWeapon, NULL_VECTOR, NULL_VECTOR);
		TeleportEntity(ActiveWeapon, pos, ang, NULL_VECTOR);

		PrintToChatAll("%N throwed %s", client, sWeapon);
	}
	return Plugin_Continue;
}

Last edited by Visual77; 06-27-2017 at 06:55.
Visual77 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-27-2017 , 06:55   Re: [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #6

Use that to do your own TraceRay and if it hits something (fence) block. The only otherway would be with an etension, find the function in the server binary and create a forward or detour to allow/disallow. I guess you would still ne to do a trace-ray, but with an Extension that should be less CPU cycles compared to OnPlayerRunCmd.
__________________

Last edited by Silvers; 06-27-2017 at 06:56.
Silvers is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 06-27-2017 , 07:03   Re: [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #7

Quote:
Originally Posted by Silvers View Post
Use that to do your own TraceRay and if it hits something (fence) block. The only otherway would be with an etension, find the function in the server binary and create a forward or detour to allow/disallow. I guess you would still ne to do a trace-ray, but with an Extension that should be less CPU cycles compared to OnPlayerRunCmd.
The code above is actually working, now using SDKHooks_DropWeapon which must have fixed the noclipping issue. Good, now I can apply this to both gnome, oxygentank and propanetank.

edit: Were would I do the block action if traceray hits something?

And an interesting fact: SDKHooks_DropWeapon drops weapon_gnome to the ground. But without it, gnome becomes a prop_physics on drop and a weapon_gnome on pickup.
Entity id also stays the same on drop, using Sdkhooks.

Last edited by Visual77; 06-27-2017 at 07:21.
Visual77 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-27-2017 , 07:16   Re: [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #8

If this is blocking throwing: ^= IN_ATTACK; then put the traceray just above this line and only block if the trace hits a fence or whatever, you don't need to fake throwing, you can let the game do that itself if it doesn't hit by not blocking IN_ATTACK.

Edit: Or if SDKHooks throws it but it hits the fence, then just do that.
__________________

Last edited by Silvers; 06-27-2017 at 07:17.
Silvers is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 06-27-2017 , 07:33   Re: [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #9

Quote:
Originally Posted by Silvers View Post
If this is blocking throwing: ^= IN_ATTACK; then put the traceray just above this line and only block if the trace hits a fence or whatever, you don't need to fake throwing, you can let the game do that itself if it doesn't hit by not blocking IN_ATTACK.

Edit: Or if SDKHooks throws it but it hits the fence, then just do that.
Are you talking about blocking client throw if a trace ray finds an entity near by? I don't see that as a good solution. The client should be able to drop the gnome at all times.

With SDKHooks throw I don't need to check anything. It hits the fence and bounces back, it doesn't no clip through the fence anymore.

Last edited by Visual77; 06-27-2017 at 07:34.
Visual77 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 06-27-2017 , 08:27   Re: [L4D2] Prevent Gnome from noclipping through obstacles
Reply With Quote #10

Omfg, I didn't even think about pressing (USE) to drop the gnome, it noclips through the fence.

Guess I need sdkhooks for that aswell.

Last edited by Visual77; 06-27-2017 at 08:29.
Visual77 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 19:50.


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