Creating NPC-Controlled Mounted Guns: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Continuation of initial edit)
m (→‎Adding the NPC: Unicodifying, replaced: [[Image: → [[File: (2))
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This tutorial will teach you how to add a Survivor NPC who will use a mounted gun
{{screenshot}}
 
This tutorial will teach you how to add a Survivor NPC who will use a mounted gun to kill infected that come within it field of fire.
{{note|Louis is the only bot capable of using the mounted machine gun.}}
{{tip|Instead of doing it yourself, you can download [https://github.com/Mrfunreal/Prefabs/blob/main/Maps/l4d1_bot_npc_spawn.vmf this prefab] and copy paste its content into your map}}


==Construction==
==Construction==
===Emplacement===
===Making an Emplacement===
#Create an emplacement for your mounted gun. The survivor NPC we will be using does not take damage and does not interact with survivors or infected. Having this emplacement accessible to zombies will interfere with suspension of disbelief. Consider placing your mounted gun in a location that appears inaccessible to common infected to hide the NPC's invulnerability.
#Create an emplacement for your mounted gun. All Survivor NPC's will not take damage and do not interact with survivors or infected. Having this emplacement accessible to zombies will interfere with suspension of disbelief.<br>Consider placing your mounted gun in a location that appears inaccessible to common infected to hide the NPC's invulnerability.
#Add a [[prop_mounted_machine_gun]] to the emplacement. Ensure you have the right gun. Neither [[prop_minigun]] nor [[prop_minigun_l4d1]] will work in this situation.
#Add a {{ent|prop_mounted_machine_gun}} to the emplacement. Ensure you have the right gun. Neither {{ent|prop_minigun}} nor {{ent|prop_minigun_l4d1}} will work in this situation.
:3.Add an area for the NPC to spawn in. If you want the survivors to see the NPC walk to the gun, ensure they cannot see the NPC when it spawns, as it will appear out of nowhere.
#Add an area for the NPC to spawn in. If you want the survivors to see the NPC walk to the gun, ensure they cannot see the NPC when it spawns, as it will appear out of nowhere.
==Adding the NPC==
===Adding the NPC===
#Create a [[prop_ragdoll]] out of sight of the survivors.
#Create four {{ent|info_l4d1_survivor_spawn}} where you want the NPC to be created. Set their "Character" field to your desired bot. Name all four {{ent|info_l4d1_survivor_spawn}} "L4D1_Bots".
#Set its name to MountedGunRagdoll, or something similar.
#Create four {{ent|prop_dynamic}} nearby, using the L4D1 player models. This is done to precache the models.  Name all four {{ent|prop_dynamic}} "L4D1_Models".
#Set its World Model to "survivor_manager.mdl".  
#Create a logic_auto. (Any entity capable of firing outputs will work)
#Create an [[info_l4d1_survivor_spawn]] where you want the NPC to be created.
Set its outputs as follows:
#Set its name to "MountedGunSurvivor", or something similar.
{| {{OutputsTable}}
#Set its character to "Louis"
| [[File:Io11.png]] || OnMapSpawn || L4D1_Bots || SpawnSurvivor|| || 0.00 || No
|-
| [[File:Io11.png]] || OnMapSpawn || L4D1_Models|| Kill|| || 0.01 || No
|}
 
 
[[Category: Left 4 Dead 2 Level Design]]

Latest revision as of 08:39, 8 January 2024

Nuvola apps ksnapshot.png
This article or section needs a screenshot to help visually convey the subject.
You can upload screenshots at Special:Upload. For help, see Help:Images.

This tutorial will teach you how to add a Survivor NPC who will use a mounted gun to kill infected that come within it field of fire.

Note.pngNote:Louis is the only bot capable of using the mounted machine gun.
Tip.pngTip:Instead of doing it yourself, you can download this prefab and copy paste its content into your map

Construction

Making an Emplacement

  1. Create an emplacement for your mounted gun. All Survivor NPC's will not take damage and do not interact with survivors or infected. Having this emplacement accessible to zombies will interfere with suspension of disbelief.
    Consider placing your mounted gun in a location that appears inaccessible to common infected to hide the NPC's invulnerability.
  2. Add a prop_mounted_machine_gun to the emplacement. Ensure you have the right gun. Neither prop_minigun nor prop_minigun_l4d1 will work in this situation.
  3. Add an area for the NPC to spawn in. If you want the survivors to see the NPC walk to the gun, ensure they cannot see the NPC when it spawns, as it will appear out of nowhere.

Adding the NPC

  1. Create four info_l4d1_survivor_spawn where you want the NPC to be created. Set their "Character" field to your desired bot. Name all four info_l4d1_survivor_spawn "L4D1_Bots".
  2. Create four prop_dynamic nearby, using the L4D1 player models. This is done to precache the models. Name all four prop_dynamic "L4D1_Models".
  3. Create a logic_auto. (Any entity capable of firing outputs will work)

Set its outputs as follows:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnMapSpawn L4D1_Bots SpawnSurvivor 0.00 No
Io11.png OnMapSpawn L4D1_Models Kill 0.01 No