Well, I've got COVID-19 again. So I decided to use some free time to modify this map.
* I tried to make a model with Blender earlier and got stuck on Crowbar not generating a .phy file, and then I got COVID-19 due to an overwork induced immune deficiency xd.
Long story short, this time I'm going to modify the spawnpoint of survivors so that they will spawn in a different position when onmapspawn. I tried this before in c1m1, but didn't leave a manual for it.
1) First, we export the entity information of the map we want to modify (e.g. c5m1) using the stripper_dump console command (the exported entity information is located in the Left 4 Dead 2\left4dead2\addons\stripper\dumps\ folder);
* This console command will only work if Stripper is installed.
2) Then use CTRL+F to find the string info_survivor_position;
* The value of the entity parameter "SurvivorName" indicates which survivor spawnpoint the entity controls.
**It looks like a single info_survivor_position entity can only control one survivor spawnpoint, so we need to find // at least four info_survivor_position entities.
The next step is pretty simple, we just need to use modify to change the origin of the info_survivor_position entities (by their hammerid) to the position where we want the survivors to spawn.
* The hammerid is included in the exported result of stripper_dump;
* You can get the position where you want the survivors to spawn by using Dev Cmd's /pos command, just move to that position and use this command.
Use match to match the hammerid of the entities you want to modify, then use replace to replace the origin of the target entities with the position you get from /pos; you may also need to replace the value of the angles parameter to modify the orientation of the survivor(s)' vision. For example:
* Note: Using 0 as the value of angles may cause related changes to the entities not to work, because some entity classes do not accept 0 as a value for their angles parameter. In this case, use 360 as the value of this parameter instead of 0. See https://forums.alliedmods.net/showpo...&postcount=180.
* Note: "modify" is case sensitive. If you use "Modify", then the above code will not work (quite a strange bug).
Save the changes and then reload the map with the "map ..." console command. You should see Coach spawn at the position you specified.
* I recommend disabling the movement of bot survivors with "sb_move 0" in console.
The next step is to copy and paste the above code three times, change the hammerid in the copied code to the relevant entities (info_survivor_position) hammerid and replace their origin and angles parameters one by one to modify the other three survivors' spawnpoints. For example:
PHP Code:
modify: { match: { "hammerid" "1703281" ; Coach's spawn position / spawnpoint } replace: { "origin" "-148.340118 1324.557617 -175.968750" "angles" "10.825081 -97.690162 360" "SurvivorName" "Louis" ; Set the target survivor to Louis } }
You'll also have to add additional entities for the L4D1 survivors to make sure they spawn at the correct position (if your server uses plugins like csm), because when the game restarts by failure (or vote), these L4D1 survivors may respawn at a wrong position.
Simply copy the corresponding four info_survivor_position entities from the results exported by stripper_dump, add them to the Stripper:Source configuration file, and specify that the "SurvivorName" parameter of these entities is the name of one of the Left 4 Dead survivors.
The value of the SurvivorName parameter specifies who is affected by the entity. For example, setting the value to louis will cause the entity to change the spawnpoint of louis.
* Note: } and { cannot be on the same line, this will break the code, so after copying and pasting you will also have to create new lines for }{.
Example code:
* Don't forget to synchronize the "origin" and "angles" parameters of the code you copied from the stripper_dump results with the changes you made to the L4D2 survivor info_survivor_position entities in "modify:".
* To be on the safe side, it is best to remove the hammerid parameter and its value from the code you copied.
However, adding additional info_survivor_position entities for the L4D1 survivors is not enough, as it seems there is no entity to unlock the intro camera for the survivors after the intro camera relay ends.
To solve this problem, we need to know which entities control the locking and unlocking of the intro camera.
The results that the stripper_dump exports show that survivorPos_intro_* are related to camera_intro_survivor_*, and by looking at the related documentation of this classname(point_viewcontrol_survivor), we can see that providing a StartMovement input for it will play the corresponding intro camera, but the point_viewcontrol_survivor will be automatically disabled after the intro camera finishes by spawnflags 1.
Testing StartMovement of point_viewcontrol_survivor (camera_intro_survivor_*) with ent_fire shows that this type of entity does not accept StartMovement input while it is disabled, which causes the intro camera controlled by the associated entity(ies) to not work properly, resulting in the affected survivor(s) being stuck by the locked intro camera.
For unknown reasons, when the game is restarted, point_viewcontrol_survivor entities will only play the L4D2 survivors' intro camera normally, and not the L4D1 survivors' intro camera normally.
Nanually enabling point_viewcontrol_survivor with ent_fire and giving it with a StartMovement input will play the L4D1 survivors' intro camera normally.
Spoiler
Intuitively, we can re-enable point_viewcontrol_survivor(camera_intro_survi vor_*) entities when the game is restarted, which requires us to find the logic_relay entity that is automatically executed at the start of the game, and then insert the appropriate code into that entity to re-enable point_viewcontrol_survivor (automatically).
survivorPos_intro_* entities will automatically move the survivors to the origin of those entities when they receive ForceSurvivorPositions input.
If you look for ForceSurvivorPositions in the stripper_dump export, you can see that this input is provided by the relay_intro_start logic_relay, which means that this logic_relay moves the survivors to the origin of survivorPos_intro_* at the start of the game, and that the entity "director" triggered this logic_relay entity.
I tried inserting the re-Enable code into info_director (as OnGameplayStart) and relay_intro_start (as OnTrigger), but they didn't work. oddly enough, manually triggering the relevant logic_relay entity via ent_fire, or directly enabling the point_viewcontrol_survivor entity works fine.
So I spent about four hours looking for the exact cause, and I suspected that point_viewcontrol_survivor needed to specify an activator to achieve something similar to using ent_fire enable in the console.
I also tried using script DoEntFire("camera_intro_survivor_03", "Enable", "0",0, "louis",""); to enable point_viewcontrol_survivor to allow StartMovement input can make it to move the survivors' intro camera, but unfortunately this code doesn't work. it's probably because the string louis is not treated as a constant for that survivor, and therefore does not function as an !activator.
Considering that trigger_once/trigger_multiple can pass a survivor as !activator parameter to other entities, maybe OnTrigger point_viewcontrol_survivor,Enable,0,0,!activa tor will work.
I tried it and this method correctly gets and passes the !activator parameter needed by point_viewcontrol_survivor. It looks like the fifth argument in the output (-1) is used to pass the !activator.
The intro camera bug caused by point_viewcontrol_survivor is because the logic_relay in question does not provide the necessary !activator parameter to re-enable point_viewcontrol_survivor normally.
Since there is no constant to pass the value of survivors to !activator, in order to pass the value of survivors to point_viewcontrol_survivor so that it can control the intro camera movement of the relevant survivors, we need to create different trigger_onces for the survivors of L4D1 to get the values that can be passed to !activator, and then use OnTrigger point_viewcontrol_survivor,Enable,0,0,!activa tor to pass this parameter to camera_intro_survivor_* to control the intro camera movement of the corresponding survivors.
* The concept sounds like running a program as Administrator, except in this case there is no way to get the Administrator account username directly, so there has to be a trick to enable point_viewcontrol_survivor as "Administrator" and thereby make it accept StartMovement input, thus normalizing the intro camera movement.
First create a logic_auto to create the bounding box needed to trigger OnStartTouchAll for l4d1_survivors_camera_fixer, then create four trigger_onces (all named l4d1_survivors_camera_fixer) and set their origin to the L4D1 survivor spawn position (specified by survivorPos_intro_*), and then add the OnStartTouchAll output for trigger_onces to enable the point_viewcontrol_survivor entities (corresponding to survivorPos_intro_*). This process is a bit tedious..:
PHP Code:
logic_auto: { "classname" "logic_auto" "OnMapSpawn" "l4d1_survivors_camera_fixeraddoutputmaxs 4 4 40-1" "OnMapSpawn" "l4d1_survivors_camera_fixeraddoutputmins -4 -4 -40-1" "OnMapSpawn" "l4d1_survivors_camera_fixeraddoutputsolid 20-1" } ; This creates bounding boxes for all trigger_onces to make sure survivors can trigger on those entities.
* Set the origin to the position(s) of survivorPos_intro_*. The origins of these four trigger_onces must be set to the position of survivorPos_intro_01, survivorPos_intro_02, survivorPos_intro_03 and survivorPos_intro_04 respectively.
* Change camera_intro_survivor_* in "OnStartTouchAll" of trigger_onces to camera_intro_survivor_* entities that are related to survivorPos_intro_* entities.
* By looking at OnTriggers in relay_intro_setup, you can determine which camera_intro_survivor_* survivorPos_intro_* is related to.
** For example, "OnTrigger" "survivorPos_intro_02 SetViewControl camera_intro_survivor_02 0 -1" indicates that the survivor intro camera (related to survivorPos_intro_02) is controlled by camera_intro_survivor_02.
point_viewcontrol_survivor will accept the StartMovement input if it's enabled, in which case, giving it this input to it will cause the intro camera to start moving.
* See https://developer.valvesoftware.com/...ntrol_survivor.
The intro camera is divided into two parts. the first part is not affected by the position of spawnpoint ( if you have played c1m1 of this map, you will probably understand what I am talking about), and the second part is the point_viewcontrol_survivor(camera_intro_survi vor_*) entities we are modifying.
To avoid these entities encountering some messy execution order issues and not working properly, trigger_onces should be disabled by default (via "startdisabled" "1"), and then enabled manually with logic_relay to ensure that the point_viewcontrol_survivor entities control the intro camera normally as expected.
Searching for camera_intro_survivor_* in stripper_dump will tell you which logic_relay (such as relay_intro_finished) provides the StartMovement input and controls the intro camera. find the parent logic_relay (not parentname) that triggers the sub logic_relay (such as relay_intro_survivor_cameras), and then insert the code that enables trigger_once entities into the parent logic_relay entity:
* 1693402 is the hammerid of relay_intro_survivor_cameras, which triggers relay_intro_finished to start the second part of the intro camera movement.
* It is recommended to enable the trigger_once entities of relay_intro_survivor_cameras one second in advance.
* If the delay of relay_intro_finished is less than 1, you may be able to insert the code to this logic_relay's parent logic_relay (such as relay_intro_start) and set the delay to enable trigger_once entities based on the delay of relay_intro_survivor_cameras in the parent logic_relay.
** For example, in relay_intro_start, the delay of relay_intro_survivor_cameras is 13, and we need to enable trigger_once entities one second in advance, so we need to set the 0 (delay) in "l4d1_survivors_camera_fixer,Enable,,0,-1" to 12.
I have also noticed that L4D2 survivors are also experiencing this intro camera bug at the same time (reason unknown). my opinion is that L4D1 survivors and L4D2 survivors should use the same spawn position so that the above code can handle intro camera glitches on both.
However, the camera movement during onmapspawn does not change with the spawnpoint change (mentioned above). While this problem is harmless, it also means that changing the spawnpoint will cause some visual glitches. I'm not currently interested in finding a solution to this problem xd.
On the other hand, changing the spawn position and solving the L4D1 survivor intro camera bug doesn't mean that this is the end of spawnpoint modification. In order for the area around the spawn point to be considered a "safe zone", the associated navmesh needs to be modified as well. I'll look into this later.