News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Enemies that grab and hold u in place

Started by VGames, July 07, 2015, 12:29:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

VGames

Has anybody ever implemented enemies that grab u and hold u in place as they do damage to u? I was thinking about adding something like this to the zombies. Maybe they could grab u and if u don't press a certain key fast enough they kill u with one bite.
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BloodRayne

Quote from: VGames on July 07, 2015, 12:29:02 PM
Has anybody ever implemented enemies that grab u and hold u in place as they do damage to u? I was thinking about adding something like this to the zombies. Maybe they could grab u and if u don't press a certain key fast enough they kill u with one bite.
I've looked into this once but ran into several issues, because I couldn't animate the creatures to make it look realistic. It's actually pretty easy to implement in terms of scripting, you don't even need the SDK or source. In the zombie_ai script, during the melee attack phase, check how close the player is to the monster by doing a trace of say 8 units, then if the trace hits instead of playing the normal attack animation, jump to a function where you bind the player to it's current position. You can later tweak it, by moving the player in a certain manner, so it looks like the creature is dragging the player close to it, but of course you need to animate all that in the creature. Then during the bind phase, check for a key press and do you quick time even there.

The thing is, many players (like me) tend to not get close to enemies at all. In many games I've only learned by watching videos on youtube that some creatures can grab you in games and will trigger quick-time events. Fear 2 did this, and a creature never even got close to me, same thing with Dead Space. I found out only by watching youtube vids of creatures doing a fatality on the player.

So it could happen that you will put a lot of effort into something that only 10% of your players will actually ever experience, something to think about.

VGames

This is very true. But it would be a nice feature nonetheless. The method you've explained to me is a bit out there for me but I will see if I can pull it off. I'm sure I'll be back with more questions. Like how to code all of it.  :P
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BloodRayne

Quote from: VGames on July 08, 2015, 11:48:50 AM
This is very true. But it would be a nice feature nonetheless. The method you've explained to me is a bit out there for me but I will see if I can pull it off. I'm sure I'll be back with more questions. Like how to code all of it.  :P
I'm an idea/strategy guy, and much to lazy to code things for you. But I'm very happy to teach you 'how to fish' so to speak.

The first thing is to learn by example, and start simple to learn how to understand how the scripts flow and work. For instance, initially start out by printing a simple 'hello world' to the console, every time the monster spots a player (that's your first challenge). Then try to hack the script so you can measure the distance to the player.

Open the file doom_events.script, this is your holy book and will show you all the available script commands. Don't edit it, it'll break the game. But it will give you the syntax of all the script commands, which is extremely handy. Keep things simple while scripting, take small steps, before you know it you'll be right there where you want to be.

VGames

Yeah I understand. I've got the flow down but starting from scratch with an idea is always tough. But when I got something to go by I can move so fast. Like when doomtrinity added the secondary fire code to one of my weapons it was so much help. Now since then all of my weapons have 2 and sometimes 3 different fire modes. Since the zombies already have an attack set up I can go in that and check for player distance. The part that will stump me for a while is setting up the new function to bind the player to the zombie. Then I'm sure after that the next head scratcher will be setting up the qte. I'll be back with more questions on fishing.
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BloodRayne

Quote from: VGames on July 08, 2015, 12:19:57 PM
Yeah I understand. I've got the flow down but starting from scratch with an idea is always tough. But when I got something to go by I can move so fast. Like when doomtrinity added the secondary fire code to one of my weapons it was so much help. Now since then all of my weapons have 2 and sometimes 3 different fire modes. Since the zombies already have an attack set up I can go in that and check for player distance. The part that will stump me for a while is setting up the new function to bind the player to the zombie. Then I'm sure after that the next head scratcher will be setting up the qte. I'll be back with more questions on fishing.

Binding is the easiest part, look in doom_events.script for bindtoJoint, bindtoPosition and other such commands.
Grabbing the keypresses, now that will be hard. ;)

VGames

Yeah I was expecting that. One thing though why is player sometimes referred to as $player? What kind of player should be bound and what kind of player should I check for distance?
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BielBdeLuna

the player is an entity more in the world, in a single player game, his name is $player1, this is stipulated in the c++ code, I guess in a multi-player game the players get numbered, but I don't know this for sure, also the player's weapon I think it's named "$weapon1"

BielBdeLuna

I guess you could create a camera entity, and bind it to a bone in the monster, animate this bone so it makes the acting of being hold by the monster from the point of view of his victim, and pass the action to that camera and once finished teleport the player to the position relative to that bone.

Tehstrelok

If I remember well, the chainsaw zombie holds you in place when it hits you, so you must kill it to be free

VGames

Yeah I'm fixing to look into this feature. Just now getting to it. I'm not sure how much sawyer holds u in place but I was thinking he did something like I needed. The animations are a whole other problem.
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

Tehstrelok

Quote from: VGames on September 08, 2015, 01:52:16 PM
Yeah I'm fixing to look into this feature. Just now getting to it. I'm not sure how much sawyer holds u in place but I was thinking he did something like I needed. The animations are a whole other problem.

just confirmed that when he stabs you with the chainsaw, the player can be stuck in it for the duration of the swing animation, if it barely hits you can get out of it, but if you are too close, you can´t run away for the duration of the attack, it just swings you left n right while the chainsaw is cutting you.

Phrozo

Hmm, I don't see anything scripted that causes you to get stuck by his attack. The only thing I see is that when his attack is true ( makes contact ), the blood particles bound to his "gore" joint turn on. Btw, that system is unreliable and I took it out of my mod.

Anyways, his damage has a negative kick direction. Maybe that is what is 'sucking' the player in when he hits you.

from entityDef melee_zombie_chainsaw

"kickDir" "-0.25 0 0"



VGames

I'm pretty sure its gonna be a lot more complex like BloodRayne explained above. But that negative kickDir is pretty handy.
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

Tehstrelok

I brought up sawyer sucking you in, and phrozo explained how it worked, I hope we have helped you heh.