Monster that alternates between hovering/flying and walking.

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
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Monster that alternates between hovering/flying and walking.

Post by Hidden Hands »

I'm trying to make a certain behaviour here. I'm trying to make my Daleks in my Doctor Who project alternate between moving along the ground like normal, to hovering/flying when faced with ledges or stairs. So basically, we have a creature that moves like a regular walking enemy but when wanting to reach a higher area or even attack from a height, will switch to a more Caco-demon like behaviour. And back and forth. Any advice on how to pull this off?

Thanks in advance.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Monster that alternates between hovering/flying and walk

Post by Graf Zahl »

It depends on whether both states use the same sprites or different ones.
Technically, all a flying monster needs is the +NOGRAVITY and +FLOAT flags, so the main difference is to handle different animations for both. The easiest way to do this is to have a check after each state label and then branch into the respective animation for the currently active state.
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: Monster that alternates between hovering/flying and walk

Post by Matt »

As to when to decide which, one possibility I can think of:

1. Call CheckMove() at a few points between the dalek and the doctor, with dropoff disabled.

2. If any of those checks fail, go into flying mode.

3. Once in flying mode, have a random chance to go back to rolling mode if the dalek is above the doctor and has clear LOS. (Some additional checks might be called for so the dalek doesn't just drop into a pit the doctor is on the edge of, possibly temporarily setting its Z position to floorz and doing the CheckMove call from that temporary position before resetting.)
Post Reply

Return to “Scripting”