Raised This Month: $ Target: $400
 0% 

[L4D2] Sky (comp. config), that adds only the additional events to camapigns?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
LN5005
Member
Join Date: Oct 2022
Location: Mad Universe
Old 11-23-2023 , 19:12   Re: [L4D2] Sky (comp. config), that adds only the additional events to camapigns?
Reply With Quote #30

I found that I can use prop_physics's features to create a tank-destructible escape route.

Video: In a nutshell.


prop_physics can generate OnAwakened outputs when an external force is applied to it, which we can use to "disable" entities related to the escape route, thus destroying the escape route.

Specifically, we need to create two entities, one being the entity that acts as the escape route (hereafter referred to as the "bridge"), and the other being the prop_physics entity that acts as the support of the bridge for the bridge (hereafter referred to as the "car").

They look like this: [Screenshot] The bridge and the car that supports for the bridge.

* Both entities are prop_physics entities, but since the "bridge" model itself does not support being a prop_physics entity (using that classname causes the entity to disappear), you must use prop_physics_override as its classname.

Our goal is simple: we want the bridge to collapse when the car is hit by a tank. this is similar to the bridge in chapter 3 of Blood Harvest, except that we want to destroy an escape route instead of creating one.

First, we need to disable the motion of the bridge (mainly because the car itself is not necessarily stable enough to act as a support for the bridge), which can be done by simply setting spawnflags 8 on the bridge. For example:
PHP Code:
{
    
"solid" "6"
    "origin" "-7350 -8271 -28"
    "angles" "90 -90 0"
    "model"     "models/props_urban/gate_wall003_128.mdl"
    "classname"    "prop_physics_override"
    "targetname"    "physical_gate_wall_road"
    "spawnflags"    "8"

* If we don't disable the bridge's motion, it might fly to somewhere else when OnMapSpawn is finished;
* We just need to make the bridge collapse when the car is hit by a tank;

Then we need to prevent players from applying force to the car to prevent the bridge from collapsing from players *scaring* the car:
PHP Code:
{
    
"origin" "-7350 -8272 -27"
    "angles" "0 90 0"
    "model"     "models/props_vehicles/airport_baggage_cart2.mdl"
    "classname"    "prop_physics"
    "OnAwakened" "physical_gate_wall_road,EnableMotion,,0,-1"
    "OnAwakened" "bus_station_saferoom_door_nav_blocker_02,BlockNav,,0,-1"
    "spawnflags"    "1025"

"spawnflags" "1025" consists of 1 and 1024 and has two functions:
* 1: Start Asleep. This will disable the motion of the car, but it will re-enable its motion when external forces are applied to it.
** This is mainly to avoid interactions between solid models that would cause the "car" to bounce out of its intended position.
* 1024: Prevents players from applying force to it. (unverified)
* In the code above, "physical_gate_wall_road,EnableMotion,,0,-1" is used to enable motion of the bridge named physical_gate_wall_road, which will cause it to collapse.

We can use the output generation mechanism of "the car (prop_physics)" to provide input to the bridge and cause it to collapse:

1) Use "OnAwakened" to generate outputs: the car will cause the bridge to collapse (generate outputs) by all forces from boomer, charger and tank;
2) Use "OnHitByTank" to generate outputs: the car will cause the bridge to collapse only if it is hit by a tank. The rock from the tank will not cause the car to collapse the bridge, although it will knock the car away.
* The process can be summarized as follows: the car gets hit by a tank >> which generates output / EnableMotion to enable bridge motion >> bridge collapses due to gravity and loss of support.

Using "OnAwakened" as the method to generate the output would make the game harder or cause the escape route associated with the bridge to be destroyed earlier, while using OnHitByTank would affect the realism of the bridge collapse event.
* Screenshot: Rocks from a tank will not cause the car to generate outputs related to OnHitByTank, such as causing a bridge to collapse.
* If you have an alternate escape route for survivors (e.g. put a ladder down here for survivors to climb), then I recommend using OnAwakened as the method for the output generation.

In order for survivor bots to recognize the bridge and be able to use it to jump, we need to create a navmesh area for them on the bridge:
1) Use nav_create_area_at_feet 1 to create a navmesh area on the surface of prop_physics entity(ies) (the bridge);
* This will also allow you to create navmesh areas on the various prop_dynamic entities that you create via stripper, allowing bots to use or bypass the appropriate entities in their paths.
2) Create a navmesh area by setting the start point of the navmesh area with nav_begin_area and the end point with nav_end_area;
3) Select the other area(s) with nav_mark, aim at the navmesh area we created, and use nav_connect to create a connection between the other area and the navmesh area we created, allowing bots to move from the other area to the navmesh area we created.
* Screenshot: It looks like this.
* If you're using a model for the car that survivors can't jump onto directly, you'll need to place an entity near it to allow survivors to jump onto the car (don't forget to create new navmesh areas associated with that entity).

