Portal - Tutorial - Spawning With The Portalgun

From Valve Developer Community
Jump to navigation Jump to search
English (en)中文 (zh)Translate (Translate)
Portal Level Creation


Introduction

When transitioning through levels, you don't want the player to hear the portalgun upgrade sound or see a portalgun coming from nowhere when loading a new map from a level transition. This guide will show you how to fix that.

Note.pngNote: If your map doesn't have any level transitions or it's the first/only map in the map collection, all you have to do is put the weapon_portalgun on the player spawn and you don't need to follow this guide.

Creating

1. Create a weapon_portalgun entity and position it inside the info_player_start or where the player spawns and set its name to portalgun.

2. Create a point_template and set its name to portalgun_template and set template 1 to portalgun.

3. Create a logic_auto entity and enter the following properties:

My Output > Target Entity Target Input Parameter Delay Only Once
OnNewGame portalgun_template ForceSpawn <none> 0.00 No

The portalgun should now only spawn when you load directly into the map and won't spawn when using level transitions.