block trap
{
	es_xset wcs_ability_count 0
	//es_keygetvalue wcs_ability_count WCSuserdata server_var(wcs_userid) ability_count
	es wcsgroup get ability_count wcs_ability_count server_var(wcs_userid)
	ifx parse("(wcs_ability_count > 0) or (wcs_ability_count == -1)") do
	{
		es_xset wcs_params 0
		//es_keygetvalue wcs_params WCSuserdata server_var(wcs_userid) "ability_parameter"
		es wcsgroup get ability_parameter wcs_params server_var(wcs_userid)
		if (server_var(wcs_params) != "0") do
		{
			es_getplayerteam wcs_team server_var(wcs_userid)
			ifx parse("wcs_team = 2") do
			{
				es_xset wcs_team_target 3
				es_xset wcs_team_targetn "#ct"
			}
			ifx parse("wcs_team = 2") do
			{
				es_xset wcs_team_target 2
				es_xset wcs_team_targetn "#t"
			}
			es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid)
			es_xset wcs_duration 0
			es_token wcs_duration server_var(wcs_params) 1 "_"
			ifx true(wcs_graphicfx) do
			{
				es_xcopy wcs_x2 wcs_x1
				es_xcopy wcs_y2 wcs_y1
				es_xcopy wcs_z2 wcs_z1
				es_xmath wcs_z1 + 120
				es est_Effect 11 #a 0 "sprites/purpleglow1.vmt" server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_duration) 2 50
				es est_Effect 3 #a 0 "sprites/lgtning.vmt" server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) server_var(wcs_duration) 20 20 10 0 255 70
				es_xmath wcs_z1 - 120
			}
			es_token wcs_dmg server_var(wcs_params) 2 "_"
			es_token wcs_radius server_var(wcs_params) 3 "_"
			es wcs_trap server_var(wcs_userid) server_var(wcs_duration) server_var(wcs_dmg) server_var(wcs_radius) server_var(wcs_team_target) server_var(wcs_team_targetn) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_trapcounter)
			es wcs_xtell server_var(wcs_userid) a_wardencreated
		}
		es_xmath wcs_ability_count - 1
		//es_keysetvalue WCSuserdata server_var(wcs_userid) ability_count server_var(wcs_ability_count)
		es wcsgroup set ability_count server_var(wcs_userid) server_var(wcs_ability_count)
	}
	else do
	{
		es wcs_xtell server_var(wcs_userid) a_failed
	}
}

event round_start
{
	es_xmath wcs_trapcounter + 1
}

event round_start
{
	es_xmath wcs_trapcounter - 1
}
