Onah 58 / 2,684 Report Post Posted March 30, 2019 MAKING BOSSES/NPC'S MOVE Alright, so this is gonna be a little tutorial on how to make a boss/NPC move around while tracking players! Now this is just one of MANY ways to create a moving boss/NPC, of course you could do this using different methods, entities, or even scripts, but for this tutorial, we will learn it this way. Special Thanks to Luffaren, because this method was taught to me by him. **This tutorial will ONLY cover boss movement** ------------------------------------------------------------------------------- THE SOUL OF THE BOSS The first thing you will need to create is a func_physbox_multiplayer A func_physbox works too but word on the street is that _multiplayer is cooler (and cheaper) Ideally you would probably want this to be textured with an invisible texture Anyways, this is your bosses daddy. And by daddyy i mean parent. The majority of your bosses stuff will be parented to this guy. You may name it whatever you want, but for this tutorial we will name and reference it as Daddy_Phys KEYVALUES: The keyvalues for the physbox are really up to you, like the strength, mass, whatever, but you should at least have this one set: Solid to World This is just so it can slide along the ground, if it's set to the other option it'll just fall through lmao FLAGS: The same goes with the flags, depending on what you're going for, but generally you would want this one checked: Debris - Don't collide with players or other debris Unless of course you want it to be hitting players, but then you might wanna play with the other flags as well in that case. -------------------------------------------------- BOSS TARGETING SYSTEM This section will go over how to make a boss FIND a target to attack **Having it attack these targets will be covered in the Boss Movement Sections** What you will need for this portion is a Trigger_Multiple and a filter_activator_name For the Trigger_Multiple: Make sure it's big, big enough to cover the entire boss platform, or however large you want the range of your boss/NPC to be. Make sure its origin doesnt leak out of the map though For this tutorial we will name this trigger Daddy_Targeter KEYVALUES: Set its parent to Daddy_Phys Set its Delay Before Reset to 0 FLAGS: Clients OUTPUTS: OnTrigger -> !self -> Disable -> -> Delay = 0 seconds OnTrigger -> !activator -> AddOutput -> targetname boss_target -> Delay = 0 seconds OnTrigger -> !activator -> AddOutput -> targetname no_target -> Delay = 4.95 seconds OnTrigger -> !self -> Enable -> -> Delay = 5 seconds --Don't wory if !self and !activator show up red, it WILL work in game, it's just a way to call certain thingies regarding the trigger-- So what goes on here is when Daddy_Targeter is triggered, it will disable itself so it can NOT be triggered by someone else while the outputs are running. It will give the person who first set it off (!activator) as the targetname of "boss_target" This is essentially a filter name and you can name it whatever you want, but for the sake of this tutorial it will be referenced as boss_target **Remember the name of this, because it will be IMPORTANT for the following parts** The delay is set for however long you want your boss to be targeting a single player for. I put 4.95 seconds for 5 seconds, but you can set your boss to target players for as long short as you want. Following this, after the delay, the trigger will then replace the boss_target 's targetname with the targetname of no_target. This will cause the player to no longer be the bosses target. I should also mention that you can name "no_target" whatever you want, as long as it is NOT the same as "boss_target" - all it is is a replacement targetname that is not the boss_target After the replacement targetname is set, the trigger will then re-enable itself so that it can find a new target to fuck with. For the Filter_Activator_Name: Name this whatever you want, for this tutorial we will name it boss_target_filter KEYVALUES: Set Filter Mode to allow entities that match criteria Set Filter Name to boss_target Or whatever you set your targetname to be for the boss -------------------------------------------------- BOSS MOVEMENT PT. 1 In this section we will go over the settings required for phys_thrusters to move our Daddy_Phys. The triggers for these thrusters to allow them to move our Daddy_Phys relative to the targeted player will be covered in the section immediately after this. For simple movement across a flat platform, you will need 2 phys_thruster Our first thruster will be named boss_front_thruster This thruster will be responsible for your boss/NPC's frontal movement Our second thruster will be named boss_sides_thruster This thruster will be responsible for your boss/NPC's turning Again, the names are entirely up to you, but those names is how we'll refer to them here. KEYVALUES: Set the Force to be whatever you want depending on how fast you want your boss to be Personally i find that 2500 is a good starting point for the front thruster and 500 is a good starting point for the sides Set the Attached Object to be Daddy_Phys The attached object is simply the entity that the thruster applies force too, which is our physbox. Bear in mind that the location of the thrusters relative to the physbox is important! I find that placing them infront of the Boss/NPC on the ground (same lvl as the physbox) is ideal Having it higher up or oddly placed can cause some wonky movement FLAGS: Apply Force So it can apply force lmfao Orient Locally This flag will make it so that the boss will always move properly according to its orientation (More on this in the next part) Ignore Mass Just so you don't have to deal with mass values and junk.. You probably could leave this unchecked and play around with it if you really wanted to though Apply Torque (SIDE THRUSTER ONLY) This flag should only be applied on the side thrusters! It will allow the boss/npc to turn more smoothly Thrusters will act according to the orientation of the grid in a "PITCH YAW ROLL" format If your boss is ONLY moving along the ground, then you only need to care about the YAW When looking at the top view of your map, there is a grid, the angles work according to this grid like it would in a math unit circle or a compass Lol For movement along flat ground: The above image would be the TOP view of your map. (the one in the top right corner when you have all 4 screens showing) KEEP THIS IN MIND WHEN ADDING THE VALUES TO YOUR BOSS!!!! The direction your boss faces INITIALLY is dependent on this. FOR THIS TUTORIAL, we will have an example where the initial direction the FRONT of our boss faces is EAST. If your boss faces a different direction just adjust the angles accordingly boss_front_thruster ADDITIONAL KEYVALUE: Set the PITCH YAW ROLL value to 0 0 0 Similarly, the boss_sides_thruster would only need a YAW value change; however, seeing as we only use one thruster for both the left and right sides, we will set the PITCH YAW ROLL value to a neutral angle. This value should usually be opposite of the boss_front thruster. boss_sides_thruster ADDITIONAL KEYVALUE: Set the PITCH YAW ROLL value to 0 180 0 The following part is where we will change the values of this thruster so that it can shoot either left or right. -------------------------------------------------- BOSS MOVEMENT PT.2 Now this is where it really comes together. So far we have created a thing that will target INDIVIDUALS and we have created thrusters with settings to move our boss around. All that's left is to connect the two so we can have a boss that can move around and follow players! You will now need another Trigger_Multiple Ideally, you should make this the same size as the targeting trigger (Daddy_Targeter) This trigger will be cut up into 3 parts using the clipping tool (and vertex tool if you wanna do other stuff) But first i want to mention some Keyvalues and Flags that will be universal among the 3 KEYVALUES: Set its parent to Daddy_Phys Set its Delay Before Reset to be 0 Set Start Disabled to YES This is how we'll start our boss movement, when the boss fight begins then ENABLE all of these triggers using whatever triggers the bossfight You could also have it set to NO in the event of this being an NPC rather than a boss (or whatever you imagine). What i mean is that it will just attack when something gets within sight instead of waiting for the fight to begin. Set its Filter Name to be boss_target_filter (OR whatever you chose to name the filter_activator_name) **Important: Make sure that these triggers are filtered to the boss_target_filter; if not then the boss will try to target everybody and it'll get a little wonky** FLAGS: Clients --- Now, divide this trigger into 3 parts like so: The names shown in the above image are the names we will be referring these triggers too. Trig_Front Trig_Left Trig_Right Of course you do not have to go by this set up, you could have a round trigger, different shapes/sizes of these three etc. You could even divide the trigger into more than 3 parts (I'll briefly explain a method using this later) But anyways, these triggers will simply activate as they are touched by the boss_target and send some info back to the thrusters so that it can move our boss accordingly Now for the OUTPUTS of these triggers We will be continuing with the example of if our boss INITIALLY faces EAST Trig_Front OUTPUTS: OnTrigger -> boss_front_thruster -> Activate -> -> Delay = 0 seconds Seeing as we have already set the proper value at which this thruster must shoot at, all we need to do is activate it. Now the left and right triggers is where it gets a little more complicated, but not that complicated at all lol Since our boss is initially facing east (in this example) the LEFT of that would be SOUTH (if you were facing the boss) Similarly, the RIGHT of this would be NORTH Pair this info with the angles shown earlier for these directions and you have the angles you need! Trig_Left OUTPUTS: OnTrigger -> boss_sides_thruster -> AddOutput -> angles 0 270 0 -> Delay = 0 seconds OnTrigger -> boss_sides_thruster -> Activate -> -> Delay = 0.01 seconds So what happens here is that when the boss_target activates this trigger the angle of our boss_sides_thruster will change from the neutral position to the LEFT of the boss and then activate so it can move the boss in that direction. Trig_Right OUTPUTS: OnTrigger -> boss_sides_thruster -> AddOutput -> angles 0 90 0 -> Delay = 0 seconds OnTrigger -> boss_sides_thruster -> Activate -> -> Delay = 0.01 seconds So what happens here is that when the boss_target activates this trigger the angle of our boss_sides_thruster will change from the neutral position to the RIGHT of the boss and then activate so it can move the boss in that direction. Now i feel like right now is the best time to explain the "Orient Locally" flag that we checked off on the thrusters earlier. As you can see, we set the angles of our boss_sides_thruster using Trig_Left and Trig_Right; however, our boss will NOT always be facing east as it moves around. This is why we use the Orient Locally flag. This makes it so that the angles being set on the thrusters are always relative to its INITIAL position. You can do cool things WITHOUT the Orient Locally flag, but that goes beyond the scope of this tutorial. Anyways, just thought that was some important information. Now back to the tutorial... With the thrusters constantly activating and receiving new information, it needs to be refreshed to allow the new values to be placed upon them. How do we solve this? We use the ole turn it off and on again trick! And we accomplish this using a logic_timer Throw one in using the entity tool and if you want, you can name it, but you don't have too But fuck it, we'll just call it boss_timer KEYVALUES: Set Start Disabled to NO Alternatively you could have this set to YES but then just make sure to name it so you can enable it before the boss fight starts Set Use Random Time to NO Set Refire Interval to 0.1 OUTPUTS: OnTimer -> boss_sides_thruster -> Deactivate -> -> Delay = 0 seconds OnTimer -> boss_front_thruster -> Deactivate -> -> Delay = 0 seconds What happens here is that this timer will constantly deactivate the thrusters as it reaches its refire interval of 0.1 seconds so that it can constantly update thrusters as the boss_target moves through the triggers Wow, once you get this far, your boss thing should probably be fuckin you up right about now, in a good way EXTRA BITS Another thing you might wanna add is a phys_keepupright What this entity will do is prevent your boss from tipping over KEYVALUES: Set its Target Entity to be Daddy_Phys Set its Angular Limit to 110 You may set this too whatever, just make sure its large enough to prevent tipping over from whatever forces might push it -------------------------------------------------- FINAL SUMMARY Now in case you wanted to have a quick description as to what the hell is going on i'll try my best to explain quickly Player gets targeted by Daddy_Targeter and gets the targetname of boss_target boss_target is standing in one of the 3 triggers (Trig_Front, Trig_Left, Trig_Right) and triggers them as a result The trigger then sends the info that the boss_target is within it to its respective thruster The thruster activates and moves Daddy_Phys (our boss) towards the boss_target boss_timer deactivates the thruster REPEAT The delay set on Daddy_Targeter is reached boss_target is now given a new targetname -> no_target For a very brief moment, the boss has no one to hunt for Daddy_Targeter re-enables itself REPEAT -- THAT IS ALL! GOODLUCK! I hope it works. I really do, cause if it doesn't that might mean my tutorial was shit. -- Share this post Link to post Share on other sites More sharing options...
AutoJumper 3 / 90 Report Post Posted October 31, 2022 If anyone is still looking at this thread, I recommend using luffarens vscript for boss movements. Just go to his websites and under the prefab sections and download the moving_npc prefab. If you have any questions on it you could ask him and he could probably answer them. http://www.luffaren.com/ Share this post Link to post Share on other sites More sharing options...
bladetv 0 / 122 Report Post Posted November 16, 2022 Edited November 16, 2022 by bladetv hey how can u fix boss movement issue because my boss keep getting stuck on side walls if player moves away at last moment near wall physbox get stuck on wall. I have attached file.(im using luff script + trigg stuff from top) ze_test_boss.zip Edited November 16, 2022 by bladetv Share this post Link to post Share on other sites More sharing options...
AutoJumper 3 / 90 Report Post Posted November 16, 2022 1 hour ago, bladetv said: hey how can u fix boss movement issue because my boss keep getting stuck on side walls if player moves away at last moment near wall physbox get stuck on wall. I have attached file.(im using luff script + trigg stuff from top) ze_test_boss.zip 101.47 kB · 0 downloads dont use both just use one, you can decompile jb_paradise_lost and look at the chicken game, all you would have to add to it is a physbox over it with some hp bar, pretty sure theres some hp bar boss system on gamebanana Share this post Link to post Share on other sites More sharing options...