Welcome to PlagueFest.com! Log in or Sign up to interact with the Plague Fest community.
  1. Welcome Guest! to interact with the community and gain access to all the site's features.

Tutorial Dynamic bosses (such as predator_ultimate)

Discussion in Resources & Tutorials started by dormantlemon, Sep 7, 2011

  1. Aug 19, 2011
    Well my first tutorial that i hope can help others. Im here to explain what has probably baffled many a mapper. I aim to explain the basics of how to make an interactive moving boss like predator from ze_predator_ultimate. I worked this out when i was building ze_bioshocks big daddy boss, after a huge amount of messing around with physics entities. Its actually rather simple and i shall explain how it works. Ill keep to th ebasics but add an later an explaination about how to add extras

    I. Producing the basic boss setup
    II. Animation
    III. Scaling HP
    IV. Sound and Particles
    V. Additional Attacks [still to do]

    [----------I. Produicng the basic boss setup-----------]

    1. We need to produce a func_physbox brush entity to begin with. It should be fairly sized, a tad smaller than the boss model you plan to use. Give it a nice name (im using my bioshock names as reference so take note). My physbox will be called r1_daddy_physbox.

    2. We need our boss model. So go ahead and find/produce one. We need to use a prop_dynamic here so add one inside the physbox and set it to the model you desire. Give it a name, and parent it to the physbox we created in step 1. So now we have r1_boss_physbox and a parented model within it.

    3. The next thing we must do is add some phys_thruster entities. See where this is going now? I used 6 (forwards, leftforwards, rightforwards, leftbackwards, rightbackwards, and backwards). You need to make sure each direction of force is pointing in the direction is is placed in relation to the physbox. Each thruster should be almost touching the physbox. So go ahead and parent (technically its attached object) them to the physbox aswell. Make sure they are all set to start off.

    4. We now add 6 trigger_multiples around the boss that extend far out from the model (large enough that someone should be touching a trigger regardless of where they are). They should be postioned in the same way as the thrusters.No trigger should overlap with the exception of the forwards trigger which should not be rectangular, but rather start at the boss and slowly extend outwards to for an elongated trapezium shape. This one can and should overlap the left and right forward triggers. Now name each one suitably (i used r1_boss_trigger_thrust_f, r1_boss_trigger_thrust_lf, r1_boss_trigger_thrust_rf etc), and parent each one to the physbox. Lastly make sure that each one has reset time of 1.

    5. Now weve got some basic IO's to do on each trigger.
    So what we do it this:

    My forward trigger r1_boss_trigger_thrust_f has the following IOs:
    OnTrigger---->r1_boss_thruster_f---->Activate---->Delay 0----->Only Once: No
    OnEndTouchAll---->r1_boss_thruster_f---->Deactivate---->Delay 0----->Only Once: No

    My forwardleft trigger r1_boss_trigger_thrust_lf has the following IOs:
    OnTrigger---->r1_boss_thruster_lf---->Activate---->Delay 0----->Only Once: No
    OnEndTouchAll---->r1_boss_thruster_lf---->Deactivate---->Delay 0----->Only Once: No

    This means that when a player touches the trigger, the thruster will take the boss in their direction. When they leave the trigger the thruster deactivates. Its simple movement that fakes AI!

    6. Add a phys_keepupright anywhere, and select the physbox as the entity to keep upright. This dpes exactly what it suggests.

    7. Make the boss hurt you:
    This is easy, add a trigger_hurt around the model and parent it to the physbox. When the model comes very close to you, youll get hurt!

    8. Lastly is HP. There are 2 ways to do this, physbox HP or using a func_breakable.
    I use a func_breakable and shall explain that. This is as simple as the last step.Add a func_breakable with the tools/invisible texture around the model and set its HP.
    If you want a door or whever to activate on break just add the OnBreak output. Again parent it to the physbox, and thats it!

    [----------II. Animation----------]

    I shall not explain the Ins and Out of animation production, as although i am more than capable of explaining how to animate in 3dsmax, its not part of this tutorial. However i can explain what animation/s you need.

    Now as we know, custom models (and even most stock models) by default have no animations, and in the more basic sense, no bones with which to produce animation. Therefore when you use a custom model, unless you use a prerigged character (such as enemy models from halflife 2) you will either have to rig the character [prepare it for animation] or at least animate it yourself.
    For a boss, you realistically only NEED 1 animation, a running animation. So mke sure youve made one. There are tutorials about how to rig, animate and export to source all over the place. Now onto instructions on how to make use of that animation:

    1. Assuming youw ant the boss to be always running while alive by default, we would need to set our running animation as the default animation. So what we do is we go to ou prop_dynamic boss and find the Default Animation property, and we shall set this to whatever name our run animation is.

    Basically thats it. Just 1 step for enabling an animation for a model. Of course producing an animation takes a lot more work.

    [-------II part2. Additional Animation--------]
    So we now have a basic animation for our boss. But what if we want something more? Such as an attack animation whenever he hits someone? Well thats easy enough too, just make sure you have the model with all the appropriate animations you need.

    1. To add an attack animation to the boss, first add a trigger_multiple 1 unit around the triger_hurt that surrounds the boss in the x and y directions and parent it to the func_physbox like everything else.

    2. Now the outputs of the trigger are relatively straightforward:
    OnTrigger--->prop_dynamic's name----->Set Animation---->Attack (or whatever your desired animation is called)----->Delay 0
    OnTrigger--->prop_dynamic's name----->Set Animation---->Run (or whatever your default animation is called).----Delay X (where X is the length of the attack animation. This will prevent the animtion from looping and looking weird. Make suer you get this right though!)

    What we see here is that when the player comes into close contact with the prop_dynamic, the attack animation is played, and because they are so close to the trigger_hurt, we expect them to be killed as the animation takes place. Then once the animation is finished it is set back to its default animation

    You can leave out the second output to reset the animation, assuming that when you compiled the models attacking animation you set it to not loop. If this is the case it will automatically revert to its default animation when that animation has finished its cycle.

    [------III. Scaling HP------]
    Another popular (and understandably so) thing to do is use HP scaling for the boss (based on the number of players they fight). There are various ways to do this, but since i took the func_brekable method of setting HP, we'll use this for making scaling HP.

    This is actually very simple, although people believe this is difficult.

    1. Before the bossfight, i sugget you find somewhere that the humans should be safe(ish) but can only pass thorugh once.
    For example, you would expect the boss room to have a narrow doorway/a long drop for humans to get into the room.

    2. In this particular entrance i suggest that you add a trigger_push that prevents humans from passing back through that tunnel. I use push forces of 300 as weak pushes can still allow people to force their way through. It doesnt need to be a long push or a large push, just enough to stop players from getting back past it (if they leave after defeating the boss by the same exit you can disable it later). Then we add a trigger_multiple just before the trigger_push (so the push separates the trigger_from the room). I recommend putting the trigger inside the push, so humans cant go trhough it and back out again just before the push. Make sure the trigger_multiple has reset set to 1 or less.

    3. Our output for the trigger_multiple
    OnTrigger----->Our Boss' prop_dynamic----->AddHealth----->XXXX----->Delay 0

    What we see here is that every time the trigger is activated health is added to the boss.

    If you implement this, 500-750 at max is a good value i think for Health to add per person. Also make sure that the boss has a low HP to start with, but not 0. I recommend 5000HP unless hes supposed to be very difficult.This means HP will be 5000+ (500xXno. of humans)

    [-----IV. Sound and Particles-------]
    Now i dont really feel that this need explaining but ill explian what should be done.

    Sounds from the boss are easily done unless you wish to go very complicated for very little extra gain.
    Sounds are done via ambient_generics, which i believe you can parent, but havent looked into. One ambient_generic can play 1 sound. This example will show how to add a sound to the attack mentioned in Part II. So make sure youve read that as this will continue straight on

    1. The trigger we created for SetAnimation? Well we simply add another output to it:
    OnTrigger----->Name of our ambient_generic---->PlaySound----->Delay 0

    2. Make sure each ambient_generic has the following under flags. It is NOT looped. Plays everywhere. Make sure both are ticked. They do exactly what they suggest.

    Thats it for adding simple sound.

    The same applies to particle effects, you add an info_particle_system, parent it again to the func_physbox and chose your particle name (likely after producing your own).
    We then make sure under its properties that it is set to Not Start On, and the we can enable it on a trigger just like sound. Thats it for the basics experiment and see what you can find

    [-----V. Aditional Attacks-----]

    I need to write this section with some etxras such as lunge attacks or jump attacks or whatever, i need to produce some working stuff first though before i finish this up. This section is probably not so much use anyway as i would hope that anyone who actually produces a boss in a map would come up with some original attacks.

    [--To be written--]

    General Notes:
    This isnt bugless, Luffaren has got the system nailed far better than me, particlularly that the boss may have issues facing players they are chasing. However if done as i explained, the boss will turn to face players over time, and hopefully fairly swiftly. The more triggers and trusters you add, the more accurate is movement will be. However the more laggy and entity bloadted your map will become. 6-8 thrusters should more than suffice. for movement on the X/Y plane

    Final Note:
    Predator *may* not work like this. HOWEVER if youve seen the early versions (v2) you will see just how similar things are that leads me to believe this is how luffaren produced predator (I never decompiled his map as i dont believe in doing such things for any reason other than to fix a broken map. So ultimately i dont know if this is the case)
    • Useful Useful x 2
    • Jul 28, 2011
      Thanks for this tutorial dormantlemon. Maybe one day I'll make a zombie escape map :thumbsup:
      Do you know if there is a way to make the boss' HP vary based on how many players there are? I think some maps do this (not certain which ones). I haven't given it much thought, but could you count the number of players at the beginning of the round and then add a certain amount of HP for each player? I've messed with it some, but with little success...
    • Mar 25, 2011
      Try playing around with math counters, for example:

      Make a trigger_once, and link a math_counter to it.

      Make it so if # of players is greater/less than a number, it will set the health to whatever you want.

      Also, skimming through this i didn't see anything going over animations, or how to make it so the boss is facing whoever when he is walking towards whoever. Do the thrusters cause the model to turn or what?
    • Aug 19, 2011
      its easier than that, make a trigger wihout put OnTrigger--->func_breakable--->AddHealth--->XXXX.Just make sure players can only pass through once.
      The thrusters do kinda casue the model to turn towards movement directon. Its not perfect but there is much more to predator than what i added. This is only the basics. I believe that theremay be some knd of func_rotatings ivlloved.
      animation is done using the models animations and the Setanimation output.

      I plan t add more to this tutorial including rush attacks once ive got everything nailed down. Ill also provide a sample map to sho how it works when im happy with it.

      I think that the problem with sourc games is that there is rarely ned t experminet with many available entities and s most mappers are unfamiliar with many entites and their range of uses, point_template is a very useful entity for example tat is ohften overlooked

      Added much more to the tutorial. It now covers animtion, some sound, and scaling HP