Is it possible to make enemies run + shoot you at same 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!)
User avatar
lizardcommando
Posts: 1486
Joined: Thu Sep 07, 2006 12:24 pm
Location: Boringland, California

Is it possible to make enemies run + shoot you at same time?

Post by lizardcommando »

Is it possible to have an enemy shoot and run at you at the same time?

I want to try and make a zombieman type enemy that has the ability to shoot and run (complete with actual running+shooting sprites) towards the player at the same time. Would this be possible to make through DECORATE?
Gez
 
 
Posts: 17633
Joined: Fri Jul 06, 2007 3:22 pm

Re: Is it possible to make enemies run + shoot you at same t

Post by Gez »

It is perfectly possible.

One thing you can do is put calls to [wiki]A_Chase[/wiki] in their attack state sequence. Use the melee and missile parameters to prevent these calls from jumping to the attack state.
User avatar
Cherno
Posts: 1279
Joined: Tue Dec 06, 2016 11:25 am

Re: Is it possible to make enemies run + shoot you at same t

Post by Cherno »

You pass null for the states that are entered if the monster attacks, so it only moves. Combine that with an attack at the same time by using 0-duration frames. A_Wander could be used for a more random movement. Note that This will not check if the monster can actually see it's target, so you might want to add some conditions for that, otherwise the monster might shoot at walls betwen itself and it's target while chasing it. The wiki article on A_Chase also lists flags that could be useful for controlling turning behavior.

Code: Select all

POSS A 0 A_Chase(null, null)
POSS A 0 A_FaceTarget
POSS A 3 A_PosAttack
A_Chase
Gez
 
 
Posts: 17633
Joined: Fri Jul 06, 2007 3:22 pm

Re: Is it possible to make enemies run + shoot you at same t

Post by Gez »

In DECORATE, use "" instead of null.
User avatar
Enjay
 
 
Posts: 26403
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Is it possible to make enemies run + shoot you at same t

Post by Enjay »

Yarp. I've used A_Chase ("","") many times before in DECORATE. Works perfectly.

Return to “Scripting”