SF's Hammer Tutorials - NPC Animations
HTML-код
- Опубликовано: 11 окт 2024
- Learn how to use a scripted_sequence to make a combine kick in a door.
Rundown:
We create a npc_metropolice, then we get the animation we want and position a scripted_sequence at the desired location.
We make the door open faster and give it a more fitting opening sound. Then we make it open as the animation is played.
After that we finish it up by adding a trigger for the event and some info_nodes for NPC navigation.
Made by Silverfish
www.precautious...
over 11 years later, and his tutorial still teaches
Yeah
Yeah
Yeah
Yeah
Yeah
I was 1 year old when this video came out, and now you teached me. Thanks a lot!
Wow, that's pretty cool! :D
You're welcome!
Oh that old hammer and xp UI take me back.. God how I miss the early 2000s
If you are referring to when you start the game, the screen fades from black to clear vision then you go to Map>Map Properties>Level Fade In>Yes.
A very important section for maps, especially singleplayer ones.
Thanks for that! it really helped me understand how to make NPCs work in SDK. I honestly had no clue before this.
Also, your accent is epic.
You do that by using info_node_hint nodes, these won't force an NPC to jump somewhere, but it's used by them to know that they CAN jump up or down somewhere. You can read up on info_node_hint on the valve developer wiki.
You'll first need to set up something like an aiscripted_schedule that tells the crow to go to a specific place that you want it to fly. Then you create a trigger_once brush volume and set it to activate your aiscripted_schedule when the player enters it.
You can check the flag "Ignore Player +USE", or you could have the door start locked and then unlock it at the same time you open it up.
I'm glad you found my tutorial useful! :)
Actually, you don't want them to sync up entirely probably, but you can set an output that fires when the combine's animation starts that activates the zombie's animation. Then you just have a delay set on the output that makes the animations sync up.
After making him kick down the door like in this tutorial you can give him an aiscripted_schedule that tells him to run to the player. When setting the target that he should run to, put in "!player" without the quotation marks, but with the exclamation mark.
All you need to do is activate the aiscripted_schedule with an output that is fired from the scripted_sequence when it completes its animation, and that should work!
Thank you for the kind comment, I'm glad you like it! If you want me to cover a specific subject just give me a comment, the most requested ones will get made!
I have heard there was something wrong, something happened during the steam update that messed up hammer. Thank you very much for the help so far :D
There is actually a prefab showing how this is done.
*Select your block creation tool or your entity tool.
* In the right hand menu you will see a drop down menu with the title "Categores:", set that to "Prefabs HL2".
* Set the "Objects:" drop down menu to "npc_zombie_slump".
* Press "Insert original prefab".
Now there should spawn a bunch of objects, place them somewhere in your map, compile and watch the result. Then check out the settings of them in Hammer.
Hope this helps!
@ThomasBorn92 This program is used to make levels for games using the Source engine. Like Half-Life 2, Counter-Strike: Source, Day of Defeat: Source and Team Fortress 2 for example.
Platinum Arts Sandbox is a totally different program using the Cube2 engine.
You can import animations into both, but I don't think you can import animations from one of the engines to the other.
I remember having a bunch of trouble with this before. You should be able to select the sitting animation as the action animation on the scripted sequence and then set "loop action animation?" to yes.
If that doesn't do it, check in the flags as well and I think you'll find some flags related to looping animations and such.
Thanks for the tutorial. I wasn't actually planning on doing this, but I'm making a surreal type map to sort of learn different things and I figured this could go in it :D
a tiny bit late but where can I find the map
yeah wheres it
Yeah the Combine goes to the scripted_sequence, the info_nodes are there for navigation.
Without any info_nodes your NPCs can't navigate around the map, I will make a video explaining this further soon so stay tuned!
To make him not return to his starting position before dying you probably have to set the killing output to start when he starts the animation and then manually set the delay for the output to match with the end of the animation.
Hm, I guess you want him to kind of fly away a tiny bit as well when he dies maybe? You can use a phys_ragdollmagnet entity to do that, you can read about it on the valve developer wiki.
Glad I could help!
@NoSRESPAWN Thanks for reminding me, I stopped doing the download links because they where too much work compared to the amount of people who used it. I added an annotation saying that there is no download.
@LuiDeca That should be quite easy.
Just set everything up as usual to make the NPC sit. But when it comes to triggering the scripted_sequence, instead of using a trigger_once brush entity you create a point entity called logic_auto. In that entity add an output like this:
OnMapSpawn
name_of_your_scripted_sequence
BeginSequence
Hope that helps!
@GamingIsFreaky I think there's a property in the scripted_sequence that decides whether the NPC should face the direction of the scripted_sequence. After making sure that's on, rotate your scripted_sequence to face the direction you want your NPC to face.
nice tutorial!
i have 2 request.
1. Can you make a platform moving back and forth like as an obstacle? For some reason i cant find proper tutorials on how to do that...
2. Also, Can you make a tutorial for an animated object like from a trigger or like a ragdoll flying around randomly to scare someone?
making tutorials for these would be awesome!
i'm planning to make a scary L4D map that has random events to frighten player :D
@RickRay9 This can be slightly confusing. I think there is one property and one flag that says something like "Loop in post action" or something like that, try activating those and see if they actually make him loop in the animation.
If it says "loop in post action", then you would have Idle_To_Sit_Chair as the action animation, and then Sit_Chair (or whatever it might be called) as the post action animation.
Hope this helps, let me know how it goes (if you didn't solve it in 4 weeks :P )
@dacisco101 Are you sure that the NPC has that specific animation? Have you tried using another animation? If you play your map with developer 1, do you get any error messages in the console when the NPC is supposed to play his animation?
@FoxY1233 Are you entirely sure you're mapping for HL2, HL2:Ep1 or HL2:Ep2? Those are the only games I know of where the npc_metropolice entity are available.
@GENIUSGT You made the choreography using Face Poser? Then... I really don't know how to play that since TF2 doesn't have NPCs. I've made a tutorial series on Face Poser and how to get that into the game, but I use an NPC to play the choreography. And I don't use the entity I explained in this tutorial for that, I use logic_choreographed_scene.
So I'm afraid I can't help you there. :/
Yeah there are pretty many steps involved, but if you compare the effort it takes to what you get in the end, it's totally worth it!
I am indeed Swedish!
There can never be enough tutorials, you should make some more! ^^
Thanks for the comment!
Use the entity tool to create an entity who's name begins with npc_, like npc_citizen or npc_combine_s for example.
@cresholicrop I won't make a video on that, but I can explain it briefly: Where you want the player to be when the door closes, create a brush with the trigger texture and make it into a trigger_once entity. In its outputs, add:
OnTrigger
[name of door]
Close
And then add another one like this:
OnTrigger
[name of door]
Lock
And that should do it. When the player enters the trigger ,the door will close and lock itself.
Hope this helps!
@YetiSandvichVideos I'm really happy to hear you learned from my tutorial, thanks for letting me know! ♥
@HUMANCONDlTION Hi! It's actually quite simple, you need to add a env_physexplosion entity that you trigger to go off at the same time as the combine plays the animation.
An env_physexplosion is like a normal explosion, but it's silent, invisible and does no damage, it just pushes stuff around.
You will need to play around with timings and you might want to make the barrel start with motion disabled and enable it just before you fire the env_physexplosion and stuff like that.
Hope this helps!
Stop spamming!
@Jacc0s To make an NPC say something in the game you'll need to use Face Poser. I have two Face Poser tutorials up right now (both on setting your computer up to use it) with a third one on its way (on how to actually use it).
Thank you for the requests, they have been added to the request list. Sounds like a cool map, good luck with it!
If you want stuff to move I can suggest looking for tutorials on func_tracktrain, I couldn't find a good one after a quick search on RUclips though.
@ThePoliceComedyShow Choreography isn't lip synch though. Face Poser can be used to create lip synch and choreography, but lip synch is not the same thing as choreography.
@TheCreatorOfOwls The different models have their own sets of animations, it IS possible to replace the models but it's probably pretty hard to do and you'd also probably need to make your own mod to do it.
Well you can only play one script at a time. If you want to chain scripts, just edit the next script field of each scripted_sequence to be in the order you want. So that the next script field of the first scripted_sequence points to the next one, and that ones field points to the next one and so on.
@liamjhackett this just plays the animation, there's no way to simply change how the animation looks, so you'll have to adjust your environment to fit the animation. You might be able to stop the animation at a good time using inputs and outputs, but that will look very bad.
@mixterproductions Well they don't do that for me and they should stay for at least a while even if you have that flag unchecked. It might be some setting you've got somewhere that overrides the fade corpses flag. I know there's a convar that can change that, but that setting might also be tied to some graphical settings, I don't know.
Well you can still make characters talk and interact using the stock animations in an HL2 game by using Face Poser.
This is much simpler than making your own animations and gives you a lot of freedom.
The thing is that you need XP for this to work properly, and I have Win7. A tutorial on Face Poser is very requested, but it might take a while for me to find a way around this.
In Steam you go to your game library, and then in the categories you change to "tools" and then you download and install Source SDK. In there you have Hammer.
Wow, I watched it with volume and I finally get that the person walks to the scripted_sequence.
Do they? The same animations don't show up in the animation preview thing for the metropolice and the citizen at least. Maybe it works though, if you decide to try it I'd be glad if you let me know if it worked or not. :)
Actually, I'd say you get quite a lot back considering the time you invest.
Mapping is a very time consuming process (like almost any art form), and we mappers basically get everything on a silver plate anyway (imagine having to make that animation).
@MrRichie567 Have you placed info_node entities around so the NPC can navigate?
@pr0xincss Ah yeah, if it's too far away you'll need to put info_node entities properly so the NPCs can navigate. Good thing you fixed it!
This tutorial will help you with part of that, what you need to do is sync up the combine's kick scripted_sequence with the zombie's flinch scripted_sequence (I think there are settings in the scripted_sequence entities to make them sync up).
And then you need to create an output on the zombie's scripted_sequence that sets the zombie's health to 0 when his animation is over. This will kill him so he'll fall to the ground.
@HammerTutorialsCH To record the audio and video as well as for editing I use VirtualDub. The codecs I use are Lagarith when recording and Xvid for compressing before uploading to RUclips.
VirtualDub isn't an easy program to learn, but once you know how it works its very powerful.
@Andrewmaster0 to learn stuff I use the interlopers,net website for tutorials, and if I can't find anything there I use Google. Though I've learned most of what I know by just experimenting.
You could do that, that would make him do nothing until you tell him to do something (kick the door in for example), but it's not necessary.
Thank you very much Silwerfish :) You tutorial helped me !
Also you were right. I needed HL2 (EP 1 or EP2). Thanks again for posting and I hope you will make more tutorials for the new guys :).
@GameReviewer1987 You mean the name of your entity? I don't think I set a classname in this tutorial, do I? If it's the name of the entity you mean, it's supposed to be red until you hit apply or exit and then enter the properties window for that entity. So the name being red is not the cause of your problem.
@0XSpartaX0 Try bringing up the console and writing developer 2 in it, then start your map and when he should do the animation, read what the console says. If some error occurred it will be displayed there.
Good luck!
@MethshockFilms He shoots because after he's done what he was told to he returns to normal AI, which includes shooting his enemies, which includes the player. To change the relationships that the player and the different NPCs have, check my tutorial called "NPC Relationships".
Also there is env_global if the player is non criminal
omg, how could i forgot? In the Scripted sequences flags, there was an box where i said something like "corpses stay", i checked it and it worked! :D
Yeah Hammer has support for HL2:ep2. I didn't even know Hammer had a console!
Yeah, you could use a logic_auto, but you most often use trigger_once for events (at least I do), so I thought I'd do it that way.
I like your vid, thanks a lot man! :D
@superdvdman Thanks for the comment! I'll never delete it, so don't worry! :)
Thanks a lot for your reply, I tried what you told me, and everything works now... the problem is, the zombie doesn't fall to the ground form where the scripted sequence animation last stopped... it returns to the npc starting position in 1 micro second and then falls in an "unnatural" way to ground... is there a way to fix this? O_o
@Silwerfish Hehe, I fixed it like 3 or 4 weeks ago. ^^
Thanks anyway for the reply. Hopefully creating a pretty nice map soon.
@Link98367 You use the ambient_generic entity to create sound. If you have some experience with the input/output system you should be able to figure out how to use it. If not, send me a PM!
I'll also add this as a tutorial request, thanks for the comment!
CAN YOU PLEASE MAKE A VIDEO ON HOW TO MAKE "civilians" ENEMY NPC'S
@ThePoliceComedyShow Yeah I think it's because Microsoft Speech API 5.0 only works properly on XP, that is used to generate the lip synch.
It didn't work. I tried it over and over, but every time I make it a scripted sequence, the NPC disapeered, when I turned it back, the sequence didn't work!
cope
Thank you so much bro! I was struggling for hours. And I couldn't find a good tutorial. But then I watchedy ours twice, and now it works perfectly! You rock! :D
@BigbadProduction You should be able to use the same technique as I use here to make that happen, just select the right animation.
That character model probably doesn't have the door kick animation, if that is the animation you're trying to use.
Ok:/ but can you tell me where you learned to do all this? If you know of a book or guide or website that covers all the stuff about NPC actions that would be great
@superdvdman That's great to hear! I'm going to try to keep creating tutorials for you guys!
it doesn't work for me!
Thank you!
I have added your request to the request list, much appreciated. :)
Unfortunately, I don't make tutorials for the Source engine any longer, sorry!
@LuiDeca I've created a series in three parts on that, they're called "Face Poser".
@0XSpartaX0 Try checking the "Don't teleport NPC on end" spawnflag on the scripted_sequence and see if that helps!
Let me know if it works!
Hey have a question..
How do you make actions be longer? I made this map and Kleiner (te npc that i'm working with) sat for only about 0.09 seconds. Any help?
nevermind you just loop the animation
Thanks!
Remember to give me requests if you got any! :)
@tropicAL509 There should be a "next sequence" property or something like that in the scripted_sequence. Just put the name of the next sequence there and voilá!
@Silwerfish the same way applies to npc open door? like citizen opens door or combine pushes botton to call down elevator?
That's odd, sv_cheats has always worked for me. Though I do remember someone writing somewhere how you needed to do another command before you could do sv_cheats. But I don't remember what command it was, but you might want to look into that.
For the black screens in Hammer: I recognize that issue, I think it happened when I still used Hammer when Valve updated something at one point. I have no recollection of how the issue was solved unfortunately. I suggest you Google it some more.
@idonthatethissite That's not possible, unless you want to use the same scenes that can be found in the original games, those can be accessed.
Hey SF! Tja :)
Umm, I've got this problem, I made an animation following the tutorial, where a citizen walks right over to a wooden bench, then I used Idle_To_Sit_Chair,
but I can't get him to stay in the chair, after he sits down he just pops up standing idle. Help! BTW great tutorial :)
@Andrewmaster0 I haven't made a Hammer tutorial in months and I don't think I'll start again soon, sorry!
Yes, look at my tutorial called "NPC Relationships".
It's been added to the request list, thanks!
That is incredible advanced compared to this stuff so I won't make a tutorial on that.. Unless I learn how to do it some day, it's added to the request list in any case. :)
I have a question and i hope it gets answered quickly. What do i do if i want him to kick down a door and then him to run to me? hoping for a quick reply, thanks.
@Silwerfish oh because on the accursed farms faq it says how ross scott(civil protection)does his videos all within the source sdk so maybe he uses that i guess ill have to try it out for myself
@mixterproductions You could try doing SetHealth (With a parameter override of 0). That worked for me. :)
Let me know how it goes!
@ThePoliceComedyShow They say things like "Reloading" and "I'm hit!" automatically when those events occur. I've been wanting to make a tutorial on how to make an NPC talk for a long time now, but it doesn't work properly on Windows 7 (only does work correctly on Windows XP).
Why is the Scripted Sequence Entity able to collide with me?
Just add that scipted_sequence name in the "Next Script" property and he should walk to that scripted_sequence and do it right after he's done with his current one..
@MooseRider Haha, thanks! :D
I'm glad you found it useful.
for some reason when i apply the animation it applies it to all entities, any way to fix this?
@mikilofo90 Yeah it should. The thing you need to refine is just the timing of everything.
@Silwerfish Yes but now I did a adoorkick when he is holding a smg and part of the animation is when he runs into the room and I had a next sequence but he teleports back to the first script_sequence then runs to the script
I will make more tutoruals, no doubt! It would be awesome if you had a tutorial request!
Thanks! :D
THANKS FOR THE TUTORIAL i haved a lot of use for that
Could you PLEASE make a video on getting Combine to jump down from walls?
Can you make a tut about for instance a vortigaunt typing on his computer or something like that? Other npc's doing other stuff?
@spenceriguess You can't do that I'm afraid, you could use FacePoser to make scenes, but you still use predefined animations.
@MultiInsanity Just put the name of the next scripted_sequence into the "next script". The NPC will then do that scripted sequence right after the previous one.
@tylorh26 That's odd, there should be for every NPC I think.