Ways to code a Monster that charges the player like a bull?

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
SuperAble
Posts: 38
Joined: Tue Jan 02, 2018 9:04 pm

Ways to code a Monster that charges the player like a bull?

Post by SuperAble »

Is there a way to code a monster that charges/tramples towards the player like a bull? Been trying to think on how to exactly do it where a monster would constantly run towards the player and takes damage when the player is in contact with it.
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

Re: Ways to code a Monster that charges the player like a bu

Post by Cherno »

D4D and BrutalDoom both feature charging attacks for the Pinky.
User avatar
MFG38
Posts: 414
Joined: Sun Apr 14, 2019 8:26 am
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland
Contact:

Re: Ways to code a Monster that charges the player like a bu

Post by MFG38 »

One possible way of doing it is with A_SetSpeed. Just remember to reset the speed back to its default value when the attack is finished.
User avatar
Empyre
Posts: 68
Joined: Thu Apr 05, 2007 10:39 pm
Location: Garland, TX, USA

Re: Ways to code a Monster that charges the player like a bu

Post by Empyre »

The Hellsmith on this page does that: https://realm667.com/index.php/en/beast ... -137-49102
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Ways to code a Monster that charges the player like a bu

Post by Void Weaver »

Basically it can be done with A_SkullAttack, but you can also use a bit more complicated method via A_Recoil + A_CheckLOF like as in my "Charge" code (script blocks from "Charge:" to "ChargeEND:").
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: Ways to code a Monster that charges the player like a bu

Post by Matt »

I can imagine an improvement to the usual lost soul attack in a custom ZScript function:

1. call TryMove in a direction straight forward
2. if the call succeeds, change z based on pitch and return
3. if the call fails, check the blockingmobj
4. if there is no blockingmobj or it's not directly in front of the actor (i.e., in the way of the horns), abort to see state
5. otherwise, damage the blockingmobj and if it is the actor's target jump directly to melee (goring) state
Post Reply

Return to “Scripting”