Page 1 of 1

Avoiding an actor getting stuck onto another actor while teleporting or moving while non-solid?

Posted: Thu Apr 05, 2018 7:21 pm
by FranckyFox2468
Basically what i want to know is that is there a known hack or solution around teleporting an actor or have a physical-state undone without having said actor stuck inside another by accident? Some games fixes a such issue by slightly pushing the actors away from eachother until they aren't inside one another but i am not certain if that is even possible in doom. Like perhaps there's a way to make a character get a through actor flag until its not inside another actor or something?

By the way i would like to detail i am trying to find a way to do this without causing telefrags if possible? Because i intend to have some weapons with special mobility options but i don't want them to be exploited to get cheap insta-kills 24/7 but neither want people to get stuck and not able to un-do it.

Been thinking having an actor use a_warp on itself by testing possible areas in a single tick until its possible and teleports there but im not sure its even possible and i fear that even then it might lead to a player getting stuck inside ANOTHER actor by then.

Re: Avoiding an actor getting stuck onto another actor while teleporting or moving while non-solid?

Posted: Thu Apr 05, 2018 9:53 pm
by Fused
Well, it's shitty to manage. It's totally possible though. You should use SetActorPosition, as it doesnt force the player to teleport, and returns whenever it succeeded in teleporting. If it's false, you can move coordinates around a bit with some math until it works.

Re: Avoiding an actor getting stuck onto another actor while teleporting or moving while non-solid?

Posted: Thu Apr 05, 2018 10:46 pm
by ibm5155
spawn something solid at the coord that you want, if it failed to spawn you know he'll get stucked there.
But still there re no good ways, maybe teleport the actor, make him call an script that sets him non solid only when there's nothing under him

Re: Avoiding an actor getting stuck onto another actor while teleporting or moving while non-solid?

Posted: Thu Apr 05, 2018 11:38 pm
by FranckyFox2468
Fused wrote:
Thu Apr 05, 2018 9:53 pm
Well, it's shitty to manage. It's totally possible though. You should use SetActorPosition, as it doesnt force the player to teleport, and returns whenever it succeeded in teleporting. If it's false, you can move coordinates around a bit with some math until it works.
Hm... i suppose it could work... one idea i had was to use a playermorph when teleporting where the player is temporarily turned into an alternate version of its class which has +thruactors for a single tick and cancels if it is possible to un-transform, and keeps it that way if not.

But it seems i'll have some tinkering to do, thanks for the starting point.

Re: Avoiding an actor getting stuck onto another actor while teleporting or moving while non-solid?

Posted: Fri Apr 06, 2018 7:52 am
by Fused
You should be able to apply flags on an actor by simply giving an item, calling A_ChangeFlag. I had this working before but it's broken now, so I will have to check why before giving a good example

Re: Avoiding an actor getting stuck onto another actor while teleporting or moving while non-solid?

Posted: Fri Apr 06, 2018 9:57 pm
by jdagenet
I quickly made a function that checks if a location has enough room for said actor:

Code: Select all

function bool EnoughRoom (str class, int x, int y, int z)
{
	int tempTID = UniqueTID();
	int canSpawn = Spawn(class, x, y, z, tempTID);
	
	if (!canSpawn)
		return false;
	
	Thing_Remove(tempTID);
	return true;
}
You could pass this function as an argument or use it in an if statement to make sure it's safe to teleport an actor.

Re: Avoiding an actor getting stuck onto another actor while teleporting or moving while non-solid?

Posted: Wed Apr 18, 2018 2:56 pm
by FranckyFox2468
I just realized my technique won't work because the player's velocity is stopped whenever it is morphed or un-morphed, which will get obnoxious very quickly i feel.

Also:
jdagenet wrote:
Fri Apr 06, 2018 9:57 pm
I quickly made a function that checks if a location has enough room for said actor:

Code: Select all

function bool EnoughRoom (str class, int x, int y, int z)
{
	int tempTID = UniqueTID();
	int canSpawn = Spawn(class, x, y, z, tempTID);
	
	if (!canSpawn)
		return false;
	
	Thing_Remove(tempTID);
	return true;
}
You could pass this function as an argument or use it in an if statement to make sure it's safe to teleport an actor.
The problem with this is that, doesn't it suck when you try to use an item in a game and it decides to tell you "no" for something that is beyond your control?