Ways to code a Monster that charges the player like a bull?
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!)
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!)
Ways to code a Monster that charges the player like a bull?
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.
Re: Ways to code a Monster that charges the player like a bu
D4D and BrutalDoom both feature charging attacks for the Pinky.
- 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
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.
Re: Ways to code a Monster that charges the player like a bu
The Hellsmith on this page does that: https://realm667.com/index.php/en/beast ... -137-49102
- 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
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:").
- 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
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
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