Table of Contents

GEMPGameRules::CGETokenManager

Class Description

<python> class CGETokenManager:

None AddTokenType( string classname, int limit = 1, int locations = GEGlobal.SPAWN_AMMO )
None RemoveTokenType( string classname )
None RemoveTokenEnt( CBaseEntity token, bool adjustlimit = True )
None RemoveAllTokens()
None RespawnAllTokens()
None SetTokenSpawnLimit( string classname, int limit )
None SetTokenSpawnLocation( string classname, int locations )
None SetTokenRespawnDelay( string classname, float delay )
None SetTokenWorldModel( string classname, string model )
None SetTokenViewModel( string classname, string model )
None SetTokenDropType( string classname, int droptype ) # Currently Unsupported #
None SetTokenAllowSwitch( string classname, bool state )
None SetTokenCapturable( string classname, bool state ) # Automatically spawns capture points if True #
None SetTokenTeam( string classname, int teamid )
None SetTokenGlow( string classname, bool state, GEUtil.CColor glowcolor = GEUtil.CColor(255,255,255), float maxdist = 350.0 )
CBaseEntity GetTokenByType( string classname, int index )
CBaseEntity GetTokenByUniqueID( string classname, int uniqueid )
int GetTokenIndex( CBaseEntity token )
CGEPlayer GetTokenHolder( string classname, int index )
int GetTokenSpawnCount( string classname )

</python>

Description

description=Class to control implementation of gameplay tokens. Tokens can be used as special pickups and special weapons whose numbers and positions are strictly controlled by the parameters given. |version=Beta 4.0 |namespace=[[Python_GEMPGameRules|GEMPGameRules]] |inherits=None

Methods

AddTokenType

purpose=Add a new token type to the game. Tokens can have classnames of: //weapon_*// and //token_*// ONLY. |params=string, int //(1)//, int //([[Python_GEGlobal|GEGlobal.SPAWN_AMMO]])// |returns=None

RemoveTokenType

purpose=Removes a token type from the game entirely. |params=string |returns=None

RemoveTokenEnt

purpose=Removes a specific token entity from the world. |params=[[GEEntity::CBaseEntity|CBaseEntity]], bool //(True)// |returns=None

RemoveAllTokens

purpose=Remove all tokens and token definitions from the game. |params=None |returns=None

RespawnAllTokens

purpose=Remove and respawn all the tokens in the game. This will cause new spawning locations to be determined for each token based on the location parameter. |params=None |returns=None

SetTokenSpawnLimit

purpose=Set the max number of tokens of the specified classname to spawn. If the number is less then the current amount, tokens will be removed from play immediately. If the number is greater then the current amount tokens will be added immediately //(if possible)//. |params=string, int |returns=None

SetTokenSpawnLocation

purpose=Set the locations that the tokens are allowed to spawn in. Changes won't take affect unless tokens are added or removed from the world. |params=string, int |returns=None

SetTokenRespawnDelay

purpose=Set the delay that a token has to wait before being moved back to it's designated spawner location after it has been dropped by a player. |params=string, float |returns=None

SetTokenWorldModel

purpose=Sets the world model (seen on other players) of a token. //NOTE: Only effective for token_* type tokens// |params=string, string |returns=None

SetTokenViewModel

purpose=Sets the view model (seen in firstperson view) of a token. //NOTE: Only effective for token_* type tokens// |params=string, string |returns=None

SetTokenDropType

purpose=Sets the drop type of a token //NOTE: Currently not supported!// |params=string, int |returns=None

SetTokenAllowSwitch

purpose=Sets if a player is allowed to switch away from a token when carrying it. When this is True, when a player picks up a token they automatically switch to it and cannot use any other weapons. |params=string, bool |returns=None

SetTokenCapturable

purpose=Sets this token type as being capturable and will spawn a capture point as far away from the token as possible. The capture point is created after the first token of the specified type is spawned. |params=string, bool |returns=None

SetTokenTeam

purpose=Sets the team of a token. For tokens of classname //token_*// only the specified team can carry them. |params=string, int |returns=None

SetTokenGlow

purpose=Setup a token's glow when it is not picked up. If False is passed, the other parameters will still be applied, but the glow will be turned off. |params=string, bool, [[GEUtil::CColor|CColor]] //(CColor(255,255,255)//, float //(350.0)// |returns=None

GetTokenByType

purpose=Gets a token entity at the specified index. Useful for iterating over each token in play. |params=string, int |returns=[[GEEntity::CBaseEntity|CBaseEntity]]

GetTokenByUniqueID

purpose=Gets a token entity by an entity's unique ID. Useful for retrieving a specific token using stored id's. |params=string, int |returns=[[GEEntity::CBaseEntity|CBaseEntity]]

GetTokenIndex

purpose=Returns the token's index in the token manager. Returns -1 if the entity is not a token of the specified classname or is invalid. |params=[[GEEntity::CBaseEntity|CBaseEntity]] |returns=int

GetTokenHolder

purpose=Gets the player that is currently holding the specified token index. If the token is not being held, this returns None. |params=string, int |returns=[[GEPlayer::CGEPlayer|CGEPlayer]]

GetTokenSpawnCount

purpose=Get the current count of tokens in play for the specified classname. This may return LESS THAN the token limit if the tokens cannot find enough places to spawn on the map. |params=string |returns=int