MAKING A MELEE-BASED COMPANION WITH SLADE

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Post Reply
Psychojack88
Posts: 2
Joined: Sat May 07, 2022 10:12 pm
Graphics Processor: nVidia (Modern GZDoom)

MAKING A MELEE-BASED COMPANION WITH SLADE

Post by Psychojack88 »

I've noticed a lot of cool companion mods and templates that usually involve ranged-oriented characters. I was thinking of making a melee oriented one to spice things up, though I would like to know how to control the way characters move when they are actively swinging their weapons.
Ideally, I would like to include these features:

- A Dash attack (to close in on an otherwise far enemy)
- One midair attack (starting from ground level to air then ground to make the impact of the swing.)
- One side-step attack when in close range with an enemy. (This is to potentially make a combo of three side slashes in succession later down the line once I fix the first one.)
- Block "attack", to block projectiles for a certain window of time before needing a cool down before the character can block again (for balancing reasons). The indicator of this working would be a block sound when an attack actually touches the character when they're using the blocking. This can be interpreted code-wise as a just a temporary state of complete invulnerability, but I'm hopefully looking for a reflective feature to randomly reflect damage to enemies.

Anyone know what I can do to get these types of attacks or movements within Slade or can point me to somewhere that delves into this kind of stuff. I don't normally see anyone talking about the ins and outs of a melee-type companion mod.
User avatar
Enjay
 
 
Posts: 27043
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: MAKING A MELEE-BASED COMPANION WITH SLADE

Post by Enjay »

The funny thing is that there is actually an actor built into GZDoom that is intended as a melee companion/helper. If you type summonfriend MBFHelperDog at the console, a dog will appear and start chewing on your enemies. (In fact, you can type "summonfriend" followed by any enemy name and get a friendly version of that monster appearing to help you, but the dog is specifically intended as a helper.)

The MBFHelperDog is nowhere near as advanced as the mod you have envisaged, and was added primarily for compatibility with the Marines Best Friend Doom port but it has been included with GZDoom (and ZDoom before that) for a very long time. However, I only mention it simply because very few people even seem to be aware it exists. It's not really what you are looking for.


Your best bet would be to delve into other mods and into the stock enemies. Take a look at the code for any existing companions/enemies that exhibit some of the behaviours that you want to see how they do it and see if you can transfer those ideas to your companion. e.g. the Hexen Centaur might give you some ideas about the blocking attack. Once you have something written down, people will be far more able to help you with it and to iron out any problems that you can't resolve yourself.
Proydoha
Posts: 87
Joined: Thu Jan 21, 2016 2:25 am

Re: MAKING A MELEE-BASED COMPANION WITH SLADE

Post by Proydoha »

You can access actor's velocity vector directly and you can modify it which is perfect for dashes in any direction.
To dash towards the target you need vector difference between target position and companion position.
To dash sideways you'll need to get previous vector and rotate it 90 degrees (swap x and y and put a minus in front of one of them)



Here's an example of lamp dashing around or towards the player if its close enough:
Attachments
PR_DashingLamp.pk3
(2.56 KiB) Downloaded 2 times
Post Reply

Return to “General”