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

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

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

#1

Post by FranckyFox2468 » Thu Apr 05, 2018 7:21 pm

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.

User avatar
Fused
Contributor
Posts: 658
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

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

#2

Post by Fused » 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.
My mods
Image Image

My socials
Image Image

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

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

#3

Post by ibm5155 » Thu Apr 05, 2018 10:46 pm

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
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

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

#4

Post by FranckyFox2468 » Thu Apr 05, 2018 11:38 pm

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.

User avatar
Fused
Contributor
Posts: 658
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

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

#5

Post by Fused » Fri Apr 06, 2018 7:52 am

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
My mods
Image Image

My socials
Image Image

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

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

#6

Post by jdagenet » 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.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

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

#7

Post by FranckyFox2468 » Wed Apr 18, 2018 2:56 pm

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?

Post Reply