Unstucking in real time

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Drake Raider
Posts: 474
Joined: Fri Jul 18, 2008 12:27 pm

Unstucking in real time

Post by Drake Raider »

Is there a trick to getting monsters unstuck from each other via scripting? I have alot of Teleporters in my current mod, and they keep getting stuck on scenery or other monsters. I was wondering if there was a solution I could write in that allowed them to teleport away again if they couldn't move.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Unstucking in real time

Post by wildweasel »

I'm not aware of any native function for this, but you may be able to roll your own by customizing their movement code. Immediately after the monster teleports, have it record its position in the map somehow, then try to A_Chase for a few tics, then compare its current position with the recorded position. If it's identical, the monster is stuck, so it should teleport again.

Disclaimer: I'm unaware of how exactly you can record an actor's position in the map; I imagine it'd require some use of ZScript and user vars.
Drake Raider
Posts: 474
Joined: Fri Jul 18, 2008 12:27 pm

Re: Unstucking in real time

Post by Drake Raider »

Got it fixed. I used an A_CheckBlocking that looped back to the teleport mode if it turned solid and couldn't move. Cut the occurrence of the problem down to a fraction of them.
Post Reply

Return to “Scripting”