This article's documentation is for anything that uses the Source engine. Click here for more information.

Globalname: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:


The following func_breakables and func_physboxes use globalname to properly preserve state between transitions.
The following func_breakables and func_physboxes use globalname to properly preserve state between transitions.
[[File:todo1]]
[[File:D1 canals 05-d1 canals 06-transition-example-1.jpg|600px|center]]




After destroying the func_breakable we can see the following global states using {{cmd|dump_globals}} command output.
After destroying the func_breakable we can see the following global states using {{cmd|dump_globals}} command output.
[[File:todo2]]
[[File:D1 canals 05-d1 canals 06-transition-example-2.jpg|600px|center]]


<pre>
<pre>
Line 37: Line 37:
</pre>
</pre>


After transition we can see states preserved and model name being different. [[File:todo3]]
Changing one of the func_physboxes color to red using <code>ent_fire !picker color "255 0 0"</code>.
[[File:D1 canals 05-d1 canals 06-transition-example-3.jpg|600px|center]]
 
After transition we can see states were preserved and model name being different (*112 and *113 in d5 changed to *162 and *161 in d6).  
[[File:D1 canals 05-d1 canals 06-transition-example-4.jpg|600px|center]]
 


== See also ==
== See also ==
* [[targetname]]
* [[targetname]]
* [[classname]]
* [[classname]]

Revision as of 14:14, 29 March 2025

Icon-under construction-blue.png
This is a draft page. It is a work in progress open to editing by anyone.
Remember to check for any notes left by the tagger at this article's talk page.

Stub

This article or section is a stub. You can help by expanding it.

globalname is a keyvalue available in all Source Source games. It's a name to designate two entities in different maps as being logically the same entity. When player transitions from map A to B the entity in map B with matching globalname will get most of its properties from entity that was in map A like origin, angles, color etc. (model for example is not transferred). If the entity was killed in map A it will not spawn in map B.

Warning.pngWarning:Setting this in round based games will cause an entity to not respawn on round restart because entities are killed when round ends.
Icon-Important.pngImportant:Don't use in Left 4 Dead seriesLeft 4 Dead series Left 4 Dead series as the transition works differently and globalname is not used in this manner.
PlacementTip.gifPlacement Tip:This is important when wanting to transition brush entities as brush models are saved within a map file and is the reason model is one of the properties that isn't transferred.

Other ways to ensure no duplicate (logically same) entities between transition is properly utilizing logic_auto outputs like OnNewGame, OnMapTransition.

Examples

Note.pngNote:There are several in Half-Life 2 Half-Life 2

d1_canals_05 / d1_canals_06

The following func_breakables and func_physboxes use globalname to properly preserve state between transitions.

D1 canals 05-d1 canals 06-transition-example-1.jpg


After destroying the func_breakable we can see the following global states using dump_globals command output.

D1 canals 05-d1 canals 06-transition-example-2.jpg
] dump_globals 
is_pc: d1_canals_05 (On) = 217026304
-- Globals --
05.breakable01_2: d1_canals_05 (On) = 12110476
skill.cfg: d1_canals_05 (On) = 0
05.breakable01_1: d1_canals_05 (On) = 12110476
is_console: d1_canals_05 (Off) = 1560839504
05.breakable02_4: d1_canals_05 (Dead) = 12110476
05.breakable02_1: d1_canals_05 (Dead) = 12110476
05.breakable02_5: d1_canals_05 (Dead) = 12110476
05.breakable02_6: d1_canals_05 (Dead) = 12110476
05.breakable02_2: d1_canals_05 (Dead) = 12110476
05.breakable02_3: d1_canals_05 (Dead) = 12110476

Changing one of the func_physboxes color to red using ent_fire !picker color "255 0 0".

D1 canals 05-d1 canals 06-transition-example-3.jpg

After transition we can see states were preserved and model name being different (*112 and *113 in d5 changed to *162 and *161 in d6).

D1 canals 05-d1 canals 06-transition-example-4.jpg


See also