Then we also need to block the navmesh area(s) of the bridge when it collapses, so that bots don't use the non-existent navmesh area(s) (escape route), which requires us to create a (few) func_nav_blocker(s):
* infected, including common, also use navmesh areas for routing; the users of navmesh areas are not limited to survivor bots.
PHP Code:
{
    
"classname"    "logic_auto"
    "OnMapSpawn"    "bus_station_saferoom_door_nav_blocker_02,addoutput,maxs 2 2 2,0,-1"
    "OnMapSpawn"    "bus_station_saferoom_door_nav_blocker_02,addoutput,mins -2 -2 -2,0,-1"
}
{
    
"classname"        "func_nav_blocker"
    "origin" "-7351.905273 -8370.178710 -26.968750"
    "targetname"    "bus_station_saferoom_door_nav_blocker_02"
    "teamToBlock"    "-1"

* Move the position (origin) of func_nav_blocker(s) to the navmesh area(s) so that it can be blocked, then block the navmesh area with "bus_station_saferoom_door_nav_blocker_02,Blo ckNav,,0,-1".
** You need to add "bus_station_saferoom_door_nav_blocker_02,Blo ckNav,,0,-1" to the car as "OnAwakened" or "OnHitByTank".
** The navmesh area on top of the car (if there is one) also needs to be blocked. Simply create a new func_nav_blocker entity with the same name and move it to the navmesh area on top of the car by setting its origin.

That way, if the bridge collapses because the car has been hit by a tank (or a charger), the bots won't try to walk on the entities that are no longer available.

——————

If you're using a model that the survivors can't jump directly onto as the car model, then we'll need to make some additional I/O changes to our navmesh areas and entities.
Video: Tank trying to jump to the "top of the car" via the nearby boxes.


prop_physics will cause tanks (and also survivor bots) to tend to go through other navmesh areas instead of trying to go through where the prop_physics is, which will cause them to tend to jump on top of the car instead of breaking, hitting the car and causing the bridge to collapse. While it is still possible for them to hit the car and cause the bridge to collapse, they would look pretty stupid because of the pathfinding problems in those areas.

Considering that func_nav_blocker's blocking effect on navmesh areas can be targeted to only disable pathfinding for infected or survivors, just put a (few) func_nav_blocker(s) on the boxes (or any other navmesh area(s) used to jump to the top of the car) and block the navmesh area when OnMapSpawn:
PHP Code:
modify:
{
    
match:
    {
    
"hammerid"    "1797205"
    
}
    
insert:
    {
    
"OnFullyOpen"    "bus_station_boxes_nav_blocker,BlockNav,,0,-1"
    
}
}

add:
{
    
"classname"        "logic_auto"
    "OnMapSpawn"    "bus_station_button,Lock,,0,-1"
    "OnMapSpawn"    "bus_station_boxes_nav_blocker,addoutput,maxs 1 1 1,0,-1"
    "OnMapSpawn"    "bus_station_boxes_nav_blocker,addoutput,mins -1 -1 -1,0,-1"
}

{
    
"classname"    "func_nav_blocker"
    "origin"    "-7478.168457 -8235.031250 32.092636"
    "targetname" "bus_station_boxes_nav_blocker"
    "teamToBlock"    "3"

The parameter "teamToBlock" "3" of func_nav_blocker means that the navmesh area blocking effect of this entity only works for infected bots (including common, special infected and tank). this may cause special infected to get stuck in the car (since there is no other way to jump on top of the car), but since common can automatically climb shorter entities, this shouldn't be a serious problem..

However, common needs an available navmesh path before it will try to climb the car, so you'll also need to create a (few) navmesh connection(s) between the bottom of the car and the top of the car, or else common will *cheer* for the survivor(s) that at the top of the car due to the lack of available paths (it seems like dropping a bile on an unreachable location).

* Screenshot: There should be one (or a few) connection(s) between the navmesh area(s) at the top of the car and the navmesh area(s) at the bottom.
** If the survivor bots are unable to jump directly to a higher navmesh area, they will attempt to travel to the higher navmesh area from other navmesh areas, so this type of navmesh connection will not interfere with the survivor bots' pathfinding process.
* Oddly enough, logic_auto can't provide BlockNav input for func_nav_blocker to block the associated navmesh (I'm not quite sure if this is a load order related issue), so we have to provide BlockNav input to func_nav_blocker from other sources (e.g. OnFullyOpen function of saferoom door).
Attached Files
File Type: zip c5m2 example.zip (1.53 MB, 30 views)
LN5005 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode