Global/Add NPC Class

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(wording and example)
Line 2: Line 2:
 
|Name=Add_NPC_Class
 
|Name=Add_NPC_Class
 
|Parent=Global
 
|Parent=Global
|Description=Creates a CLASS_ Enum and assigns it as a global variable with a automatic value so as to prevent collisions with
+
|Description=Defines a global entity class variable with an automatic value in order to prevent collisions with other {{Enum|CLASS}}. You should prefix your variable with CLASS_ for consistency.
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=No
 
|IsClass=No
Line 9: Line 9:
 
|type=string
 
|type=string
 
|name=name
 
|name=name
|desc=The name of the ENUM/new global variable.
+
|desc=The name of the new enum/global variable.
 +
}}
 +
{{Example
 +
|Description=Creates a global variable named CLASS_TESTER and prints its value.
 +
|Code=Add_Entity_Class( "CLASS_TESTER" )
 +
print( CLASS_TESTER )
 +
|Output=26 (one greater than the current highest value of the {{Enum|CLASS}})
 
}}
 
}}

Revision as of 01:37, 17 April 2015

 Add_NPC_Class( )

Contents

Description

Defines a global entity class variable with an automatic value in order to prevent collisions with other CLASS_ Enums. You should prefix your variable with CLASS_ for consistency.

Arguments

string name

The name of the new enum/global variable.

Examples

Example

Creates a global variable named CLASS_TESTER and prints its value.

Add_Entity_Class( "CLASS_TESTER" )
print( CLASS_TESTER )

Output:

26 (one greater than the current highest value of the CLASS_ Enums)
Personal tools
Navigation