Difference between revisions of "Lua:player spawn"

From Fortress Forever Wiki
Jump to navigationJump to search
m
(No difference)

Revision as of 04:24, 13 December 2007

This function is called whenever a player spawns in the map.

Here is an example of giving the player full health, full armor, full rockets, full shells, and 1 grenade upon spawning (player_id is the player this event is called on and must be passed in to the functions used as shown in the example):

function player_spawn( player_id )
	-- 400 for overkill. of course the values
	-- get clamped in game code
	AddHealth( player_id, 400 )
	AddArmor( player_id, 400 )

	AddAmmo( player_id, "AMMO_NAILS", -400 )
	AddAmmo( player_id, "AMMO_SHELLS", 400 )
	AddAmmo( player_id, "AMMO_ROCKETS", 400 )
	AddAmmo( player_id, "AMMO_CELLS", -400 )
	AddAmmo( player_id, "AMMO_DETPACK", -1 )
	AddAmmo( player_id, "AMMO_RADIOTAG", -400 )
	AddAmmo( player_id, "AMMO_GREN1", -4 )
	AddAmmo( player_id, "AMMO_GREN2", -4 )

	-- Players get 1 gren1
	AddAmmo( player_id, "AMMO_GREN1", 1 )
end