Raised This Month: $32 Target: $400
 8% 

Solved [L4D2]How can I check that a teleport won't fail or correct a failed teleport?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Morning
Member
Join Date: May 2021
Old 01-27-2023 , 07:44   [L4D2]How can I check that a teleport won't fail or correct a failed teleport?
Reply With Quote #1

I'm using teleport to move witches after spawning them. My problem is that I want to move them to a point within an area around XYZ coordinates, and that if the point happens to be inside of a wall, the teleport seems to fail and they get stuck at origin (0,0) - which also happens to be inside of a wall on the map i'm using.

Is there a way to either check that a position is safe, or deal with the entity after the teleport has failed by checking entity properties somewhere? I do usually get console output after the witch starts to experience issues:

Witch 1325 is failing excessively

Last edited by Morning; 01-27-2023 at 20:36.
Morning is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 01-27-2023 , 08:03   Re: [L4D2]How can I check that a teleport won't fail or correct a failed teleport?
Reply With Quote #2

You can use a tracehull to get a safer position, but that doesn't mean that the witch won't fail, this message may be related to other stuff besides position.
I don't have any examples here, but this would be the result (not L4D2)
https://www.youtube.com/watch?v=NxReDzc_oCo
__________________
Marttt is offline
Morning
Member
Join Date: May 2021
Old 01-27-2023 , 20:35   Re: [L4D2]How can I check that a teleport won't fail or correct a failed teleport?
Reply With Quote #3

I ended up using this modified from line-of-sight teleporting to check if it's safe, though the teleport still errors if it intersects a player. It's good enough for what I need, thanks a lot for the help!
Code:
bool IsEntityStuck(float pos[3], int entity)
{
	float fMins[3];
	float fMaxs[3];

	GetEntPropVector( entity, Prop_Send, "m_vecMins", fMins );
	GetEntPropVector( entity, Prop_Send, "m_vecMaxs", fMaxs );
	
	for (int i=0; i<sizeof(fMins); i++)
	{
		fMins[i] -= 3;
		fMaxs[i] += 3;
	}


	TR_TraceHullFilter(pos, pos, fMins, fMaxs, MASK_SOLID, TraceEntityFilterPlayer, entity);

	return TR_DidHit();
}

bool TraceEntityFilterPlayer(int entity, int contentsMask)
{
	return false;
}
Morning 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:02.


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