Making an enemy teleport close to the player?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Sergeant_Mark_IV
Posts: 812
Joined: Wed Feb 02, 2011 12:44 pm
Location: United Communist Nazi Republic Dictactorship of Banana Land (Brazil)

Making an enemy teleport close to the player?

Post by Sergeant_Mark_IV »

I am trying to do the following: If the monster is too far from the player, and there is no line of sight (A_CheckSight), the monster should teleport near to the player.

I am currently doing a very gross hack: Making the monster disappear, spawn a pathfinder actor that moves very fast and has NOCLIP, and on his missile state, spawn a clone of the previous monster. (its a low health monster, so doesn't matters if his health is reseted).
This works fine for a while, but sometimes the pathfinder just doesn't want to search for the player. Sometimes it will just stay still where it have last seen the player, facing the same angle, doing nothing, and will only work again if he see the player again.

The pathfinder code:
Spoiler:

There is a better and cleaner way to make the monster teleport, or, at least fix this pathfinder?
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: Making an enemy teleport close to the player?

Post by GooberMan »

I guess hooking it in to some ACS would be the way to go there. I assume you'd need to Thing_Hate the Pathfinder for it to move forward in all cases.

Once you've gone the ACS route, the spawn code would simply SetActorPosition on the monster that created the Pathfinder and spawn the TeleportFog like you're currently doing.

(At least, it sounds sensible to me. I'm not able to test it for the next few hours due to work)
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Making an enemy teleport close to the player?

Post by Matt »

Just wanna comment one one side thing:

See:
TNT1 AAAAAAAAAAAAAAAAA 1 A_Chase
Loop

=

See:
TNT1 A 1 A_Chase
Loop

but !=

See:
TNT1 AAAAAAAAAAAAAAAA 0 A_Chase
TNT1 A 1 A_Chase
Loop



Anyway: is [wiki]A_Warp[/wiki] an option? If so you can try using that, with or without an intermediary actor.
Locked

Return to “Editing (Archive)”